Beispiel #1
0
            /// <summary>
            /// Loads the IMD5 Header of a stream.
            /// </summary>
            /// <param name="fileOrHeader"></param>
            /// <returns></returns>
            public static IMD5 Load(Stream fileOrHeader)
            {
                HeaderType type = DetectHeader(fileOrHeader);

                if (type != HeaderType.IMD5)
                {
                    throw new Exception("No IMD5 Header found!");
                }

                IMD5 h = new IMD5();

                h.parseHeader(fileOrHeader);
                return(h);
            }
Beispiel #2
0
            /// <summary>
            /// Loads the IMD5 Header of a byte array.
            /// </summary>
            /// <param name="fileOrHeader"></param>
            /// <returns></returns>
            public static IMD5 Load(byte[] fileOrHeader)
            {
                HeaderType type = DetectHeader(fileOrHeader);

                if (type != HeaderType.IMD5)
                {
                    throw new Exception("No IMD5 Header found!");
                }

                IMD5         h  = new IMD5();
                MemoryStream ms = new MemoryStream(fileOrHeader);

                try { h.parseHeader(ms); }
                catch { ms.Dispose(); throw; }

                ms.Dispose();
                return(h);
            }
Beispiel #3
0
            /// <summary>
            /// Loads the IMD5 Header of a stream.
            /// </summary>
            /// <param name="fileOrHeader"></param>
            /// <returns></returns>
            public static IMD5 Load(Stream fileOrHeader)
            {
                HeaderType type = DetectHeader(fileOrHeader);
                if (type != HeaderType.IMD5)
                    throw new Exception("No IMD5 Header found!");

                IMD5 h = new IMD5();
                h.parseHeader(fileOrHeader);
                return h;
            }
Beispiel #4
0
            /// <summary>
            /// Loads the IMD5 Header of a byte array.
            /// </summary>
            /// <param name="fileOrHeader"></param>
            /// <returns></returns>
            public static IMD5 Load(byte[] fileOrHeader)
            {
                HeaderType type = DetectHeader(fileOrHeader);
                if (type != HeaderType.IMD5)
                    throw new Exception("No IMD5 Header found!");

                IMD5 h = new IMD5();
                MemoryStream ms = new MemoryStream(fileOrHeader);

                try { h.parseHeader(ms); }
                catch { ms.Dispose(); throw; }

                ms.Dispose();
                return h;
            }