/// <summary>
        /// Reloads the JangsellConfiguration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A JangsellConfig object.</returns>
        public E621Config Reload()
        {
            if (!File.Exists(_path))
            {
                File.Create(_path).Close();

                #region append

                var writeConfig = new E621Config
                {
                    HideTagBox = true,
                    IncludeImageTagsInFilename = false,

                    Account = new Account
                    {
                        AutoLogin = false,
                        Password = null,
                        Username = null
                    }
                };

                #endregion

                File.WriteAllText(_path, writeConfig.SerializeToXml());
            }

            using (var sr = new StreamReader(_path))
            {
                return
                    (E621Config)
                        new XmlSerializer(typeof(E621Config)).Deserialize(sr);
            }
        }
Esempio n. 2
0
        public E621SharpDlForm()
        {
            _applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            _configHandler = new E621ConfigHandler("settings.xml");
            _config = _configHandler.Reload();

            InitializeComponent();
        }
Esempio n. 3
0
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            _config = _configHandler.Reload();

            censorTagsCheckBox.Checked = _config.HideTagBox;
            sXTIESCheckBox.Checked = _config.IncludeImageTagsInFilename;
            autoLoginCheckBox.Checked = _config.Account.AutoLogin;
            username.Text = _config.Account.Username;
            password.Text = _config.Account.Password;
        }
Esempio n. 4
0
 private void launchConfigWindow_Click(object sender, EventArgs e)
 {
     var configForm = new ConfigForm(_configHandler);
     configForm.ShowDialog();
     _config = _configHandler.Reload();
 }
 /// <summary>
 /// Writes the changes made to the JangsellConfig.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(E621Config towrite)
 {
     File.WriteAllText(_path, towrite.SerializeToXml());
 }