public static void Notify(ProgressChangeHandler handler, ProgressMode mode, int current, int total) { if (handler == null) { return; } if (mode == ProgressMode.DontNotify) { return; } switch (mode) { case ProgressMode.NotifyBytes: handler(new ProgressEventArgs(mode, current, total)); break; case ProgressMode.NotifyRecords: handler(new ProgressEventArgs(mode, current, total)); break; case ProgressMode.NotifyPercent: if (total == -1) { return; } handler(new ProgressEventArgs(mode, (int)(current * 100 / total), 100)); break; } }
public static void Notify(ProgressChangeHandler handler, ProgressMode mode, int current, int total) { if (handler == null) return; if (mode == ProgressMode.DontNotify) return; switch(mode) { case ProgressMode.NotifyBytes: handler(new ProgressEventArgs(mode, current, total)); break; case ProgressMode.NotifyRecords: handler(new ProgressEventArgs(mode, current, total)); break; case ProgressMode.NotifyPercent: if (total == -1) return; handler(new ProgressEventArgs(mode, (int) (current*100/total), 100)); break; } }
/// <summary>Set the handler to the engine used to notify progress into the operations.</summary> /// <param name="handler">Your <see cref="ProgressChangeHandler"/> method.</param> /// <param name="mode">The <see cref="ProgressMode"/> to use.</param> public void SetProgressHandler(ProgressChangeHandler handler, ProgressMode mode) { mNotifyHandler = handler; if (mode == ProgressMode.NotifyBytes) throw new NotImplementedException("Not implemented yet. Planed for version 1.5.0"); mProgressMode = mode; }
/// <summary>Set the handler to the engine used to notify progress into the operations.</summary> /// <param name="handler">Your <see cref="ProgressChangeHandler"/> method.</param> /// <param name="mode">The <see cref="ProgressMode"/> to use.</param> public void SetProgressHandler(ProgressChangeHandler handler, ProgressMode mode) { mNotifyHandler = handler; if (mode == ProgressMode.NotifyBytes) { throw new NotImplementedException("Not implemented yet. Planed for version 1.5.0"); } mProgressMode = mode; }
public static void CreateUOP(string path, Patch[] patches, ProgressChangeHandler progressDelegate) { PatchWriter writer = new PatchWriter(File.Create(path), PatchFileType.UOP); writer.WriteUOPHeader(); writer.Write(patches.Length); writer.Write((int)0);//Unknown for( int i = 0; i < patches.Length; i++ ) { writer.WriteUOPPatch(patches[i]); if( i != 0 && progressDelegate != null ) progressDelegate(writer, new ProgressChangeEventArgs(((100 * i) / patches.Length), i, patches.Length)); } writer.Close(); }
public static void CreateMUO(string path, Patch[] patches, ProgressChangeHandler progressDelegate) { PatchWriter writer = new PatchWriter(File.Create(path), PatchFileType.MUO); writer.WriteMUOHeader(); writer.WriteMUOMetaData(new string[] { "MUO", "Created with PatchLib", "Jeff Boulanger" }); writer.Write((int)patches.Length); for( int i = 0; i < patches.Length; i++ ) { writer.WriteMUOPatch(patches[i]); if( i != 0 && progressDelegate != null ) progressDelegate(writer, new ProgressChangeEventArgs(((100 * i) / patches.Length), i, patches.Length)); } writer.Close(); }
public static void CreateMUO(string path, Patch[] patches, ProgressChangeHandler progressDelegate) { PatchWriter writer = new PatchWriter(File.Create(path), PatchFileType.MUO); writer.WriteMUOHeader(); writer.WriteMUOMetaData(new string[] { "MUO", "Created with PatchLib", "Jeff Boulanger" }); writer.Write((int)patches.Length); for (int i = 0; i < patches.Length; i++) { writer.WriteMUOPatch(patches[i]); if (i != 0 && progressDelegate != null) { progressDelegate(writer, new ProgressChangeEventArgs(((100 * i) / patches.Length), i, patches.Length)); } } writer.Close(); }
public static void CreateUOP(string path, Patch[] patches, ProgressChangeHandler progressDelegate) { PatchWriter writer = new PatchWriter(File.Create(path), PatchFileType.UOP); writer.WriteUOPHeader(); writer.Write(patches.Length); writer.Write((int)0); //Unknown for (int i = 0; i < patches.Length; i++) { writer.WriteUOPPatch(patches[i]); if (i != 0 && progressDelegate != null) { progressDelegate(writer, new ProgressChangeEventArgs(((100 * i) / patches.Length), i, patches.Length)); } } writer.Close(); }
/// <summary>Set the handler to the engine used to notify progress into the operations.</summary> /// <param name="handler">The <see cref="ProgressChangeHandler"/></param> public void SetProgressHandler(ProgressChangeHandler handler) { SetProgressHandler(handler, ProgressMode.NotifyRecords); }
protected void Notify(ProgressChangeHandler handler, ProgressMode mode, int current, int total) { ProgressHelper.Notify(handler, mode, current, total); }