コード例 #1
0
        public static void Book(string path)
        {
            int csvLineCount = 0;
            int recordIndex  = 0;

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

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

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

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

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

                    ERClass.Book.structRecords[recordIndex].bookID   = Int32.Parse(fields[0]);
                    ERClass.Book.structRecords[recordIndex].bookName = fields[1];
                    ERClass.Book.structRecords[recordIndex].library  = fields[2];
                }

                csvLineCount++;
            }
        }
コード例 #2
0
        public static void RosaryBead(string path)
        {
            int csvLineCount = 0;
            int recordIndex  = 0;

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

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

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

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

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

                    ERClass.RosaryBead.structRecords[recordIndex].rosaryBeadID     = Int32.Parse(fields[0]);
                    ERClass.RosaryBead.structRecords[recordIndex].beadIndex        = Int32.Parse(fields[1]);
                    ERClass.RosaryBead.structRecords[recordIndex].decadeIndex      = Int32.Parse(fields[2]);
                    ERClass.RosaryBead.structRecords[recordIndex].mysteryIndex     = Int32.Parse(fields[3]);
                    ERClass.RosaryBead.structRecords[recordIndex].prayerIndex      = Int32.Parse(fields[4]);
                    ERClass.RosaryBead.structRecords[recordIndex].scriptureIndex   = Int32.Parse(fields[5]);
                    ERClass.RosaryBead.structRecords[recordIndex].messageIndex     = Int32.Parse(fields[6]);
                    ERClass.RosaryBead.structRecords[recordIndex].loopBody         = Int32.Parse(fields[7]);
                    ERClass.RosaryBead.structRecords[recordIndex].smallbeadPercent = Int32.Parse(fields[8]);
                    ERClass.RosaryBead.structRecords[recordIndex].mysteryPercent   = Int32.Parse(fields[9]);
                }

                csvLineCount++;
            }
        }
コード例 #3
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++;
            }
        }