コード例 #1
0
        private void ConvertSniffFile(string fileName)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            System.IO.StreamReader file = new System.IO.StreamReader(fileName);
            var line = file.ReadLine();

            file.Close();

            if (line == "# TrinityCore - WowPacketParser")
            {
                string     filenameNoPath = Path.GetFileNameWithoutExtension(fileName);
                TextWriter tw             = new StreamWriter(filenameNoPath + "_filtered.txt");

                foreach (String s in packetFiltering.FilterSniffFile(fileName, rdb_blacklist.Checked, GetCheckedFilterList()))
                {
                    tw.WriteLine(s);
                }

                tw.Close();
            }
            else
            {
                MessageBox.Show(saveFileDialog.FileName + " is is not a valid TrinityCore parsed sniff file.", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }

            Cursor = Cursors.Default;
        }
コード例 #2
0
        private void btn_loadFile_Click(object sender, EventArgs e)
        {
            openFileDialog.Title           = "Open File";
            openFileDialog.Filter          = "Parsed Sniff File (*.txt)|*.txt";
            openFileDialog.FileName        = "*.txt";
            openFileDialog.FilterIndex     = 1;
            openFileDialog.ShowReadOnly    = false;
            openFileDialog.Multiselect     = true;
            openFileDialog.CheckFileExists = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                btn_loadFile.Enabled    = false;
                btn_loadFile.Text       = "Loading...";
                btn_pasteResult.Enabled = false;
                btn_pasteResult.Text    = "Loading...";

                foreach (String file in openFileDialog.FileNames)
                {
                    List <string> filterList = new List <string>(new string[] { "SMSG_QUESTGIVER_QUEST_DETAILS", "SMSG_QUESTGIVER_REQUEST_ITEMS", "SMSG_QUESTGIVER_OFFER_REWARD" });

                    filteredPackets.AddRange(filter.FilterSniffFile(file, false, filterList));
                }

                btn_loadFile.Enabled    = true;
                btn_loadFile.Text       = "Load File(s)";
                btn_pasteResult.Enabled = true;
                btn_pasteResult.Text    = "Paste Result";
            }
            else
            {
                // This code runs if the dialog was cancelled
                return;
            }
        }
コード例 #3
0
        private void FillDataTable(string filename)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            List <string> filterList       = new List <string>(new string[] { "SMSG_UPDATE_OBJECT", "SMSG_COMPRESSED_UPDATE_OBJECT" });
            List <string> createObjectList = filter.FilterSniffFile(filename, false, filterList);

            spawns.Merge(filter.GetDataTableForSpawns(createObjectList, box_createObject2.Checked, filename));

            //dgv_grid.Rows.Clear();
            //dgv_grid.Columns.Clear();
            //dgv_grid.Rows.Add(name, item.Entry, oldSpeedWalk, oldSpeedRun, roundedSpeedWalk, roundedSpeedRun);

            dgv_grid.DataSource = null;
            dgv_grid.DataSource = spawns;
            Cursor = Cursors.Default;
        }
コード例 #4
0
        private void FillDataTable(string filename)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            List <string> filterList = new List <string>(new string[] { "SMSG_CHAT" });
            List <string> textList   = filter.FilterSniffFile(filename, false, filterList);

            spawns.Merge(filter.GetDataTableForTexts(textList, filename));

            dgv_grid.DataSource = null;
            dgv_grid.DataSource = spawns;
            Cursor = Cursors.Default;
        }
コード例 #5
0
        private void FillDataTable(string filename)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            List <string> filterList       = new List <string>(new string[] { "SMSG_SPELL_START" });
            List <string> createObjectList = filter.FilterSniffFile(filename, false, filterList);

            spellTable = filter.GetDataTableForSpells(createObjectList);

            //dgv_grid.Rows.Clear();
            dgv_grid.Columns.Clear();

            dgv_grid.DataSource = spellTable;
            Cursor = Cursors.Default;
        }
コード例 #6
0
        private void btn_loadSniff_Click(object sender, EventArgs e)
        {
            openFileDialog.Title           = "Open File";
            openFileDialog.Filter          = "Parsed Sniff File (*.txt)|*.txt";
            openFileDialog.FileName        = "*.txt";
            openFileDialog.FilterIndex     = 1;
            openFileDialog.ShowReadOnly    = false;
            openFileDialog.Multiselect     = true;
            openFileDialog.CheckFileExists = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                Application.DoEvents();
                int numOfFiles  = openFileDialog.FileNames.Length;
                int currentFile = 0;
                progress.Step = 100 / numOfFiles;

                foreach (String file in openFileDialog.FileNames)
                {
                    currentFile++;
                    lbl_currentFileCount.Text = "File " + currentFile + "/" + numOfFiles;
                    progress.PerformStep();

                    List <string> filterList = new List <string>(new string[] { "SMSG_GOSSIP_MESSAGE" });
                    List <string> gossipList = filter.FilterSniffFile(file, false, filterList);
                    CheckMissingGossip(filter.GetSniffGossip(gossipList));
                    CheckMissingGossipMenuOption(filter.GetSniffGossipOptionMenu(gossipList));
                }

                lbl_currentFileCount.Text = "Done!";
                progress.Value            = 0;
                Cursor = Cursors.Default;
            }
            else
            {
                // This code runs if the dialog was cancelled
                return;
            }
        }
コード例 #7
0
        private void CheckInvalidSpeeds(string fileName)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            List <string>       filterList       = new List <string>(new string[] { "SMSG_UPDATE_OBJECT", "SMSG_COMPRESSED_UPDATE_OBJECT" });
            List <string>       createObjectList = filter.FilterSniffFile(fileName, false, filterList);
            List <SniffedSpeed> speeds           = filter.GetSniffedSpeedList(createObjectList);

            foreach (var item in speeds)
            {
                string oldSpeedWalk = "";
                string oldSpeedRun  = "";

                double w         = Convert.ToDouble(item.SpeedWalk, new CultureInfo("en-US"));
                double speedWalk = w / 2.5f;

                double r        = Convert.ToDouble(item.SpeedRun, new CultureInfo("en-US"));
                double speedRun = r / 7f;

                double roundedSpeedWalk;
                double roundedSpeedRun;
                if (speedWalk > 1)
                {
                    roundedSpeedWalk = Math.Round(speedWalk, 5);
                }
                else
                {
                    roundedSpeedWalk = Math.Round(speedWalk, 6);
                }

                if (speedRun > 1)
                {
                    roundedSpeedRun = Math.Round(speedRun, 5);
                }
                else
                {
                    roundedSpeedRun = Math.Round(speedRun, 6);
                }

                string name    = "";
                bool   addItem = false;

                for (int i = 0; i < models.Count; i++)
                {
                    if (models[i].ModelId == item.ModelId)
                    {
                        //name = creatures[i].Name;

                        if (roundedSpeedWalk != double.Parse(models[i].SpeedWalk) || roundedSpeedRun != double.Parse(models[i].SpeedRun))
                        {
                            bool exists = false;
                            addItem = false;

                            if (int.Parse(models[i].ModelId) > 25958)
                            {
                                addItem = false;
                            }

                            for (int k = 0; k < dgv_grid.Rows.Count; k++)
                            {
                                if (dgv_grid.Rows[k].Cells[1].Value != null && item.ModelId == dgv_grid.Rows[k].Cells[1].Value.ToString())
                                {
                                    if (roundedSpeedWalk.ToString() != dgv_grid.Rows[k].Cells[4].Value.ToString() || roundedSpeedRun.ToString() != dgv_grid.Rows[k].Cells[5].Value.ToString())
                                    {
                                        //MessageBox.Show("The value already existed in DataGridView. ModelId: (" + item.ModelId + ")\n First Sniffed SpeedWalk: " + roundedSpeedWalk + " Second Sniffed SpeedWalk: " + dgv_grid.Rows[k].Cells[4].Value.ToString()
                                        //+ "\n First Sniffed SpeedRun: " + roundedSpeedRun + " Second Sniffed SpeedRun: " + dgv_grid.Rows[k].Cells[5].Value.ToString() + "\n Sniffs are showing different speeds for the same model!!\n" + fileName);
                                        rtxt_duplicateResults.Text += item.UnitGUID + ", " + fileName + " vs " + dgv_grid.Rows[k].Cells[7].Value.ToString() + ", " + dgv_grid.Rows[k].Cells[6].Value.ToString() + ",\n";
                                        // Add to ignore list
                                        ignoreList.Add(item.ModelId);
                                    }
                                    exists = true;
                                }
                            }
                            if (exists == false)
                            {
                                oldSpeedWalk = models[i].SpeedWalk;
                                oldSpeedRun  = models[i].SpeedRun;

                                addItem = true;
                            }
                        }
                    }
                }

                if (addItem)
                {
                    dgv_grid.Rows.Add(name, int.Parse(item.ModelId), oldSpeedWalk, oldSpeedRun, roundedSpeedWalk, roundedSpeedRun, fileName, item.UnitGUID);
                }
            }

            Cursor        = Cursors.Default;
            lbl_rows.Text = "Rows: " + dgv_grid.RowCount;
        }