Skip to content

Instantly share code, notes, and snippets.

@cmpunches
Created October 14, 2015 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmpunches/1d283b6ea7baf349406d to your computer and use it in GitHub Desktop.
Save cmpunches/1d283b6ea7baf349406d to your computer and use it in GitHub Desktop.
namespace cli_20150929
{
class Program
{
static void Main(string[] args)
{
// load the INI file
INI Settings = new INI("settings.ini");
if (Settings.KeyExists("Config", "VERSION"))
{
string ConfigVersion = Settings.Read("Config", "VERSION");
Console.WriteLine("ConfigVersion = {0}", ConfigVersion);
}
string[] targetArchives;
if (Settings.KeyExists("path", "Archives"))
{
string archivesPath = Settings.Read("path", "Archives");
Console.WriteLine("Scanning {0}...", archivesPath);
targetArchives = Directory.GetFiles(@archivesPath);
}
string[] extractionTargets = Settings.target_matches(Settings);
// single instance debugging.
// string inputFilePath = @"C:\Users\punchc1\Desktop\COBRA_SVN\trunk\External Customer\BiPoshv3\Test-Data\6503\1_1.zip";
foreach (string inputFilePath in targetArchives)
{
// if the zipfile exists
if (File.Exists(inputFilePath))
{
foreach (string extractionTarget in extractionTargets)
{
Console.WriteLine("Scanning {0} for {1}...", Path.GetFileName(inputFilePath), extractionTarget);
// for debugging
// Console.WriteLine("Scanning {0} for {1}...", inputFilePath, extractionTarget);
Stream workStream = ExtractionPhaseMethods.ExtractZipEntrytoStream(inputFilePath, extractionTarget);
if (workStream != null)
{
StreamFilters.DumpEnumeratorToConsole(
StreamFilters.AllFilter(workStream)
);
}
else
{
Console.WriteLine("No match was found.");
}
}
}
else
{
Console.WriteLine("{0} doesn't exist.", inputFilePath);
}
Console.WriteLine("Complete. Press a key to continue...");
Console.ReadLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment