Exemplo n.º 1
0
        public bool LoadConfig()
        {
            try
            {
                using (Stream stream = new FileStream(fileName, FileMode.Open))
                {
                    // Deserialize SioData
                    IFormatter formatter = new SoapFormatter();
                    ReaderConfig sData = (ReaderConfig)formatter.Deserialize(stream);
                    oData = sData;
                }
            }
            catch
            {
                return false;
            }

            return true;
        }
Exemplo n.º 2
0
        private void initConfigInfo()
        {
            //string logname = DateTime.Now.ToFileTimeUtc().ToString() + ".log";
            logFile = log4net.LogManager.GetLogger("logdebug");
            HelperConfigSerialize helper = new HelperConfigSerialize(conf);

            if (File.Exists(helper.fileName))
            {
                if (helper.LoadConfig())
                {
                    writeLog("Load config file ok");
                }
                else
                {
                    helper.SaveConfig();
                    writeLog("Load config file fail, use default config");
                }
                conf = helper.oData;
            }
            else
            {
                helper.SaveConfig();
            }

            //test
            //CYMessageBox.Show("Hello,world");
            //startRealInv();
        }
Exemplo n.º 3
0
 public HelperConfigSerialize(ReaderConfig data)
 {
     oData = data;
 }