示例#1
0
        public void LoadConfig(string configDir)
        {
            string configPath = configDir + CFG_FILE_NAME;

            if (!File.Exists(configPath))
            {
                this.config = new EminusConfig();
            }
            else
            {
                Stream          fs        = File.OpenRead(configPath);
                BinaryFormatter formatter = new BinaryFormatter();
                try
                {
                    this.config = (EminusConfig)formatter.Deserialize(fs);
                }
                catch (SerializationException e)
                {
                    MessageBox.Show(e.Message, "Deserialize");
                    this.config = new EminusConfig();
                }
                finally
                {
                    fs.Close();
                }
            }
        }
示例#2
0
 public EminusConfig Clone()
 {
   EminusConfig config = new EminusConfig();
   config.host = this.host;
   config.port = this.port;
   config.password = this.password;
   return config;
 }
示例#3
0
        public EminusConfig Clone()
        {
            EminusConfig config = new EminusConfig();

            config.host     = this.host;
            config.port     = this.port;
            config.password = this.password;
            return(config);
        }
示例#4
0
    public EminusConfigDlg(EminusConfig config)
    {
      InitializeComponent();
      this.TopLevel = false;
      this.config = config;

      this.hostTextBox.Text = config.host;
      this.portTextBox.Text = "" + config.port;
      this.passwordTextBox.Text = config.password;
    }
示例#5
0
        public EminusConfigDlg(EminusConfig config)
        {
            InitializeComponent();
            this.TopLevel = false;
            this.config   = config;

            this.hostTextBox.Text     = config.host;
            this.portTextBox.Text     = "" + config.port;
            this.passwordTextBox.Text = config.password;
        }
示例#6
0
        public void SaveConfig(string configDir)
        {
            string configPath = configDir + CFG_FILE_NAME;

            if (this.dlg != null)
            {
                this.dlg.ApplyChanges();
            }
            this.config = this.tmpConfig.Clone();
            BinaryFormatter formatter = new BinaryFormatter();
            Stream          fs        = new FileStream(configPath, FileMode.Create, FileAccess.Write);

            formatter.Serialize(fs, this.config);
            fs.Close();
        }
示例#7
0
 public void StartConfig()
 {
     this.tmpConfig = this.config.Clone();
 }
示例#8
0
 public void StartConfig()
 {
   this.tmpConfig = this.config.Clone();
 }
示例#9
0
 public void SaveConfig(string configDir)
 {
   string configPath = configDir + CFG_FILE_NAME;
   if (this.dlg != null)
   {
     this.dlg.ApplyChanges();
   }
   this.config = this.tmpConfig.Clone();
   BinaryFormatter formatter = new BinaryFormatter();
   Stream fs = new FileStream(configPath, FileMode.Create, FileAccess.Write);
   formatter.Serialize(fs, this.config);
   fs.Close();
 }
示例#10
0
    public void LoadConfig(string configDir)
    {
      string configPath = configDir + CFG_FILE_NAME;

      if (!File.Exists(configPath))
      {
        this.config = new EminusConfig();
      }
      else
      {
        Stream fs = File.OpenRead(configPath);
        BinaryFormatter formatter = new BinaryFormatter();
        try
        {
          this.config = (EminusConfig)formatter.Deserialize(fs);
        }
        catch (SerializationException e)
        {
          MessageBox.Show(e.Message, "Deserialize");
          this.config = new EminusConfig();
        }
        finally
        {
          fs.Close();
        }
      }
    }