コード例 #1
0
        public static string ToDirectoryName(this RMCharImageFile.ImageTypes type, bool fullPath = true)
        {
            switch (type)
            {
            case RMCharImageFile.ImageTypes.Character:
                if (fullPath)
                {
                    return(DirectoryNames.ProjectFiles.Image.ROOT + "\\" + DirectoryNames.ProjectFiles.Image.CHARACTERS);
                }
                else
                {
                    return(DirectoryNames.ProjectFiles.Image.CHARACTERS);
                }

            case RMCharImageFile.ImageTypes.Enemy:
                if (fullPath)
                {
                    return(DirectoryNames.ProjectFiles.Image.ROOT + "\\" + DirectoryNames.ProjectFiles.Image.ENEMIES);
                }
                else
                {
                    return(DirectoryNames.ProjectFiles.Image.ENEMIES);
                }

            case RMCharImageFile.ImageTypes.Face:
                if (fullPath)
                {
                    return(DirectoryNames.ProjectFiles.Image.ROOT + "\\" + DirectoryNames.ProjectFiles.Image.FACES);
                }
                else
                {
                    return(DirectoryNames.ProjectFiles.Image.FACES);
                }

            case RMCharImageFile.ImageTypes.SV_Actor:
                if (fullPath)
                {
                    return(DirectoryNames.ProjectFiles.Image.ROOT + "\\" + DirectoryNames.ProjectFiles.Image.SV_ACTORS);
                }
                else
                {
                    return(DirectoryNames.ProjectFiles.Image.SV_ACTORS);
                }

            case RMCharImageFile.ImageTypes.SV_Enemy:
                if (fullPath)
                {
                    return(DirectoryNames.ProjectFiles.Image.ROOT + "\\" + DirectoryNames.ProjectFiles.Image.SV_ENEMIES);
                }
                else
                {
                    return(DirectoryNames.ProjectFiles.Image.SV_ENEMIES);
                }

            default:
                return(string.Empty);
            }
        }
コード例 #2
0
        public static RMCharImageFile.ImageTypes ParseString(this RMCharImageFile.ImageTypes type, string str)
        {
            switch (str)
            {
            case RMPConstants.CharacterImageType.CHARACTER:
                return(RMCharImageFile.ImageTypes.Character);

            case RMPConstants.CharacterImageType.ENEMY:
                return(RMCharImageFile.ImageTypes.Enemy);

            case RMPConstants.CharacterImageType.FACE:
                return(RMCharImageFile.ImageTypes.Face);

            case RMPConstants.CharacterImageType.SV_ACTOR:
                return(RMCharImageFile.ImageTypes.SV_Actor);

            case RMPConstants.CharacterImageType.SV_ENEMY:
                return(RMCharImageFile.ImageTypes.SV_Enemy);

            default:
                return(RMCharImageFile.ImageTypes.None);
            }
        }
コード例 #3
0
        public static string ToXMLString(this RMCharImageFile.ImageTypes type)
        {
            switch (type)
            {
            case RMCharImageFile.ImageTypes.Character:
                return(RMPConstants.CharacterImageType.CHARACTER);

            case RMCharImageFile.ImageTypes.Enemy:
                return(RMPConstants.CharacterImageType.ENEMY);

            case RMCharImageFile.ImageTypes.Face:
                return(RMPConstants.CharacterImageType.FACE);

            case RMCharImageFile.ImageTypes.SV_Actor:
                return(RMPConstants.CharacterImageType.SV_ACTOR);

            case RMCharImageFile.ImageTypes.SV_Enemy:
                return(RMPConstants.CharacterImageType.SV_ENEMY);

            default:
                return(string.Empty);
            }
        }
コード例 #4
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);
     }
 }