Ejemplo n.º 1
0
        public static void DeleteDefaultFirstCharacter(string server, string zoneId)
        {
            SettingsFile.ReloadXmlDocument();

            Collection <DefaultFirstCharacter> characters = DefaultFirstCharacters;

            int index = FindCharacterByServerAndZone(characters, server, zoneId);

            if (index == -1)
            {
                return;
            }

            characters.RemoveAt(index);

            Collection <Dictionary <string, string> > collection = new Collection <Dictionary <string, string> >();

            foreach (DefaultFirstCharacter character in characters)
            {
                Dictionary <string, string> attributes = new Dictionary <string, string>();

                attributes.Add("Server", character.Server);
                attributes.Add("ZoneId", character.ZoneId);

                attributes.Add("CharacterName", character.CharacterName);

                collection.Add(attributes);
            }

            SettingsFile.SetNodeChildrenAndSaveToDisk("CharacterSelectionScreen/DefaultLoginChars", "DefaultLoginChar", collection);
        }
Ejemplo n.º 2
0
            public static void DeleteWindowPosition(string server, string accountName)
            {
                SettingsFile.ReloadXmlDocument();

                Collection <Client.WindowPosition> windowPositions = WindowPositions;

                for (int i = 0; i < windowPositions.Count; i++)
                {
                    if (windowPositions[i].Server == server && windowPositions[i].AccountName == accountName)
                    {
                        windowPositions.RemoveAt(i);

                        Collection <Dictionary <string, string> > collection = new Collection <Dictionary <string, string> >();

                        foreach (Client.WindowPosition windowPosition in windowPositions)
                        {
                            Dictionary <string, string> attributes = new Dictionary <string, string>();

                            attributes.Add("Server", windowPosition.Server);
                            attributes.Add("AccountName", windowPosition.AccountName);

                            attributes.Add("X", windowPosition.X.ToString(CultureInfo.InvariantCulture));
                            attributes.Add("Y", windowPosition.Y.ToString(CultureInfo.InvariantCulture));

                            collection.Add(attributes);
                        }

                        SettingsFile.SetNodeChilderen("Misc/WindowPositions", "WindowPosition", collection);

                        break;
                    }
                }
            }
Ejemplo n.º 3
0
            public static void DeleteDefaultFirstCharacter(string server, string accountName)
            {
                SettingsFile.ReloadXmlDocument();

                Collection <DefaultFirstCharacter> characters = DefaultFirstCharacters;

                for (int i = 0; i < characters.Count; i++)
                {
                    if (characters[i].Server == server && characters[i].AccountName == accountName)
                    {
                        characters.RemoveAt(i);

                        Collection <Dictionary <string, string> > collection = new Collection <Dictionary <string, string> >();

                        foreach (DefaultFirstCharacter character in characters)
                        {
                            Dictionary <string, string> attributes = new Dictionary <string, string>();

                            attributes.Add("Server", character.Server);
                            attributes.Add("AccountName", character.AccountName);

                            attributes.Add("CharacterName", character.CharacterName);
                            attributes.Add("CharacterIndex", character.CharacterIndex.ToString());

                            collection.Add(attributes);
                        }

                        SettingsFile.SetNodeChilderen("CharacterSelectionScreen/DefaultLoginChars", "DefaultLoginChar", collection);

                        break;
                    }
                }
            }
Ejemplo n.º 4
0
            public static void SetPeriodicCommands(string account, string server, string character, IList <PeriodicCommand> commands)
            {
                SettingsFile.ReloadXmlDocument();

                var xmlNode = SettingsFile.GetNode("_" + account + "_" + XmlConvert.EncodeName(server) + "/" + XmlConvert.EncodeName(character) + "/PeriodicCommands", true);

                xmlNode.RemoveAll();

                foreach (var command in commands)
                {
                    XmlNode childNode = xmlNode.AppendChild(SettingsFile.XmlDocument.CreateElement("PeriodicCommand"));

                    childNode.InnerText = command.Command;

                    XmlAttribute attribute = SettingsFile.XmlDocument.CreateAttribute("offset");
                    attribute.Value = command.OffsetFromMidnight.TotalMinutes.ToString(CultureInfo.InvariantCulture);
                    if (childNode.Attributes != null)
                    {
                        childNode.Attributes.Append(attribute);
                    }

                    attribute       = SettingsFile.XmlDocument.CreateAttribute("interval");
                    attribute.Value = command.Interval.TotalMinutes.ToString(CultureInfo.InvariantCulture);
                    if (childNode.Attributes != null)
                    {
                        childNode.Attributes.Append(attribute);
                    }
                }

                SettingsFile.SaveXmlDocument();
            }
Ejemplo n.º 5
0
        public static void SetDefaultFirstCharacter(DefaultFirstCharacter newDefaultFirstCharacter)
        {
            SettingsFile.ReloadXmlDocument();

            Collection <DefaultFirstCharacter> characters = DefaultFirstCharacters;

            for (int i = 0; i < characters.Count; i++)
            {
                if (characters[i].Server == newDefaultFirstCharacter.Server && characters[i].ZoneId == newDefaultFirstCharacter.ZoneId)
                {
                    characters.RemoveAt(i);

                    break;
                }
            }

            Collection <Dictionary <string, string> > collection = new Collection <Dictionary <string, string> >();

            foreach (DefaultFirstCharacter character in characters)
            {
                Dictionary <string, string> attributes = new Dictionary <string, string>();

                attributes.Add("Server", character.Server);
                attributes.Add("ZoneId", character.ZoneId);

                attributes.Add("CharacterName", character.CharacterName);

                collection.Add(attributes);
            }

            Dictionary <string, string> newAttributes = new Dictionary <string, string>();

            newAttributes.Add("Server", newDefaultFirstCharacter.Server);
            newAttributes.Add("ZoneId", newDefaultFirstCharacter.ZoneId);

            newAttributes.Add("CharacterName", newDefaultFirstCharacter.CharacterName);

            collection.Add(newAttributes);

            SettingsFile.SetNodeChildrenAndSaveToDisk("CharacterSelectionScreen/DefaultLoginChars", "DefaultLoginChar", collection);
        }