public UserGetter(LocalUser user) : this(user.PrivateKey) { }
Vector3 oobGunOffs = new Vector3(0.074f, 0.46f, 0.84f); // offset of gun from aimBone (out of body view) void Start() { // components if (bod == null) { bod = gameObject.AddComponent <CcBody>(); } // get cc = GetComponent <CharacterController>(); var o = GameObject.Find("Main Program"); net = o.GetComponent <CcNet>(); hud = o.GetComponent <Hud>(); arse = o.GetComponent <Arsenal>(); locUser = o.GetComponent <LocalUser>(); // new female model //Model = (GameObject)GameObject.Instantiate(Models.Get("Mia")); //Model.SetActive(true); //Model.hideFlags = HideFlags.None; //.DontSave; // ....to the scene. AND don't DESTROY when new scene loads // the rest is all dependent on User class if (User == null) { return; } if (User.local && net.CurrMatch.pitchBlack) { Camera.main.backgroundColor = Color.black; RenderSettings.ambientLight = Color.black; } if (User.lives >= 0) { if (User.local) { SetModelVisibility(false); } else { SetModelVisibility(true); } Respawn(); } else { // we joined as a spectator SetModelVisibility(false); transform.position = -Vector3.up * 99f; } // get rid of gun1 and gun2 builtin to the avatar MeshInHand.GetComponent <Renderer>().enabled = false; MeshInHand.SetActive(false); MeshOnBack.SetActive(false); MeshOnBack.GetComponent <Renderer>().enabled = false; }
private void loginResultCallBack(Authenticator.AuthStatus status, LocalUser user) { if (buttonLogin.InvokeRequired) //Turi būti tas pats thread { buttonLogin.Invoke(new Authenticator.LoginResultDelegate(loginResultCallBack), new object[] { status, user }); } else { buttonLogin.Enabled = true; string message = ""; switch (status) { case Authenticator.AuthStatus.UsernameEmpty: message = "Vartotojo vardas negali būti tuščias"; break; case Authenticator.AuthStatus.PasswordEmpty: message = "Vartotojo slaptažodis negali būti tuščias"; break; case Authenticator.AuthStatus.FailedToConnect: message = "Nepavyko prisijungti prie serverio"; break; case Authenticator.AuthStatus.InvalidUsernameOrPassword: message = "Neteisingas vartotojo vardas/slaptažodis"; break; case Authenticator.AuthStatus.InvalidPrivateKey: //Prisiminti login message = "Bandykite prisijungti išnaujo"; break; case Authenticator.AuthStatus.Success: message = "Success"; break; default: message = "Kažkas nepavyko"; break; } statusLabel.Text = message; if ((status == Authenticator.AuthStatus.Success)) { if (checkBoxRememberLogin.Checked == true) { Properties.Settings.Default.privateKey = user.PrivateKey; Properties.Settings.Default.Save(); } else { Properties.Settings.Default.privateKey = ""; Properties.Settings.Default.Save(); } //Perjungiama į main menu formą MainMenuForm mainForm = new MainMenuForm(user); //Sukurti pagrindinę formą ir parodyti mainForm.Show(); this.Hide(); // Hide this one mainForm.FormClosed += (s, args) => this.Close(); //Kai užsidaro pagrindinė forma, uždaryti ir šitą } } }
public string SendEmail(LocalUser luser, string case_cid, string case_id, string template, LocalUser comment_by = null, string comment_on_case = null, string group_name = null, Case related_case = null) { try { //Sending notification string from_add = _config.GetValue <string>("Smtp:FromAddress"); string server_add = _config.GetValue <string>("Smtp:Server"); string email_pass = _config.GetValue <string>("Smtp:Password"); int email_port = _config.GetValue <int>("Smtp:Port"); string host_add = _config.GetValue <string>("Launch:Host_Name"); string host_port = _config.GetValue <string>("Launch:Host_Port"); MimeMessage message = new MimeMessage(); MailboxAddress from = new MailboxAddress("SOD RequestManager", from_add); message.From.Add(from); MailboxAddress to = new MailboxAddress(luser.FirstName, luser.LocalUserID); message.To.Add(to); // Uncomment this section when group send mail gets fixed, otherwise the system will send duplicate emails to Anya for each member in a group // Copy Admin ([email protected]) to every email sent out by Resolve //MailboxAddress copy = new MailboxAddress("Anya L. Levysmith", "*****@*****.**"); //message.Cc.Add(copy); BodyBuilder bodyBuilder = new BodyBuilder(); // Picking Template if (template == "assignment") { var fileName = $"wwwroot/email_templates/case_assignment.html"; message.Subject = "[" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "] Assigned"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Case_Description}", related_case.Description); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "new_assignment") { var fileName = $"wwwroot/email_templates/new_case_assignment.html"; message.Subject = "[" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "] Assigned"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Case_Description}", related_case.Description); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "g_assignment") { var fileName = $"wwwroot/email_templates/group_case_assignment.html"; message.Subject = "New Case [" + case_cid + "] Assigned"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{group_name}", group_name) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "new_g_assignment") { var fileName = $"wwwroot/email_templates/new_group_case_assignment.html"; message.Subject = "[" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "] Assigned"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{group_name}", group_name) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Case_Description}", related_case.Description) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "comment") { var fileName = $"wwwroot/email_templates/comment_creation.html"; message.Subject = "New Comment on [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID) .Replace("{commenter_fname}", comment_by.FirstName) .Replace("{commenter_lname}", comment_by.LastName) .Replace("{comment_on_case}", comment_on_case); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "new_comment") { var fileName = $"wwwroot/email_templates/new_comment_creation.html"; message.Subject = "New comment on [" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Case_Description}", related_case.Description) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Resolve_UserID}", luser.LocalUserID) .Replace("{commenter_fname}", comment_by.FirstName) .Replace("{commenter_lname}", comment_by.LastName) .Replace("{comment_on_case}", comment_on_case); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "approved") { var fileName = $"wwwroot/email_templates/case_approval.html"; message.Subject = "Case Approved - [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "new_approved") { var fileName = $"wwwroot/email_templates/new_case_approval.html"; message.Subject = "Case Approved - [" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Case_Description}", related_case.Description) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "rejected") { var fileName = $"wwwroot/email_templates/case_rejection.html"; message.Subject = "Case Rejected - [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } else if (template == "new_rejected") { var fileName = $"wwwroot/email_templates/new_case_rejection.html"; message.Subject = "Case Rejected - [" + related_case.CaseType.CaseTypeTitle + "] : [" + case_cid + "]"; var body = File.ReadAllText(fileName); body = body.Replace("{first_name}", luser.FirstName) .Replace("{last_name}", luser.LastName) .Replace("{Resolve_Hostname}", host_add) .Replace("{Resolve_Port}", host_port) .Replace("{Resolve_CASEID}", case_id) .Replace("{Resolve_CASECID}", case_cid) .Replace("{Case_Type}", related_case.CaseType.CaseTypeTitle) .Replace("{Case_Description}", related_case.Description) .Replace("{Created_By}", related_case.LocalUserID) .Replace("{Created_On}", related_case.CaseCreationTimestamp.ToString()) .Replace("{Resolve_UserID}", luser.LocalUserID); bodyBuilder.HtmlBody = body; //bodyBuilder.TextBody = "Hello World!"; message.Body = bodyBuilder.ToMessageBody(); } SmtpClient client = new SmtpClient(); client.Connect(server_add, email_port, false); client.Authenticate(from_add, email_pass); client.Send(message); client.Disconnect(true); client.Dispose(); return("Sent"); } catch { return("Failed"); } }
public CommentManagerBase(LocalUser user) : this(user.PrivateKey) { }
public MessagePoster(LocalUser user) : this(user.PrivateKey) { }
public static bool CheckSignUp(string sessionId, out LocalUser user) { return(ConnectedUsers.TryGetValue(sessionId, out user) && !user.IsOwner); }
public ConversationHistoryForm(LocalUser localUser) { InitializeComponent(); this.Text = "Pokalbiai"; this.localUser = localUser; }
public void LocalUser(IInBitStream bitstream, ref LocalUser data) { data.localIndex = bitstream.ReadIntegerRange(15, -9999); }
public UserReviewTest(LocalUser localUser) { InitializeComponent(); this.localUser = localUser; }
public MessageGetter(LocalUser user, MessageGetDelegate getMessageResult) : this(user.PrivateKey, getMessageResult) { }
private void DeserializeLocalUser(Coherence.Replication.Protocol.Definition.IInBitStream protocolStream) { var ignored = new LocalUser(); unityReaders.Read(ref ignored, protocolStream); }
public UserReviewPoster(LocalUser user) : this(user.PrivateKey) { }
public async Task LoginAsync(UserStatus initialStatus = UserStatus.Online) { await @lock.WriterLockAsync(); try { if (IsLoggedIn) return; IConnection connection = null; ConnectionStream stream = null; CommandReader reader = null; CommandWriter writer = null; ResponseTracker responseTracker = null; IConnectableObservable<Command> commands = null; IDisposable commandsDisposable = null; int transferCount = 0; SocketEndPoint endPoint = SocketEndPoint.Parse("messenger.hotmail.com:1863"); string authTicket = null; while (authTicket == null) { connection = new SocketConnection(); await connection.ConnectAsync(endPoint); stream = new ConnectionStream(connection); writer = new CommandWriter(stream); reader = new CommandReader(stream, new Dictionary<string, Type> { { "VER", typeof(VersionCommand) }, { "CVR", typeof(ClientVersionCommand) }, { "USR", typeof(AuthenticateCommand) }, { "XFR", typeof(TransferCommand) }, { "SYN", typeof(SynchronizeCommand) }, { "SBS", typeof(SbsCommand) }, { "MSG", typeof(MessageCommand) }, { "LST", typeof(UserCommand) }, { "LSG", typeof(GroupCommand) }, { "BPR", typeof(UserPropertyCommand) }, { "BLP", typeof(PrivacySettingCommand) }, { "GTC", typeof(PrivacySettingCommand) }, { "CHG", typeof(ChangeStatusCommand) }, { "UBX", typeof(BroadcastCommand) }, { "PRP", typeof(LocalPropertyCommand) }, { "NLN", typeof(UserOnlineCommand) }, { "ILN", typeof(InitialUserOnlineCommand) }, { "FLN", typeof(UserOfflineCommand) }, { "UUX", typeof(SendBroadcastCommand) }, { "NOT", typeof(NotificationCommand) }, { "QNG", typeof(PingCommand) }, { "CHL", typeof(ChallengeCommand) }, { "ADC", typeof(AddContactCommand) }, { "REM", typeof(RemoveContactCommand) }, { "ADG", typeof(AddGroupCommand) }, { "RMG", typeof(RemoveGroupCommand) }, { "REG", typeof(RenameGroupCommand) }, { "QRY", typeof(AcceptChallengeCommand) }, { "RNG", typeof(RingCommand) }, { "SBP", typeof(ChangeUserPropertyCommand) }, { "IMS", typeof(EnableIMCommand) }, }); commands = reader.GetReadObservable().Publish(); responseTracker = new ResponseTracker(writer, commands); commandsDisposable = commands.Connect(); var versionCommand = new VersionCommand("MSNP12"); var versionResponse = await responseTracker.GetResponseAsync<VersionCommand>(versionCommand, defaultTimeout); if (versionResponse.Versions.Length == 0) throw new ProtocolNotAcceptedException(); var clientVersionCommand = new ClientVersionCommand { LocaleId = "0x0409", OsType = "winnt", OsVersion = "5.0", Architecture = "1386", LibraryName = "MSMSGS", ClientVersion = "5.0.0482", ClientName = "WindowsMessenger", LoginName = credentials.LoginName, }; await responseTracker.GetResponseAsync<ClientVersionCommand>(clientVersionCommand, defaultTimeout); var userCommand = new AuthenticateCommand("TWN", "I", credentials.LoginName); var userResponse = await responseTracker.GetResponseAsync(userCommand, new Type[] { typeof(AuthenticateCommand), typeof(TransferCommand) }, defaultTimeout); if (userResponse is AuthenticateCommand) { authTicket = (userResponse as AuthenticateCommand).Argument; } else if (userResponse is TransferCommand) { TransferCommand transferResponse = userResponse as TransferCommand; if (transferCount > 3) throw new InvalidOperationException("The maximum number of redirects has been reached."); transferCount++; endPoint = SocketEndPoint.Parse(transferResponse.Host); commandsDisposable.Dispose(); reader.Close(); writer.Close(); connection.Dispose(); } } PassportAuthentication auth = new PassportAuthentication(); string authToken = await auth.GetToken(credentials.LoginName, credentials.Password, authTicket); var authCommand = new AuthenticateCommand("TWN", "S", authToken); var authResponse = await responseTracker.GetResponseAsync<AuthenticateCommand>(authCommand, defaultTimeout); var synCommand = new SynchronizeCommand(syncTimeStamp1 ?? "0", syncTimeStamp2 ?? "0"); var synResponse = await responseTracker.GetResponseAsync<SynchronizeCommand>(synCommand, defaultTimeout); IDisposable syncCommandsSubscription = null; List<Command> syncCommands = null; if (synResponse.TimeStamp1 != syncTimeStamp1 || synResponse.TimeStamp2 != syncTimeStamp2) { syncCommands = new List<Command>(); Type[] syncTypes = new Type[] { typeof(MessageCommand), typeof(UserCommand), typeof(GroupCommand), typeof(LocalPropertyCommand), typeof(PrivacySettingCommand), }; syncCommandsSubscription = commands .Where(c => syncTypes.Contains(c.GetType())) .Catch(Observable.Empty<Command>()) .Subscribe(c => syncCommands.Add(c)); //if we're expecting users/groups, wait for them before we proceed if (synResponse.UserCount + synResponse.GroupCount > 0) { await commands .Where(c => c is UserCommand || c is GroupCommand) .Take(synResponse.UserCount + synResponse.GroupCount) .Timeout(defaultTimeout); } } UserCapabilities capabilities = 0; MSNObject displayPicture = MSNObject.Empty; if (LocalUser != null) { capabilities = LocalUser.Capabilities; displayPicture = LocalUser.DisplayPicture; } Command changeStatusCommand = new ChangeStatusCommand(User.StatusToString(UserStatus.Online), (uint)capabilities, displayPicture != MSNObject.Empty ? displayPicture.ToString() : "0"); await responseTracker.GetResponseAsync(changeStatusCommand, defaultTimeout); if (syncCommandsSubscription != null) syncCommandsSubscription.Dispose(); this.writer = writer; this.reader = reader; this.stream = stream; this.connection = connection; this.responseTracker = responseTracker; this.commands = commands; this.commandsDisposable = commandsDisposable; if (LocalUser == null) { LocalUser = new LocalUser(this, credentials.LoginName); userCache.Add(credentials.LoginName, new WeakReference(LocalUser)); } LocalUser.Status = initialStatus; SyncEvents syncEvents = null; if (syncCommands != null) { syncTimeStamp1 = synResponse.TimeStamp1; syncTimeStamp2 = synResponse.TimeStamp2; syncEvents = ProcessSyncCommands(syncCommands); } var commandsSafe = commands .Catch<Command, ConnectionErrorException>(tx => Observable.Empty<Command>()); commandsSafe.OfType<MessageCommand>().Subscribe(cmd => HandleMessages(cmd, connection)); commandsSafe.OfType<RingCommand>().Subscribe(cmd => HandleRings(cmd, connection)); commandsSafe.OfType<BroadcastCommand>().Subscribe(cmd => HandleBroadcasts(cmd, connection)); commandsSafe.OfType<NotificationCommand>().Subscribe(cmd => HandleNotifications(cmd, connection)); commandsSafe.OfType<AddContactCommand>().Subscribe(cmd => HandleNewUsers(cmd, connection)); commandsSafe.OfType<OutCommand>().Subscribe(cmd => HandleOut(cmd, connection)); commandsSafe.OfType<ChallengeCommand>().Subscribe(cmd => HandleChallenges(cmd, connection)); commandsSafe.OfType<UserOnlineCommand>().Subscribe(cmd => HandleOnlineUsers(cmd, connection)); commandsSafe.OfType<InitialUserOnlineCommand>().Subscribe(cmd => HandleOnlineUsers(cmd, connection)); commandsSafe.OfType<UserOfflineCommand>().Subscribe(cmd => HandleOfflineUsers(cmd, connection)); connection.Error += connection_Error; IsLoggedIn = true; OnLoggedIn(); OnUserStatusChanged(new UserStatusEventArgs(LocalUser, initialStatus, UserStatus.Offline, true)); if (syncEvents != null) RaiseSyncEvents(syncEvents); } finally { @lock.WriterRelease(); } }
public ConversationGetter(LocalUser user) : this(user.PrivateKey) { }
// ------[ LOGIN PROMPT ]------ protected virtual void LayoutSubmissionFields() { using (new EditorGUI.DisabledScope(isAwaitingServerResponse)) { // - Account Header - EditorGUILayout.BeginHorizontal(); { if (this.user == null) { EditorGUILayout.LabelField("Not logged in to mod.io"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Log In")) { LoginWindow.GetWindow <LoginWindow>("Login to mod.io"); } } else { EditorGUILayout.LabelField("Logged in as: " + this.user.username); GUILayout.FlexibleSpace(); if (GUILayout.Button("Log Out")) { EditorApplication.delayCall += () => { if (EditorDialogs.ConfirmLogOut(this.user.username)) { this.user = null; LocalUser.instance = new LocalUser(); LocalUser.Save(); isAwaitingServerResponse = false; Repaint(); } }; } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); // - Submission Section - if (!String.IsNullOrEmpty(uploadSucceededMessage)) { EditorGUILayout.HelpBox(uploadSucceededMessage, MessageType.Info); } else if (!String.IsNullOrEmpty(uploadFailedMessage)) { EditorGUILayout.HelpBox(uploadFailedMessage, MessageType.Error); } else if (profile == null) { EditorGUILayout.HelpBox("Please select a mod profile as a the upload target.", MessageType.Info); } else if (profile.modId > 0) { EditorGUILayout.HelpBox(profile.editableModProfile.name.value + " will be updated as used as the upload target on the server.", MessageType.Info); } else { EditorGUILayout.HelpBox(profile.editableModProfile.name.value + " will be created as a new profile on the server.", MessageType.Info); } EditorGUILayout.Space(); // TODO(@jackson): Support mods that haven't been downloaded? profile = EditorGUILayout.ObjectField("Mod Profile", profile, typeof(ScriptableModProfile), false) as ScriptableModProfile; // - Build Profile - using (new EditorGUI.DisabledScope(profile == null)) { EditorGUILayout.BeginHorizontal(); if (EditorGUILayoutExtensions.BrowseButton(buildFilePath, new GUIContent("Modfile"))) { EditorApplication.delayCall += () => { #if UPLOAD_MOD_BINARY_AS_DIRECTORY string path = EditorUtility.OpenFolderPanel("Set Build Location", "", "ModBinary"); #else string path = EditorUtility.OpenFilePanelWithFilters("Set Build Location", "", modBinaryFileExtensionFilters); #endif if (path.Length != 0) { buildFilePath = path; } }; } if (EditorGUILayoutExtensions.ClearButton()) { buildFilePath = string.Empty; } EditorGUILayout.EndHorizontal(); // - Build Profile - #if UPLOAD_MOD_BINARY_AS_DIRECTORY using (new EditorGUI.DisabledScope(!System.IO.Directory.Exists(buildFilePath))) #else using (new EditorGUI.DisabledScope(!System.IO.File.Exists(buildFilePath))) #endif { // - Version - EditorGUI.BeginChangeCheck(); buildProfile.version.value = EditorGUILayout.TextField("Version", buildProfile.version.value); if (EditorGUI.EndChangeCheck()) { buildProfile.version.isDirty = true; } // - Changelog - EditorGUI.BeginChangeCheck(); EditorGUILayout.PrefixLabel("Changelog"); buildProfile.changelog.value = EditorGUILayoutExtensions.MultilineTextField(buildProfile.changelog.value); if (EditorGUI.EndChangeCheck()) { buildProfile.changelog.isDirty = true; } // - Metadata - EditorGUI.BeginChangeCheck(); EditorGUILayout.PrefixLabel("Metadata"); buildProfile.metadataBlob.value = EditorGUILayoutExtensions.MultilineTextField(buildProfile.metadataBlob.value); if (EditorGUI.EndChangeCheck()) { buildProfile.metadataBlob.isDirty = true; } } // TODO(@jackson): if(profile) -> show build list? EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Upload to Server")) { UploadToServer(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } } }
public CategoryManagerBase(LocalUser user) : this(user.PrivateKey) { }
public KarmaBadgeListGetter(LocalUser user) : this(user.PrivateKey) { }
public RankingsGetter(LocalUser user) : this(user.PrivateKey) { }
public UserUpdater(LocalUser user, UpdateUserResultDelegate updateUserResult) : this(user.PrivateKey, updateUserResult) { }
public CategoryGetter(LocalUser user) : this(user.PrivateKey) { }
public MessagePoster(LocalUser user, MessagePostDelegate postMessageResult) : this(user.PrivateKey, postMessageResult) { }
public LocalUser CreateUser(LocalUser item) { return(CreateOrEditUser(item, OperationType.Create)); }
public HelpRequestManager(LocalUser user) : this(user.PrivateKey) { }
public LocalUser EditUser(LocalUser item, string id) { return(CreateOrEditUser(item, OperationType.Edit, id)); }
public void OnEnable() { localUser = LocalUserManager.readOnlyLocalUsersList[0]; }
public async Task <IActionResult> Index() { var ADemail = User.Identity.Name; //Console.WriteLine(ADemail); var LocalUserEmail = _context.LocalUser .FromSqlRaw("SELECT * FROM dbo.LocalUser where LocalUserID={0}", ADemail) .ToList(); var c = LocalUserEmail.Count; if (c == 0) { //Console.WriteLine("Creating Local User"); Graph::GraphServiceClient graphClient = GetGraphServiceClient(new[] { Constants.ScopeUserRead }); var me = await graphClient.Me.Request().GetAsync() as Microsoft.Graph.User; var properties = me.GetType().GetProperties(); IDictionary <string, string> LocalUserAttributes = new Dictionary <string, string>(); foreach (var child in properties) { object value = child.GetValue(me); string stringRepresentation; if (value is string) { stringRepresentation = value?.ToString(); } else { stringRepresentation = ""; } if (child.Name == "OnPremisesSamAccountName") { LocalUserAttributes.Add("NetID", stringRepresentation); } else if (child.Name == "GivenName") { LocalUserAttributes.Add("FirstName", stringRepresentation); } else if (child.Name == "Surname") { LocalUserAttributes.Add("LastName", stringRepresentation); } else if (child.Name == "Mail") { LocalUserAttributes.Add("EmailID", stringRepresentation); } } //ViewData["Me"] = me; var CreateUser = new LocalUser { LocalUserID = LocalUserAttributes["EmailID"], FirstName = LocalUserAttributes["FirstName"], LastName = LocalUserAttributes["LastName"], EmailID = LocalUserAttributes["NetID"] }; _context.Add(CreateUser); EmailPreference e_pref = new EmailPreference { LocalUserID = CreateUser.LocalUserID, CaseCreation = true, CaseAssignment = true, GroupAssignment = true, CommentCreation = true, AttachmentCreation = true, CaseProcessed = true, CasesCreatedByUser = true, CasesAssignedToUser = false, CasesAssignedToUsersGroups = false }; _context.Add(e_pref); await _context.SaveChangesAsync(); /* * Console.WriteLine("Created"); * Console.WriteLine(LocalUserAttributes["NetID"]); * Console.WriteLine(LocalUserAttributes["FirstName"]); * Console.WriteLine(LocalUserAttributes["LastName"]); * Console.WriteLine(LocalUserAttributes["EmailID"]); */ } else { //Console.WriteLine("User Already Exists!"); } // Populate or Check validity of User's group membership var UsersLGroups = _context.UserGroup .Where(m => m.LocalUserID == ADemail) .ToList(); HashSet <string> UsersLocalGroups = new HashSet <string>(); foreach (var g in UsersLGroups) { UsersLocalGroups.Add(g.LocalGroupID); } HashSet <string> UsersRetrievedGroups = new HashSet <string>(); foreach (var claim in User.Claims) { if (claim.Type == "groups") { UsersRetrievedGroups.Add(claim.Value); } } HashSet <string> AllLocalGroups = new HashSet <string>(); var AllGroups = _context.LocalGroup.ToList(); foreach (var g in AllGroups) { AllLocalGroups.Add(g.LocalGroupID); } HashSet <string> GroupsToBeAdded = new HashSet <string>(); HashSet <string> GroupsToBeRemoved = new HashSet <string>(); // Check for every groups that is associated with our application (Resolve) foreach (var group in AllLocalGroups) { if (UsersRetrievedGroups.Contains(group)) { if (UsersLocalGroups.Contains(group)) { } else { GroupsToBeAdded.Add(group); } } else { if (UsersLocalGroups.Contains(group)) { GroupsToBeRemoved.Add(group); } else { } } } foreach (var g in GroupsToBeAdded) { var test = new UserGroup { LocalGroupID = g, LocalUserID = ADemail }; _context.Add(test); } foreach (var g in GroupsToBeRemoved) { var test = _context.UserGroup.Single(b => b.LocalUserID == ADemail && b.LocalGroupID == g); _context.Remove(test); } await _context.SaveChangesAsync(); // Cases created by the User(or on behalf of user), assigned to the User, and assigned to the groups to which the User belongs to var UCases = await _context.LocalUser // Created by the User .Include(s => s.Cases.Where(p => p.Processed == 0)) .ThenInclude(w => w.CaseType) // Including Approvers .Include(s => s.Cases.Where(p => p.Processed == 0)) .ThenInclude(w => w.Approvers) .ThenInclude(w => w.LocalUser) // Created on behalf of the User .Include(s => s.OnBehalves.Where(p => p.Case.Processed == 0)) .ThenInclude(s => s.Case) .ThenInclude(s => s.CaseType) // Including Approvers .Include(s => s.OnBehalves.Where(p => p.Case.Processed == 0)) .ThenInclude(s => s.Case) .ThenInclude(s => s.Approvers) .ThenInclude(w => w.LocalUser) // Assigned to the User .Include(q => q.CasesforApproval.Where(p => p.Case.Processed == 0 && p.Approved == 0)) .ThenInclude(q => q.Case) .ThenInclude(q => q.CaseType) // Including Case Creator .Include(q => q.CasesforApproval.Where(p => p.Case.Processed == 0 && p.Approved == 0)) .ThenInclude(q => q.Case) .ThenInclude(q => q.LocalUser) // Including Approvers .Include(q => q.CasesforApproval.Where(p => p.Case.Processed == 0 && p.Approved == 0)) .ThenInclude(q => q.Case) .ThenInclude(q => q.Approvers) .ThenInclude(w => w.LocalUser) // Assigned to the Groups to which the user belongs to .Include(e => e.UserGroups) .ThenInclude(e => e.LocalGroup) .ThenInclude(e => e.GroupCases.Where(p => p.Case.Processed == 0)) .ThenInclude(e => e.Case) .ThenInclude(e => e.CaseType) // Including Case Creator .Include(e => e.UserGroups) .ThenInclude(e => e.LocalGroup) .ThenInclude(e => e.GroupCases.Where(p => p.Case.Processed == 0)) .ThenInclude(e => e.Case) .ThenInclude(e => e.LocalUser) // Including Approvers .Include(e => e.UserGroups) .ThenInclude(e => e.LocalGroup) .ThenInclude(e => e.GroupCases.Where(p => p.Case.Processed == 0)) .ThenInclude(e => e.Case) .ThenInclude(e => e.Approvers) .ThenInclude(w => w.LocalUser) .Include(e => e.EmailPreference) .FirstOrDefaultAsync(m => m.LocalUserID == ADemail); int group_case_count = 0; foreach (var item in UCases.UserGroups) { foreach (var item2 in item.LocalGroup.GroupCases) { group_case_count += 1; } } ViewData["group_case_count"] = group_case_count; return(View(UCases)); }
public UserGetter(LocalUser user, GetUserResultDelegate getUserResult) : this(user.PrivateKey, getUserResult) { }
void ProcessLine(string line) { if (string.IsNullOrEmpty(line)) { return; } var l = new Line(this, line); OnLineRead(l); int numeric; if (Exts.TryParseIntegerInvariant(l.Command, out numeric)) { var nl = new NumericLine(l, numeric); LocalUser.OnNumeric(nl); OnNumeric(nl); switch (nl.Numeric) { case NumericCommand.RPL_WELCOME: OnRegister(nl); break; case NumericCommand.RPL_ENDOFNAMES: OnSync(nl); break; } } else { switch (l.Command) { case "PING": Pong(l.Message); OnPing(l); break; case "PRIVMSG": if (IrcUtils.IsChannel(l.Target)) { OnPublicMessage(l); } else { OnPrivateMessage(l); } break; case "NOTICE": if (IrcUtils.IsChannel(l.Target)) { OnPublicNotice(l); } else { OnPrivateNotice(l); } break; case "JOIN": var jl = new JoinLine(l); LocalUser.OnJoin(jl); OnJoin(jl); break; case "PART": LocalUser.OnPart(l); OnPart(l); break; case "NICK": var nsl = new NicknameSetLine(l); LocalUser.OnNicknameSet(nsl); OnNicknameSet(nsl); break; case "QUIT": OnQuit(l); LocalUser.OnQuit(l); break; case "KICK": var kl = new KickLine(l); LocalUser.OnKick(kl); OnKick(kl); break; case "TOPIC": LocalUser.OnTopicSet(l); OnTopicSet(l); break; } } }
private void AcceptClient(TcpClient client, ListenerInfo info) { IPEndPoint ep = (IPEndPoint)client.Client.RemoteEndPoint; if (IsKLined(ep.Address)) { Console.WriteLine("Client is K:lined! Dropping."); client.Close(); return; } string ip = ep.Address.ToString(); HostMask mask = HostMask.Parse("*!:" + ep.Port + "@" + ip); mask.Account = "/" + ip; LocalUser user = new LocalUser(this, client, mask, info.Binding.Protocol == Protocols.Rfc2812 ? false : true); user.Start(); UsersByMask.Add(user.Mask, user); }
// Token: 0x0600208D RID: 8333 RVA: 0x00099507 File Offset: 0x00097707 private static bool IsAppropriateTimeToDisplayUserAchievementNotification(LocalUser localUser) { return(!GameOverController.instance); }
// POST api/values public async Task Post(LocalUser user) { m_unitOfWork.LocalUserRepository.Insert(user); await m_unitOfWork.CommitAsync(); }