示例#1
0
 public void SaveConfig(DataModel.xTraceConfig xConfig)
 {
     localSettings.Values["ISFIRSTRUN"] = xConfig.ISFIRSTRUN;
     localSettings.Values["IPADDR"] = xConfig.IPADDR;
     localSettings.Values["PORT"] = xConfig.PORT;
     CurrentSettings = xConfig;
 }
示例#2
0
 public DataModel.xTraceConfig InitAppsettings()
 {
     DataModel.xTraceConfig xConfig = new DataModel.xTraceConfig();
     System.Reflection.PropertyInfo[] properinfos = System.Reflection.TypeExtensions.GetProperties(typeof(DataModel.xTraceConfig));
     
     xConfig.ISFIRSTRUN = true.ToString();
     xConfig.IPADDR = "";
     xConfig.PORT = "49002";
     SaveConfig(xConfig);
     return xConfig;
 }
示例#3
0
        public DataModel.xTraceConfig LoadConfig()
        {
            if (CurrentSettings == null)
                CurrentSettings = new DataModel.xTraceConfig();
            System.Reflection.PropertyInfo[] propertyinfos = System.Reflection.TypeExtensions.GetProperties(typeof(DataModel.xTraceConfig));
            foreach(System.Reflection.PropertyInfo p in propertyinfos)
            {
                if(localSettings.Values[p.Name] == null)
                {
                    InitAppsettings();
                }
                else
                {
                    p.SetValue(CurrentSettings, localSettings.Values[p.Name].ToString());
                }
            }

            return CurrentSettings;
        }