Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes the changes made to the JangsellConfig.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(E621Config towrite)
 {
     File.WriteAllText(_path, towrite.SerializeToXml());
 }