static void Main() { GParams.Instance.ServerAdress = "127.0.0.1"; GParams.Instance.PortAdress = 1353; GParams.Instance.TimeOut = int.MaxValue; if (System.IO.File.Exists(Program.LocalAppParamPath)) { var _cfgFile = new CfgFile(Program.LocalAppParamPath); if (_cfgFile.Read()) { if (!string.IsNullOrEmpty(_cfgFile.GetValue("Comunication", "Adress", false))) { GParams.Instance.ServerAdress = _cfgFile.GetValue("Comunication", "Adress", false); } if (GParams.ToInt32(_cfgFile.GetValue("Comunication", "Port", false)).HasValue) { GParams.Instance.PortAdress = GParams.ToInt32(_cfgFile.GetValue("Comunication", "Port", false)) ?? 0; } } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
public static Guid?ToGuid(object value) { try { return(new Guid(GParams.ToString(value))); } catch { } return(null); }