public static void ReadMenuItemDataFromNative(SceneEdit.SMenuItem mi, int menuDataBaseIndex, out string iconStr)
        {
            MenuDataBase menuDataBase = GameMain.Instance.MenuDataBase;

            menuDataBase.SetIndex(menuDataBaseIndex);
            mi.m_strMenuName           = menuDataBase.GetMenuName();
            mi.m_strInfo               = menuDataBase.GetItemInfoText();
            mi.m_mpn                   = (MPN)menuDataBase.GetCategoryMpn();
            mi.m_strCateName           = menuDataBase.GetCategoryMpnText();
            mi.m_eColorSetMPN          = (MPN)menuDataBase.GetColorSetMpn();
            mi.m_strMenuNameInColorSet = menuDataBase.GetMenuNameInColorSet();
            mi.m_pcMultiColorID        = (MaidParts.PARTS_COLOR)menuDataBase.GetMultiColorId();
            mi.m_boDelOnly             = menuDataBase.GetBoDelOnly();
            mi.m_fPriority             = menuDataBase.GetPriority();
            mi.m_bMan                  = menuDataBase.GetIsMan();
            mi.m_bOld                  = (menuDataBase.GetVersion() < 2000);
            iconStr = menuDataBase.GetIconS();

            if (Main.UseVanillaCache.Value)
            {
                MenuStub newStub = new MenuStub()
                {
                    Name         = mi.m_strMenuName,
                    Description  = mi.m_strInfo,
                    Category     = mi.m_mpn.ToString(),
                    ColorSetMPN  = mi.m_eColorSetMPN.ToString(),
                    ColorSetMenu = mi.m_strMenuNameInColorSet,
                    MultiColorID = mi.m_pcMultiColorID.ToString(),
                    DelMenu      = mi.m_boDelOnly,
                    Priority     = mi.m_fPriority,
                    ManMenu      = mi.m_bMan,
                    LegacyMenu   = mi.m_bOld,
                    Icon         = iconStr,
                    DateModified = File.GetLastWriteTimeUtc(BepInEx.Paths.GameRootPath + "\\GameData\\paths.dat")
                };

                MenuCache[mi.m_strMenuFileName] = newStub;
            }
        }
Ejemplo n.º 2
0
        public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, out string IconTex)
        {
            IconTex = null;

            if (f_strMenuFileName.IndexOf("mod_") == 0)
            {
                string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName);
                return(!string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName));
            }

            if (MenuCache.ContainsKey(f_strMenuFileName))
            {
                try
                {
                    MenuStub tempStub = MenuCache[f_strMenuFileName];
                    if (tempStub.DateModified == File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]))
                    {
                        if (tempStub.Name != null)
                        {
                            mi.m_strMenuName = tempStub.Name;
                        }

                        if (tempStub.Description != null)
                        {
                            mi.m_strInfo = tempStub.Description;
                        }

                        if (tempStub.Category != null)
                        {
                            mi.m_strCateName = tempStub.Category;
                            mi.m_mpn         = (MPN)Enum.Parse(typeof(MPN), tempStub.Category);
                        }
                        else
                        {
                            mi.m_mpn = MPN.null_mpn;
                        }

                        if (tempStub.ColorSetMPN != null)
                        {
                            mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), tempStub.ColorSetMPN);
                        }

                        if (tempStub.ColorSetMenu != null)
                        {
                            mi.m_strMenuNameInColorSet = tempStub.ColorSetMenu;
                        }

                        if (tempStub.MultiColorID == null)
                        {
                            mi.m_pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
                        }
                        else if (tempStub.MultiColorID != null)
                        {
                            mi.m_pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), tempStub.MultiColorID);
                        }

                        mi.m_boDelOnly = tempStub.DelMenu;

                        mi.m_fPriority = tempStub.Priority;

                        mi.m_bMan = tempStub.ManMenu;

                        IconTex = tempStub.Icon;

                        return(true);
                    }
                    else
                    {
                        Main.logger.LogWarning($"A cache entry was found outdated. This should be automatically fixed and the cache reloaded.");
                    }
                }
                catch (Exception ex)
                {
                    Main.logger.LogError(string.Concat(new string[]
                    {
                        $"Encountered an issue while trying to load menu {f_strMenuFileName} from cache. This should be automatically fixed and the cache reloaded.",
                        "\n\n",
                        ex.Message,
                        "\n",
                        ex.StackTrace
                    }));
                }
            }

            try
            {
                if (FilesToRead[f_strMenuFileName] == null)
                {
                    FilesToRead[f_strMenuFileName] = new MemoryStream(File.ReadAllBytes(FilesDictionary[f_strMenuFileName]));
                }
            }
            catch (Exception ex)
            {
                Main.logger.LogError(string.Concat(new string[]
                {
                    "The following menu file could not be read! (メニューファイルがが読み込めませんでした。): ",
                    f_strMenuFileName,
                    "\n\n",
                    ex.Message,
                    "\n",
                    ex.StackTrace
                }));

                return(false);
            }

            string text6 = string.Empty;
            string text7 = string.Empty;
            string path  = "";

            MenuStub cacheEntry = new MenuStub();

            try
            {
                cacheEntry.DateModified = File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]);

                BinaryReader binaryReader = new BinaryReader(FilesToRead[f_strMenuFileName], Encoding.UTF8);
                string       text         = binaryReader.ReadString();

                if (text != "CM3D2_MENU")
                {
                    Main.logger.LogError("ProcScriptBin (例外 : ヘッダーファイルが不正です。) The header indicates a file type that is not a menu file!" + text + " @ " + f_strMenuFileName);

                    return(false);
                }

                binaryReader.ReadInt32();
                path = binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadInt32();
                string text5 = null;

                while (true)
                {
                    int num4 = binaryReader.ReadByte();
                    text7 = text6;
                    text6 = string.Empty;
                    if (num4 == 0)
                    {
                        break;
                    }
                    for (int i = 0; i < num4; i++)
                    {
                        text6 = text6 + "\"" + binaryReader.ReadString() + "\" ";
                    }
                    if (!(text6 == string.Empty))
                    {
                        string   stringCom  = UTY.GetStringCom(text6);
                        string[] stringList = UTY.GetStringList(text6);
                        if (stringCom == "name")
                        {
                            if (stringList.Length > 1)
                            {
                                string text8 = stringList[1];
                                string text9 = string.Empty;
                                string arg   = string.Empty;
                                int    j     = 0;
                                while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ')
                                {
                                    text9 += text8[j];
                                    j++;
                                }
                                while (j < text8.Length)
                                {
                                    arg += text8[j];
                                    j++;
                                }
                                mi.m_strMenuName = text9;
                                cacheEntry.Name  = mi.m_strMenuName;
                            }
                            else
                            {
                                Main.logger.LogWarning("Menu file has no name and an empty description will be used instead." + " @ " + f_strMenuFileName);

                                mi.m_strMenuName = "";
                                cacheEntry.Name  = mi.m_strMenuName;
                            }
                        }
                        else if (stringCom == "setumei")
                        {
                            if (stringList.Length > 1)
                            {
                                mi.m_strInfo           = stringList[1];
                                mi.m_strInfo           = mi.m_strInfo.Replace("《改行》", "\n");
                                cacheEntry.Description = mi.m_strInfo;
                            }
                            else
                            {
                                Main.logger.LogWarning("Menu file has no description (setumei) and an empty description will be used instead." + " @ " + f_strMenuFileName);

                                mi.m_strInfo           = "";
                                cacheEntry.Description = mi.m_strInfo;
                            }
                        }
                        else if (stringCom == "category")
                        {
                            if (stringList.Length > 1)
                            {
                                string strCateName = stringList[1].ToLower();
                                mi.m_strCateName    = strCateName;
                                cacheEntry.Category = mi.m_strCateName;
                                try
                                {
                                    mi.m_mpn            = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName);
                                    cacheEntry.Category = mi.m_mpn.ToString();
                                }
                                catch
                                {
                                    Main.logger.LogWarning("There is no category called (カテゴリがありません。): " + mi.m_strCateName + " @ " + f_strMenuFileName);
                                    return(false);
                                }
                            }
                            else
                            {
                                Main.logger.LogWarning("The following menu file has a category parent with no category: " + f_strMenuFileName);
                                return(false);
                            }
                        }
                        else if (stringCom == "color_set")
                        {
                            if (stringList.Length > 1)
                            {
                                try
                                {
                                    mi.m_eColorSetMPN      = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower());
                                    cacheEntry.ColorSetMPN = mi.m_eColorSetMPN.ToString();
                                }
                                catch
                                {
                                    Main.logger.LogWarning("There is no category called(カテゴリがありません。): " + mi.m_strCateName + " @ " + f_strMenuFileName);

                                    return(false);
                                }
                                if (stringList.Length >= 3)
                                {
                                    mi.m_strMenuNameInColorSet = stringList[2].ToLower();
                                    cacheEntry.ColorSetMenu    = mi.m_strMenuNameInColorSet;
                                }
                            }
                            else
                            {
                                Main.logger.LogWarning("A color_set entry exists but is otherwise empty" + " @ " + f_strMenuFileName);
                            }
                        }
                        else if (stringCom == "tex" || stringCom == "テクスチャ変更")
                        {
                            MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
                            if (stringList.Length == 6)
                            {
                                string text10 = stringList[5];
                                try
                                {
                                    pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper());
                                }
                                catch
                                {
                                    Main.logger.LogError("無限色IDがありません。(The following free color ID does not exist: )" + text10 + " @ " + f_strMenuFileName);

                                    return(false);
                                }
                                mi.m_pcMultiColorID     = pcMultiColorID;
                                cacheEntry.MultiColorID = mi.m_pcMultiColorID.ToString();
                            }
                        }
                        else if (stringCom == "icon" || stringCom == "icons")
                        {
                            if (stringList.Length > 1)
                            {
                                text5 = stringList[1];
                            }
                            else
                            {
                                Main.logger.LogError("The following menu file has an icon entry but no field set: " + f_strMenuFileName);

                                return(false);
                            }
                        }
                        else if (stringCom == "saveitem")
                        {
                            if (stringList.Length > 1)
                            {
                                string text11 = stringList[1];
                                if (String.IsNullOrEmpty(text11))
                                {
                                    Main.logger.LogWarning("SaveItem is either null or empty." + " @ " + f_strMenuFileName);
                                }
                            }
                            else
                            {
                                Main.logger.LogWarning("A saveitem entry exists with nothing set in the field @ " + f_strMenuFileName);
                            }
                        }
                        else if (stringCom == "unsetitem")
                        {
                            mi.m_boDelOnly     = true;
                            cacheEntry.DelMenu = mi.m_boDelOnly;
                        }
                        else if (stringCom == "priority")
                        {
                            if (stringList.Length > 1)
                            {
                                mi.m_fPriority      = float.Parse(stringList[1]);
                                cacheEntry.Priority = mi.m_fPriority;
                            }
                            else
                            {
                                Main.logger.LogError("The following menu file has a priority entry but no field set. A default value of 10000 will be used: " + f_strMenuFileName);

                                mi.m_fPriority      = 10000f;
                                cacheEntry.Priority = mi.m_fPriority;
                            }
                        }
                        else if (stringCom == "メニューフォルダ")
                        {
                            if (stringList.Length > 1)
                            {
                                if (stringList[1].ToLower() == "man")
                                {
                                    mi.m_bMan          = true;
                                    cacheEntry.ManMenu = mi.m_bMan;
                                }
                            }
                            else
                            {
                                Main.logger.LogError("A a menu with a menu folder setting (メニューフォルダ) has an entry but no field set: " + f_strMenuFileName);

                                return(false);
                            }
                        }
                    }
                }

                if (!String.IsNullOrEmpty(text5))
                {
                    try
                    {
                        IconTex         = text5;
                        cacheEntry.Icon = text5;
                        //mi.m_texIcon = ImportCM.CreateTexture(text5);
                    }
                    catch (Exception)
                    {
                        Main.logger.LogError("Error setting some icon tex from a normal mod." + " @ " + f_strMenuFileName);

                        return(false);
                    }
                }
                binaryReader.Close();
            }
            catch (Exception ex2)
            {
                Main.logger.LogError(string.Concat(new string[]
                {
                    "Exception when reading: ",
                    f_strMenuFileName,
                    "\nThe line currently being processed, likely the issue (現在処理中だった行): ",
                    text6,
                    "\nPrevious line (以前の行): ",
                    text7,
                    "\n\n",
                    ex2.Message,
                    "\n",
                    ex2.StackTrace
                }));

                return(false);
            }
            MenuCache[f_strMenuFileName] = cacheEntry;
            return(true);
        }
        public static IEnumerator VanillaMenuLoadStart(List <SceneEdit.SMenuItem> menuList, Dictionary <int, List <int> > menuGroupMemberDic)
        {
            Dictionary <SceneEdit.SMenuItem, int>    filesToLoadFromDatabase = new Dictionary <SceneEdit.SMenuItem, int>();
            Dictionary <SceneEdit.SMenuItem, string> filesToLoad             = new Dictionary <SceneEdit.SMenuItem, string>();

            //We wait until the manager is not busy because starting work while the manager is busy causes egregious bugs.
            while (GameMain.Instance.CharacterMgr.IsBusy())
            {
                yield return(null);
            }

            MenuDataBase menuDataBase = GameMain.Instance.MenuDataBase;

            Stopwatch waitOnKiss = new Stopwatch();

            waitOnKiss.Start();

            while (!menuDataBase.JobFinished())
            {
                yield return(null);
            }

            waitOnKiss.Stop();

            int fileCount = menuDataBase.GetDataSize();

            //This entire for loop is what loads in normal game menus. It's been left relatively untouched.
            for (int i = 0; i < fileCount; i++)
            {
                menuDataBase.SetIndex(i);
                string fileName = menuDataBase.GetMenuFileName();

                if (GameMain.Instance.CharacterMgr.status.IsHavePartsItem(fileName))
                {
                    SceneEdit.SMenuItem mi = new SceneEdit.SMenuItem
                    {
                        m_strMenuFileName = fileName,
                        m_nMenuFileRID    = fileName.GetHashCode()
                    };

                    filesToLoadFromDatabase[mi] = i;
                }
            }

            while (CacheLoadDone != true && Main.UseVanillaCache.Value)
            {
                yield return(null);
            }

            foreach (SceneEdit.SMenuItem mi in filesToLoadFromDatabase.Keys)
            {
                try
                {
                    string iconFileName = null;

                    if (MenuCache.ContainsKey(mi.m_strMenuFileName) && Main.UseVanillaCache.Value)
                    {
                        MenuStub tempStub = MenuCache[mi.m_strMenuFileName];

                        if (tempStub.DateModified == File.GetLastWriteTimeUtc(BepInEx.Paths.GameRootPath + "\\GameData\\paths.dat"))
                        {
                            mi.m_strMenuName           = tempStub.Name;
                            mi.m_strInfo               = tempStub.Description;
                            mi.m_mpn                   = (MPN)Enum.Parse(typeof(MPN), tempStub.Category);
                            mi.m_strCateName           = tempStub.Category;
                            mi.m_eColorSetMPN          = (MPN)Enum.Parse(typeof(MPN), tempStub.ColorSetMPN);
                            mi.m_strMenuNameInColorSet = tempStub.ColorSetMenu;
                            mi.m_pcMultiColorID        = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), tempStub.MultiColorID);
                            mi.m_boDelOnly             = tempStub.DelMenu;
                            mi.m_fPriority             = tempStub.Priority;
                            mi.m_bMan                  = tempStub.ManMenu;
                            mi.m_bOld                  = tempStub.LegacyMenu;

                            iconFileName = tempStub.Icon;
                        }
                        else
                        {
                            Debug.LogWarning("GameData folder was changed! We'll be wiping the vanilla cache clean and rebuilding it now.");
                            MenuCache = new Dictionary <string, MenuStub>();
                        }
                    }

                    if (string.IsNullOrEmpty(mi.m_strMenuName))
                    {
                        //Debug.Log($"Loading {mi.m_strMenuFileName} from the database as it wasn't in cache...");
                        VanillaMenuLoad.ReadMenuItemDataFromNative(mi, filesToLoadFromDatabase[mi], out iconFileName);
                    }

                    filesToLoad[mi] = null;

                    if (!string.IsNullOrEmpty(iconFileName) && GameUty.FileSystem.IsExistentFile(iconFileName))
                    {
                        if (SceneEdit.Instance != null)
                        {
                            SceneEdit.Instance.editItemTextureCache.PreLoadRegister(mi.m_nMenuFileRID, iconFileName);
                        }
                        else
                        {
                            mi.m_texIcon = ImportCM.CreateTexture(iconFileName);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError(string.Concat(new string[]
                    {
                        "ReadMenuItemDataFromNative 例外/",
                        mi.m_strMenuFileName,
                        "/",
                        ex.Message,
                        " StackTrace/",
                        ex.StackTrace
                    }));
                }
            }

            while (GSModMenuLoad.DictionaryBuilt == false)
            {
                yield return(null);
            }

            foreach (SceneEdit.SMenuItem mi in filesToLoad.Keys)
            {
                if (!mi.m_bMan && !GSModMenuLoad.FilesDictionary.ContainsKey(mi.m_strMenuFileName) && [email protected](mi.m_nMenuFileRID))
                {
                    AccessTools.Method(typeof(SceneEdit), "AddMenuItemToList").Invoke(Main.@this, new object[] { mi });

                    menuList.Add(mi);

                    [email protected]_menuRidDic[mi.m_nMenuFileRID] = mi;
                    string parentMenuName = AccessTools.Method(typeof(SceneEdit), "GetParentMenuFileName").Invoke(Main.@this, new object[] { mi }) as string;

                    if (!string.IsNullOrEmpty(parentMenuName))
                    {
                        int hashCode = parentMenuName.GetHashCode();
                        if (!menuGroupMemberDic.ContainsKey(hashCode))
                        {
                            menuGroupMemberDic.Add(hashCode, new List <int>());
                        }
                        menuGroupMemberDic[hashCode].Add(mi.m_strMenuFileName.ToLower().GetHashCode());
                    }
                    else if (mi.m_strCateName.IndexOf("set_") != -1 && mi.m_strMenuFileName.IndexOf("_del") == -1)
                    {
                        mi.m_bGroupLeader = true;
                        mi.m_listMember   = new List <SceneEdit.SMenuItem>
                        {
                            mi
                        };
                    }

                    if (0.5f < Time.realtimeSinceStartup - Main.time)
                    {
                        yield return(null);

                        Main.time = Time.realtimeSinceStartup;
                    }
                }
            }

            Main.ThreadsDone++;
            Debug.Log($"Vanilla menus finished loading at: {Main.WatchOverall.Elapsed}. We also spent {waitOnKiss.Elapsed} waiting for an unmodified database to finish loading...");

            [email protected](SaveCache(filesToLoad));
        }
Ejemplo n.º 4
0
        public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, out string IconTex)
        {
            IconTex = null;

            if (f_strMenuFileName.IndexOf("mod_") == 0)
            {
                string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName);
                return(!string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName));
            }
            try
            {
                if (MenuCache.ContainsKey(f_strMenuFileName))
                {
                    MenuStub tempStub = MenuCache[f_strMenuFileName];
                    if (tempStub.DateModified == File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]))
                    {
                        if (tempStub.Name != null)
                        {
                            mi.m_strMenuName = tempStub.Name;
                        }

                        if (tempStub.Description != null)
                        {
                            mi.m_strInfo = tempStub.Description;
                        }

                        if (tempStub.Category != null)
                        {
                            mi.m_strCateName = tempStub.Category;
                            mi.m_mpn         = (MPN)Enum.Parse(typeof(MPN), tempStub.Category);
                        }
                        else
                        {
                            mi.m_mpn = MPN.null_mpn;
                        }

                        if (tempStub.ColorSetMPN != null)
                        {
                            mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), tempStub.ColorSetMPN);
                        }

                        if (tempStub.ColorSetMenu != null)
                        {
                            mi.m_strMenuNameInColorSet = tempStub.ColorSetMenu;
                        }

                        if (tempStub.MultiColorID == "null")
                        {
                            mi.m_pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
                        }
                        else if (tempStub.MultiColorID != null)
                        {
                            mi.m_pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), tempStub.MultiColorID);
                        }

                        mi.m_boDelOnly = tempStub.DelMenu;

                        mi.m_fPriority = tempStub.Priority;

                        mi.m_bMan = tempStub.ManMenu;

                        IconTex = tempStub.Icon;

                        return(true);
                    }
                    else
                    {
                        Debug.Log($"A cache entry was found outdated. This should be automatically fixed and the cache reloaded.");
                    }
                }

                if (FilesToRead[f_strMenuFileName] == null)
                {
                    FilesToRead[f_strMenuFileName] = new MemoryStream(File.ReadAllBytes(FilesDictionary[f_strMenuFileName]));
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(string.Concat(new string[]
                {
                    "メニューファイルがが読み込めませんでした。 : ",
                    f_strMenuFileName,
                    " : ",
                    ex.Message,
                    " : StackTrace :\n",
                    ex.StackTrace
                }));
                throw ex;
            }

            string text6 = string.Empty;
            string text7 = string.Empty;
            string path  = "";

            MenuStub cacheEntry = new MenuStub();

            try
            {
                cacheEntry.DateModified = File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]);

                BinaryReader binaryReader = new BinaryReader(FilesToRead[f_strMenuFileName], Encoding.UTF8);
                string       text         = binaryReader.ReadString();
                NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text);
                binaryReader.ReadInt32();
                path = binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadString();
                binaryReader.ReadInt32();
                string text5 = null;

                while (true)
                {
                    int num4 = binaryReader.ReadByte();
                    text7 = text6;
                    text6 = string.Empty;
                    if (num4 == 0)
                    {
                        break;
                    }
                    for (int i = 0; i < num4; i++)
                    {
                        text6 = text6 + "\"" + binaryReader.ReadString() + "\" ";
                    }
                    if (!(text6 == string.Empty))
                    {
                        string   stringCom  = UTY.GetStringCom(text6);
                        string[] stringList = UTY.GetStringList(text6);
                        if (stringCom == "name")
                        {
                            string text8 = stringList[1];
                            string text9 = string.Empty;
                            string arg   = string.Empty;
                            int    j     = 0;
                            while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ')
                            {
                                text9 += text8[j];
                                j++;
                            }
                            while (j < text8.Length)
                            {
                                arg += text8[j];
                                j++;
                            }
                            mi.m_strMenuName = text9;
                            cacheEntry.Name  = mi.m_strMenuName;
                        }
                        else if (stringCom == "setumei")
                        {
                            mi.m_strInfo           = stringList[1];
                            mi.m_strInfo           = mi.m_strInfo.Replace("《改行》", "\n");
                            cacheEntry.Description = mi.m_strInfo;
                        }
                        else if (stringCom == "category")
                        {
                            string strCateName = stringList[1].ToLower();
                            mi.m_strCateName    = strCateName;
                            cacheEntry.Category = mi.m_strCateName;
                            try
                            {
                                mi.m_mpn            = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName);
                                cacheEntry.Category = mi.m_mpn.ToString();
                            }
                            catch
                            {
                                Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName);
                                mi.m_mpn = MPN.null_mpn;
                            }
                        }
                        else if (stringCom == "color_set")
                        {
                            try
                            {
                                mi.m_eColorSetMPN      = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower());
                                cacheEntry.ColorSetMPN = mi.m_eColorSetMPN.ToString();
                            }
                            catch
                            {
                                Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName);
                            }
                            if (stringList.Length >= 3)
                            {
                                mi.m_strMenuNameInColorSet = stringList[2].ToLower();
                                cacheEntry.ColorSetMenu    = mi.m_strMenuNameInColorSet;
                            }
                        }
                        else if (stringCom == "tex" || stringCom == "テクスチャ変更")
                        {
                            MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
                            cacheEntry.MultiColorID = "null";
                            if (stringList.Length == 6)
                            {
                                string text10 = stringList[5];
                                try
                                {
                                    pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper());
                                }
                                catch
                                {
                                    NDebug.Assert("無限色IDがありません。" + text10, false);
                                }
                                mi.m_pcMultiColorID     = pcMultiColorID;
                                cacheEntry.MultiColorID = mi.m_pcMultiColorID.ToString();
                            }
                        }
                        else if (stringCom == "icon" || stringCom == "icons")
                        {
                            text5 = stringList[1];
                        }
                        else if (!(stringCom == "iconl"))
                        {
                            if (!(stringCom == "setstr"))
                            {
                                if (!(stringCom == "アイテムパラメータ"))
                                {
                                    if (stringCom == "saveitem")
                                    {
                                        string text11 = stringList[1];
                                        if (text11 == string.Empty)
                                        {
                                            Debug.LogError("err SaveItem \"" + text11);
                                        }
                                        if (text11 == null)
                                        {
                                            Debug.LogError("err SaveItem null=\"" + text11);
                                        }
                                    }
                                    else if (!(stringCom == "catno"))
                                    {
                                        if (stringCom == "unsetitem")
                                        {
                                            mi.m_boDelOnly     = true;
                                            cacheEntry.DelMenu = mi.m_boDelOnly;
                                        }
                                        else if (stringCom == "priority")
                                        {
                                            mi.m_fPriority      = float.Parse(stringList[1]);
                                            cacheEntry.Priority = mi.m_fPriority;
                                        }
                                        else if (stringCom == "メニューフォルダ" && stringList[1].ToLower() == "man")
                                        {
                                            mi.m_bMan          = true;
                                            cacheEntry.ManMenu = mi.m_bMan;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (text5 != null && text5 != string.Empty)
                {
                    try
                    {
                        IconTex         = text5;
                        cacheEntry.Icon = text5;
                        //mi.m_texIcon = ImportCM.CreateTexture(text5);
                    }
                    catch (Exception)
                    {
                        Debug.LogError("Error:");
                    }
                }
                binaryReader.Close();
            }
            catch (Exception ex2)
            {
                Debug.LogError(string.Concat(new string[]
                {
                    "Exception ",
                    Path.GetFileName(path),
                    " 現在処理中だった行 = ",
                    text6,
                    " 以前の行 = ",
                    text7,
                    "   ",
                    ex2.Message,
                    "StackTrace:\n",
                    ex2.StackTrace
                }));
                throw ex2;
            }
            MenuCache[f_strMenuFileName] = cacheEntry;
            return(true);
        }