TreeNode AddFile(string path, RMMovieGroup movieGroup, bool pathCanBeTrimmed = false) { string ext = Path.GetExtension(path).ToLower(); RMMovieFile movieFile = new RMMovieFile(movieGroup); if (pathCanBeTrimmed) { movieFile.Path = Helper.GetRelativePath(path, RootDirectory); } else { movieFile.Path = path; //movieFile.NonRelativePath = true; } if (ext == RMPConstants.MovieFileType.DOT_MP4) { movieFile.TypeOfFile = RMMovieFile.FileType.mp4; } else if (ext == RMPConstants.MovieFileType.DOT_WEBM) { movieFile.TypeOfFile = RMMovieFile.FileType.webm; } else { throw new InvalidMovieFileException(ExceptionMessages.General.FileExtInvalid(path), InvalidMovieFileException.WhichInvalid.InvalidType, movieGroup); } TreeNode tNode = new TreeNode(); frmPackAssetTNodeTag tag = new frmPackAssetTNodeTag(tNode, movieFile, RootDirectory); tNode.Text = tag.ToString(); tNode.Tag = tag; if (movieGroup.Files == null) { movieGroup.Files = new List <RMMovieFile>(); } movieGroup.Files.Add(movieFile); return(tNode); }
public static RMMovieCollection RetrieveMovieCollection(string path, string rootPath, string _namespace, bool trimRootPath, out LogDataList log, RMPackage parent) { log = new LogDataList(); RMMovieCollection newCollection = new RMMovieCollection(parent); log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedAutoData(parent.Name, path, RMCollectionType.Movies), _namespace); string[] files = null; try { files = Directory.GetFiles(path); } catch (Exception ex) { log.WriteErrorLog(LoggerMessages.RMPackage.Error.RetrieveAutoError(path, parent.Name, RMCollectionType.Movies), _namespace, ex); return(null); } if (files == null || files.Length == 0) { return(null); } for (int i = 0; i < files.Length; ++i) { string originalFileName = Path.GetFileNameWithoutExtension(files[i]); string nonLoweredPath = files[i]; files[i] = files[i].ToLower(); string fileName = originalFileName.ToLower(); string fileExtension = Path.GetExtension(files[i]); if (fileExtension.Length < RMPConstants.MovieFileType.MP4.Length + 1) { continue; } fileExtension = fileExtension.Substring(1); RMMovieFile.FileType typeOfFile = RMMovieFile.FileType.none; typeOfFile = typeOfFile.ParseString(fileExtension); if (typeOfFile == RMMovieFile.FileType.none || string.IsNullOrWhiteSpace(originalFileName)) { continue; } RMMovieGroup rmv = newCollection.Groups.FindByInternalName(fileName); if (rmv == null) { rmv = new RMMovieGroup(newCollection); rmv.Name = originalFileName; rmv.internalName = fileName; newCollection.Groups.Add(rmv); } RMMovieFile rmf = new RMMovieFile(rmv); if (trimRootPath) { rmf.Path = Helper.GetRelativePath(nonLoweredPath, rootPath); } else { rmf.Path = nonLoweredPath; } rmf.TypeOfFile = typeOfFile; rmv.Files.Add(rmf); log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedFile(parent.Name, nonLoweredPath, RMCollectionType.Movies), _namespace); } if (newCollection.Groups.Count == 0) { return(null); } return(newCollection); }
void SaveFileInfo(TreeNode node) { string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName(); if (node.Tag == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } frmPackAssetTNodeTag tag = node.Tag as frmPackAssetTNodeTag; if (tag == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMAudioFile) { RMAudioFile audioFile = tag.Object as RMAudioFile; if (audioFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection objAndIntColl = comboFileType1.SelectedItem as ObjectAndIntCollection; audioFile.TypeOfFile = (RMAudioFile.FileType)objAndIntColl.IntegerCollection[0]; node.Text = tag.ToString(); changesMadeFile = false; return; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMCharImageFile) { RMCharImageFile charImageFile = tag.Object as RMCharImageFile; if (charImageFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection objAndIntColl = comboFileType1.SelectedItem as ObjectAndIntCollection; charImageFile.ImageType = (RMCharImageFile.ImageTypes)objAndIntColl.IntegerCollection[0]; node.Text = tag.ToString(); changesMadeFile = false; return; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMGenFile) { RMGenFile genFile = tag.Object as RMGenFile; if (genFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection objAndIntColl = comboFileType1.SelectedItem as ObjectAndIntCollection; genFile.FileType = (RMGenFile.GenFileType)objAndIntColl.IntegerCollection[0]; int highOrderParse = comboFileType2.Text.TryToInt(0); int lowOrderParse = comboFileType3.Text.TryToInt(0); int colourParse = comboFileType4.Text.TryToInt(0); if (highOrderParse == -1) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.HIGH_ORDER_INVALID, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (lowOrderParse == -1) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.LOW_ORDER_INVALID, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (colourParse == -1) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.COLOUR_INVALID, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } genFile.Order = lowOrderParse; genFile.Colour = colourParse; genFile.BaseOrder = highOrderParse; node.Text = tag.ToString(); changesMadeFile = false; return; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMMovieFile) { RMMovieFile movieFile = tag.Object as RMMovieFile; if (movieFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection objAndIntColl = comboFileType1.SelectedItem as ObjectAndIntCollection; movieFile.TypeOfFile = (RMMovieFile.FileType)objAndIntColl.IntegerCollection[0]; node.Text = tag.ToString(); changesMadeFile = false; return; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMTilesetFile) { RMTilesetFile tilesetFile = tag.Object as RMTilesetFile; if (tilesetFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection objAndIntColl = comboFileType1.SelectedItem as ObjectAndIntCollection; tilesetFile.FileType = (RMTilesetFile.eFileType)objAndIntColl.IntegerCollection[0]; objAndIntColl = comboFileType2.SelectedItem as ObjectAndIntCollection; tilesetFile.AtlasType = (RMTilesetFile.eAtlasType)objAndIntColl.IntegerCollection[0]; node.Text = tag.ToString(); changesMadeFile = false; return; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMSingleFile) { return; } Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.UNABLE_SAVE_FILE_INFO, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.UNABLE_SAVE_FILE_INFO_NULL_TAG, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; }
bool RemoveAsset(TreeNode tNode) { string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName(); frmPackAssetTNodeTag assetTag = tNode.Tag as frmPackAssetTNodeTag; if (assetTag == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_NULL, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMAudioFile) { RMAudioFile audioFile = assetTag.Object as RMAudioFile; if (audioFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (audioFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } audioFile.Parent.Files.Remove(audioFile); assetTag.AssociatedNode.Remove(); return(true); } else if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMCharImageFile) { RMCharImageFile charImageFile = assetTag.Object as RMCharImageFile; if (charImageFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (charImageFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } charImageFile.Parent.Files.Remove(charImageFile); assetTag.AssociatedNode.Remove(); return(true); } else if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMGenFile) { RMGenFile genFile = assetTag.Object as RMGenFile; if (genFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (genFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } genFile.Parent.Files.Remove(genFile); assetTag.AssociatedNode.Remove(); return(true); } else if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMMovieFile) { RMMovieFile movieFile = assetTag.Object as RMMovieFile; if (movieFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (movieFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } movieFile.Parent.Files.Remove(movieFile); assetTag.AssociatedNode.Remove(); return(true); } else if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMSingleFile) { RMSingleFile singleFile = assetTag.Object as RMSingleFile; if (singleFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (singleFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } singleFile.Parent.Files.Remove(singleFile); assetTag.AssociatedNode.Remove(); return(true); } else if (assetTag.TagObjectType == frmPackAssetTNodeTag.TagType.RMTilesetFile) { RMTilesetFile tilesetFile = assetTag.Object as RMTilesetFile; if (tilesetFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_TAG_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } if (tilesetFile.Parent == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_PARENT_NULL_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); } tilesetFile.Parent.Files.Remove(tilesetFile); assetTag.AssociatedNode.Remove(); return(true); } Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_ASSET_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_ASSET_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return(false); }
void LoadAssetInfo(frmPackAssetTNodeTag tag) { string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName(); bool groupTypeSet = false; bool genderSet = false; bool type1Set = false; bool type2Set = false; bool type3Set = false; bool type4Set = false; if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.AudioGroup || tag.TagObjectType == frmPackAssetTNodeTag.TagType.CharacterGroup || tag.TagObjectType == frmPackAssetTNodeTag.TagType.TilesetGroup || tag.TagObjectType == frmPackAssetTNodeTag.TagType.MovieGroup) { if (string.IsNullOrWhiteSpace(tag.Name)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_LOAD_NAME, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } txtGroupName.Text = tag.Name; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.Collection) { ObjectAndIntCollection obj = comboGroupType.Items.FindObjectAndIntItemWithInt(0, (int)tag.CollectionType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboGroupType.SelectedItem = obj; groupTypeSet = true; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.GeneratorPartGroup) { if (string.IsNullOrWhiteSpace(tag.Name)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_LOAD_NAME, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } txtGroupName.Text = tag.Name; RMGenPart genPart = tag.Object as RMGenPart; if (genPart == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboGroupType.Items.FindObjectAndIntItemWithInt(0, (int)genPart.PartType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboGroupType.SelectedItem = obj; groupTypeSet = true; obj = comboGroupGender.Items.FindObjectAndIntItemWithInt(0, (int)genPart.Gender); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboGroupGender.SelectedItem = obj; genderSet = true; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMAudioFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } RMAudioFile audioFile = tag.Object as RMAudioFile; if (audioFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboFileType1.Items.FindObjectAndIntItemWithInt(0, (int)audioFile.TypeOfFile); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType1.SelectedItem = obj; type1Set = true; //Be wary of this. Set this to false if error occurs. } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMCharImageFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } RMCharImageFile charImageFile = tag.Object as RMCharImageFile; if (charImageFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboFileType1.Items.FindObjectAndIntItemWithInt(0, (int)charImageFile.ImageType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType1.SelectedItem = obj; type1Set = true; //Be wary of this. Set this to false if error occurs. } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMGenFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } RMGenFile genFile = tag.Object as RMGenFile; if (genFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboFileType1.Items.FindObjectAndIntItemWithInt(0, (int)genFile.FileType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType1.SelectedItem = obj; type1Set = true; //Be wary of this. Set this to false if error occurs. comboFileType2.Text = genFile.BaseOrder.ToString(); comboFileType3.Text = genFile.Order.ToString(); comboFileType4.Text = genFile.Colour.ToString(); type2Set = true; type3Set = true; type4Set = true; } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMMovieFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } RMMovieFile movieFile = tag.Object as RMMovieFile; if (movieFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboFileType1.Items.FindObjectAndIntItemWithInt(0, (int)movieFile.TypeOfFile); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType1.SelectedItem = obj; type1Set = true; //Be wary of this. Set this to false if error occurs. } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMSingleFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } } else if (tag.TagObjectType == frmPackAssetTNodeTag.TagType.RMTilesetFile) { if (string.IsNullOrWhiteSpace(tag.FullPath)) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_PATH_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } if (string.IsNullOrWhiteSpace(NonVisibleRootDir)) { FileToOpenPath = tag.FullPath; } else { FileToOpenPath = NonVisibleRootDir + "\\" + tag.FullPath; } if (File.Exists(FileToOpenPath)) { txtFilePath.Text = tag.FullPath; } else { btnFileOpen.Enabled = false; txtFilePath.Text = "(Missing!) " + tag.FullPath; } RMTilesetFile tilesetFile = tag.Object as RMTilesetFile; if (tilesetFile == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } ObjectAndIntCollection obj = comboFileType1.Items.FindObjectAndIntItemWithInt(0, (int)tilesetFile.FileType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType1.SelectedItem = obj; type1Set = true; //Be wary of this. Set this to false if error occurs. obj = comboFileType2.Items.FindObjectAndIntItemWithInt(0, (int)tilesetFile.AtlasType); if (obj == null) { Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.CORRUPTED_MAIN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.WriteErrorLog(LoggerMessages.GUI.frmPackageAssets.Error.FAILED_CORRUPTED_DATA, _namespace, null, BasicDebugLogger.DebugErrorType.Error); return; } comboFileType2.SelectedItem = obj; type2Set = true; } if (!groupTypeSet && comboGroupType.Items.Count > 0) { comboGroupType.SelectedIndex = 0; } if (!genderSet && comboGroupGender.Items.Count > 0) { comboGroupGender.SelectedIndex = 0; } if (!type1Set && comboFileType1.Items.Count > 0) { comboFileType1.SelectedIndex = 0; } if (!type2Set && comboFileType2.Items.Count > 0) { comboFileType2.SelectedIndex = 0; } if (!type3Set && comboFileType3.Items.Count > 0) { comboFileType3.SelectedIndex = 0; } if (!type4Set && comboFileType4.Items.Count > 0) { comboFileType4.SelectedIndex = 0; } }