TreeNode AddFile(string path, RMTilesetGroup tilesetGroup, bool pathCanBeTrimmed = false)
        {
            string ext = Path.GetExtension(path).ToLower();

            RMTilesetFile tilesetFile = new RMTilesetFile(tilesetGroup);

            if (pathCanBeTrimmed)
            {
                tilesetFile.Path = Helper.GetRelativePath(path, RootDirectory);
            }
            else
            {
                tilesetFile.Path = path;
                //tilesetFile.NonRelativePath = true;
            }

            try
            {
                TilesetTypeAndName parsedFileName = new TilesetTypeAndName(Path.GetFileNameWithoutExtension(path));
                tilesetFile.AtlasType = parsedFileName.atlasType;
            }
            catch
            {
                tilesetFile.AtlasType = RMTilesetFile.eAtlasType.NotSpecified;
            }

            if (ext == RMPConstants.TilesetFileType.DOT_PNG)
            {
                tilesetFile.FileType = RMTilesetFile.eFileType.PNG;
            }
            else if (ext == RMPConstants.TilesetFileType.DOT_TEXT)
            {
                tilesetFile.FileType = RMTilesetFile.eFileType.Text;
            }
            else
            {
                throw new InvalidTilesetFileException(ExceptionMessages.General.FileExtInvalid(path), InvalidTilesetFileException.WhichInvalid.InvalidType, tilesetGroup);
            }
            TreeNode             tNode = new TreeNode();
            frmPackAssetTNodeTag tag   = new frmPackAssetTNodeTag(tNode, tilesetFile, RootDirectory);

            tNode.Text = tag.ToString();
            tNode.Tag  = tag;

            if (tilesetGroup.Files == null)
            {
                tilesetGroup.Files = new List <RMTilesetFile>();
            }
            tilesetGroup.Files.Add(tilesetFile);

            return(tNode);
        }
        public RMTilesetFile Clone(RMTilesetGroup parent)
        {
            RMTilesetFile clone = new RMTilesetFile(parent);

            clone.AtlasType          = AtlasType;
            clone.FileName           = FileName;
            clone.FileType           = FileType;
            clone.InstallationStatus = InstallationStatus;
            clone.InternalFileName   = InternalFileName;
            clone.Path  = Path;
            clone._path = _path;
            return(clone);
        }
            public static RMTilesetCollection RetrieveTilesetCollection(string path, string rootPath, string _namespace, bool trimRootPath, out LogDataList log, RMPackage parent)
            {
                log = new LogDataList();
                RMTilesetCollection newCollection = new RMTilesetCollection(parent);

                log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedAutoData(parent.Name, path, RMCollectionType.Tilesets), _namespace);
                string[] files = null;
                try
                {
                    files = Directory.GetFiles(path);
                }catch (Exception ex)
                {
                    log.WriteErrorLog(LoggerMessages.RMPackage.Error.RetrieveAutoError(path, parent.Name, RMCollectionType.Tilesets), _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 fileExtension = Path.GetExtension(files[i]);
                    if (fileExtension.Length < RMPConstants.TilesetFileType.PNG.Length + 1)
                    {
                        continue;
                    }
                    fileExtension = fileExtension.Substring(1);

                    RMTilesetFile.eFileType typeOfFile = RMTilesetFile.eFileType.None;
                    typeOfFile = typeOfFile.ParseString(fileExtension);


                    if (typeOfFile == RMTilesetFile.eFileType.None || string.IsNullOrWhiteSpace(originalFileName))
                    {
                        continue;
                    }

                    TilesetTypeAndName parsedFileName = new TilesetTypeAndName(originalFileName);


                    RMTilesetGroup tileset = newCollection.Groups.FindByInternalName(parsedFileName.internalName);
                    if (tileset == null)
                    {
                        tileset              = new RMTilesetGroup(newCollection);
                        tileset.Name         = parsedFileName.Name;
                        tileset.internalName = parsedFileName.internalName;
                        newCollection.Groups.Add(tileset);
                    }
                    RMTilesetFile tilefile = new RMTilesetFile(tileset);
                    if (trimRootPath)
                    {
                        tilefile.Path = Helper.GetRelativePath(nonLoweredPath, rootPath);
                    }
                    else
                    {
                        tilefile.Path = nonLoweredPath;
                    }
                    tilefile.FileType  = typeOfFile;
                    tilefile.AtlasType = parsedFileName.atlasType;
                    tileset.Files.Add(tilefile);
                    log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedFile(parent.Name, nonLoweredPath, RMCollectionType.Tilesets), _namespace);
                }
                if (newCollection.Groups.Count == 0)
                {
                    return(null);
                }

                return(newCollection);
            }
示例#4
0
        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);
        }
示例#6
0
        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;
            }
        }