コード例 #1
0
        public static async Task <List <SpreadsheetTools.User> > GetInactiveUsersAsync(Clan clan, int threshold = 14)
        {
            var clanMembers = await GetClanInfoCards(clan);

            foreach (var member in clanMembers.validMembers)
            {
                //Console.WriteLine(string.Format("Destiny2/{0}/Profile/{1}/", member.membershipType, member.membershipId));
                var destinyMember = await bungieApi.ApiEndpoints.Destiny2_GetProfile(member.membershipId, member.membershipType);

                //var a = destinyMember.characterActivities.data.Values;
            }
            throw new NotImplementedException("not finished.");
        }
コード例 #2
0
        public static async Task <(List <UserInfoCard> validMembers, List <GroupUserInfoCard> invalidMembers)> GetClanInfoCards(Clan clan)
        {
            SearchResultOfGroupMember group = await bungieApi.ApiEndpoints.GroupV2_GetMembersOfGroup(1, Convert.ToInt64(clan.details.ID));

            var groupList = group.results.ToList();

            var validMembers   = groupList.Where(t => t.bungieNetUserInfo != null).Select(t => t.bungieNetUserInfo).ToList();
            var invalidMembers = groupList.Where(t => t.bungieNetUserInfo == null).Select(t => t.destinyUserInfo).ToList();

            return(validMembers, invalidMembers);
        }
コード例 #3
0
        public static async Task <List <SpreadsheetTools.User> > CheckForLeaves(Clan clan, bool DontWrite = false)
        {
            if (clan.members.ClanLeavers != null)
            {
                await CheckForRejoiners(clan);
            }
            if (!DontWrite)
            {
                if (clan.members.ClanLeavers != null)
                {
                    List <SpreadsheetTools.User> oldLeavers = clan.members.ClanLeavers;
                    List <SpreadsheetTools.User> leavers    = new List <SpreadsheetTools.User>();
                    var ClanMembers = await GetClanInfoCards(clan);

                    foreach (var member in clan.members.BungieUsers)
                    {
                        if (!ClanMembers.validMembers.Select(t => t.membershipId).Contains(Convert.ToInt64(member.BungieID)))
                        {
                            if (!oldLeavers.Select(t => t.BungieID).Contains(member.BungieID))
                            {
                                if (member.BungieID != null)
                                {
                                    leavers.Add(member);
                                }
                            }
                        }
                    }
                    //clan.Users.ForEach(member =>
                    //{


                    //});
                    foreach (var member in leavers)
                    {
                        var workingMember = member;
                        var _             = clan.members.BungieUsers.FindIndex(t => t.BungieProfile == workingMember.BungieProfile);
                        workingMember.UserStatus    = UserStatus.StatusEnum.leftClan;
                        clan.members.BungieUsers[_] = workingMember;
                    }
                    oldLeavers.AddRange(leavers);
                    clan.members.ClanLeavers = oldLeavers;
                    Clans.SaveClanMembers(clan);
                    SpreadsheetTools.Write(clan);

                    return(leavers);
                }
                else
                {
                    List <SpreadsheetTools.User> leavers = new List <SpreadsheetTools.User>();
                    var ClanMembers = await GetClanInfoCards(clan);

                    clan.members.BungieUsers.ForEach(member =>
                    {
                        if (!ClanMembers.validMembers.Select(t => t.membershipId).Contains(Convert.ToInt64(member.BungieID)))
                        {
                            if (member.BungieID != null)
                            {
                                leavers.Add(member);
                            }
                        }
                    });
                    foreach (var member in leavers)
                    {
                        var workingMember = member;
                        var _             = clan.members.BungieUsers.FindIndex(t => t.BungieProfile == workingMember.BungieProfile);
                        workingMember.UserStatus    = UserStatus.StatusEnum.leftClan;
                        clan.members.BungieUsers[_] = workingMember;
                    }
                    clan.members.ClanLeavers = leavers;
                    Clans.SaveClanMembers(clan);
                    SpreadsheetTools.Write(clan);

                    return(leavers);
                }
            }
            else
            {
                await SpreadsheetTools.Read(clan);

                List <SpreadsheetTools.User> leavers = new List <SpreadsheetTools.User>();
                var ClanMembers = await GetClanInfoCards(clan);

                clan.members.BungieUsers.ForEach(member => {
                    if (!ClanMembers.validMembers.Select(t => t.membershipId).Contains(Convert.ToInt64(member.BungieID)))
                    {
                        if (member.BungieID != null)
                        {
                            leavers.Add(member);
                        }
                    }
                });
                //foreach (var member in leavers)
                //{
                //    var workingMember = member;
                //    var _ = clan.members.BungieUsers.FindIndex(t => t.bungieProfile == workingMember.bungieProfile);
                //    workingMember.UserStatus = SpreadsheetTools.UserStatus.leftclan;
                //    clan.members.BungieUsers[_] = workingMember;
                //}
                //SpreadsheetTools.Write(clan);
                return(leavers);
            }
        }
コード例 #4
0
        public static async Task <Changes> CheckForChangesAsync(Clan clan)
        {
            await Read(clan);

            List <User> addedUsers = new List <User>(); List <User> removedUsers = new List <User>(); List <User> updatedUsers = new List <User>();

            for (int i = 0; i < clan.members.BungieUsers.Count; i++)
            {
                if (clan.members.BungieUsers[i].BungieProfile != null)
                {
                    if (!clan.members.SpreadsheetUsers.Select(t => t.BungieProfile).Contains(clan.members.BungieUsers[i].BungieProfile))
                    {
                        removedUsers.Add(clan.members.BungieUsers[i]);
                    }
                }
            }
            for (int i = 0; i < clan.members.SpreadsheetUsers.Count; i++)
            {
                if (clan.members.SpreadsheetUsers[i].BungieProfile != null)
                {
                    if (!clan.members.BungieUsers.Select(t => t.BungieProfile).Contains(clan.members.SpreadsheetUsers[i].BungieProfile))
                    {
                        addedUsers.Add(clan.members.SpreadsheetUsers[i]);
                    }
                }
            }
            for (int i = 0; i < clan.members.SpreadsheetUsers.Count; i++)
            {
                if (clan.members.SpreadsheetUsers[i].BungieProfile != null)
                {
                    if (clan.members.BungieUsers.Select(t => t.BungieProfile).Contains(clan.members.SpreadsheetUsers[i].BungieProfile))
                    {
                        bool userUpdated = false;
                        var  workingList = clan.members.BungieUsers.Where(t => t.BungieProfile == clan.members.SpreadsheetUsers[i].BungieProfile);
                        User workingUser = workingList.FirstOrDefault();
                        if (workingList.FirstOrDefault().UserStatus != clan.members.SpreadsheetUsers[i].UserStatus)
                        {
                            workingUser.UserStatus = clan.members.SpreadsheetUsers[i].UserStatus;
                            userUpdated            = true;
                        }
                        if (workingList.FirstOrDefault().DiscordID != clan.members.SpreadsheetUsers[i].DiscordID)
                        {
                            workingUser.DiscordID = clan.members.SpreadsheetUsers[i].DiscordID;
                            userUpdated           = true;
                        }
                        if (workingList.FirstOrDefault().SteamName != clan.members.SpreadsheetUsers[i].SteamName)
                        {
                            workingUser.SteamName = clan.members.SpreadsheetUsers[i].SteamName;
                            userUpdated           = true;
                        }
                        if (workingList.FirstOrDefault().SteamProfile != clan.members.SpreadsheetUsers[i].SteamProfile)
                        {
                            workingUser.SteamProfile = clan.members.SpreadsheetUsers[i].SteamProfile;
                            userUpdated = true;
                        }
                        if (workingList.FirstOrDefault().BungieName != clan.members.SpreadsheetUsers[i].BungieName)
                        {
                            workingUser.BungieName = clan.members.SpreadsheetUsers[i].BungieName;
                            userUpdated            = true;
                        }
                        if (clan.members.SpreadsheetUsers[i].ExtraColumns != null)
                        {
                            if (workingList.FirstOrDefault().ExtraColumns != null)
                            {
                                var a = workingList.FirstOrDefault().ExtraColumns;
                                var b = clan.members.SpreadsheetUsers[i].ExtraColumns;
                                var c = (!a.SequenceEqual(b));
                                if (c)
                                {
                                    workingUser.ExtraColumns = clan.members.SpreadsheetUsers[i].ExtraColumns;
                                    userUpdated = true;
                                }
                            }
                            else
                            {
                                workingUser.ExtraColumns = clan.members.SpreadsheetUsers[i].ExtraColumns;
                                userUpdated = true;
                            }
                        }
                        if (userUpdated)
                        {
                            updatedUsers.Add(workingUser);
                        }
                    }
                }
            }
            return(new Changes(addedUsers, removedUsers, updatedUsers));
        }
コード例 #5
0
        public static async Task Read(Clan clan)
        {
            // Define requestRead parameters.
            String spreadsheetId = ConfigValues.SpreadsheetID;
            String range         = clan.details.SpreadsheetRange;

            SpreadsheetsResource.ValuesResource.GetRequest requestRead =
                service.Spreadsheets.Values.Get(spreadsheetId, range);

            // Prints the names and majors of students in a sample spreadsheet:
            // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
            ValueRange response = requestRead.Execute();
            IList <IList <Object> > spreadsheetData = response.Values;
            var  workingList     = new List <User>();
            bool forceBulkUpdate = false;

            if (spreadsheetData == null)
            {
                var _       = new User();
                var members = await BungieTools.GetClanInfoCards(clan);

                var validMembers   = members.validMembers;
                var invalidMembers = members.invalidMembers;
                validMembers.ForEach(async member =>
                {
                    _ = new User(BungieTools.GetBungieProfileLink(member), null, null, null, null, null, null, UserStatus.StatusEnum.ok, clan.details.Tag);
                    workingList.Add(_);
                });
                invalidMembers.ForEach(async member =>
                {
                    _ = new User(BungieTools.GetBungieProfileLink(member), null, null, null, null, null, null, UserStatus.StatusEnum.ok, clan.details.Tag);
                    workingList.Add(_);
                });
                Log.Information("Spreadsheet for " + clan.details.Name + " is empty, generating (will take 10 minutes)");
                forceBulkUpdate = true;
            }
            else
            {
                for (int i = 0; i < spreadsheetData.Count; i++)
                {
                    var user = new User();
                    //if (spreadsheetData[i] != null && spreadsheetData[i].Count > 0 && !string.IsNullOrEmpty(spreadsheetData[i][0].ToString()))
                    //{
                    //    switch (spreadsheetData[i].Count)
                    //    {
                    //        case 0:
                    //            break;
                    //        case 1:
                    //            user = new User(spreadsheetData[i][0].ToString(), null, null, null, null, null, null, UserStatus.ok, clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        case 2:
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, null, null, null, null, UserStatus.ok, clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        case 3:
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, spreadsheetData[i][2].ToString(), null, null, null, UserStatus.ok, clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        case 4:
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, spreadsheetData[i][2].ToString(), null, spreadsheetData[i][3].ToString(), null, UserStatus.ok, clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        case 5:
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, spreadsheetData[i][2].ToString(), null, spreadsheetData[i][3].ToString(), spreadsheetData[i][4].ToString(), UserStatus.ok, clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        case 6:
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, spreadsheetData[i][2].ToString(), null, spreadsheetData[i][3].ToString(), spreadsheetData[i][4].ToString(), Enum.Parse<UserStatus>(spreadsheetData[i][5].ToString().ToLower()), clan.details.Tag);
                    //            workingList.Add(user);
                    //            break;
                    //        default:
                    //            List<string> extraColumns = new List<string>();
                    //            for (int index = 6; index < spreadsheetData[i].Count; index++)
                    //            {
                    //                extraColumns.Add(spreadsheetData[i][index].ToString());
                    //            }
                    //            var a = spreadsheetData[i];
                    //            var b = a[5].ToString().ToLower();
                    //            UserStatus d = UserStatus.ok;
                    //            var c = Enum.TryParse(b, false, out d);
                    //            user = new User(spreadsheetData[i][0].ToString(), spreadsheetData[i][1].ToString(), null, spreadsheetData[i][2].ToString(), null, spreadsheetData[i][3].ToString(), spreadsheetData[i][4].ToString(), d, clan.details.Tag, extraColumns);
                    //            workingList.Add(user);
                    //            break;
                    //    }
                    //}
                    if (spreadsheetData[i] != null && spreadsheetData[i].Count > 0 && !string.IsNullOrEmpty(spreadsheetData[i][0].ToString()))
                    {
                        var count = spreadsheetData[i].Count;
                        if (count > 0)
                        {
                            user.BungieProfile = spreadsheetData[i][0].ToString();
                        }
                        if (count > 1)
                        {
                            user.BungieName = spreadsheetData[i][1].ToString();
                        }
                        if (count > 2)
                        {
                            user.SteamProfile = spreadsheetData[i][2].ToString();
                        }
                        if (count > 3)
                        {
                            user.SteamName = spreadsheetData[i][3].ToString();
                        }
                        if (count > 4)
                        {
                            user.DiscordID = spreadsheetData[i][4].ToString();
                        }
                        if (count > 5)
                        {
                            user.UserStatus = UserStatus.ToEnum(spreadsheetData[i][5].ToString());
                        }
                        if (count > 6)
                        {
                            List <string> extraColumns = new List <string>();
                            for (int index = 6; index < spreadsheetData[i].Count; index++)
                            {
                                extraColumns.Add(spreadsheetData[i][index].ToString());
                            }
                            user.ExtraColumns = extraColumns;
                        }
                        workingList.Add(user);
                    }
                }
            }

            clan.members.SpreadsheetUsers = workingList;
            if (clan.members.BungieUsers == null || clan.members.BungieUsers.Count == 0)
            {
                forceBulkUpdate = true;
                Log.Information("User details for " + clan.details.Name + " is empty, generating (will take 10 minutes)");
                //Console.WriteLine("User details for " + clan.clanName + " is empty, generating (will take 10 minutes)");
            }

            if (forceBulkUpdate)
            {
                await BulkUpdate(clan, null, null, true);
            }
        }
コード例 #6
0
        public static async Task SelectiveUpdate(Clan clan, Changes changes, List <DiscordMessage> modifyMessages, Action <List <DiscordMessage>, TimeSpan, Changes> modifyMethod)
        {
            await Read(clan);

            int size = (int)MathF.Ceiling((float)changes.addedUsers.Count / 5);

            TimeSpan[] durations   = new TimeSpan[size];
            var        workingList = clan.members.BungieUsers;
            int        index       = 0;

            foreach (User addedUser in changes.addedUsers)
            {
                var startTime   = DateTime.UtcNow;
                var workingUser = new User();
                if (!string.IsNullOrEmpty(addedUser.BungieProfile))
                {
                    var a = await BungieTools.GetBungieUserID(addedUser.BungieProfile);

                    workingUser.BungieID = a.ToString();
                    if (!string.IsNullOrEmpty(workingUser.BungieID))
                    {
                        string bungieProfile             = addedUser.BungieProfile;
                        string bungieID                  = workingUser.BungieID;
                        UserStatus.StatusEnum userStatus = addedUser.UserStatus;
                        GeneralUser           bungieUser = await BungieTools.GetBungieUser(Convert.ToInt64(bungieID));

                        string steamID      = SteamTools.GetSteamID(bungieProfile);
                        string steamProfile = "https://steamcommunity.com/profiles/" + steamID;
                        string bungieName   = bungieUser.displayName;
                        string steamName    = SteamTools.GetSteamUserName(steamID);
                        string discordID    = addedUser.DiscordID;
                        string userClanTag  = addedUser.ClanTag;
                        workingUser = new User(bungieProfile, bungieName, bungieID, steamProfile, steamID, steamName, discordID, userStatus, userClanTag);
                        workingList.Add(workingUser);
                    }
                    else
                    {
                        List <string> extraColumns  = new List <string>();
                        string        bungieProfile = addedUser.BungieProfile;
                        string        bungieID      = "N/A";
                        string        steamID       = "N/A";
                        string        steamProfile  = "N/A";
                        string        bungieName    = "N/A";
                        string        steamName     = "N/A";
                        string        discordID     = addedUser.DiscordID;
                        if (addedUser.BungieID != "N/A" || addedUser.BungieID != "")
                        {
                            bungieID = addedUser.BungieID;
                        }
                        if (addedUser.SteamID != "N/A" || addedUser.SteamID != "")
                        {
                            steamID = addedUser.SteamID;
                        }
                        if (addedUser.SteamProfile != "N/A" || addedUser.SteamProfile != "")
                        {
                            steamProfile = addedUser.SteamProfile;
                        }
                        if (addedUser.BungieName != "N/A" || addedUser.BungieName != "")
                        {
                            bungieName = addedUser.BungieName;
                        }
                        if (addedUser.SteamName != "N/A" || addedUser.SteamName != "")
                        {
                            steamName = addedUser.SteamName;
                        }

                        if (addedUser.ExtraColumns != null)
                        {
                            extraColumns = addedUser.ExtraColumns;
                        }
                        UserStatus.StatusEnum userStatus = addedUser.UserStatus;

                        if (addedUser.ExtraColumns != null)
                        {
                            extraColumns = addedUser.ExtraColumns;
                        }
                        workingList.Add(new User(bungieProfile, bungieName, bungieID, steamProfile, steamID, steamName, discordID, userStatus, clan.details.Tag, extraColumns));
                    }
                }
                durations[index % durations.Length] = DateTime.UtcNow - startTime;

                if (index > durations.Length - 1)
                {
                    var averageTime = TimeSpan.FromMilliseconds(durations.Average(t => t.TotalMilliseconds));
                    var usersLeft   = changes.addedUsers.Count - (index + 1);
                    if (modifyMessages != null && modifyMethod != null)
                    {
                        modifyMethod.Invoke(modifyMessages, averageTime * usersLeft, changes);
                    }
                }
                index++;
            }
            for (int i = 0; i < changes.updatedUsers.Count; i++)
            {
                index = workingList.FindIndex(t => t.BungieProfile == changes.updatedUsers[i].BungieProfile);
                workingList[index] = changes.updatedUsers[i];
            }
            changes.removedUsers.ForEach(removedUser =>
            {
                index = workingList.FindIndex(t => t.BungieProfile == removedUser.BungieProfile);
                workingList.RemoveAt(index);
            });
            workingList.RemoveAll(t => string.IsNullOrEmpty(t.BungieProfile));
            workingList = workingList.DistinctBy(t => t.BungieProfile).ToList();
            workingList = workingList.OrderBy(t => t.SteamName).ToList();
            clan.members.BungieUsers = workingList;
            Write(clan);
            Clans.SaveClanMembers(clan);
        }
コード例 #7
0
        public static async Task BulkUpdate(Clan clan, List <DiscordMessage> modifyMessages, Action <List <DiscordMessage>, TimeSpan> modifyMethod, bool skipRead = false)
        {
            TimeSpan[] durations = new TimeSpan[5];
            if (!skipRead)
            {
                await Read(clan);
            }
            //ShowLoading("processing...");
            var         _           = clan.members.SpreadsheetUsers;
            List <User> workingList = new List <User>();
            int         index       = 0;

            foreach (User user in _)
            {
                var startTime   = DateTime.UtcNow;
                var workingUser = new User();
                if (!string.IsNullOrEmpty(user.BungieProfile))
                {
                    long?a = await BungieTools.GetBungieUserID(user.BungieProfile);

                    workingUser.BungieID = a.ToString();
                    if (!string.IsNullOrEmpty(workingUser.BungieID))
                    {
                        List <string> extraColumns  = new List <string>();
                        string        bungieProfile = user.BungieProfile;
                        string        bungieID      = workingUser.BungieID;
                        GeneralUser   bungieUser    = await BungieTools.GetBungieUser(Convert.ToInt64(bungieID));

                        string steamID      = SteamTools.GetSteamID(bungieProfile);
                        string steamName    = SteamTools.GetSteamUserName(steamID);
                        string steamProfile = "https://steamcommunity.com/profiles/" + steamID;
                        string bungieName   = bungieUser.displayName;
                        string discordID    = user.DiscordID;
                        UserStatus.StatusEnum userStatus = user.UserStatus;

                        if (user.ExtraColumns != null)
                        {
                            extraColumns = user.ExtraColumns;
                        }
                        if (steamName == null || steamID == null)
                        {
                            steamName = "N/A"; steamProfile = "N/A";
                        }
                        workingList.Add(new User(bungieProfile, bungieName, bungieID, steamProfile, steamID, steamName, discordID, userStatus, clan.details.Tag, extraColumns));
                    }
                    else
                    {
                        List <string>         extraColumns  = new List <string>();
                        string                bungieProfile = user.BungieProfile;
                        string                bungieID      = "N/A";
                        string                steamID       = "N/A";
                        string                steamProfile  = "N/A";
                        string                bungieName    = "N/A";
                        string                steamName     = "N/A";
                        string                discordID     = user.DiscordID;
                        UserStatus.StatusEnum userStatus    = user.UserStatus;
                        if (user.BungieID != "N/A" || user.BungieID != null)
                        {
                            bungieID = user.BungieID;
                        }
                        if (user.SteamID != "N/A" || user.SteamID != null)
                        {
                            steamID = user.SteamID;
                        }
                        if (user.SteamProfile != "N/A" || user.SteamProfile != null)
                        {
                            steamProfile = user.SteamProfile;
                        }
                        if (user.BungieName != "N/A" || user.BungieName != null)
                        {
                            bungieName = user.BungieName;
                        }
                        if (user.SteamName != "N/A" || user.SteamName != null)
                        {
                            steamName = user.SteamName;
                        }

                        if (user.ExtraColumns != null)
                        {
                            extraColumns = user.ExtraColumns;
                        }
                        workingList.Add(new User(bungieProfile, bungieName, bungieID, steamProfile, steamID, steamName, discordID, userStatus, clan.details.Tag, extraColumns));
                    }
                }
                durations[index % durations.Length] = DateTime.UtcNow - startTime;

                if (index > durations.Length - 1)
                {
                    var averageTime = TimeSpan.FromMilliseconds(durations.Average(t => t.TotalMilliseconds));
                    var usersLeft   = _.Count - (index + 1);
                    if (modifyMessages != null && modifyMethod != null)
                    {
                        modifyMethod.Invoke(modifyMessages, averageTime * usersLeft);
                    }
                }
                index++;
            }
            workingList.RemoveAll(t => string.IsNullOrEmpty(t.BungieProfile));
            workingList = workingList.DistinctBy(t => t.BungieProfile).ToList();
            workingList = workingList.OrderBy(t => t.SteamName).ToList();
            clan.members.BungieUsers = workingList;
            Write(clan);
            Clans.SaveClanMembers(clan);
        }
コード例 #8
0
        public static void Write(Clan clan)
        {
            String     spreadsheetId = ConfigValues.SpreadsheetID;
            String     range         = clan.details.SpreadsheetRange;
            ValueRange valueRange    = new ValueRange();
            var        table         = new List <IList <object> >();

            for (int c = 0; c < clan.members.BungieUsers.Count; c++)
            {
                List <object> _;
                if (string.IsNullOrEmpty(clan.members.BungieUsers[c].BungieProfile))
                {
                    _ = new List <object>(6)
                    {
                        "", "", "", "", "", "", ""
                    };
                }
                else
                {
                    _ = new List <object>(6)
                    {
                        clan.members.BungieUsers[c].BungieProfile, clan.members.BungieUsers[c].BungieName, clan.members.BungieUsers[c].SteamProfile, clan.members.BungieUsers[c].SteamName, clan.members.BungieUsers[c].DiscordID, UserStatus.ToString(clan.members.BungieUsers[c].UserStatus)
                    };
                }

                if (clan.members.BungieUsers[c].ExtraColumns != null)
                {
                    foreach (string column in clan.members.BungieUsers[c].ExtraColumns)
                    {
                        _.Add(column);
                    }
                    var letterStrings = clan.details.SpreadsheetRange.Split('!')[1].Split(':');
                    var a             = char.ToUpper(letterStrings[0][0]) - 64;
                    var b             = char.ToUpper(letterStrings[1][0]) - 64;
                    var forRange      = b - a - clan.members.BungieUsers[c].ExtraColumns.Count - 5;
                    for (int i = 0; i < forRange; i++)
                    {
                        _.Add("");
                    }
                }
                else
                {
                    var letterStrings = clan.details.SpreadsheetRange.Split('!')[1].Split(':');
                    var a             = char.ToUpper(letterStrings[0][0]) - 64;
                    var b             = char.ToUpper(letterStrings[1][0]) - 64;
                    var forRange      = b - a - 5;
                    for (int i = 0; i < forRange; i++)
                    {
                        _.Add("");
                    }
                }
                table.Add(_);
            }
            for (int c = clan.members.BungieUsers.Count; c < 100; c++)
            {
                List <object> _ = new List <object>(5)
                {
                    "", "", "", "", "", ""
                };
                table.Add(_);
            }
            valueRange.Values = table;
            SpreadsheetsResource.ValuesResource.UpdateRequest requestUpdate = service.Spreadsheets.Values.Update(valueRange, spreadsheetId, range);
            requestUpdate.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;

            // Prints the names and majors of students in a sample spreadsheet:
            var response = requestUpdate.Execute();
        }