private void extractOrInjectScript()
        {
            if (ProjectProperties.CurrentProjectPropperties.LoadSaveScriptToMap)
            {
                if (File.Exists(ProjectProperties.CurrentProjectPropperties.MapPath))
                {
                    UploadToMapForm questionForm = new UploadToMapForm();
                    questionForm.ShowDialog(this);
                    if (questionForm.Extract)
                    {
                        if (ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Exists)
                        {
                            //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Delete(true);
                            Form1.DeleteDir(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        }
                        //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir = new DirectoryInfo(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Create();
                        MpqEditor.ExtractGalaxyppScriptFiles(
                            new FileInfo(ProjectProperties.CurrentProjectPropperties.MapPath),
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir, true);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.FixConflicts(".galaxy++");
                        Form1.Form.ReloadSourceFiles();
                        Form1.Form.RebuildProjectView();
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else if (questionForm.Inject)
                    {
                        MpqEditor.SaveGalaxyppScriptFiles(
                            new FileInfo(ProjectProperties.CurrentProjectPropperties.MapPath),
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir);
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else
                    {
                        CBSaveScriptToMap.Checked = false;
                    }
                }
                else if (Directory.Exists(ProjectProperties.CurrentProjectPropperties.MapPath))
                {
                    UploadToMapForm questionForm = new UploadToMapForm();
                    questionForm.ShowDialog(this);
                    if (questionForm.Extract)
                    {
                        if (ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Exists)
                        {
                            //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Delete(true);
                            Form1.DeleteDir(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        }
                        //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir = new DirectoryInfo(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Create();

                        DirectoryInfo codeDir =
                            new DirectoryInfo(Path.Combine(ProjectProperties.CurrentProjectPropperties.MapPath,
                                                           "Galaxy++"));

                        if (!codeDir.Exists)
                        {
                            MessageBox.Show(this, "Unable to extract script. No script found in map.", "Error");
                            return;
                        }

                        Form1.CopyDirectories(
                            codeDir,
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.FixConflicts("*.galaxy++");
                        Form1.Form.ReloadSourceFiles();
                        Form1.Form.RebuildProjectView();
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else if (questionForm.Inject)
                    {
                        string path = Path.Combine(ProjectProperties.CurrentProjectPropperties.MapPath,
                                                   "Galaxy++");
                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }
                        Form1.CopyDirectories(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir,
                                              new DirectoryInfo(path));
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else
                    {
                        CBSaveScriptToMap.Checked = false;
                    }
                }
            }
        }
        private void extractOrInjectScript()
        {
            if (ProjectProperties.CurrentProjectPropperties.LoadSaveScriptToMap)
            {
                if (File.Exists(ProjectProperties.CurrentProjectPropperties.MapPath))
                {
                    UploadToMapForm questionForm = new UploadToMapForm();
                    questionForm.ShowDialog(this);
                    if (questionForm.Extract)
                    {
                        if (ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Exists)
                            //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Delete(true);
                            Form1.DeleteDir(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir = new DirectoryInfo(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Create();
                        MpqEditor.ExtractGalaxyppScriptFiles(
                            new FileInfo(ProjectProperties.CurrentProjectPropperties.MapPath),
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir, true);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.FixConflicts(".galaxy++");
                        Form1.Form.ReloadSourceFiles();
                        Form1.Form.RebuildProjectView();
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else if (questionForm.Inject)
                    {
                        MpqEditor.SaveGalaxyppScriptFiles(
                            new FileInfo(ProjectProperties.CurrentProjectPropperties.MapPath),
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir);
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else
                    {
                        CBSaveScriptToMap.Checked = false;
                    }
                }
                else if (Directory.Exists(ProjectProperties.CurrentProjectPropperties.MapPath))
                {
                    UploadToMapForm questionForm = new UploadToMapForm();
                    questionForm.ShowDialog(this);
                    if (questionForm.Extract)
                    {
                        if (ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Exists)
                            //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Delete(true);
                            Form1.DeleteDir(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        //ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir = new DirectoryInfo(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.FullName);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir.Create();

                        DirectoryInfo codeDir =
                            new DirectoryInfo(Path.Combine(ProjectProperties.CurrentProjectPropperties.MapPath,
                                                           "Galaxy++"));

                        if (!codeDir.Exists)
                        {
                            MessageBox.Show(this, LocRM.GetString("ErrorMsgScript.Text"), LocRM.GetString("Error.Text"));
                            return;
                        }

                        Form1.CopyDirectories(
                            codeDir,
                            ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir);
                        ProjectProperties.CurrentProjectPropperties.SrcFolder.FixConflicts("*.galaxy++");
                        Form1.Form.ReloadSourceFiles();
                        Form1.Form.RebuildProjectView();
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else if (questionForm.Inject)
                    {
                        string path = Path.Combine(ProjectProperties.CurrentProjectPropperties.MapPath,
                                                   "Galaxy++");
                        if (Directory.Exists(path))
                            Directory.Delete(path, true);
                        Form1.CopyDirectories(ProjectProperties.CurrentProjectPropperties.SrcFolder.Dir,
                            new DirectoryInfo(path));
                        Form1.Form.UploadedChangesToMap = true;
                    }
                    else
                    {
                        CBSaveScriptToMap.Checked = false;
                    }
                }
            }
        }