private uint selflen; //子要素を除く長さ //constructor public mwgIffDir(byte[] data, uint offset) { uint i = offset; //id identifier = new mwgFourcc(data, i); if ((string)(identifier) != "DIR ") { throw new System.Exception("mwgIff データの読み取り中にエラーが発生しました。ディレクトリでない情報を誤ってディレクトリ'DIR 'として処理しようとしました。"); } i += 4; //name name = new mfString(data, i); i += this.name.Length; //made,lastmodified this.madetime = new mfTime(data, i); i += 5; this.lasttime = new mfTime(data, i); i += 5; //data annex = new mfString(data, i); i += this.annex.Length; //子要素の最後 uint imax = i + 4 + (uint)(new mwgDword(data, i)); if (imax > data.Length) { imax = (uint)data.Length; } i += 4; this.selflen = i; //◆以上 runover の可能性在り //子要素 while (i < imax) { switch ((string)(new mwgFourcc(data, i))) { case "DIR ": childs.Add(new mwgIffDir(data, i)); break; case "FILE": childs.Add(new mwgIffFile(data, i)); break; default: childs.Add(new mwgIffData(data, i)); break; } i += (uint)childs.Item(childs.Length - 1).Length; } }
//constructor public mwgIffData(byte[] data, uint offset) { long im = data.Length; identifier = (offset + 4 > im)?new mwgFourcc(" "):new mwgFourcc(data, offset); if (offset + 8 > im) { len1 = new mwgDword(0); data1 = new byte[0]; } else { len1 = new mwgDword(data, offset + 4); data1 = mwgIff.readByteData(data, offset + 8, (uint)len1); } }
//constructor public mwgIffFile(byte[] data, uint offset) { uint i = offset; //id identifier = new mwgFourcc(data, i); if ((string)(identifier) != "FILE") { throw new System.Exception("mwgIff データの読み取り中にエラーが発生しました。ファイルでない情報を誤ってファイル'FILE'として処理しようとしました。"); } i += 4; //name name = new mfString(data, i); i += this.name.Length; //made,lastmodified this.madetime = new mfTime(data, i); i += 5; this.lasttime = new mfTime(data, i); i += 5; //data this.content = new mfBytes(data, i); i += this.content.Length; //子要素の最後(postLen) uint imax = i + 4 + (uint)(new mwgDword(data, i)); if (imax > data.Length) { imax = (uint)data.Length; } i += 4; this.selflen = i; //◆以上 runover の可能性在り //子要素の登録 while (i < imax) { childs.Add(new mwgIffData(data, i)); i += childs.Item(childs.Length - 1).Length; } }