Beispiel #1
0
        internal static void PrintConfig(Configuration config)
        {
            string print = string.Empty;

            ParcelDataController parcelData = ParcelDataController.Instance;
            List <DataType>      collums    = config.Data;
            List <string>        stations   = parcelData.GetStationNames();

            foreach (string s in stations)
            {
                print += $"Indføring: {s}\r\n";
                DateTime timePointer = config.StartTime;
                do
                {
                    foreach (DataType d in collums)
                    {
                        string str = parcelData.GetData(s, d, timePointer, timePointer + config.Interval);
                        print += RightAlign(str, 15);
                    }
                    print       += "\r\n";
                    timePointer += config.Interval;
                } while (timePointer < config.EndTime);
                print += "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
                Console.WriteLine(s);
            }
            StreamWriter file = File.CreateText("out.txt");

            file.Write(print);
            file.Dispose();
            //Console.WriteLine(print);
            //Console.ReadKey();
        }
        public void IngestLogfile(string path)
        {
            ParcelDataController parcelData = ParcelDataController.Instance;

            foreach (string s in Directory.GetFiles(Directory.GetCurrentDirectory(), "Taulov*.txt"))
            {
                Console.WriteLine(s);
                string[] lines = File.ReadAllLines(s);
                for (int i = 4; i < lines.Length; i++)
                {
                    int      weight, length, height, width;
                    string[] tabs       = lines[i].Split('\t');
                    DateTime date       = DateTime.Parse(tabs[0]);
                    string   termianlId = tabs[1];
                    weight = ParsData(tabs[2]);
                    length = ParsData(tabs[3]);
                    height = ParsData(tabs[4]);
                    width  = ParsData(tabs[5]);
                    parcelData.RegisterParcel(termianlId, date, weight, length, height, width);
                }
            }
        }