/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }