public void SaveDefinition(Definition pDefinition)
        {
            if (!_definitions.ContainsKey(pDefinition.Locale)) _definitions.Add(pDefinition.Locale, new Dictionary<ushort, List<Definition>>());
            if (!_definitions[pDefinition.Locale].ContainsKey(pDefinition.Build)) _definitions[pDefinition.Locale].Add(pDefinition.Build, new List<Definition>());

            _definitions[pDefinition.Locale][pDefinition.Build].RemoveAll(d =>
            {
                return d.Outbound == pDefinition.Outbound && d.Opcode == pDefinition.Opcode;
            });

            _definitions[pDefinition.Locale][pDefinition.Build].Add(pDefinition);
        }
Esempio n. 2
0
        private void AddOpcode(ushort pBuild, byte pLocale, bool pOutbound, ushort pOpcode, string pName)
        {
            Definition def = Config.Instance.GetDefinition(pBuild, pLocale, pOutbound, pOpcode);
            if (def == null)
            {
                def = new Definition();
                txtLog.AppendText(string.Format("Adding opcode {1}: 0x{0:X4}\r\n", pOpcode, pName));
            }
            else
            {
                txtLog.AppendText(string.Format("Replacing opcode {1} 0x{0:X4} for {2}\r\n", pOpcode, def.Name, pName));
            }

            def.Build = pBuild;
            def.Locale = pLocale;
            def.Opcode = pOpcode;
            def.Outbound = pOutbound;
            def.Name = pName;
            def.Ignore = false;

            DefinitionsContainer.Instance.SaveDefinition(def);
        }