Example #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();
                }
            }
        }
Example #2
0
 public EminusConfig Clone()
 {
   EminusConfig config = new EminusConfig();
   config.host = this.host;
   config.port = this.port;
   config.password = this.password;
   return config;
 }
Example #3
0
        public EminusConfig Clone()
        {
            EminusConfig config = new EminusConfig();

            config.host     = this.host;
            config.port     = this.port;
            config.password = this.password;
            return(config);
        }
Example #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;
    }
Example #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;
        }
Example #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();
        }
Example #7
0
 public void StartConfig()
 {
     this.tmpConfig = this.config.Clone();
 }
Example #8
0
 public void StartConfig()
 {
   this.tmpConfig = this.config.Clone();
 }
Example #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();
 }
Example #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();
        }
      }
    }