예제 #1
0
파일: DZx.cs 프로젝트: pho/WindViewer
            public FileChunk(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, ZeldaArc ParentZA = null)
            {
                byte[] SrcData = FE.GetFileData();

                Tag = Helpers.ReadString(SrcData, SrcOffset, 4);
                Elements = Helpers.Read32(SrcData, SrcOffset + 4);
                Offset = Helpers.Read32(SrcData, SrcOffset + 8);

                Data = new object[Elements];

                TreeNode NewNode = Helpers.CreateTreeNode(Tag, this, string.Format("Offset: {0:X6}\n{1} elements", Offset, Elements));

                int ReadOffset = (int)Offset;
                for (int i = 0; i < Elements; i++)
                {
                    switch (Tag)
                    {
                        /* Typically in DZR */
                        case "ACTR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue;
                        case "TGOB": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue;
                        case "PLYR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange); continue;
                        case "PPNT":    /* Found in DmSpot0's Stage DZS for some reason... */
                        case "RPPN": Data[i] = new RPPN(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightSkyBlue); continue;
                        case "SHIP": Data[i] = new SHIP(FE, ref ReadOffset, NewNode, System.Drawing.Color.BlueViolet); continue;
                        case "TGDR":
                        case "DOOR":
                        case "Door": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.HotPink, ParentZA); continue;
                        case "LGTV": Data[i] = new LGTV(FE, ref ReadOffset, NewNode, System.Drawing.Color.DarkGray); continue;  /* ????? */

                        /* Typically in DZS */
                        case "MULT": Data[i] = new MULT(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightGray); continue;
                        case "TRES": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown); continue;
                        //case "EnvR": Data[i] = new EnvRChunk(FE, ref ReadOffset, NewNode, System.Drawing.Color.DarkSlateGray); continue;
                    }

                    switch (Tag.Substring(0, 3))
                    {
                        case "ACT": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); break;
                        case "PLY": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange); break;
                        case "SCO": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Yellow, ParentZA); break;
                        case "TRE": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown); break;
                        default: Data[i] = new Generic(FE, ref ReadOffset, NewNode); NewNode.Tag = Data[i]; break;
                    }
                }

                ParentNode.Nodes.Add(NewNode);

                SrcOffset += 12;
            }