Example #1
0
        internal static void StartGrinder(bool parLoadLast)
        {
            if (IsEngineRunning)
            {
                return;
            }
            string tmpProfileName;

            if (parLoadLast && Options.LastProfile != "")
            {
                tmpProfileName = Options.LastProfile;
            }
            else
            {
                using (var locateProfile = new OpenFileDialog())
                {
                    locateProfile.CheckFileExists  = true;
                    locateProfile.CheckPathExists  = true;
                    locateProfile.Filter           = "xml Profile (*.xml)|*.xml";
                    locateProfile.FilterIndex      = 1;
                    locateProfile.InitialDirectory = Paths.ProfileFolder;
                    if (locateProfile.ShowDialog() == DialogResult.OK)
                    {
                        tmpProfileName = locateProfile.FileName;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            tmpGrind = new Grinder();
            if (!IsWaitingForGeneration && tmpGrind.Prepare(tmpProfileName, Callback))
            {
                Main.MainForm.Invoke(new MethodInvoker(delegate
                {
                    Main.MainForm.lGrindState.Text = "State: Loading mmaps";
                    IsWaitingForGeneration         = true;
                    Options.LastProfile            = tmpProfileName;
                }));
            }
        }
Example #2
0
        internal static void StartGrinder(bool parLoadLast)
        {
            Helpers.Logger.Append("Grinder starting up");
            GuiCore.MainForm.runToolStripMenuItem.Enabled   = false;
            GuiCore.MainForm.pauseToolStripMenuItem.Enabled = true;
            GuiCore.MainForm.stopToolStripMenuItem.Enabled  = true;

            if (IsEngineRunning)
            {
                return;
            }

            string tmpProfileName = string.Empty;

            if (parLoadLast && Settings.Settings.LastProfileFileName != "")
            {
                tmpProfileName = Paths.ProfilesDirectory + Settings.Settings.LastProfileFileName;
            }
            else
            {
                using (var locateProfile = new OpenFileDialog())
                {
                    locateProfile.CheckFileExists  = true;
                    locateProfile.CheckPathExists  = true;
                    locateProfile.Filter           = "xml Profile (*.xml)|*.xml";
                    locateProfile.FilterIndex      = 1;
                    locateProfile.InitialDirectory = Paths.ProfilesDirectory;
                    if (locateProfile.ShowDialog() == DialogResult.OK)
                    {
                        tmpProfileName = locateProfile.FileName;
                    }
                    else
                    {
                        //  StopCurrentEngine();
                        //  return;
                    }
                }
            }

            Helpers.Logger.Append("cc directory: " + Settings.Settings.CCDirectory.ToString());
            Helpers.Logger.Append("internal directory: " + Paths.InternalDirectory.ToString());
            Helpers.Logger.Append("wow directory: " + Paths.WowDirectory.ToString());
            Helpers.Logger.Append("profiles directory: " + Paths.ProfilesDirectory.ToString());
            Helpers.Logger.Append("working directory: " + Paths.WorkingDirectory.ToString());
            Helpers.Logger.Append("settings file: " + Paths.SettingsFile.ToString());
            Helpers.Logger.Append("bot assembly file: " + Paths.BotAssemblyFile.ToString());

            tmpGrind = new Grinder();
            if (tmpGrind.Prepare(tmpProfileName, Callback))
            {
                GuiCore.MainForm.Invoke(new MethodInvoker(delegate
                {
                    GuiCore.MainForm.lGrindState.Text     = "State: Loading mmaps";
                    string profileFileName                = tmpProfileName.Replace(Paths.ProfilesDirectory, "");
                    Settings.Settings.LastProfileFileName = profileFileName;
                }));
            }
            else
            {
                Helpers.Logger.Append("Grinder wasn't able to finish preparing! Aborting launch process..");
                GuiCore.MainForm.runToolStripMenuItem.Enabled   = true;
                GuiCore.MainForm.pauseToolStripMenuItem.Enabled = false;
                GuiCore.MainForm.stopToolStripMenuItem.Enabled  = false;
            }

            StartTick = DateTime.Now.Ticks;
        }