public UserInfo(Guid id, Guid token, ProfileEnum profile) { Id = id; Token = token; LastConnection = DateTime.Now; Profile = profile; }
public static void EndSample(ProfileEnum profile) { m_stackCounter--; float num = Time.realtimeSinceStartup - m_stamps[m_stackCounter].Stamp; m_profiles[(int)profile].Time += num; m_profiles[(int)profile].Count++; }
private static Guid Register(Guid id, ProfileEnum profile) { _users = _users ?? new List <UserInfo>(); if (!_users.Any(a => a.Id.Equals(id))) { _users.Add(new UserInfo(id, Guid.NewGuid(), profile)); } var response = _users.FirstOrDefault(f => f.Id.Equals(id)); response.LastConnection = DateTime.Now; return(response.Token); }
public static bool CheckAccess(MethodBase method, ProfileEnum profile) { var attributes = method.GetCustomAttributes(typeof(AccessAttribute), true); if (attributes.Count() == 0) { return(true); } var access = attributes.FirstOrDefault() as AccessAttribute; if (access == null) { return(true); } switch (access.MinimumProfile) { case ProfileEnum.Superuser: return(profile == ProfileEnum.Superuser); case ProfileEnum.Protector: return(profile == ProfileEnum.Protector); case ProfileEnum.Administrator: return(profile == ProfileEnum.Administrator || profile == ProfileEnum.Protector); case ProfileEnum.Manager: return(profile == ProfileEnum.Administrator || profile == ProfileEnum.Manager || profile == ProfileEnum.Protector); case ProfileEnum.Creator: return(profile == ProfileEnum.Administrator || profile == ProfileEnum.Creator || profile == ProfileEnum.Manager || profile == ProfileEnum.Protector); case ProfileEnum.User: default: return(profile != ProfileEnum.Superuser); } }
private void SetNewDefaults(string key, ProfileEnum newvalue) { foreach (SettingHandle h in Settings.Handles) { if (h is SettingHandle <int> handle) { if (newvalue > 0) { bool isPreset = Extracted(key, handle.Name, out int presetValue); if (isPreset) { handle.DefaultValue = presetValue; } } else { handle.DefaultValue = BaseBeauty[handle.Name]; } } } }
public static string ToAttribute(this ProfileEnum value) { switch (value) { case ProfileEnum.USER_PROFILE_PATH: return("profilePath"); case ProfileEnum.LOGON_SCRIPT: return("scriptPath"); case ProfileEnum.HOME_FOLDER_LOCAL_PATH: return("homeDirectory"); case ProfileEnum.HOME_FOLDER_CONNECT_DRIVE: return("homeDrive"); case ProfileEnum.HOME_FOLDER_CONNECT_TO: return("homeDirectory"); default: throw new ArgumentException($"Invalid Enum:{value.ToString()}"); } }
//For Seed private Profile(ProfileEnum @enum) { Id = (int)@enum; Description = @enum.ToString(); }
public static void BeginSample(ProfileEnum profile) { m_stamps[m_stackCounter].Profile = profile; m_stamps[m_stackCounter].Stamp = Time.realtimeSinceStartup; m_stackCounter++; }
public AccessAttribute(ProfileEnum minimumProfile = ProfileEnum.User) { MinimumProfile = minimumProfile; }
internal static string getAttribute(this LdapEntry entry, ProfileEnum value) { var attr = value.ToAttribute(); return(entry.getAttribute(attr)?.ToString()); }