public ValidationKey(string key, KeyScope keyscope, long forumuserid, ulong userid, ulong guildid) { Key = key; KeyScope = keyscope; ForumUserId = forumuserid; DiscordUserId = userid; GuildId = guildid; CreatedAt = DateTime.UtcNow; }
public ValidationKey GenerateKey(KeyScope keyscope, long forumuserid, ulong userid, ulong guildid) { ValidationKey key; while (ValidationKeys.Contains(key = new ValidationKey(InternalGenerateKey(), keyscope, forumuserid, userid, guildid))) { } Task.Run(async() => { await Task.Delay(600000); ValidationKeys.TryRemove(key); }); ValidationKeys.Add(key); return(key); }
public void method_2() { for (int i = 0; i < (this.list_0.Count - 1); i++) { IMessageTypeRoom room = this.list_0[i]; KeyScope scope = new KeyScope(room.StartKey, room.MaxKeyValue); for (int j = i + 1; j < this.list_0.Count; j++) { IMessageTypeRoom room2 = this.list_0[j]; if (scope.Intersect(new KeyScope(room2.StartKey, room2.MaxKeyValue))) { throw new Exception(string.Format("MessageType Conflicted between [{0}] and [{1}] !", room.GetType(), room2.GetType())); } } } foreach (IMessageTypeRoom room in this.list_0) { Type t = room.GetType(); string classSimpleName = TypeHelper.GetClassSimpleName(t); foreach (PropertyInfo info in t.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { if ((info.CanWrite && (info.PropertyType == typeof(int))) && (info.Name != "StartKey")) { int key = (int)info.GetValue(room, null); string str2 = string.Format("{0}.{1}", classSimpleName, info.Name); lock (this.idictionary_0) { this.idictionary_0.Remove(key); this.idictionary_0.Add(key, str2); } } } } if (this.class141_0 != null) { foreach (IMessageTypeRoom room3 in this.list_0) { foreach (int num5 in room3.PushKeyList) { this.class141_0.method_9(num5); } } } }
private static bool IsValidScopeForSetting(KeyScope scope) { switch (scope) { case KeyScope.AddedApplications: // check app return(IsForegroundWindowInAppList()); case KeyScope.FullScreenApplications: return(IsForegroundWindowFullScreen()); case KeyScope.Global: return(true); default: Console.Error.WriteLine($"Unknown KeyScope {scope}. Your settings.json may be corrupted."); return(false); } }