Esempio n. 1
0
        public static void TestArgosEmailFile()
        {
            const string path = @"..\..\SampleFiles\Gen34moose08-09-2-12.TXT";
            const string tpf  = @"..\..\SampleFiles\080711003_87744.tpf";

            Console.WriteLine("File {0}", path);

            var processorDict = new Dictionary <string, IProcessor>
            {
                { "77267", new Gen3Processor(TimeSpan.FromMinutes(24 * 60)) },
                { "87744", new Gen4Processor(File.ReadAllBytes(tpf)) },
            };
            ArgosFile a = new ArgosEmailFile(path);

            SummarizeFile(a);
            foreach (var id in new[] { "77267", "87744" })
            {
                Console.WriteLine("Messages for {0} in File", id);
                var platform      = id; // to protect against AccessToForEachVariableInClosure
                var transmissions = a.GetTransmissions().Where(t => t.PlatformId == platform);
                foreach (var s in processorDict[id].ProcessTransmissions(transmissions, a))
                {
                    Console.WriteLine(s);
                }
            }
        }
Esempio n. 2
0
        public static void TestArgosFolder()
        {
            const string id    = "60793";
            const int    hours = 25;

            const string inPath  = @"C:\tmp\Argos_Emails";
            const string outPath = @"C:\tmp\reports\" + id + "_2012a.txt";

            if (!Directory.Exists(inPath))
            {
                Console.Write("Invalid Directory {0}", inPath);
            }
            Console.Write("Processing Directory {0}", inPath);
            using (var f = new StreamWriter(outPath))
            {
                foreach (var file in Directory.EnumerateFiles(inPath))
                {
                    var path = Path.Combine(inPath, file);
                    Console.WriteLine("  File {0}", file);
                    ArgosFile a         = new ArgosEmailFile(path);
                    var       processor = new Gen3Processor(TimeSpan.FromMinutes(hours * 60));
                    //CollarFinder = (i, d) => i
                    var lines = new string[0];
                    try
                    {
                        var transmissions = a.GetTransmissions().Where(t => t.PlatformId == id);
                        lines = processor.ProcessTransmissions(transmissions, a).ToArray();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("ERROR: InTelonicsToData(): {0}", ex.Message);
                    }
                    foreach (var l in lines)
                    {
                        f.WriteLine(l);
                    }
                }
            }
        }