示例#1
0
        public static void Main(string[] args)
        {
            DateTime lTimer = new DateTime();

            if (args.Length > 0)
            {
                FIsPatch       = true;
                FPatchFileName = args[0];
            }

            Console.Title = "Venushja Mulpatcher v0.2 aplha";
            if (!FIsPatch)
            {
                Console.WriteLine("0 for GUI (correctly works only on x64 app)");
                Console.WriteLine("1 for Arts - 11 for Arts [.uop]");
                Console.WriteLine("2 for Gumps - 22 for Gumps [.uop]");
                Console.WriteLine("3 for Textures");
                string lValue = Console.ReadLine();
                lValue = lValue.Trim();

                int lChoose = Convert.ToInt32(lValue);

                Console.WriteLine("Loading mul files");
                Files.LoadMulPath();
                Console.WriteLine("Loaded mul files");

                switch (lChoose)
                {
                case 0:
                    Console.WriteLine("Choosed GUI...");
                    RunGUI();
                    Console.ReadKey();
                    break;

                case 1:
                case 11:
                    Console.WriteLine("Choosed ART...");
                    Utility.LoadConfig(FArtConfig, ref FItems);
                    Utility.LoadPath(FileRecognization.Art, ref FItems, FArtPath);
                    if (lChoose == 11)
                    {
                        Console.WriteLine("Unpacking .uop");
                        Utility.UnpackUOP(FileType.ArtLegacyMUL);
                        Console.WriteLine("Unpacked!");
                        Art.Reload();
                    }
                    PatchArt();
                    break;

                case 2:
                case 22:
                    Console.WriteLine("Choosed GUMP...");
                    Utility.LoadConfig(FGumpConfig, ref FItems);
                    Utility.LoadPath(FileRecognization.Gump, ref FItems, FGumpPath);
                    if (lChoose == 22)
                    {
                        Console.WriteLine("Unpacking .uop");
                        Utility.UnpackUOP(FileType.GumpartLegacyMUL);
                        Console.WriteLine("Unpacked!");
                        Gumps.Reload();
                    }
                    PatchGump();
                    break;

                case 3:
                    Console.WriteLine("Choosed TEXTURE...");
                    Utility.LoadConfig(FTextureConfig, ref FItems);
                    Utility.LoadPath(FileRecognization.Texture, ref FItems, FTexturePath);
                    PatchTexture();
                    break;

                case 666:
                    Application.EnableVisualStyles();
                    Application.Run(new DebugForm(0));
                    Console.ReadKey();
                    break;

                case 6666:
                    Bitmap   original;
                    ushort[] Items = new ushort[] { 0x0D85, 0x0CC7, 0x134F };
                    string[] Names = new string[] { "parez", "prazdne", "kameny" };
                    for (int y = 0; y < Items.Length; y++)
                    {
                        Console.WriteLine(Names[y] + " creating...");
                        StreamWriter lSW = new StreamWriter(Names[y] + ".txt");
                        lSW.Write(Names[y] + " = { ");
                        for (ushort i = 0; i < Art.GetMaxItemID(); i++)
                        {
                            Bitmap next = Art.GetStaticNoCache(i);
                            original = Art.GetStaticNoCache(Items[y]);     //0x0D85, 0x0CC7
                            try
                            {
                                if (BitmapComparer.CompareBitmapsFast(original, next))
                                {
                                    Console.WriteLine("Positon 0x" + i.ToString("X4") + " is same. Added");
                                    //lSW.WriteLine("0x" + i.ToString("X4"));
                                    lSW.Write("0x" + i.ToString("X4") + ", ");
                                }
                            }
                            finally
                            {
                                next = null;
                            }
                        }
                        lSW.Write("}");
                        lSW.Close();
                    }
                    break;
                }
                lTimer = DateTime.Now;
                Save(lChoose);
            }
            else
            {
                Console.WriteLine("0 for patch into MUL files");
                Console.WriteLine("1 for patch into UOP files");
                string lValue = Console.ReadLine();
                lValue = lValue.Trim();

                int lChoose = Convert.ToInt32(lValue);

                Console.WriteLine("Loading mul files");
                Files.LoadMulPath();
                Console.WriteLine("Loaded mul files");

                PatchesUtility lPatchesUtility = new PatchesUtility(FPatchFileName);

                if (lChoose == 1)
                {
                    bool lArtsUnpacked = false;
                    foreach (FileRecognization lFileRec in lPatchesUtility.ContainsFlags)
                    {
                        switch (lFileRec)
                        {
                        case FileRecognization.Art:
                        case FileRecognization.ArtLand:
                            if (lArtsUnpacked)
                            {
                                continue;
                            }
                            Console.WriteLine("Unpacking arts .uop file");
                            Utility.UnpackUOP(FileType.ArtLegacyMUL);
                            Console.WriteLine("Unpacked!");
                            Art.Reload();
                            lArtsUnpacked = true;
                            break;

                        case FileRecognization.Gump:
                            Console.WriteLine("Unpacking gumps .uop file");
                            Utility.UnpackUOP(FileType.GumpartLegacyMUL);
                            Console.WriteLine("Unpacked!");
                            Gumps.Reload();
                            break;
                        }
                    }
                }
                PatchDragAndDropPatch(ref lPatchesUtility.FVMulPatches);

                lTimer = DateTime.Now;
                Save(ref lPatchesUtility.ContainsFlags, lChoose == 1);
            }
            Console.WriteLine("Time elapsed: " + Math.Round(Convert.ToDecimal((DateTime.Now - lTimer).TotalMinutes), 4) + " minutes");
            Console.ReadKey();
        }