Ejemplo n.º 1
0
        public void loadItems()
        {
            // Clear the current items
            itemArr.Clear();

            ValueRange response = GDriveManager.readSpreadsheet(Constants.ITEMS_ID, "ROFItems");
            IDictionary <string, int> headerMap = GDriveManager.getHeaderMap(response.Values);
            List <BulkLoader>         rows      = new List <BulkLoader>();

            // Iterate through each row
            foreach (IList <Object> row in response.Values.Skip(1))
            {
                ItemEntry item = new ItemEntry();
                item.itemName   = GDriveManager.readCell(row, headerMap[ITEM_NAME_COL]);
                item.eventName  = GDriveManager.readCell(row, headerMap[EVENT_COL]);
                item.slot       = GDriveManager.readCell(row, headerMap[SLOT_COL]);
                item.is_special = GDriveManager.readCell(row, headerMap[SPECIAL_COL]);

                rows.Add(item);
                itemArr.Add(item);
            }

            DBManager.getManager().bulkInsert(rows, "items");
            logger.Info("Items loaded successfully. " + itemArr.Count + " entries.");
        }
Ejemplo n.º 2
0
        public void loadEvents()
        {
            events.Clear();

            ValueRange response = GDriveManager.readSpreadsheet(logURI, "RainOfFearRaids");
            IDictionary <string, int> headerMap = GDriveManager.getHeaderMap(response.Values);

            // order by 2nd column (Short Name)
            IEnumerable <IList <Object> > sorted = response.Values.Skip(1).OrderBy(f => f.ElementAt(headerMap[EVENT_SHORT_COL]).ToString());
            List <BulkLoader>             rows   = new List <BulkLoader>();

            // Iterate through each row
            foreach (IList <Object> row in sorted)
            {
                string display = row[headerMap[EVENT_DISPLAY_COL]].ToString().ToLower();
                if (display.Equals("yes"))
                {
                    EventEntry evt = new EventEntry();
                    evt.eventName = row[headerMap[EVENT_EVENT_COL]].ToString();
                    evt.shortName = row[headerMap[EVENT_SHORT_COL]].ToString();
                    evt.tier      = row[headerMap[EVENT_TIER_COL]].ToString();

                    events.Add(evt);
                    rows.Add(evt);
                }
            }

            DBManager.getManager().bulkInsert(rows, "events");

            logger.Info("Events loaded successfully. " + events.Count + " entries.");
        }
Ejemplo n.º 3
0
        public void loadArmorTypes()
        {
            armorTypes.Clear();

            ValueRange response = GDriveManager.readSpreadsheet(logURI, "Constants");
            IDictionary <string, int> headerMap = GDriveManager.getHeaderMap(response.Values);

            IEnumerable <IList <Object> > sorted = response.Values.Skip(1).OrderBy(f => f.ElementAt(headerMap[CONSTANTS_ARMOR_TYPES_NAME_COL]).ToString());
            List <BulkLoader>             rows   = new List <BulkLoader>();

            // Iterate through each row
            foreach (IList <Object> row in sorted)
            {
                ArmorTypeEntry at = new ArmorTypeEntry();
                at.armorType = GDriveManager.readCell(row, headerMap[CONSTANTS_ARMOR_TYPES_NAME_COL]);

                // for some reason if data isn't present in the 2nd column the row array is set to 1
                // not sure what happens if the first column was missing data
                if (row.Count > headerMap[CONSTANTS_TIER_COL])
                {
                    string tier = row[headerMap[CONSTANTS_TIER_COL]].ToString();
                    if (!tier.Equals(""))
                    {
                        tiers.Add(tier);
                    }
                }

                armorTypes.Add(at);
            }

            tiers.Reverse();
            logger.Info("Events loaded successfully. " + events.Count + " entries.");
        }
Ejemplo n.º 4
0
        public Roster()
        {
            // Clear the current roster
            rosterArr.Clear();

            ValueRange response = GDriveManager.readSpreadsheet(Constants.ROSTER_ID, "Sheet1");
            IDictionary <string, int> headerMap = GDriveManager.getHeaderMap(response.Values);

            IEnumerable <IList <Object> > sorted = response.Values.Skip(1).OrderBy(f => f.ElementAt(headerMap[NAME_COL]).ToString());
            List <BulkLoader>             rows   = new List <BulkLoader>();

            // Iterate through each row
            foreach (IList <Object> row in sorted)
            {
                RosterEntry r = new RosterEntry();
                r.name      = GDriveManager.readCell(row, headerMap[NAME_COL]);
                r.classType = GDriveManager.readCell(row, headerMap[CLASS_COL]);
                r.rank      = GDriveManager.readCell(row, headerMap[RANK_COL]);
                r.active    = GDriveManager.readCell(row, headerMap[ACTIVE_COL]);

                rows.Add(r);
                rosterArr.Add(r);
            }

            DBManager.getManager().bulkInsert(rows, "roster");

            logger.Info("Roster loaded successfully. " + rosterArr.Count + " entries.");
        }
Ejemplo n.º 5
0
 public void loadLogFeed()
 {
     logFeed = GDriveManager.readSpreadsheet(logURI, "RainOfFearLoot");
 }