mirror of
https://github.com/kwsch/pkNX.git
synced 2026-10-02 14:16:55 -05:00
Initial Commit
This commit is contained in:
29
pkNX.Containers/ContainerHandler/ContainerHandler.cs
Normal file
29
pkNX.Containers/ContainerHandler/ContainerHandler.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
// ReSharper disable EventNeverSubscribedTo.Global
|
||||
|
||||
namespace pkNX.Containers
|
||||
{
|
||||
public sealed class ContainerHandler
|
||||
{
|
||||
public event EventHandler<FileCountDeterminedEventArgs> FileCountDetermined;
|
||||
public event EventHandler<FileProgressedEventArgs> FileProgressed;
|
||||
|
||||
private int count;
|
||||
|
||||
public void Initialize(int total)
|
||||
{
|
||||
count = total;
|
||||
var args = new FileCountDeterminedEventArgs {Total = total};
|
||||
FileCountDetermined?.Invoke(null, args);
|
||||
}
|
||||
|
||||
public void StepFile(int ctr, int total = -1, string fileName = null)
|
||||
{
|
||||
if (total < 0)
|
||||
total = count;
|
||||
var args = new FileProgressedEventArgs {Current = ctr, Total = total, CurrentFile = fileName};
|
||||
FileProgressed?.Invoke(null, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace pkNX.Containers
|
||||
{
|
||||
public class FileCountDeterminedEventArgs : EventArgs
|
||||
{
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
11
pkNX.Containers/ContainerHandler/FileProgressedEventArgs.cs
Normal file
11
pkNX.Containers/ContainerHandler/FileProgressedEventArgs.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace pkNX.Containers
|
||||
{
|
||||
public class FileProgressedEventArgs : EventArgs
|
||||
{
|
||||
public int Current { get; set; }
|
||||
public int Total { get; set; }
|
||||
public string CurrentFile { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user