Settings.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using Oreo.CleverDog.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using Y.Utils.DataUtils.Collections;
  7. using Y.Utils.DataUtils.JsonUtils;
  8. using Y.Utils.IOUtils.TxtUtils;
  9. using Y.Utils.NetUtils.HttpUtils;
  10. namespace Oreo.CleverDog.Commons
  11. {
  12. /// <summary>
  13. /// 配置信息
  14. /// </summary>
  15. public static class Settings
  16. {
  17. static string ServerUrl = "http://10.49.129.127:8001/noah/webservice/getDownloadSoftwareInfo";
  18. public static void Init()
  19. {
  20. ReadFromWeb();
  21. //ReadFromDemo();
  22. }
  23. public static Frisbee[] Frisbee { get; set; }
  24. public static void ReadFromDemo()
  25. {
  26. //string fb = JsonTool.ToStr(new Frisbee[]{
  27. // new Frisbee() {
  28. // Any3264 ="32",
  29. // Term = DateTime.Parse("2017-7-1"),
  30. // ExistControl=new string[] {"趋势科技防毒墙网络版客户端"},
  31. // ExistFile=new string[] {},
  32. // ExistProcess =new string[] { "PccNTMon"},
  33. // Url = "http://10.49.129.127/file/soft/trend32.exe",
  34. // FileName="trend32.exe",
  35. // SuccUrl="",
  36. // AutoRun=true,
  37. // KillProcess=new string[] { },
  38. // RunProcess=new string[] { }
  39. // },
  40. // new Frisbee() {
  41. // Any3264 ="64",
  42. // Term = DateTime.Parse("2017-7-1"),
  43. // ExistControl=new string[] {"趋势科技防毒墙网络版客户端"},
  44. // ExistFile=new string[] {},
  45. // ExistProcess =new string[] { "PccNTMon"},
  46. // Url = "http://10.49.129.127/file/soft/trend64.exe",
  47. // FileName="trend64.exe",
  48. // SuccUrl="",
  49. // AutoRun=true,
  50. // KillProcess=new string[] { },
  51. // RunProcess=new string[] { }
  52. // },
  53. // });
  54. //TxtTool.Create(@"D:\Temp\Frisbee Data.txt", fb);
  55. Frisbee = JsonTool.ToObjFromFile<Frisbee[]>(@"D:\Temp\Frisbee Data.txt");
  56. }
  57. public static void ReadFromWeb()
  58. {
  59. Frisbee = HttpTool.Get<Frisbee[]>(ServerUrl);
  60. if (ListTool.IsNullOrEmpty(Frisbee))
  61. {
  62. R.Log.e("从服务器读取配置失败 准备第二次尝试");
  63. Frisbee = HttpTool.Get<Frisbee[]>(ServerUrl);
  64. if (ListTool.IsNullOrEmpty(Frisbee))
  65. {
  66. R.Log.e("从服务器读取配置失败 准备第三次尝试");
  67. Frisbee = HttpTool.Get<Frisbee[]>(ServerUrl);
  68. }
  69. }
  70. }
  71. }
  72. }