예제 #1
0
        public static void Decade(string path)
        {
            int csvLineCount = 0;
            int recordIndex  = 0;

            // Update Class info
            ERClass.Decade.path           = path;
            ERClass.Decade.attributeNames = MyFunctions.ReturnHeaderArray(ERClass.Decade.path);
            ERClass.Decade.totalRecords   = MyFunctions.RecordCount(ERClass.Decade.path);

            string[] readText = File.ReadAllLines(ERClass.Decade.path);

            // Resize Array of record structs from initial array size [0]
            Array.Resize(ref ERClass.Decade.structRecords, ERClass.Decade.totalRecords);

            foreach (string record in readText)
            {
                if (record.Trim() == "")
                {
                    continue;
                }

                if (csvLineCount > 0 && csvLineCount <= ERClass.Decade.totalRecords)
                {
                    string[] fields = record.Split(';');
                    recordIndex = csvLineCount - 1;

                    ERClass.Decade.structRecords[recordIndex].decadeID       = Int32.Parse(fields[0]);
                    ERClass.Decade.structRecords[recordIndex].mysteryIndex   = Int32.Parse(fields[1]);
                    ERClass.Decade.structRecords[recordIndex].decadeNo       = Int32.Parse(fields[2]);
                    ERClass.Decade.structRecords[recordIndex].decadeName     = fields[3];
                    ERClass.Decade.structRecords[recordIndex].decadeInfo     = fields[4];
                    ERClass.Decade.structRecords[recordIndex].infoRefference = fields[5];
                }

                csvLineCount++;
            }
        }
예제 #2
0
        public static void Feast(string path)
        {
            int csvLineCount = 0;
            int recordIndex  = 0;

            // Update Class info
            ERClass.Feast.path           = path;
            ERClass.Feast.attributeNames = MyFunctions.ReturnHeaderArray(ERClass.Scripture.path);
            ERClass.Feast.totalRecords   = MyFunctions.RecordCount(ERClass.Feast.path);

            string[] readText = File.ReadAllLines(ERClass.Feast.path);

            // Resize Array of record structs from initial array size [0]
            Array.Resize(ref ERClass.Feast.structRecords, ERClass.Feast.totalRecords);

            foreach (string record in readText)
            {
                if (record.Trim() == "")
                {
                    continue;
                }

                if (csvLineCount > 0 && csvLineCount <= ERClass.Feast.totalRecords)
                {
                    string[] fields = record.Split(';');
                    recordIndex = csvLineCount - 1;

                    ERClass.Feast.structRecords[recordIndex].feastID    = Int32.Parse(fields[0]);
                    ERClass.Feast.structRecords[recordIndex].feastName  = fields[1];
                    ERClass.Feast.structRecords[recordIndex].feastDay   = Int32.Parse(fields[2]);
                    ERClass.Feast.structRecords[recordIndex].feastMonth = Int32.Parse(fields[3]);
                    ERClass.Feast.structRecords[recordIndex].monthName  = fields[4];
                }

                csvLineCount++;
            }
        }
예제 #3
0
        public static void ImportCsvDatabase()
        {
            // astDiffSume csvs are contained within ".\database\csv\*.csv"
            string   path, csvName;
            DateTime t0, t1;
            TimeSpan tDiffSum, tDiff;

            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("\n#  Demo: CSV Database Import\n");
            Console.ResetColor();

            t0       = t1 = DateTime.Now;
            tDiff    = t1 - t0;
            tDiffSum = t0 - t0;
            Console.WriteLine(" Import Start Time:\t" + DateTime.Now + "\tTimeSpan: " + tDiffSum + "\t\tms:" + tDiffSum.Milliseconds + "\n---");

            csvName = "rosaryBead.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.RosaryBead(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "bead.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Bead(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "book.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Book(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "decade.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Decade(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "message.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Message(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "mystery.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Mystery(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "prayer.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Prayer(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "scripture.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Scripture(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            csvName = "feast.csv";
            t0      = DateTime.Now;
            path    = MyFunctions.CsvFilePath(csvName);
            PopulateER.Feast(path);
            t1        = DateTime.Now;
            tDiff     = t1 - t0;
            tDiffSum += tDiff;
            Console.WriteLine(" Importing: " + csvName + "\t\t...\t\tTimeSpan: " + tDiff + "\tms:" + tDiff.Milliseconds);

            Console.WriteLine("---\n Import End Time:\t" + DateTime.Now + "\tTimeSpan: " + tDiffSum + "\tms:" + tDiffSum.Milliseconds + "\n");
        }