Beispiel #1
0
        public FormChunk Construct(string aId, UInt32 aSize, AByteArray aByteArray, FormChunkList aParent)
        {
            Type[]   lArgumentTypes = { typeof(string), typeof(UInt32), typeof(AByteArray), typeof(FormChunkList) };
            object[] lArguments     = { aId, aSize, aByteArray, aParent };

            Type lTypeChunk = typeof(FormUnknown);

            if (ChunkTypeDictionaryDictionary.ContainsKey(type) == true)
            {
                if (ChunkTypeDictionaryDictionary[type].ContainsKey(aId) == true)
                {
                    lTypeChunk = ChunkTypeDictionaryDictionary[type][aId];
                }
            }

            if (lTypeChunk == typeof(FormUnknown))
            {
                Logger.Debug("Unknown:" + type + "," + aId);
            }
            else
            {
                Logger.Debug("known:" + type + "," + aId);
            }

            return(( FormChunk )lTypeChunk.GetConstructor(lArgumentTypes).Invoke(lArguments));
        }
Beispiel #2
0
        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.Error("List is not exist.");
            }
            else if (listListDictionary[aType].Count > 1)
            {
                Logger.Error("List exist lather than 1.");
            }

            return(listListDictionary[aType][0]);
        }
Beispiel #3
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]);
        }
Beispiel #4
0
        public FormUnknown(string aId, UInt32 aSize, AByteArray aByteArray, FormChunkList aParent)
            : base(aId, aSize, aByteArray, aParent)
        {
            Logger.Debug("Unknown ID:" + aId + ", Size:" + aSize);

            if (position + Size <= aByteArray.Length)
            {
                dataArray = aByteArray.ReadBytes(( int )Size);
            }
        }
Beispiel #5
0
        protected FormChunk(string aId, UInt32 aSize, AByteArray aByteArray, FormChunkList aParent)
        {
            id     = aId;
            Size   = aSize;
            parent = aParent;

            if (aByteArray != null)
            {
                position = ( UInt32 )aByteArray.Position;
            }

            informationList = new List <string>();
        }
Beispiel #6
0
        protected FormChunkList(string aId, UInt32 aSize, AByteArray aByteArray, FormChunkList aParent)
            : base(aId, aSize, aByteArray, aParent)
        {
            chunkList          = new List <FormChunk>();
            listListDictionary = new Dictionary <string, List <FormChunkList> >();

            type = aByteArray.ReadString(4);

            try
            {
                while (aByteArray.Position < position + aSize)
                {
                    ReadChunk(aByteArray);
                }
            }
            catch (Exception aExpection)
            {
                Logger.Error("Expection at Form Read:" + aExpection.ToString());
            }

            aByteArray.SetPosition(( int )(position + aSize));
        }