private static void AddList(
            List <CustomClothesFileInfo> _list,
            string path,
            byte sex,
            bool preset,
            ref int idx)
        {
            string[] searchPattern = new string[1] {
                "*.png"
            };
            CoordinateCategoryKind coordinateCategoryKind = sex != (byte)0 ? CoordinateCategoryKind.Female : CoordinateCategoryKind.Male;

            if (preset)
            {
                coordinateCategoryKind |= CoordinateCategoryKind.Preset;
            }
            FolderAssist folderAssist = new FolderAssist();

            folderAssist.CreateFolderInfoEx(path, searchPattern, true);
            int fileCount = folderAssist.GetFileCount();

            for (int index = 0; index < fileCount; ++index)
            {
                ChaFileCoordinate chaFileCoordinate = new ChaFileCoordinate();
                if (!chaFileCoordinate.LoadFile(folderAssist.lstFile[index].FullPath))
                {
                    Debug.LogFormat("コーディネートファイル読込みエラー:Code {0}", new object[1]
                    {
                        (object)chaFileCoordinate.GetLastErrorCode()
                    });
                }
                else
                {
                    List <CustomClothesFileInfo> customClothesFileInfoList = _list;
                    CustomClothesFileInfo        customClothesFileInfo1    = new CustomClothesFileInfo();
                    CustomClothesFileInfo        customClothesFileInfo2    = customClothesFileInfo1;
                    int num1;
                    idx = (num1 = idx) + 1;
                    int num2 = num1;
                    customClothesFileInfo2.index    = num2;
                    customClothesFileInfo1.name     = chaFileCoordinate.coordinateName;
                    customClothesFileInfo1.FullPath = folderAssist.lstFile[index].FullPath;
                    customClothesFileInfo1.FileName = folderAssist.lstFile[index].FileName;
                    customClothesFileInfo1.time     = folderAssist.lstFile[index].time;
                    customClothesFileInfo1.cateKind = coordinateCategoryKind;
                    CustomClothesFileInfo customClothesFileInfo3 = customClothesFileInfo1;
                    customClothesFileInfoList.Add(customClothesFileInfo3);
                }
            }
        }
Ejemplo n.º 2
0
        private static void AddList(
            List <GameCoordinateFileInfo> list,
            List <string> coordList,
            string path,
            ref int idx)
        {
            List <string> toRelease = ListPool <string> .Get();

            if (!coordList.IsNullOrEmpty <string>())
            {
                foreach (string coord in coordList)
                {
                    if (!toRelease.Contains(coord))
                    {
                        toRelease.Add(coord);
                    }
                }
            }
            FolderAssist folderAssist = new FolderAssist();

            folderAssist.CreateFolderInfoEx(path, GameCoordinateFileInfoAssist._searchPatterns, true);
            int fileCount = folderAssist.GetFileCount();

            for (int index = 0; index < fileCount; ++index)
            {
                ChaFileCoordinate     chaFileCoordinate = new ChaFileCoordinate();
                FolderAssist.FileInfo fileInfo          = folderAssist.lstFile[index];
                if (!chaFileCoordinate.LoadFile(fileInfo.FullPath))
                {
                    Debug.Log((object)string.Format("衣装カードファイル読み込みエラー:Code {0}", (object)chaFileCoordinate.GetLastErrorCode()));
                }
                else if (!toRelease.Contains(Path.GetFileNameWithoutExtension(chaFileCoordinate.coordinateFileName)))
                {
                    List <GameCoordinateFileInfo> coordinateFileInfoList = list;
                    GameCoordinateFileInfo        coordinateFileInfo1    = new GameCoordinateFileInfo();
                    GameCoordinateFileInfo        coordinateFileInfo2    = coordinateFileInfo1;
                    int num1;
                    idx = (num1 = idx) + 1;
                    int num2 = num1;
                    coordinateFileInfo2.Index    = num2;
                    coordinateFileInfo1.FullPath = fileInfo.FullPath;
                    coordinateFileInfo1.FileName = fileInfo.FileName;
                    coordinateFileInfo1.Time     = fileInfo.time;
                    GameCoordinateFileInfo coordinateFileInfo3 = coordinateFileInfo1;
                    coordinateFileInfoList.Add(coordinateFileInfo3);
                }
            }
            ListPool <string> .Release(toRelease);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a ChaFileCoordinate instance from the selected coordinate in CharaMaker.
 /// </summary>
 public static ChaFileCoordinate GetSelectedCoordinate()
 {
     ChaCustom.CustomCoordinateFile    clothesFile = Singleton <ChaCustom.CustomCoordinateFile> .Instance;
     ChaCustom.CustomFileListCtrl      listCtrl    = Traverse.Create(clothesFile).Field("listCtrl").GetValue <ChaCustom.CustomFileListCtrl>();
     ChaCustom.CustomFileInfoComponent selected    = listCtrl.GetSelectTopItem();
     if (selected != null)
     {
         string            fullPath = selected.info.FullPath;
         ChaFileCoordinate tmp      = new ChaFileCoordinate();
         tmp.LoadFile(fullPath);
         return(tmp);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public static CardType LoadFile(string path, out byte[] saveData, out ChaFileControl result, out byte[] pngData)
        {
            if (Path.GetExtension(path) != Strings.CARD_EXTENSION)
            {
                goto UNKNOWN;
            }

            saveData = File.ReadAllBytes(path);

            ChaFileControl chara = new ChaFileControl();

            if (chara.LoadCharaFile(path))
            {
                result  = chara;
                pngData = chara.pngData;
                return(CardType.Character);
            }

            ChaFileCoordinate coord = new ChaFileCoordinate();

            if (coord.LoadFile(path))
            {
                KKABMXCoordToChara(coord, chara);
                KCOXCoordToChara(coord, chara);

                for (int i = 0; i < chara.coordinate.Length; i++)
                {
                    chara.coordinate[i] = coord;
                }

                result  = chara;
                pngData = PngFile.LoadPngBytes(path);
                return(CardType.Coordinate);
            }

UNKNOWN:
            saveData = null;
            result   = null;
            pngData  = null;
            return(CardType.Unknown);
        }
Ejemplo n.º 5
0
        private static void AddFileNameList(
            List <GameCoordinateFileInfo> list,
            List <string> fileNameList,
            string path,
            ref int idx)
        {
            if (fileNameList.IsNullOrEmpty <string>())
            {
                return;
            }
            int count = fileNameList.Count;

            for (int index = 0; index < count; ++index)
            {
                ChaFileCoordinate chaFileCoordinate = new ChaFileCoordinate();
                string            fileName          = fileNameList[index];
                string            path1             = string.Format("{0}{1}.png", (object)path, (object)fileName);
                if (!chaFileCoordinate.LoadFile(path1))
                {
                    Debug.Log((object)string.Format("衣装カードファイル読み込みエラー:Code {0}", (object)chaFileCoordinate.GetLastErrorCode()));
                }
                else
                {
                    List <GameCoordinateFileInfo> coordinateFileInfoList = list;
                    GameCoordinateFileInfo        coordinateFileInfo1    = new GameCoordinateFileInfo();
                    GameCoordinateFileInfo        coordinateFileInfo2    = coordinateFileInfo1;
                    int num1;
                    idx = (num1 = idx) + 1;
                    int num2 = num1;
                    coordinateFileInfo2.Index    = num2;
                    coordinateFileInfo1.FullPath = path1;
                    coordinateFileInfo1.FileName = fileName;
                    coordinateFileInfo1.Time     = File.GetLastWriteTime(path1);
                    GameCoordinateFileInfo coordinateFileInfo3 = coordinateFileInfo1;
                    coordinateFileInfoList.Add(coordinateFileInfo3);
                }
            }
        }