This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
static class Program { | |
static void Main() { | |
Console.Write("Performing some task... "); | |
using (var progress = new ProgressBar()) { | |
for (int i = 0; i <= 100; i++) { | |
progress.Report((double) i / 100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Text; | |
namespace deflect | |
{ | |
class Wizard | |
{ | |
public string Name {get;set;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Security.Cryptography; | |
//Example: Hash("myfile.txt", "SHA-512"); | |
public string Hash(string inputFile, string algorithm) | |
{ | |
HashAlgorithm hash = HashAlgorithm.Create (algorithm); | |
FileStream fileStream = File.OpenRead (inputFile); | |
byte[] hashBytes = hash.ComputeHash (fileStream); | |
return Convert.ToBase64String (hashBytes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void CreateTarGZ (string tgzFilename, string sourceDirectory) | |
{ | |
Stream outStream = File.Create (tgzFilename); | |
Stream gzoStream = new GZipOutputStream (outStream); | |
TarArchive tarArchive = TarArchive.CreateOutputTarArchive (gzoStream); | |
// Note that the RootPath is currently case sensitive and must be forward slashes e.g. "c:/temp" | |
// and must not end with a slash, otherwise cuts off first char of filename |