static void ProcessRMCollectionInstall(RMCollection collection, string installPath, string sourcePath, string _namespace) { if (collection is RMAudioCollection) { Audio.InstallAudioCollection(installPath, sourcePath, collection as RMAudioCollection, _namespace); } else if (collection is RMDataCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Data, collection as RMSingleFileCollection, _namespace); } else if (collection is RMAnimationCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Animation, collection as RMSingleFileCollection, _namespace); } else if (collection is RMBattleBacks1_Collection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.BattleBacks_1, collection as RMSingleFileCollection, _namespace); } else if (collection is RMBattleBacks2_Collection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.BattleBacks_2, collection as RMSingleFileCollection, _namespace); } else if (collection is RMParallaxCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Parallax, collection as RMSingleFileCollection, _namespace); } else if (collection is RMPictureCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Pictures, collection as RMSingleFileCollection, _namespace); } else if (collection is RMSysImageCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.System, collection as RMSingleFileCollection, _namespace); } else if (collection is RMTitles1_Collection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Titles_1, collection as RMSingleFileCollection, _namespace); } else if (collection is RMTitles2_Collection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Titles_2, collection as RMSingleFileCollection, _namespace); } else if (collection is RMPluginsCollection) { SingleFile.InstallSingleFileCollection(installPath, sourcePath, RMSingleFileCollection.CollectionType.Plugins, collection as RMSingleFileCollection, _namespace); } else if (collection is RMCharImageCollection) { Characters.InstallCharacters(installPath, sourcePath, collection as RMCharImageCollection, _namespace); } else if (collection is RMTilesetCollection) { Tilesets.InstallTileset(installPath, sourcePath, collection as RMTilesetCollection, _namespace); } else if (collection is RMMovieCollection) { Movies.InstallMovie(installPath, sourcePath, collection as RMMovieCollection, _namespace); } }
public static RMCollectionType GetRMCollectionType(this RMCollection collection) { RMAudioCollection audioCollection = collection as RMAudioCollection; if (audioCollection != null) { return(audioCollection.CollectionType.ToRMCollectionType()); } if (collection is RMDataCollection) { return(RMCollectionType.Data); } if (collection is RMGeneratorCollection) { return(RMCollectionType.Generator); } if (collection is RMAnimationCollection) { return(RMCollectionType.Animation); } if (collection is RMBattleBacks1_Collection) { return(RMCollectionType.BattleBacks_1); } if (collection is RMBattleBacks2_Collection) { return(RMCollectionType.BattleBacks_2); } if (collection is RMCharImageCollection) { return(RMCollectionType.Characters); } if (collection is RMParallaxCollection) { return(RMCollectionType.Parallaxes); } if (collection is RMPictureCollection) { return(RMCollectionType.Pictures); } if (collection is RMSysImageCollection) { return(RMCollectionType.System_Image); } if (collection is RMTilesetCollection) { return(RMCollectionType.Tilesets); } if (collection is RMTitles1_Collection) { return(RMCollectionType.Titles1); } if (collection is RMTitles2_Collection) { return(RMCollectionType.Titles2); } if (collection is RMMovieCollection) { return(RMCollectionType.Movies); } if (collection is RMPluginsCollection) { return(RMCollectionType.Plugins); } return(RMCollectionType.None); }
public static void RetrievePackFromDir(string rootPath, string _namespace, bool trimRootPath, out LogDataList log, ref RMPackage package, bool skipGenParts = false) { log = new LogDataList(); rootPath = rootPath.ToLower(); string appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.GENERATOR; LogDataList outLog = null; if (!skipGenParts && Directory.Exists(appendedPath)) { RMCollection collectionToAdd = GeneratorProbe.RetrieveGeneratorCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.AUDIO; if (Directory.Exists(appendedPath)) { string newRootPath = appendedPath; appendedPath += "\\" + RMPConstants.LowCaseDirectoryNames.AUDIO_BGM; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = AudioProbe.RetrieveAudioCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMAudioCollection.AudioType.BGM, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.AUDIO_BGS; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = AudioProbe.RetrieveAudioCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMAudioCollection.AudioType.BGS, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.AUDIO_ME; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = AudioProbe.RetrieveAudioCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMAudioCollection.AudioType.ME, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.AUDIO_SE; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = AudioProbe.RetrieveAudioCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMAudioCollection.AudioType.SE, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } } appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.DATA; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Data, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = CharacterProbe.RetrieveCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); string newRootPath = appendedPath; appendedPath += "\\" + RMPConstants.LowCaseDirectoryNames.IMG_ANIM; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Animation, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_BATTLEBACKS_1; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.BattleBacks_1, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_BATTLEBACKS_2; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.BattleBacks_2, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_PARALLAXES; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Parallax, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_PICTURES; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Pictures, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_SYSTEM; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.System, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_TITLES_1; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Titles_1, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_TITLES_2; if (Directory.Exists(appendedPath)) { collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Titles_2, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = newRootPath + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_TILESETS; if (Directory.Exists(appendedPath)) { collectionToAdd = TilesetProbe.RetrieveTilesetCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } } appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.PLUGINS; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = SingleFileCollectionProbe.RetrieveSingleFileCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, RMSingleFileCollection.CollectionType.Plugins, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } appendedPath = rootPath + "\\" + RMPConstants.LowCaseDirectoryNames.MOVIES; if (Directory.Exists(appendedPath)) { RMCollection collectionToAdd = MovieProbe.RetrieveMovieCollection(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, package); if (collectionToAdd != null) { package.Collections.Add(collectionToAdd); } log.AppendLogs(outLog); } }
TreeNode AddAssetGroup(frmAddAssetGroup formShown) { string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName(); if (formShown.DialogResult == DialogResult.Cancel) { return(null); } if (string.IsNullOrWhiteSpace(formShown.TypeName)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_NO_NAME_GROUP_ASSET, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } frmPackAssetTNodeTag collectionTag = tViewAssets.Nodes.FindNodeOfCollectionType(formShown.TypeToAdd); if (collectionTag == null) { RMCollection rmc = null; try { rmc = formShown.TypeToAdd.ToNewCollection(PackageOfCollections); } catch (Exception ex) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_CREATE_COLLECTION, _namespace, ex, BasicDebugLogger.DebugErrorType.Error); return(null); } if (PackageOfCollections.Collections == null) { PackageOfCollections.Collections = new List <RMCollection>(); } PackageOfCollections.Collections.Add(rmc); collectionTag = AddCollectionToTView(tViewAssets, rmc, RootDirectory); } if (formShown.TypeToAdd == RMCollectionType.BGM || formShown.TypeToAdd == RMCollectionType.BGS || formShown.TypeToAdd == RMCollectionType.ME || formShown.TypeToAdd == RMCollectionType.SE) { RMAudioCollection collectionObj = collectionTag.Object as RMAudioCollection; if (collectionObj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_ADD_GROUP_INVALID_COLLECTION, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(null); } RMAudioGroup audioGroup = new RMAudioGroup(collectionObj); audioGroup.Name = formShown.TypeName; TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag newGroupTag = new frmPackAssetTNodeTag(tNode, audioGroup, RootDirectory); tNode.Text = newGroupTag.ToString(); tNode.Tag = newGroupTag; collectionTag.AssociatedNode.Nodes.Add(tNode); if (collectionObj.Groups == null) { collectionObj.Groups = new List <RMAudioGroup>(); } collectionObj.Groups.Add(audioGroup); if (!PackageOfCollections.Collections.Contains(collectionObj)) { PackageOfCollections.Collections.Add(collectionObj); } return(tNode); } else if (formShown.TypeToAdd == RMCollectionType.Characters) { RMCharImageCollection collectionObj = collectionTag.Object as RMCharImageCollection; if (collectionObj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_ADD_GROUP_INVALID_COLLECTION, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(null); } RMCharImageGroup charImageGroup = new RMCharImageGroup(collectionObj); charImageGroup.Name = formShown.TypeName; TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag newGroupTag = new frmPackAssetTNodeTag(tNode, charImageGroup, RootDirectory); tNode.Text = newGroupTag.ToString(); tNode.Tag = newGroupTag; collectionTag.AssociatedNode.Nodes.Add(tNode); if (collectionObj.Groups == null) { collectionObj.Groups = new List <RMCharImageGroup>(); } collectionObj.Groups.Add(charImageGroup); if (!PackageOfCollections.Collections.Contains(collectionObj)) { PackageOfCollections.Collections.Add(collectionObj); } return(tNode); } else if (formShown.TypeToAdd == RMCollectionType.Tilesets) { RMTilesetCollection collectionObj = collectionTag.Object as RMTilesetCollection; if (collectionObj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_ADD_GROUP_INVALID_COLLECTION, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(null); } RMTilesetGroup tilesetGroup = new RMTilesetGroup(collectionObj); tilesetGroup.Name = formShown.TypeName; TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag newGroupTag = new frmPackAssetTNodeTag(tNode, tilesetGroup, RootDirectory); tNode.Text = newGroupTag.ToString(); tNode.Tag = newGroupTag; collectionTag.AssociatedNode.Nodes.Add(tNode); if (collectionObj.Groups == null) { collectionObj.Groups = new List <RMTilesetGroup>(); } collectionObj.Groups.Add(tilesetGroup); if (!PackageOfCollections.Collections.Contains(collectionObj)) { PackageOfCollections.Collections.Add(collectionObj); } return(tNode); } else if (formShown.TypeToAdd == RMCollectionType.Movies) { RMMovieCollection collectionObj = collectionTag.Object as RMMovieCollection; if (collectionObj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_ADD_GROUP_INVALID_COLLECTION, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(null); } RMMovieGroup movieGroup = new RMMovieGroup(collectionObj); movieGroup.Name = formShown.TypeName; TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag newGroupTag = new frmPackAssetTNodeTag(tNode, movieGroup, RootDirectory); tNode.Text = newGroupTag.ToString(); tNode.Tag = newGroupTag; collectionTag.AssociatedNode.Nodes.Add(tNode); if (collectionObj.Groups == null) { collectionObj.Groups = new List <RMMovieGroup>(); } collectionObj.Groups.Add(movieGroup); if (!PackageOfCollections.Collections.Contains(collectionObj)) { PackageOfCollections.Collections.Add(collectionObj); } return(tNode); } else if (formShown.TypeToAdd == RMCollectionType.Generator) { RMGeneratorCollection collectionObj = collectionTag.Object as RMGeneratorCollection; if (collectionObj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.ADD_ASSET_GROUP_ERR_GENERAL, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_ADD_GROUP_INVALID_COLLECTION, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(null); } RMGenPart genGroup = new RMGenPart(collectionObj); genGroup.Name = formShown.TypeName; genGroup.PartType = formShown.GeneratorType; genGroup.Gender = formShown.GeneratorGender; TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag newGroupTag = new frmPackAssetTNodeTag(tNode, genGroup, RootDirectory); tNode.Text = newGroupTag.ToString(); tNode.Tag = newGroupTag; collectionTag.AssociatedNode.Nodes.Add(tNode); if (collectionObj.Parts == null) { collectionObj.Parts = new List <RMGenPart>(); } collectionObj.Parts.Add(genGroup); if (!PackageOfCollections.Collections.Contains(collectionObj)) { PackageOfCollections.Collections.Add(collectionObj); } return(tNode); } return(null); }