public void Load() { damnedMaps = new DamnedMaps(directory); damnedObjects = new DamnedObjects(directory); damnedSounds = new DamnedSounds(directory); damnedImages = new DamnedImages(directory, damnedMaps, damnedObjects); }
public void Refresh() { SetDirectories(); damnedMaps = new DamnedMaps(directory); damnedObjects = new DamnedObjects(directory); damnedSounds = new DamnedSounds(directory); damnedImages = new DamnedImages(directory, damnedMaps, damnedObjects); }
public DamnedImages(string rootDirectory, DamnedMaps damnedStages, DamnedObjects damnedObjects) { directory = rootDirectory; this.damnedStages = damnedStages; this.damnedObjects = damnedObjects; SetGUIDirectory(); SetImages(); SetDamnedStagesXmlFile(); SetDamnedTerrorZipFile(); SetTerrorImagesDirectory(); }
// Too much work to write this. Probably a better way to do this. private void Package(DamnedNewStage newStage, string destination) { tempDirectory = DamnedFiles.CreateTempWorkshopDirectory(); CreateDirectories(); DirectoryInfo[] info = new DirectoryInfo(tempDirectory).GetDirectories("*", SearchOption.AllDirectories); string newStageNamePath = newStage.newStagePath; string newStageName = Path.GetFileName(newStageNamePath); string newSceneNamePath = newStage.newScenePath; string newSceneName = Path.GetFileName(newStage.newScenePath); string newLoadingImageNamePath = newStage.loadingImagePath; string newLoadingImageName = Path.GetFileName(newLoadingImageNamePath); string newLobbyButtonImagePath = newStage.lobbyImageButtonPath; string newLobbyButtnImageName = Path.GetFileName(newStage.lobbyImageButtonPath); string newLobbyButtonImageHighlightedPath = newStage.lobbyImageButtonHighlightedPath; string newLobbyButtonImageHighlightedName = Path.GetFileName(newStage.lobbyImageButtonHighlightedPath); string stageAndScenePath = GetPath(info, "Stages"); string guiPath = GetPath(info, "GUI"); string terrorImagesPath = GetPath(info, "TerrorImages"); string newZipArchiveName = Path.GetFileNameWithoutExtension(newStageName).Replace("_", " "); newZipArchiveName = String.Format("{0}.zip", newZipArchiveName); string newPath = Path.Combine(stageAndScenePath, newStageName); File.Copy(newStageNamePath, newPath); newPath = Path.Combine(stageAndScenePath, newSceneName); File.Copy(newSceneNamePath, newPath); newPath = Path.Combine(terrorImagesPath, newLoadingImageName); File.Copy(newLoadingImageNamePath, newPath); newPath = Path.Combine(guiPath, newLobbyButtnImageName); File.Copy(newLobbyButtonImagePath, newPath); newPath = Path.Combine(guiPath, newLobbyButtonImageHighlightedName); File.Copy(newLobbyButtonImageHighlightedPath, newPath); destination = Path.Combine(destination, newZipArchiveName); if (newStage.hasObjects) { CreateObjectsDirectory(); DamnedObjects damnedObjects = new DamnedObjects(tempDirectory); damnedObjects.CopyObjects(newStage.newObjectsPath.ToArray(), damnedObjects.objectsDirectory); } if (File.Exists(destination)) { string message = String.Format("Package \"{0}\" already exists at this location. Do you wish to overwrite it?", newZipArchiveName); DialogResult result = MessageBox.Show(message, "Package already exists", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { File.Delete(destination); } else { Directory.Delete(tempDirectory, true); return; } } ZipFile.CreateFromDirectory(tempDirectory, destination); Directory.Delete(tempDirectory, true); }