示例#1
0
        // Token: 0x06000110 RID: 272 RVA: 0x0000B9B8 File Offset: 0x00009BB8
        private static void WriteMenuFile(BinaryReader reader, string header, string filepath, ACCMenu menu)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
                {
                    using (BinaryWriter binaryWriter2 = new BinaryWriter(File.OpenWrite(filepath)))
                    {
                        binaryWriter2.Write(header);
                        binaryWriter2.Write(reader.ReadInt32());
                        reader.ReadString();
                        string text = menu.txtpath;
                        if (!text.EndsWith(FileConst.EXT_TXT, StringComparison.OrdinalIgnoreCase))
                        {
                            text += FileConst.EXT_TXT;
                        }
                        binaryWriter2.Write(text);
                        reader.ReadString();
                        reader.ReadString();
                        reader.ReadString();
                        binaryWriter2.Write(menu.name);
                        binaryWriter2.Write(menu.category);
                        string text2 = menu.desc.Replace("\n", FileConst.RET);
                        binaryWriter2.Write(text2);
                        reader.ReadInt32();
                        bool flag = false;
                        for (;;)
                        {
                            int num = (int)reader.ReadByte();
                            if (num == 0)
                            {
                                break;
                            }
                            string   text3 = reader.ReadString();
                            string[] array = new string[num - 1];
                            for (int i = 0; i < num - 1; i++)
                            {
                                array[i] = reader.ReadString();
                            }
                            string key;
                            switch (key = text3)
                            {
                            case "priority":
                                array[0] = menu.priority;
                                flag     = true;
                                break;

                            case "name":
                                array[0] = menu.name;
                                break;

                            case "setumei":
                                array[0] = text2;
                                break;

                            case "icon":
                            case "icons":
                                array[0] = menu.EditIconFileName();
                                break;

                            case "additem":
                            {
                                string text4 = array[0];
                                array[0] = menu.itemFiles[text4].EditFileName();
                                LogUtil.Debug(new object[]
                                    {
                                        "modelfile replaces ",
                                        text4,
                                        "=>",
                                        array[0]
                                    });
                                break;
                            }

                            case "マテリアル変更":
                            {
                                string         slot     = array[0];
                                int            matNo    = int.Parse(array[1]);
                                TargetMaterial material = menu.GetMaterial(slot, matNo);
                                array[2] = material.EditFileName();
                                break;
                            }

                            case "リソース参照":
                                array[1] = menu.resFiles[array[1]].EditFileName();
                                break;

                            case "半脱ぎ":
                                array[0] = menu.resFiles[array[0]].EditFileName();
                                break;
                            }
                            binaryWriter.Write((byte)(array.Length + 1));
                            binaryWriter.Write(text3);
                            foreach (string value in array)
                            {
                                binaryWriter.Write(value);
                            }
                        }
                        binaryWriter.Write(0);
                        if (!flag)
                        {
                            binaryWriter.Write(2);
                            binaryWriter.Write("priority");
                            binaryWriter.Write(menu.priority);
                        }
                        binaryWriter2.Write((int)memoryStream.Length);
                        binaryWriter2.Write(memoryStream.ToArray());
                    }
                }
            }
        }
示例#2
0
 // Token: 0x0600015D RID: 349 RVA: 0x0000CE04 File Offset: 0x0000B004
 public Func <string, string[], string[]> ReplaceMenuFunc()
 {
     this.replaceFiles = new List <ReplacedInfo>();
     return(delegate(string key, string[] param)
     {
         if (key != null)
         {
             if (!(key == "additem"))
             {
                 if (!(key == "マテリアル変更"))
                 {
                     return param;
                 }
             }
             else
             {
                 if (param.Length < 2)
                 {
                     return param;
                 }
                 string text = param[1];
                 try
                 {
                     TBody.SlotID key2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), text, false);
                     Item item = this.menu.itemSlots[key2];
                     if (item.needUpdate)
                     {
                         string text2 = param[0];
                         string text3;
                         if (item.filename == text2)
                         {
                             item.worksuffix = null;
                             text3 = item.EditFileName();
                         }
                         else
                         {
                             item.worksuffix = this.suffix;
                             text3 = item.EditFileName();
                             this.replaceFiles.Add(new ReplacedInfo(text2, text3, this, item));
                         }
                         param[0] = text3;
                     }
                     return param;
                 }
                 catch (Exception ex)
                 {
                     LogUtil.Debug(new object[]
                     {
                         "failed to parse SlotID:",
                         text,
                         ex
                     });
                     return param;
                 }
             }
             string slot = param[0];
             int matNo = int.Parse(param[1]);
             string text4 = param[2];
             TargetMaterial material = this.menu.GetMaterial(slot, matNo);
             material.worksuffix = null;
             if (material.filename == text4)
             {
                 param[2] = material.EditFileName();
             }
             else if (material.shaderChanged || material.hasParamChanged || material.hasTexFileChanged || material.hasTexColorChanged)
             {
                 material.worksuffix = this.suffix;
                 string text5 = material.EditFileName();
                 param[2] = text5;
                 ReplacedInfo item2 = new ReplacedInfo(text4, text5, this, material);
                 this.replaceFiles.Add(item2);
             }
         }
         return param;
     });
 }
示例#3
0
        public Func <string, string[], string[]> ReplaceMenuFunc()
        {
            replaceFiles = new List <ReplacedInfo>();
            // menuファイル中のmodelとmateを更新する
            // それ以外はそのまま出力
            return((string key, string[] param) => {
                switch (key)
                {
                case "additem":
                    if (param.Length >= 2)
                    {
                        string slot0 = param[1];
                        try {
                            var slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), slot0, false);
                            Item item = menu.itemSlots[slot];

                            // 対応するスロットのアイテムが更新される場合にのみ出力
                            if (item.needUpdate)
                            {
                                var filename0 = param[0];
                                string editfile;
                                // 元のmodelファイルが同一であれば、すでに出力済みと見なす
                                if (item.filename == filename0)
                                {
                                    item.worksuffix = null;
                                    editfile = item.EditFileName();
                                }
                                else
                                {
                                    item.worksuffix = suffix;
                                    editfile = item.EditFileName();
                                    replaceFiles.Add(new ReplacedInfo(filename0, editfile, this, item));
                                }
                                param[0] = editfile;
                            }
                        } catch (Exception e) {
                            LogUtil.Debug("failed to parse SlotID:", slot0, e);
                            // LogUtil.DebugLog("failed to parse additem slot", slot0, e);
                        }
                    }
                    break;

                case "マテリアル変更":
                    string slotName = param[0];
                    int matNo = int.Parse(param[1]);
                    string filename1 = param[2];
                    TargetMaterial tm = menu.GetMaterial(slotName, matNo);
                    // 上位menuと同名ファイルであれば、出力済のファイル名を指定 (上位側が変更されていなければそのまま)
                    tm.worksuffix = null;
                    if (tm.filename == filename1)
                    {
                        param[2] = tm.EditFileName();
                    }
                    else
                    {
                        if (tm.shaderChanged || tm.hasParamChanged || tm.hasTexFileChanged || tm.hasTexColorChanged)
                        {
                            tm.worksuffix = suffix;
                            var editfile = tm.EditFileName();
                            param[2] = editfile;
                            var replaced = new ReplacedInfo(filename1, editfile, this, tm);
                            replaceFiles.Add(replaced);
                        }
                        // マテリアルの内容が変更されていない場合は変更しない
                    }
                    break;
                }
                return param;
            });
        }