Skip to content

Instantly share code, notes, and snippets.

@cmpunches
Created October 14, 2015 12:32
Show Gist options
  • Save cmpunches/1d283b6ea7baf349406d to your computer and use it in GitHub Desktop.
Save cmpunches/1d283b6ea7baf349406d to your computer and use it in GitHub Desktop.

Revisions

  1. Chris Punches created this gist Oct 14, 2015.
    64 changes: 64 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    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();
    }
    }

    }
    }