コード例 #1
0
 public void Load()
 {
     damnedMaps    = new DamnedMaps(directory);
     damnedObjects = new DamnedObjects(directory);
     damnedSounds  = new DamnedSounds(directory);
     damnedImages  = new DamnedImages(directory, damnedMaps, damnedObjects);
 }
コード例 #2
0
 public DamnedCommunityStagesForm(DamnedMainForm form, DamnedFiles files)
 {
     this.form    = form;
     damnedFiles  = files;
     damnedStages = damnedFiles.damnedMaps;
     InitializeComponent();
 }
コード例 #3
0
 public void Refresh()
 {
     SetDirectories();
     damnedMaps    = new DamnedMaps(directory);
     damnedObjects = new DamnedObjects(directory);
     damnedSounds  = new DamnedSounds(directory);
     damnedImages  = new DamnedImages(directory, damnedMaps, damnedObjects);
 }
コード例 #4
0
    private bool CheckStageOrScene(string stagePath)
    {
        string directoryPath = Path.GetDirectoryName(stagePath);
        string directoryName = Path.GetFileName(directoryPath);

        if (directoryName != "Stages")
        {
            string stageName = Path.GetFileName(stagePath);
            reasonForFailedCheck = String.Format("Check failed because \"{0}\" does not reside in the Stages directory", stageName);
            return(false);
        }

        FileInfo[] stages = new DirectoryInfo(directoryPath).GetFiles("*", SearchOption.TopDirectoryOnly);

        if (stages.Length > 2)
        {
            reasonForFailedCheck = "Check failed because the Stages directory has more than 2 files in it. Only 1 scene and 1 file is allowed";
            return(false);
        }

        bool success = true;

        for (int i = 0; i < stages.Length; i++)
        {
            string stageName = stages[i].Name;

            if (!FindCorrespondingFile(stages, stageName))
            {
                success = false;
                break;
            }
        }

        if (success)
        {
            string extension = Path.GetExtension(stagePath);
            string reason    = String.Empty;

            if (extension == ".stage")
            {
                success = DamnedMaps.CheckInnerStageFile(stagePath, ref reason);
            }

            else if (extension == ".scene")
            {
                success = DamnedMaps.CheckInnerSceneFile(stagePath, ref reason);
            }

            if (!success)
            {
                this.reasonForFailedCheck = reason;
            }
        }

        return(success);
    }
コード例 #5
0
 public DamnedImages(string rootDirectory, DamnedMaps damnedStages, DamnedObjects damnedObjects)
 {
     directory          = rootDirectory;
     this.damnedStages  = damnedStages;
     this.damnedObjects = damnedObjects;
     SetGUIDirectory();
     SetImages();
     SetDamnedStagesXmlFile();
     SetDamnedTerrorZipFile();
     SetTerrorImagesDirectory();
 }
コード例 #6
0
 public DamnedMappingForm(DamnedMaps damnedMaps, DamnedImages damnedImages, DamnedMainForm mainForm)
 {
     InitializeComponent();
     this.mainForm = mainForm;
     this.mainForm.Hide();
     this.damnedMaps        = damnedMaps;
     this.damnedImages      = damnedImages;
     this.tempDirectory     = String.Empty;
     damnedRemoveStage      = new DamnedRemoveStage();
     damnedNewStage         = new DamnedNewStage();
     damnedNewStagesList    = new List <DamnedNewStage>();
     damnedRemoveStagesList = new List <DamnedRemoveStage>();
     RefreshDamnedStagesList();
 }
コード例 #7
0
        private void SelectScene(bool remove)
        {
            FileDialog dialog = new OpenFileDialog
            {
                Filter = "Scene Files(*.scene)|*.scene"
            };

            if (remove)
            {
                dialog.InitialDirectory = damnedMaps.stagesAndScenesDirectory;
            }

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            string scenePath = dialog.FileName;
            string sceneName = Path.GetFileName(scenePath);

            if (Path.GetExtension(scenePath) != ".scene")
            {
                MessageBox.Show("You did not pick a .scene file. Please select one that is a .scene file", "Please select a different file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (sceneName.Contains("menu_background"))
            {
                MessageBox.Show("Either you picked the scene that is for the main menu or you decided to name your scene along the lines of \"menu_background\". Either pick a different one or rename your scene.", "Pick a different scene", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            if (remove)
            {
                sceneName = sceneName.Replace("_", " ").Remove(sceneName.IndexOf("."), 6);

                if (sceneName != labelMapToRemove.Text)
                {
                    MessageBox.Show("It looks like you seleted a scene file that does not go with the stage file you selected already. Please pick the right one", "Wrong Scene File", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                for (int i = 0; i < damnedRemoveStagesList.Count; i++)
                {
                    string stageNameInList = Path.GetFileNameWithoutExtension(damnedRemoveStagesList[i].scenePath).Replace("_", " ");
                    string currentStage    = Path.GetFileNameWithoutExtension(scenePath).Replace("_", " ");

                    if (String.Compare(currentStage, stageNameInList, true) == 0)
                    {
                        MessageBox.Show($"The selected stage \"{currentStage}\" has already been selected to be removed from the game. Please select a different stage", "Stage already selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }

                damnedRemoveStage.scenePath = scenePath;
                damnedRemoveStagesList.Add(new DamnedRemoveStage(damnedRemoveStage));
                buttonSelectSceneToRemove.Enabled = false;
                labelSelectSceneFileToRemove.Text = "Choose another scene file to remove with a stage:";
                labelMapToRemove.Text             = "Choose another stage file to remove from the game.";
                labelMapToRemove.ForeColor        = Color.White;
                buttonModifyStages.Enabled        = true;
                changesMade = true;
                string stageToMark = Path.GetFileNameWithoutExtension(damnedRemoveStage.stagePath).Replace("_", " ");
                MarkStage(stageToMark, Color.Red);
            }

            else
            {
                string reason = String.Empty;

                if (!DamnedMaps.CheckInnerSceneFile(scenePath, ref reason))
                {
                    MessageBox.Show(String.Format("{0} Please select a different scene file.", reason), "Failed to check the scene file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (damnedNewStage.newScenePath == String.Empty)
                {
                    damnedNewStage.count++;
                }

                damnedNewStage.newScenePath = scenePath;
                labelScene.Text             = sceneName;
                labelScene.ForeColor        = Color.FromArgb(255, 168, 38);
                changesMade = true;
                buttonSelectLobbyButtonPicture.Enabled = true;
            }
        }
コード例 #8
0
        private void SelectStage(bool remove)
        {
            FileDialog dialog = new OpenFileDialog();

            if (remove)
            {
                dialog.InitialDirectory = damnedMaps.stagesAndScenesDirectory;
            }

            dialog.Filter = "Stage Files (*.stage)|*.stage";
            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            string stagePath = dialog.FileName;
            string stage     = Path.GetFileName(stagePath);

            if (Path.GetExtension(stage) != ".stage")
            {
                MessageBox.Show("You did not pick a stage file. Please select one that is a .stage file", "Please select a different file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (stage.Contains("menu_background"))
            {
                MessageBox.Show("Either you picked the stage that is for the main menu or you decided to name your stage along the lines of \"menu_background\". Either pick a different one or rename your stage.", "Pick a different stage", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (remove)
            {
                if (Path.GetFileName(Path.GetDirectoryName(stagePath)) != "Stages")
                {
                    MessageBox.Show("It seems that the stage that you have selected does not reside inside the Damned directory. Please select a different stage", "Please select a different file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                damnedRemoveStage.stagePath = stagePath;
                string newLabelText = Path.GetFileNameWithoutExtension(stage).Replace("_", " ");
                labelMapToRemove.Text             = newLabelText;
                labelMapToRemove.ForeColor        = Color.FromArgb(255, 168, 38);
                buttonSelectSceneToRemove.Enabled = true;
                changesMade = true;
            }

            else
            {
                if (damnedMaps.StageExists(stage))
                {
                    MessageBox.Show("This stage is already installed in the game. Please pick another.", "Stage Already Exists", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                string reason = String.Empty;

                if (!DamnedMaps.CheckInnerStageFile(stagePath, ref reason))
                {
                    MessageBox.Show(String.Format("{0} Please select a different stage file.", reason), "Failed to check the stage", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (damnedNewStage.newStagePath == String.Empty)
                {
                    damnedNewStage.count++;
                }

                damnedNewStage.newStagePath = stagePath;
                string newLabelText = stage.Replace("_", " ").Remove(stage.IndexOf("."), 6);
                labelMapToAdd.Text            = newLabelText;
                labelMapToAdd.ForeColor       = Color.FromArgb(255, 168, 38);
                buttonSelectSceneFile.Enabled = true;
                changesMade = true;
            }
        }