NetworkServersInfo.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using OpenSim.Framework.Interfaces;
  5. namespace OpenSim
  6. {
  7. public class NetworkServersInfo
  8. {
  9. public string AssetURL = "http://127.0.0.1:8003/";
  10. public string AssetSendKey = "";
  11. public string GridURL = "";
  12. public string GridSendKey = "";
  13. public string GridRecvKey = "";
  14. public string UserURL = "";
  15. public string UserSendKey = "";
  16. public string UserRecvKey = "";
  17. public bool isSandbox;
  18. public void InitConfig(bool sandboxMode, IGenericConfig configData)
  19. {
  20. this.isSandbox = sandboxMode;
  21. try
  22. {
  23. if (!isSandbox)
  24. {
  25. string attri = "";
  26. //Grid Server URL
  27. attri = "";
  28. attri = configData.GetAttribute("GridServerURL");
  29. if (attri == "")
  30. {
  31. this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
  32. configData.SetAttribute("GridServerURL", this.GridURL);
  33. }
  34. else
  35. {
  36. this.GridURL = attri;
  37. }
  38. //Grid Send Key
  39. attri = "";
  40. attri = configData.GetAttribute("GridSendKey");
  41. if (attri == "")
  42. {
  43. this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server", "null");
  44. configData.SetAttribute("GridSendKey", this.GridSendKey);
  45. }
  46. else
  47. {
  48. this.GridSendKey = attri;
  49. }
  50. //Grid Receive Key
  51. attri = "";
  52. attri = configData.GetAttribute("GridRecvKey");
  53. if (attri == "")
  54. {
  55. this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server", "null");
  56. configData.SetAttribute("GridRecvKey", this.GridRecvKey);
  57. }
  58. else
  59. {
  60. this.GridRecvKey = attri;
  61. }
  62. attri = "";
  63. attri = configData.GetAttribute("AssetServerURL");
  64. if (attri == "")
  65. {
  66. this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
  67. configData.SetAttribute("AssetServerURL", this.GridURL);
  68. }
  69. else
  70. {
  71. this.AssetURL = attri;
  72. }
  73. }
  74. configData.Commit();
  75. }
  76. catch (Exception e)
  77. {
  78. OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Config.cs:InitConfig() - Exception occured");
  79. OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
  80. }
  81. }
  82. }
  83. }