示例#1
0
        private void ParserControl_DoParse <T>(ParserControl parserControl) where T : Segment, new()
        {
            parserControl.Enabled = false;

            parserControl.ParseInputProgress      = 0;
            parserControl.WriteJSONOutputProgress = 0;

            if (!File.Exists(parserControl.SourceBin))
            {
                MessageBox.Show("Source bin path does not exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                parserControl.Enabled = true;
                return;
            }

            if (!Directory.Exists(lblOutputFolder.Text))
            {
                MessageBox.Show("Output folder does not exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                parserControl.Enabled = true;
                return;
            }

            ThreadPool.QueueUserWorkItem(o =>
            {
                var data = File.ReadAllBytes(parserControl.SourceBin);

                // Parse the data
                using (var memoryStream = new MemoryStream(data))
                    using (var binaryReader = new BinaryReader(memoryStream))
                    {
                        var outputFolder = lblOutputFolder.Text + "\\" + parserControl.Label + "\\" + "\\JSON\\";

                        var segment = new T();

                        parserControl.BeginInvoke((Action)(() => parserControl.ParseInputProgress = 1));

                        if (segment.Unpack(binaryReader))
                        {
                            parserControl.BeginInvoke((Action)(() => parserControl.ParseInputProgress = 100));

                            // Write out the parsed data
                            if (parserControl.WriteJSON)
                            {
                                parserControl.BeginInvoke((Action)(() => parserControl.WriteJSONOutputProgress = 1));

                                segment.WriteJSONOutput(outputFolder);

                                parserControl.BeginInvoke((Action)(() => parserControl.WriteJSONOutputProgress = 100));
                            }
                        }
                    }

                parserControl.BeginInvoke((Action)(() => parserControl.Enabled = true));
            });
        }
示例#2
0
 private void ParserControl1_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <RegionDescExtendedData>(parserControl);
 }
示例#3
0
 private void ParserControlB_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <GameEventDefDB>(parserControl);
 }
示例#4
0
 private void ParserControl9_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <WeenieDefaults>(parserControl);
 }
示例#5
0
 private void ParserControlA_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <MutationFilters>(parserControl);
 }
示例#6
0
 private void ParserControl7_DoParse(ParserControl parserControl)
 {
     MessageBox.Show("Not implemented.");
 }
示例#7
0
 private void ParserControl8_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <QuestDefDB>(parserControl);
 }
示例#8
0
 private void ParserControl6_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <LandBlockData>(parserControl);
 }
示例#9
0
 private void ParserControl5_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <HousingPortalsTable>(parserControl);
 }
示例#10
0
 private void ParserControl4_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <CraftingTable>(parserControl);
 }
示例#11
0
 private void ParserControl3_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <TreasureTable>(parserControl);
 }
示例#12
0
 private void ParserControl2_DoParse(ParserControl parserControl)
 {
     ParserControl_DoParse <SpellTableExtendedData>(parserControl);
 }