Esempio n. 1
0
        public override bool View(TabPageModel tabPage)
        {
            tabPage.Title = Text.ToString();
            tabPage.SupportsLanguageSwitching = false;

            var view     = Helpers.PrepareDataGrid(tabPage, this);
            var metadata = module.Metadata;

            var           list = new List <ConstantEntry>();
            ConstantEntry scrollTargetEntry = default;

            for (int row = 1; row <= metadata.GetTableRowCount(TableIndex.Constant); row++)
            {
                ConstantEntry entry = new ConstantEntry(module, MetadataTokens.ConstantHandle(row));
                if (scrollTarget == row)
                {
                    scrollTargetEntry = entry;
                }
                list.Add(entry);
            }

            view.ItemsSource = list;
            tabPage.Content  = view;

            if (scrollTargetEntry.RID > 0)
            {
                ScrollItemIntoView(view, scrollTargetEntry);
            }

            return(true);
        }
Esempio n. 2
0
            public ConstFileEntry(ConstantEntry entry, int index)
            {
                Index = index.ToString();

                if (entry.Type == ConstantEntryType.Number)
                {
                    Value = Convert.ToUInt32(entry.Value).ToString();
                }
                else
                {
                    Value = Convert.ToString(entry.Value);
                }
            }
        public void ParseEnumMapV1()
        {
            var csv   = "10,Org.XmlPull.V1.XmlPullParserNode,Cdsect,I:org/xmlpull/v1/XmlPullParser.CDSECT,5";
            var entry = ConstantEntry.FromString(csv);

            Assert.AreEqual(ConstantAction.Enumify, entry.Action);
            Assert.AreEqual(10, entry.ApiLevel);
            Assert.AreEqual("I:org/xmlpull/v1/XmlPullParser.CDSECT", entry.JavaSignature);
            Assert.AreEqual("5", entry.Value);
            Assert.AreEqual("Org.XmlPull.V1.XmlPullParserNode", entry.EnumFullType);
            Assert.AreEqual("Cdsect", entry.EnumMember);
            Assert.AreEqual(FieldAction.Keep, entry.FieldAction);
            Assert.False(entry.IsFlags);
        }
        public void ParseAddEnumMapV2()
        {
            var csv   = "A,10,,5,Org.XmlPull.V1.XmlPullParserNode,Cdsect";
            var entry = ConstantEntry.FromString(csv);

            Assert.AreEqual(ConstantAction.Add, entry.Action);
            Assert.AreEqual(10, entry.ApiLevel);
            Assert.AreEqual(string.Empty, entry.JavaSignature);
            Assert.AreEqual("5", entry.Value);
            Assert.AreEqual("Org.XmlPull.V1.XmlPullParserNode", entry.EnumFullType);
            Assert.AreEqual("Cdsect", entry.EnumMember);
            Assert.AreEqual(FieldAction.None, entry.FieldAction);
            Assert.False(entry.IsFlags);
        }
        public void ParseRemoveEnumMapV1()
        {
            var csv   = "10,,,I:org/xmlpull/v1/XmlPullParser.CDSECT,5";
            var entry = ConstantEntry.FromString(csv);

            Assert.AreEqual(ConstantAction.Remove, entry.Action);
            Assert.AreEqual(10, entry.ApiLevel);
            Assert.AreEqual("I:org/xmlpull/v1/XmlPullParser.CDSECT", entry.JavaSignature);
            Assert.AreEqual("5", entry.Value);
            Assert.AreEqual(string.Empty, entry.EnumFullType);
            Assert.AreEqual(string.Empty, entry.EnumMember);
            Assert.AreEqual(FieldAction.Remove, entry.FieldAction);
            Assert.False(entry.IsFlags);
        }
Esempio n. 6
0
 private void ConstantWorkerOnNewValues(ConstantEntry constantEntry)
 {
     // delegate event from constants, not required to subsribe, but recommended as it gives you app settings
     Constants.AutoTranslate = constantEntry.AutoTranslate;
     Constants.ChatCodes = constantEntry.ChatCodes;
     Constants.Colors = constantEntry.Colors;
     Constants.CultureInfo = constantEntry.CultureInfo;
     Constants.CharacterName = constantEntry.CharacterName;
     Constants.ServerName = constantEntry.ServerName;
     Constants.GameLanguage = constantEntry.GameLanguage;
     Constants.EnableHelpLabels = constantEntry.EnableHelpLabels;
     PluginViewModel.Instance.EnableHelpLabels = Constants.EnableHelpLabels;
 }