static void CopyCharacterAssetsCollection(string toWhere, RMCharImageCollection imageCollection, string _namespace, string rootDir = null)
        {
            string imgDir = toWhere + "\\" + DirectoryNames.ProjectFiles.Image.ROOT;

            Helper.MakeDirIfNotExistCopy(imgDir, _namespace);
            if (imageCollection.Groups != null)
            {
                foreach (RMCharImageGroup charGroup in imageCollection.Groups)
                {
                    CopyCharacterAssetsGroup(toWhere, charGroup, _namespace, rootDir);
                }
            }
        }
예제 #2
0
            public static RMCharImageCollection RetrieveCharacterImages(string path, string rootPath, string _namespace, bool trimRootPath, out LogDataList log, RMPackage parent)
            {
                log = new LogDataList();
                RMCharImageCollection   newCollection    = new RMCharImageCollection(parent);
                List <RMCharImageGroup> ListOfCharacters = new List <RMCharImageGroup>();
                LogDataList             outLog           = null;

                string appendedPath = path + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_CHARACTERS;

                if (Directory.Exists(appendedPath))
                {
                    RetrieveSubCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, ref ListOfCharacters, RMCharImageFile.ImageTypes.Character, newCollection);
                    log.AppendLogs(outLog);
                }

                appendedPath = path + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_ENEMIES;
                if (Directory.Exists(appendedPath))
                {
                    RetrieveSubCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, ref ListOfCharacters, RMCharImageFile.ImageTypes.Enemy, newCollection);
                    log.AppendLogs(outLog);
                }

                appendedPath = path + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_FACES;
                if (Directory.Exists(appendedPath))
                {
                    RetrieveSubCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, ref ListOfCharacters, RMCharImageFile.ImageTypes.Face, newCollection);
                    log.AppendLogs(outLog);
                }


                appendedPath = path + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_SV_ACTORS;
                if (Directory.Exists(appendedPath))
                {
                    RetrieveSubCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, ref ListOfCharacters, RMCharImageFile.ImageTypes.SV_Actor, newCollection);
                    log.AppendLogs(outLog);
                }

                appendedPath = path + "\\" + RMPConstants.LowCaseDirectoryNames.IMG_SV_ENEMIES;
                if (Directory.Exists(appendedPath))
                {
                    RetrieveSubCharacterImages(appendedPath.ToLower(), rootPath, _namespace, trimRootPath, out outLog, ref ListOfCharacters, RMCharImageFile.ImageTypes.SV_Enemy, newCollection);
                    log.AppendLogs(outLog);
                }

                if (ListOfCharacters.Count == 0)
                {
                    return(null);
                }
                newCollection.Groups.AddRange(ListOfCharacters);
                return(newCollection);
            }
                public static void InstallCharacters(string toWhere, string fromRootDirectory, RMCharImageCollection imageCollection, string _namespace)
                {
                    string imgDir = toWhere + "\\" + DirectoryNames.ProjectFiles.Image.ROOT;

                    Helper.MakeDirIfNotExistInstall(imgDir, _namespace);
                    if (imageCollection.Groups != null)
                    {
                        foreach (RMCharImageGroup character in imageCollection.Groups)
                        {
                            InstallCharacterFile(toWhere, fromRootDirectory, character, _namespace);
                        }
                    }
                }
예제 #4
0
        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);
        }
예제 #5
0
        bool RemoveAssetGroup(TreeNode tNode)
        {
            string _namespace             = MethodBase.GetCurrentMethod().ToLogFormatFullName();
            frmPackAssetTNodeTag groupTag = tNode.Tag as frmPackAssetTNodeTag;

            if (groupTag == null)
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_TAG_NULL, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                return(false);
            }

            if (tNode.Parent == null)
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_PARENT_NULL, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                return(false);
            }

            frmPackAssetTNodeTag collTag = tNode.Parent.Tag as frmPackAssetTNodeTag;

            if (collTag == null)
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_PARENT_NULL, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                return(false);
            }

            if (collTag.TagObjectType != frmPackAssetTNodeTag.TagType.Collection)
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_PARENT_NULL, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                return(false);
            }


            if (groupTag.TagObjectType == frmPackAssetTNodeTag.TagType.AudioGroup)
            {
                if (collTag.CollectionType != RMCollectionType.BGM && collTag.CollectionType != RMCollectionType.BGS && collTag.CollectionType != RMCollectionType.SE && collTag.CollectionType != RMCollectionType.ME)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMAudioCollection audioCollection = collTag.Object as RMAudioCollection;
                if (audioCollection == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMAudioGroup audio = groupTag.Object as RMAudioGroup;
                if (audio == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                tNode.Remove();
                audioCollection.Groups.Remove(audio);
                if (audioCollection.Groups.Count == 0)
                {
                    audioCollection.Parent.Collections.Remove(audioCollection);
                }
                return(true);
            }
            else if (groupTag.TagObjectType == frmPackAssetTNodeTag.TagType.CharacterGroup)
            {
                if (collTag.CollectionType != RMCollectionType.Characters)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMCharImageCollection charCollection = collTag.Object as RMCharImageCollection;
                if (charCollection == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMCharImageGroup charGroup = groupTag.Object as RMCharImageGroup;
                if (charGroup == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                tNode.Remove();
                charCollection.Groups.Remove(charGroup);
                if (charCollection.Groups.Count == 0)
                {
                    charCollection.Parent.Collections.Remove(charCollection);
                }
                return(true);
            }
            else if (groupTag.TagObjectType == frmPackAssetTNodeTag.TagType.GeneratorPartGroup)
            {
                if (collTag.CollectionType != RMCollectionType.Generator)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMGeneratorCollection genCollection = collTag.Object as RMGeneratorCollection;
                if (genCollection == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMGenPart genGroup = groupTag.Object as RMGenPart;
                if (genGroup == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                tNode.Remove();
                genCollection.Parts.Remove(genGroup);
                if (genCollection.Parts.Count == 0)
                {
                    genCollection.Parent.Collections.Remove(genCollection);
                }
                return(true);
            }
            else if (groupTag.TagObjectType == frmPackAssetTNodeTag.TagType.MovieGroup)
            {
                if (collTag.CollectionType != RMCollectionType.Movies)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMMovieCollection movieCollection = collTag.Object as RMMovieCollection;
                if (movieCollection == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMMovieGroup movieGroup = groupTag.Object as RMMovieGroup;
                if (movieGroup == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                tNode.Remove();
                movieCollection.Groups.Remove(movieGroup);
                if (movieCollection.Groups.Count == 0)
                {
                    movieCollection.Parent.Collections.Remove(movieCollection);
                }
                return(true);
            }
            else if (groupTag.TagObjectType == frmPackAssetTNodeTag.TagType.TilesetGroup)
            {
                if (collTag.CollectionType != RMCollectionType.Tilesets)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMTilesetCollection tilesetCollection = collTag.Object as RMTilesetCollection;
                if (tilesetCollection == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID_PARENT, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                RMTilesetGroup tilesetGroup = groupTag.Object as RMTilesetGroup;
                if (tilesetGroup == null)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPackageAssets.DELETE_GROUP_ERR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPackageAssetsMessages.Error.UNABLE_REMOVE_GROUP_INVALID, _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                    return(false);
                }
                tNode.Remove();
                tilesetCollection.Groups.Remove(tilesetGroup);
                if (tilesetCollection.Groups.Count == 0)
                {
                    tilesetCollection.Parent.Collections.Remove(tilesetCollection);
                }
                return(true);
            }

            return(false);
        }
예제 #6
0
 public static void RetrieveSubCharacterImages(string path, string rootPath, string _namespace, bool trimRootPath, out LogDataList log, ref List <RMCharImageGroup> collection, RMCharImageFile.ImageTypes imageType, RMCharImageCollection parent)
 {
     log = new LogDataList();
     log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedAutoData(parent.Parent.Name, path, RMCollectionType.Characters), _namespace);
     string[] files = null;
     try
     {
         files = Directory.GetFiles(path, "*" + RMPConstants.GenFileNamePrefixANDSuffix.PNG);
     }
     catch (Exception ex)
     {
         log.WriteErrorLog(LoggerMessages.RMPackage.Error.RetrieveAutoError(path, parent.Parent.Name, RMCollectionType.Characters), _namespace, ex);
         return;
     }
     if (files == null || files.Length == 0)
     {
         return;
     }
     for (int i = 0; i < files.Length; ++i)
     {
         string realFileName = Path.GetFileNameWithoutExtension(files[i]);
         if (string.IsNullOrWhiteSpace(realFileName))
         {
             continue;
         }
         string nonLoweredPath = files[i];
         files[i] = files[i].ToLower();
         string           fileName = realFileName.ToLower();
         string           rootFileName;
         bool             atlas = IsAnAtlasPartFile(realFileName, out rootFileName);
         RMCharImageGroup parentNode;
         parentNode = collection.FindByInternalName((atlas) ? rootFileName.ToLower() : fileName);
         if (parentNode == null)
         {
             parentNode = new RMCharImageGroup(parent);
             parentNode.internalName = (atlas) ? rootFileName.ToLower() : fileName;
             parentNode.Name         = (atlas) ? rootFileName : realFileName;
             collection.Add(parentNode);
         }
         RMCharImageFile newFile = new RMCharImageFile(parentNode);
         newFile.FileName  = realFileName;
         newFile.ImageType = imageType;
         if (trimRootPath)
         {
             newFile.Path = Helper.GetRelativePath(nonLoweredPath, rootPath);
         }
         else
         {
             newFile.Path = nonLoweredPath;
         }
         parentNode.Files.Add(newFile);
         log.WriteInformationLog(LoggerMessages.RMPackage.Info.RetrievedFile(parent.Parent.Name, nonLoweredPath, RMCollectionType.Characters), _namespace);
     }
 }
예제 #7
0
 public InvalidCharacterImageNodeException(string message, WhichInvalid whichInvalid, RMCharImageCollection parent) : base(message)
 {
     TypeOfIssue = whichInvalid;
     Parent      = parent;
 }