Ejemplo n.º 1
0
        public static void Patch()
        {
            OptimizationException.Reset();
            Directory = Path.GetDirectoryName(FileName) + "\\";
            if (Directory == "\\")
            {
                Directory = "";
            }
            NakedFileName = Path.GetDirectoryName(FileName) + "\\" + Path.GetFileNameWithoutExtension(FileName);
            if (CreateLog)
            {
                LogFile           = new StreamWriter(Directory + "log.txt");
                LogFile.AutoFlush = true;
            }
            if (AutoGetCode)
            {
                FileData = new PEfile(FileName);
            }
            else
            {
                FileData = new PEfile(CodeOffset, CodeLength);
            }
#if useconsole
            //ExtractCode();
            //DecompileCode();
            ReadCode();
            ApplyPatchedCode();
            Console.WriteLine("Push any key to exit (" + count3.ToString() + " patches)");
            Console.ReadKey();
#else
            ExtractCode();
            DecompileCode();
            ReadCode();
            ApplyPatchedCode();
            Console.WriteLine("Finished. Applied " + count3.ToString() + " patches.");
#endif
            if (CreateLog)
            {
                OptimizationException.LogErrors();
                LogFile.WriteLine("------------------------------------------------");
                LogFile.WriteLine(count3.ToString() + " patches were applied");
                LogFile.Close();
            }
        }
Ejemplo n.º 2
0
        public static void Patch() {
            OptimizationException.Reset();
            Directory=Path.GetDirectoryName(FileName)+"\\";
            if(Directory=="\\") Directory="";
            NakedFileName=Path.GetDirectoryName(FileName)+"\\"+Path.GetFileNameWithoutExtension(FileName);
            if(CreateLog) {
                LogFile=new StreamWriter(Directory+"log.txt");
                LogFile.AutoFlush=true;
            }
            if(AutoGetCode) {
                FileData=new PEfile(FileName);
            } else {
                FileData=new PEfile(CodeOffset,CodeLength);
            }            
#if useconsole
            //ExtractCode();
            //DecompileCode();
            ReadCode();
            ApplyPatchedCode();
            Console.WriteLine("Push any key to exit ("+count3.ToString()+" patches)");
            Console.ReadKey();
#else
            ExtractCode();
            DecompileCode();
            ReadCode();
            ApplyPatchedCode();
            Console.WriteLine("Finished. Applied "+count3.ToString()+" patches.");
#endif
            if(CreateLog) {
                OptimizationException.LogErrors();
                LogFile.WriteLine("------------------------------------------------");
                LogFile.WriteLine(count3.ToString()+" patches were applied");
                LogFile.Close();
            }
        }