Пример #1
0
        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;
            }
        }
Пример #2
0
	    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;

			}

		}
Пример #3
0
		/// <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;
		}
Пример #4
0
        /// <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;
        }
Пример #5
0
        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();
        }
Пример #6
0
        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();
        }
Пример #7
0
        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();
        }
Пример #8
0
        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();
        }
Пример #9
0
 /// <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);
 }
Пример #10
0
 protected void Notify(ProgressChangeHandler handler, ProgressMode mode, int current, int total)
 {
     ProgressHelper.Notify(handler, mode, current, total);
 }
Пример #11
0
		/// <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);
		}
Пример #12
0
		protected void Notify(ProgressChangeHandler handler, ProgressMode mode, int current, int total)
		{
			ProgressHelper.Notify(handler, mode, current, total);
		}