终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using BPA.Message;
  2. using BPASmartClient.CustomResource.Pages.Enums;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace BPASmartClient.CustomResource.Pages.Model
  11. {
  12. public class Config
  13. {
  14. private volatile static Config _Instance;
  15. public static Config GetInstance => _Instance ?? (_Instance = new Config());
  16. private Config() { }
  17. public void Init()
  18. {
  19. if (File.Exists("up.hbl"))
  20. {
  21. var result = JsonConvert.DeserializeObject<UserManager>(File.ReadAllText("up.hbl").AESDecrypt());
  22. if (result == null || (result != null && result.userInfos.Count <= 0))
  23. {
  24. AddData();
  25. }
  26. else
  27. {
  28. Global.userManager = result;
  29. }
  30. }
  31. else
  32. {
  33. AddData();
  34. }
  35. }
  36. private void AddData()
  37. {
  38. Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.管理员, UserName = "admin", Password = "admin" });
  39. Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" });
  40. Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" });
  41. Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
  42. SaveUser();
  43. }
  44. public void SaveUser()
  45. {
  46. File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
  47. }
  48. }
  49. }