public FormChunk Construct(string aId, UInt32 aSize, ByteArray aByteArray, FormChunkList aParent) { Type[] lArgumentTypes = { typeof(string), typeof(UInt32), typeof(ByteArray), typeof(FormChunkList) }; object[] lArguments = { aId, aSize, aByteArray, aParent }; Type lTypeChunk = typeof(FormChunkUnknown); if (aId == "FORM" || aId == "LIST") { type = aByteArray.ReadString(4); if (listTypeDictionary.ContainsKey(type) == true) { lTypeChunk = listTypeDictionary[type]; } else { Logger.LogError("Unknown:" + type); } } else { if (chunkTypeDictionary.ContainsKey(aId) == true) { lTypeChunk = chunkTypeDictionary[aId]; } } return(( FormChunk )lTypeChunk.GetConstructor(lArgumentTypes).Invoke(lArguments)); }
protected FormChunkList GetChunkList(string aId, string aType) { if (listListDictionary.ContainsKey(aType) == true) { return(listListDictionary[aType][0]); } List <FormChunkList> lListList = new List <FormChunkList>(); for (int i = 0; i < chunkList.Count; i++) { if (chunkList[i].id == aId) { FormChunkList lRiffList = ( FormChunkList )chunkList[i]; if (lRiffList.type == aType) { lListList.Add(( FormChunkList )chunkList[i]); } } } listListDictionary.Add(aType, lListList); if (listListDictionary[aType].Count < 1) { Logger.LogErrorBreak("List is not exist."); } else if (listListDictionary[aType].Count > 1) { Logger.LogErrorBreak("List exist lather than 1."); } return(listListDictionary[aType][0]); }
protected List <FormChunkList> GetChunkListList(string aId, string aType) { if (listListDictionary.ContainsKey(aType) == true) { return(listListDictionary[aType]); } List <FormChunkList> lListList = new List <FormChunkList>(); for (int i = 0; i < chunkList.Count; i++) { if (chunkList[i].id == aId) { FormChunkList lRiffList = ( FormChunkList )chunkList[i]; if (lRiffList.type == aType) { lListList.Add(( FormChunkList )chunkList[i]); } } } listListDictionary.Add(aType, lListList); return(listListDictionary[aType]); }
public FormChunkUnknown(string aId, UInt32 aSize, ByteArray aByteArray, FormChunkList aParent) : base(aId, aSize, aByteArray, aParent) { Logger.LogWarning("Unknown Type"); if (position + size < aByteArray.Length) { dataArray = aByteArray.ReadBytes(( int )size); } }
protected FormChunk(string aId, UInt32 aSize, ByteArray aByteArray, FormChunkList aParent) { id = aId; size = aSize; parent = aParent; if (aByteArray != null) { position = ( UInt32 )aByteArray.Position; } informationList = new List <string>(); }
protected FormChunkList(Dictionary <string, Type> aChunkTypeDictionary, Dictionary <string, Type> aBodyTypeDictionary, string aId, UInt32 aSize, ByteArray aByteArray, FormChunkList aParent) : base(aId, aSize, aByteArray, aParent) { chunkTypeDictionary = aChunkTypeDictionary; listTypeDictionary = aBodyTypeDictionary; chunkList = new List <FormChunk>(); listListDictionary = new Dictionary <string, List <FormChunkList> >(); int lStartPosition = aByteArray.Position; try { while (aByteArray.Position < lStartPosition + aSize - 4) { ReadChunk(aByteArray); } } catch (Exception aExpection) { Logger.LogError("Expection at RIFF Read:" + aExpection.ToString()); } aByteArray.SetPosition(lStartPosition + ( int )aSize - 4); }
public FormFile(ByteArray aByteArray) : base(chunkTypeDictionary, bodyTypeDictionary, ID, ( UInt32 )aByteArray.Length, aByteArray, null) { name = aByteArray.GetName(); formChunkList = ( FormChunkList )GetChunk("FORM"); }