Exemple #1
0
        public void Save(List <Gump> gumps = null)
        {
            if (string.IsNullOrEmpty(ServerName))
            {
                throw new InvalidDataException();
            }

            if (string.IsNullOrEmpty(Username))
            {
                throw new InvalidDataException();
            }

            if (string.IsNullOrEmpty(CharacterName))
            {
                throw new InvalidDataException();
            }

            string path = FileSystemHelper.CreateFolderIfNotExists(ProfilePath, Username, ServerName, CharacterName);

            Log.Message(LogTypes.Trace, $"Saving path:\t\t{path}");

            // save settings.json
            ConfigurationResolver.Save(this, Path.Combine(path, "profile.json"), new JsonSerializerSettings
            {
                TypeNameHandling         = TypeNameHandling.All,
                MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
            });

            // save gumps.bin
            SaveGumps(path, gumps);

            Log.Message(LogTypes.Trace, "Saving done!");
        }
Exemple #2
0
        public void Save(List <Gump> gumps = null)
        {
            if (string.IsNullOrEmpty(ServerName))
            {
                throw new InvalidDataException();
            }
            if (string.IsNullOrEmpty(Username))
            {
                throw new InvalidDataException();
            }
            if (string.IsNullOrEmpty(CharacterName))
            {
                throw new InvalidDataException();
            }

            string path = FileSystemHelper.CreateFolderIfNotExists(Engine.ExePath, "Data", "Profiles", Username, ServerName, CharacterName);

            Log.Message(LogTypes.Trace, $"Saving path:\t\t{path}");

            // save settings.json
            ConfigurationResolver.Save(this, Path.Combine(path, "settings.json"));

            // save gumps.bin
            SaveGumps(path, gumps);

            Log.Message(LogTypes.Trace, "Saving done!");
        }
Exemple #3
0
        public void Save(List <Gump> gumps = null)
        {
            if (string.IsNullOrEmpty(ServerName))
            {
                throw new InvalidDataException();
            }

            if (string.IsNullOrEmpty(Username))
            {
                throw new InvalidDataException();
            }

            if (string.IsNullOrEmpty(CharacterName))
            {
                throw new InvalidDataException();
            }

            string path = FileSystemHelper.CreateFolderIfNotExists(ProfilePath, Username.Trim(), ServerName.Trim(), CharacterName.Trim());

            Log.Trace($"Saving path:\t\t{path}");

            // Save profile settings
            ConfigurationResolver.Save(this, Path.Combine(path, "profile.json"));

            // Save opened gumps
            SaveGumps(path, gumps);

            Log.Trace("Saving done!");
        }
        public static void Save()
        {
            if (!Directory.Exists(_path))
            {
                Directory.CreateDirectory(_path);
            }

            ConfigurationResolver.Save(Current, Current.Path);
        }
Exemple #5
0
        public void Save(string path)
        {
            Log.Trace($"Saving path:\t\t{path}");

            // Save profile settings
            ConfigurationResolver.Save(this, Path.Combine(path, "profile.json"));

            // Save opened gumps
            SaveGumps(path);

            Log.Trace("Saving done!");
        }
Exemple #6
0
        public void Save()
        {
            // Make a copy of the settings object that we will use in the saving process
            Settings settingsToSave = JsonConvert.DeserializeObject <Settings>(JsonConvert.SerializeObject(this));

            // Make sure we don't save username and password if `saveaccount` flag is not set
            // NOTE: Even if we pass username and password via command-line arguments they won't be saved
            if (!settingsToSave.SaveAccount)
            {
                settingsToSave.Username = string.Empty;
                settingsToSave.Password = string.Empty;
            }

            // NOTE: We can do any other settings clean-ups here before we save them

            ConfigurationResolver.Save(settingsToSave, GetSettingsFilepath());
        }
Exemple #7
0
 public void Save()
 {
     ConfigurationResolver.Save(this, Path.Combine(Engine.ExePath, "settings.json"));
 }