Exemplo n.º 1
0
        public static bool IsCheatMap(string path)
        {
            bool result = false;

            using (W3MArchive map = new W3MArchive(path, true))
            {
                MPQFile file = null;
                try
                {
                    file = map.Find(@"scripts\war3map.j");
                    if (file == null)
                    {
                        file = map.Find("war3map.j");
                    }
                    string JassScript = Encoding.UTF8.GetString(file.File);

                    foreach (string item in CheatSetPhases)
                    {
                        if (JassScript.IndexOf(item) != -1)
                        {
                            result = true;
                            break;
                        }
                    }
                }
                finally
                {
                    file?.Dispose();
                }
            }
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            return(result);
        }
Exemplo n.º 2
0
        private void ExtractAllDbcs(string outputFolder)
        {
            if (!MPQFile.Exists("DBFilesClient\\Achievement.dbc"))
            {
                MessageBox.Show("Impossible d'extraire les DBCs, vérifiez que le chemin vers votre dossier World of Warcraft est correct et que les fichiers MPQs ne soient pas déjà utilisés par un autre programme.");
                return;
            }

            bool error = false;
            foreach (string dbc in listDbcs)
            {
                if (MPQFile.Exists("DBFilesClient\\" + dbc))
                {
                    MPQFile fileMpq = new MPQFile("DBFilesClient\\" + dbc);
                    FileStream file = File.Create(txtProjectPath.Text + "\\dbc\\" + dbc);
                    file.Write(fileMpq.Read((uint)fileMpq.Length), 0, (int)fileMpq.Length);
                    file.Close();
                    fileMpq.Close();
                    continue;
                }
                error = true;
            }

            if (error)
                MessageBox.Show("Toutes les DBCs n'ont pas pû être extraites, vérifiez que vous possédez bien toutes les archives MPQ du jeu.");
            else
                MessageBox.Show("Extraction des fichiers terminés.");
        }