Beispiel #1
0
            /// <summary>
            /// Creates a new IMD5 Header.
            /// </summary>
            /// <param name="file"></param>
            /// <returns></returns>
            public static IMD5 Create(byte[] file)
            {
                IMD5 h = new IMD5();

                h.fileSize = (uint)file.Length;
                h.computeHash(file);

                return(h);
            }
        public App(IMD5 md5)
        {
            InitializeComponent();
            this.md5 = md5;
            AppContainer.Container = new Bootstrap().CreateContainer();
            var login             = new MainPage();
            var navigationService = AppContainer.Container.Resolve <INavigationService>();

            navigationService.Navigation = login.Navigation;
            MainPage = new NavigationPage(login);
        }
Beispiel #3
0
            /// <summary>
            /// Adds an IMD5 Header to a byte array.
            /// </summary>
            /// <param name="file"></param>
            /// <returns></returns>
            public static byte[] AddHeader(byte[] file)
            {
                IMD5 h = IMD5.Create(file);

                MemoryStream ms = new MemoryStream();

                h.writeToStream(ms);
                ms.Write(file, 0, file.Length);

                byte[] res = ms.ToArray();
                ms.Dispose();
                return(res);
            }
Beispiel #4
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 #5
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 #6
0
            /// <summary>
            /// Creates a new IMD5 Header.
            /// </summary>
            /// <param name="file"></param>
            /// <returns></returns>
            public static IMD5 Create(byte[] file)
            {
                IMD5 h = new IMD5();

                h.fileSize = (uint)file.Length;
                h.computeHash(file);

                return h;
            }
Beispiel #7
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 #8
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;
            }