示例#1
0
 //MadCowUpdater process killer.
 public static void KillUpdater()
 {
     if (ProcessFinder.FindProcess("MadCowUpdater") == true)
     {
         ProcessFinder.KillProcess("MadCowUpdater");
     }
 }
示例#2
0
        public static void MpqTransfer()
        {
            //Takes Diablo Path from Ini, which gets it from finding diablo3.exe
            if (File.Exists(Paths.MadcowIni))
            {
                var src = Configuration.MadCow.MpqDiablo;
                var dst = Configuration.MadCow.MpqServer;

                if (ProcessFinder.FindProcess("Diablo"))
                {
                    ProcessFinder.KillProcess("Diablo");
                    Console.WriteLine("Killed Diablo3 Process");
                }
                if (!Directory.Exists(dst))
                {
                    Console.WriteLine("Creating MPQ folder...");
                    Directory.CreateDirectory(dst);
                    Console.WriteLine("Created MPQ folder over:" + dst);
                }
                //Proceeds to copy data
                Console.WriteLine("Copying MPQ files to MadCow Folders...");
                CopyDirectory(src, dst);
                //When all the files has been copied then:
                Console.WriteLine("Copying MPQ files to MadCow Folders has completed.");
                Form1.GlobalAccess.Invoke(new Action(() =>
                {
                    Form1.GlobalAccess.CopyMPQButton.Enabled    = true;
                    Form1.GlobalAccess.PlayDiabloButton.Enabled = true; //We enable Play D3 button again.
                }));
            }
            else
            {
                Console.WriteLine("MadCow could not find your Diablo III Mpq Folder");
            }
        }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (ProcessFinder.FindProcess("Mooege") == true)
     {
         var answer = MessageBox.Show("Mooege is already Running. Do you want to restart Mooege?", "Attention",
                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (answer == DialogResult.Yes)
         {
             ProcessFinder.KillProcess("Mooege");
             Process proc0 = new Process();
             proc0.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath);
             proc0.Start();
             this.Close();
         }
         else
         {
             //Do Nothing
         }
     }
     else
     {
         ProcessFinder.KillProcess("Mooege");
         Process proc0 = new Process();
         proc0.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath);
         proc0.Start();
         Thread.Sleep(3000);
         if (ErrorFinder.SearchLogs("Fatal") == true)
         {
             Console.WriteLine("Closing Mooege due Fatal Exception");
             ProcessFinder.KillProcess("Mooege");
         }
         this.Close();
     }
 }
示例#4
0
        //This is actually the whole process MadCow uses after Downloading source.
        #region RunProcedure
        public static void RunWholeProcedure()
        {
            Compile.currentMooegeExePath         = Program.programPath + @"\" + @"Repositories\" + ParseRevision.developerName + "-" + ParseRevision.branchName + "-" + ParseRevision.lastRevision + @"\src\Mooege\bin\Debug\Mooege.exe";
            Compile.currentMooegeDebugFolderPath = Program.programPath + @"\" + @"Repositories\" + ParseRevision.developerName + "-" + ParseRevision.branchName + "-" + ParseRevision.lastRevision + @"\src\Mooege\bin\Debug\";
            Compile.mooegeINI = Program.programPath + @"\" + @"Repositories\" + ParseRevision.developerName + "-" + ParseRevision.branchName + "-" + ParseRevision.lastRevision + @"\src\Mooege\bin\Debug\config.ini";

            ZipFile zip    = null;
            var     events = new FastZipEvents();

            if (ProcessFinder.FindProcess("Mooege") == true)
            {
                ProcessFinder.KillProcess("Mooege");
            }

            FastZip z = new FastZip(events);

            Console.WriteLine("Uncompressing zip file...");
            var stream = new FileStream(Program.programPath + @"\Repositories\" + @"\Mooege.zip", FileMode.Open, FileAccess.Read);

            zip = new ZipFile(stream);
            zip.IsStreamOwner = true; //Closes parent stream when ZipFile.Close is called
            zip.Close();

            var t1 = Task.Factory.StartNew(() => z.ExtractZip(Program.programPath + @"\Repositories\" + @"\Mooege.zip", Program.programPath + @"\" + @"Repositories\", null))
                     .ContinueWith(delegate
            {
                //Comenting the lines below because I haven't tested this new way over XP VM or even normal XP.
                //RefreshDesktop.RefreshDesktopPlease(); //Sends a refresh call to desktop, probably this is working for Windows Explorer too, so i'll leave it there for now -wesko
                //Thread.Sleep(2000); //<-This and ^this is needed for madcow to work on VM XP, you need to wait for Windows Explorer to refresh folders or compiling wont find the new mooege folder just uncompressed.
                Console.WriteLine("Uncompress Complete.");
                if (File.Exists(Program.madcowINI))
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String Src           = source.Configs["Balloons"].Get("ShowBalloons");

                    if (Src.Contains("1"))
                    {
                        Form1.GlobalAccess.MadCowTrayIcon.ShowBalloonTip(1000, "MadCow", "Uncompress Complete!", ToolTipIcon.Info);
                    }
                }
                Form1.GlobalAccess.Invoke((MethodInvoker) delegate { Form1.GlobalAccess.generalProgressBar.PerformStep(); });
                Compile.compileSource(); //Compile solution projects.
                Form1.GlobalAccess.Invoke((MethodInvoker) delegate { Form1.GlobalAccess.generalProgressBar.PerformStep(); });
                Form1.GlobalAccess.Invoke((MethodInvoker) delegate { Form1.GlobalAccess.generalProgressBar.PerformStep(); });
                Console.WriteLine("[Process Complete!]");
                if (File.Exists(Program.madcowINI))
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String Src           = source.Configs["Balloons"].Get("ShowBalloons");

                    if (Src.Contains("1"))
                    {
                        Form1.GlobalAccess.MadCowTrayIcon.ShowBalloonTip(1000, "MadCow", "Process Complete!", ToolTipIcon.Info);
                    }
                }
            });
        }
示例#5
0
        private void Unzip()
        {
            if (ProcessFinder.FindProcess("Mooege"))
            {
                ProcessFinder.KillProcess("Mooege");
            }

            //var stream = new FileStream(zipFileName, FileMode.Open, FileAccess.Read);
            //var zip = new ZipFile(stream) { IsStreamOwner = true };
            //Closes parent stream when ZipFile.Close is called
            //zip.Close();
            new FastZip(new FastZipEvents()).ExtractZip(Paths.MooegeDownloadPath, Paths.RepositoriesPath, null);
        }
示例#6
0
        public static void MpqTransfer()
        {
            try
            {
                //Takes Diablo Path from Ini, which gets it from finding diablo3.exe
                if (File.Exists(Program.madcowINI))
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String        Src    = source.Configs["DiabloPath"].Get("MPQpath");
                    String        Dst    = source.Configs["DiabloPath"].Get("MPQDest");

                    if (ProcessFinder.FindProcess("Diablo") == true)
                    {
                        ProcessFinder.KillProcess("Diablo");
                        Console.WriteLine("Killed Diablo3 Process");
                    }
                    if (Directory.Exists(Dst) == false)
                    {
                        Console.WriteLine("Creating MPQ folder...");
                        Directory.CreateDirectory(Dst);
                        Console.WriteLine("Created MPQ folder over:" + Dst);
                    }
                    //Proceeds to copy data
                    Console.WriteLine("Copying MPQ files...");
                    Form1.GlobalAccess.Invoke(new Action(() =>
                    {
                        Form1.GlobalAccess.CopyMPQButton.Enabled    = false;
                        Form1.GlobalAccess.PlayDiabloButton.Enabled = false;
                    }));
                    copyDirectory(Src, Dst);
                    //When all the files has been copied then:
                    Console.WriteLine("Copying MPQ files completed.");
                    Form1.GlobalAccess.Invoke(new Action(() =>
                    {
                        Form1.GlobalAccess.CopyMPQButton.Enabled    = true;
                        Form1.GlobalAccess.PlayDiabloButton.Enabled = true; //We enable Play D3 button again.
                    }));
                }
                else
                {
                    Console.WriteLine("MadCow could not find your Diablo III Mpq Folder");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#7
0
        public static void Play()
        {
            if (File.Exists(Program.madcowINI))
            {
                try
                {
                    IConfigSource source = new IniConfigSource(Program.madcowINI);
                    String        Src    = source.Configs["DiabloPath"].Get("D3Path");

                    if (ProcessFinder.FindProcess("Mooege") == false)
                    {
                        if (File.Exists(Compile.currentMooegeExePath))
                        {
                            Console.WriteLine("Starting Mooege..");
                            Process Mooege = new Process();
                            Mooege.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath);
                            Mooege.Start();

                            Thread.Sleep(3000); //We sleep so our ErrorFinder has time to parse Mooege logs.
                            if (ErrorFinder.SearchLogs("Fatal") == true)
                            {
                                Console.WriteLine("Closing Mooege due Fatal Exception");
                                ProcessFinder.KillProcess("Mooege");
                            }
                            else
                            {
                                Console.WriteLine("Starting Diablo..");
                                Process Diablo3 = new Process();
                                Diablo3.StartInfo           = new ProcessStartInfo(Src);
                                Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345";
                                Diablo3.Start();
                                //We save this repository for LastPlayed function.
                                source.Configs["LastPlay"].Set("Repository", Compile.currentMooegeExePath);
                                source.Save();
                                Process D3Patcher = new Process();
                                D3Patcher.StartInfo = new ProcessStartInfo(Program.programPath + @"\BnetPatcher\Bnet.Patcher.exe");
                                D3Patcher.Start();
                            }
                        }
                        else
                        {
                            Console.WriteLine("[Error] Couldn't find selected repository binaries."
                                              + "\nTry updating the repository again.");
                        }
                    }
                    else //If Mooege is running we kill it and start it again.
                    {
                        Console.WriteLine("Killing Mooege Process..");
                        ProcessFinder.KillProcess("Mooege");
                        Console.WriteLine("Starting Mooege..");
                        Process Mooege = new Process();
                        Mooege.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath);
                        Mooege.Start();

                        Thread.Sleep(3000);
                        if (ErrorFinder.SearchLogs("Fatal") == true)
                        {
                            Console.WriteLine("Closing Mooege due Fatal Exception");
                            ProcessFinder.KillProcess("Mooege");
                        }
                        else
                        {
                            Console.WriteLine("Starting Diablo..");
                            Process Diablo3 = new Process();
                            Diablo3.StartInfo           = new ProcessStartInfo(Src);
                            Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345";
                            Diablo3.Start();
                            //We save this repository for LastPlayed function.
                            source.Configs["LastPlay"].Set("Repository", Compile.currentMooegeExePath);
                            source.Save();
                            Process D3Patcher = new Process();
                            D3Patcher.StartInfo = new ProcessStartInfo(Program.programPath + @"\BnetPatcher\Bnet.Patcher.exe");
                            D3Patcher.Start();
                        }
                    }
                }
                catch
                {
                    Console.WriteLine("[ERROR] Could not launch Diablo. (Diablo.cs)" + "\nPlease report this error in the forum.");
                }
            }
            //If madcow.ini aint found.
            else
            {
                Console.WriteLine("[ERROR] Could not find MadCow config file. (Diablo.cs)" + "\nPlease report this error in the forum.");
            }
        }
示例#8
0
文件: Diablo.cs 项目: rjt1014/MadCow
 public static void Play(Repository repository)
 {
     try
     {
         var src = Configuration.MadCow.DiabloPath;
         Configuration.UpdateMooegeIni(repository);
         if (ProcessFinder.FindProcess("Mooege") == false)
         {
             if (File.Exists(Paths.GetMooegeExePath(repository)))
             {
                 Console.WriteLine("Starting Mooege..");
                 var mooege = new Process();
                 mooege.StartInfo = new ProcessStartInfo(Paths.GetMooegeExePath(repository));
                 mooege.Start();
                 Thread.Sleep(3000); //We sleep so our ErrorFinder has time to parse Mooege logs.
                 if (ErrorFinder.SearchLogs("Fatal"))
                 {
                     Console.WriteLine("Closing Mooege due Fatal Exception");
                     ProcessFinder.KillProcess("Mooege");
                 }
                 else
                 {
                     Console.WriteLine("Starting Diablo..");
                     var Diablo3 = new Process();
                     Diablo3.StartInfo           = new ProcessStartInfo(src);
                     Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345";
                     Diablo3.Start();
                     //We save this repository for LastPlayed function.
                     Configuration.MadCow.LastRepository = Paths.GetMooegeExePath(repository);
                 }
             }
             else
             {
                 Console.WriteLine("[Error] Couldn't find selected repository binaries."
                                   + "\nTry updating the repository again.");
             }
         }
         else //If Mooege is running we kill it and start it again.
         {
             Console.WriteLine("Killing Mooege Process..");
             ProcessFinder.KillProcess("Mooege");
             Console.WriteLine("Starting Mooege..");
             var mooege = new Process();
             mooege.StartInfo = new ProcessStartInfo(Paths.GetMooegeExePath(repository));
             mooege.Start();
             Thread.Sleep(3000);
             if (ErrorFinder.SearchLogs("Fatal"))
             {
                 Console.WriteLine("Closing Mooege due Fatal Exception");
                 ProcessFinder.KillProcess("Mooege");
             }
             else
             {
                 Console.WriteLine("Starting Diablo..");
                 var Diablo3 = new Process();
                 Diablo3.StartInfo           = new ProcessStartInfo(src);
                 Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345";
                 Diablo3.Start();
             }
         }
     }
     catch
     {
         Console.WriteLine("[ERROR] Could not launch Diablo. (Diablo.cs)" +
                           "\nPlease report this error in the forum.");
     }
 }