protected void Page_Load(object sender, EventArgs e) { Response.Write("<div>SAML Test Bed</div>"); Response.Write("<div>Page_Load</div>"); string RawSAMLRequest = Request["SAMLRequest"]; Response.Write("<div>Raw SAMLRequest :: "+RawSAMLRequest+"</div>"); AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.Response samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(Request["SAMLRequest"]); if (samlResponse.IsValid()) { Response.Write("OK!"); Response.Write(samlResponse.GetNameID()); } else { Response.Write("Failed"); } //OneLogin.Saml.AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); //Response.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); }
public static void Load() { if (Directory.Exists(baseAccountPath) == false) Directory.CreateDirectory(baseAccountPath); Account = AccountSettings.Load(baseAccountPath + "\\Accounts.xusr"); IExtendFramework.Text.INIDocument doc = null; if (!File.Exists(baseAccountPath + "\\..\\Settings.ini")) { doc = new IExtendFramework.Text.INIDocument(); doc["general"]["WaitToCheckForEmailSeconds"] = 30000.ToString(); doc.Save(baseAccountPath + "\\..\\Settings.ini"); } doc = new IExtendFramework.Text.INIDocument(baseAccountPath + "\\..\\Settings.ini"); WaitToCheckForEmailSeconds = doc.GetInt32("general", "WaitToCheckForEmailSeconds"); string base2 = baseAccountPath + "\\..\\Emails.list"; // up one folder if (!File.Exists(base2)) { using (StreamWriter sw = new StreamWriter(base2)) { sw.WriteLine(Account.Accounts[0].EmailAddress); sw.Close(); } } StreamReader sr = new StreamReader(base2); while (sr.Peek() != -1) Emails.Add(sr.ReadLine()); sr.Close(); }
protected void Page_Load(object sender, EventArgs e) { string certificate = ConfigurationManager.AppSettings["OktaCertificate"]; string idpSsoTargetUrl = ConfigurationManager.AppSettings["IdpSsoTargetUrlKey"]; if (string.IsNullOrEmpty(Request.Form["SAMLResponse"]) == false) { var accountSettings = new AccountSettings(certificate, idpSsoTargetUrl); var samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(Request.Form["SAMLResponse"]); if (samlResponse.IsValid()) { User myuser = samlResponse.GetUser(); if (Logger.IsDebugEnabled) { PrintUser(myuser); } string employeeNumber; myuser.Attributes.TryGetValue("employeeNumber", out employeeNumber); if (employeeNumber == null) { const string message = "Employee number not found. Either the SAML response is missing the employeeNumber assertion, the value is null, or the assertion could not be parsed."; Logger.Error(message); throw new InvalidOperationException( "Cannot create ICAS session if the employee number is missing. " + message); } //create ICAS token IcasTokenService svc = IcasTokenService.Instance(); string tokenId = svc.CreateIcasToken(employeeNumber); //write the token in the cookie WriteIcasCookie(tokenId); string relayState = Utils.ParseRelayState(Request); if (Uri.IsWellFormedUriString(relayState, uriKind: UriKind.Absolute)) { Response.Redirect(relayState); Logger.Warn(string.Format("RelayState Url is not well formed. RelayState={0}", relayState)); } } else { const string message = "SAML Assertion not found."; Logger.Warn(message); throw (new Exception(message)); } } else { Response.Redirect("/"); } }
protected void Page_Load(object sender, EventArgs e) { AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); Response.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); }
/// <summary> /// Constructs a TextSearchJobManagerTask object with default values. /// </summary> public TextSearchJobManagerTask() { this.textSearchSettings = Settings.Default; this.accountSettings = AccountSettings.Default; //Read some important data from preconfigured environment variables on the Batch compute node. this.accountName = Environment.GetEnvironmentVariable("AZ_BATCH_ACCOUNT_NAME"); this.jobId = Environment.GetEnvironmentVariable("AZ_BATCH_JOB_ID"); }
protected void Page_Load(object sender, EventArgs e) { this.acc = new AccountSettings(); if(!Page.IsPostBack) { loadAccontSettings(); } TextBoxPortIncoming.Attributes.Add("OnKeyDown", "this.value=clean_String(this.value)"); TextBoxPortOutgoing.Attributes.Add("OnKeyDown", "this.value=clean_String(this.value)"); }
private void btnStart_Click(object sender, EventArgs e) { if (dgvAccountList.SelectedRows.Count > 0) { AccountSettings settings = Settings.Single(x => x.Username == (string)dgvAccountList.SelectedRows[0].Cells[0].Value && x.Server == (string)dgvAccountList.SelectedRows[0].Cells[1].Value); if (StartBot != null) { StartBot(this, new EventSettingsArgs(new List <AccountSettings>() { settings })); dgvAccountList.SelectedRows[0].Cells[2].Value = "gestartet"; } } }
void AddAccountEditUI(AccountSettings accountSettings) { var uc_AccountEdit = new Uc_AccountEdit(); uc_AccountEdit.Name = $"accEdit_{accountSettings.Id}"; uc_AccountEdit.Init(accountSettings); uc_AccountEdit.Height = 45; this.fpanelAccounts.Height += uc_AccountEdit.Height + 5; this.fpanelAccounts.Controls.Add(uc_AccountEdit); fpanelAccounts.Controls.SetChildIndex(uc_AccountEdit, 0); uc_AccountEdit.OnRemove += new System.EventHandler(this.OnRemoveAccount); this.uc_AccountEditList.Add(uc_AccountEdit); }
//[ValidateModel] // X-XSRF-TOKEN public async Task <IActionResult> Add([FromBody][Required] AccountSettings accountModel) { if (!ModelState.IsValid) { return(BadRequest(new { code = 400, message = ModelState.Values.First().Errors.First().ErrorMessage })); } var result = await _userManager.CreateAsync(accountModel.ToAccount(), accountModel.Password); return(Json(accountModel)); }
public virtual IActionResult AccountSettings(AccountSettings model) { try { Engine.Settings.Set(model); SaveMessage = "Settings saved!"; MessageType = AlertType.Success; } catch (Exception ex) { SaveMessage = "Error saving: " + ex.Message; MessageType = AlertType.Danger; } return(View(model)); }
private void btnSave_Click(object sender, EventArgs e) { //check saved settings if ((cmbxTranslationService.SelectedIndex == 0 && (string.IsNullOrEmpty(mtsSettingsControl1.ClientId) || string.IsNullOrEmpty(mtsSettingsControl1.ClientSecret))) || (cmbxTranslationService.SelectedIndex == 1 && string.IsNullOrEmpty(bingSettingsControl1.BingAppId))) { MessageBoxEx.Show(this, "Please enter the account details to use.", "Specify Account Details"); return; } AccountSettings accountSettings = new AccountSettings() { UseBing = cmbxTranslationService.SelectedIndex == 1, UseMTS = cmbxTranslationService.SelectedIndex == 0, MTSClientId = mtsSettingsControl1.ClientId, MTSClientSecret = mtsSettingsControl1.ClientSecret, BingAppId = bingSettingsControl1.BingAppId }; Utilities.FormUtility.ValidateSettingsUsingModalDialog(this, ValidateSavedSettings_WorkEventHandler, accountSettings); if (accountSettings.UseMTS) { if (Utilities.FormUtility.HasValidMTSCredentials) { MessageBoxEx.Show(this, "Microsoft Translator Service Account Verified", "Account Validation Success"); Close(); } else { // show error MessageBoxEx.Show(this, "Could not validate Microsoft Translator Service account credentials. Check the event log for more details.", "Account Validation Error"); } } else if (accountSettings.UseBing) { if (Utilities.FormUtility.HasValidAppId) { MessageBoxEx.Show(this, "Bing Application ID verified", "Account Validation Success"); Close(); } else { // show error MessageBoxEx.Show(this, "Could not validate Bing Application ID. Check the event log for more details.", "Account Validation Error."); } } }
private void menuSettings(object sender, RoutedEventArgs e) { HideAllUserControls(); if (ccSettings.Content == null || (ccSettings.Content as AccountSettings).Visibility == Visibility.Collapsed) { AccountSettings _content = new AccountSettings(); _content.OnAccountSave += ApplySettings; ccSettings.Content = _content; } ccSettings.Visibility = Visibility.Visible; (ccSettings.Content as AccountSettings).Visibility = Visibility.Visible; }
public ActionResult Index(AccountSettings settings) { if (!ModelState.IsValid) { return(View(settings)); } UpdateModel(Account.Settings); LoggedInUser.OnboardingTasks.Add(OnboardingTask.SavedSettings.ToString()); HighFive("Settings Saved"); RavenSession.SaveChanges(); return(RedirectToAction("Index")); }
public override int UpdatePriority() { if (this.CollectProfile != null) { AccountSettings account = base.C.Account; if (((account != null) ? account.HangarPalladiumSell : null) != null) { AccountSettings account2 = base.C.Account; if (((account2 != null) ? account2.HangarPalladiumCollect : null) != null) { return(base.UpdatePriority()); } } } return(int.MinValue); }
private void MapCustomerSettings(ref Customer customer, AccountSettings accountSettings) { customer.CreditLimit = accountSettings.CustClass.CreditLimit; customer.ReqPO = accountSettings.CustClass.ReqPO; customer.UserFld2 = accountSettings.PricePackSlip; customer.UserFld3 = accountSettings.UserFld3; //not on form customer.BillingType = accountSettings.CustClass.BillingType; customer.CustClassKey = accountSettings.CustClass.Key; customer.DfltSalesAcctKey = accountSettings.CustClass.DfltSalesAcctKey; customer.FinChgFlatAmt = accountSettings.CustClass.FinChgFlatAmt; customer.FinChgPct = accountSettings.CustClass.FinChgPct; customer.RetntPct = accountSettings.CustClass.RetntPct; customer.TradeDiscPct = accountSettings.CustClass.TradeDiscPct; }
/// <summary> /// Method used for send a message. /// </summary> /// <param name="message">The message will be send.</param> /// <param name="acc">The account information.</param> public void SendMail(Message message, AccountSettings acc) { AccountSettings.AccountInfo arrayAcc_info = acc.Acc_Info; try { if (arrayAcc_info != null) { message.From.Email = arrayAcc_info.EmailAddress; string outgoing = arrayAcc_info.OutgoingServer; int smtp_Port = arrayAcc_info.PortOutgoingServer; string email = EncryptDescript.CriptDescript(arrayAcc_info.EmailAddress); string password = EncryptDescript.CriptDescript(arrayAcc_info.Password); bool ssl = arrayAcc_info.IsOutgoingSecureConnection; bool port = arrayAcc_info.PortOutgoingChecked; if (ssl) { if (port) { ActiveUp.Net.Mail.SmtpClient.SendSsl(message, outgoing, smtp_Port, email, password, ActiveUp.Net.Mail.SaslMechanism.Login); } else { ActiveUp.Net.Mail.SmtpClient.SendSsl(message, outgoing, email, password, ActiveUp.Net.Mail.SaslMechanism.Login); } } else { if (port) { ActiveUp.Net.Mail.SmtpClient.Send(message, outgoing, smtp_Port, email, password, ActiveUp.Net.Mail.SaslMechanism.Login); } else { ActiveUp.Net.Mail.SmtpClient.SendSsl(message, outgoing, email, password, ActiveUp.Net.Mail.SaslMechanism.Login); } } this.storeMessageSent(message); } } catch (Exception) { } }
/// <summary> /// Returns the account settings. OAuth authentication required. /// </summary> /// <exception cref="T:System.ArgumentNullException"> /// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// </exception> /// <exception cref="T:Imgur.API.ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception> /// <exception cref="T:Imgur.API.MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception> /// <returns></returns> public async Task <IAccountSettings> GetAccountSettingsAsync() { if (this.ApiClient.OAuth2Token == null) { throw new ArgumentNullException("OAuth2Token", "OAuth authentication required."); } string url = "account/me/settings"; IAccountSettings accountSettings; using (HttpRequestMessage request = this.RequestBuilder.CreateRequest(HttpMethod.Get, url)) { AccountSettings settings = await this.SendRequestAsync <AccountSettings>(request).ConfigureAwait(false); accountSettings = (IAccountSettings)settings; } return(accountSettings); }
private static AccountSettings AccountSettingsParser(string json) { JObject jsonObj = JsonConvert.DeserializeObject <JObject>(json); AccountSettings accountSettings = new AccountSettings(); Dictionary <string, object> settings = ((JObject)jsonObj["settings"]).ToObject <Dictionary <string, object> >(); foreach (KeyValuePair <string, object> setting in settings) { accountSettings.Settings.Add(setting.Key, setting.Value); } accountSettings.Status = jsonObj["status"].ToObject <string>(); return(accountSettings); }
public EditSettings(AccountSettings s) { InitializeComponent(); Setting = s; Clone = Setting.Clone(); allgemeineSettings1.SetSettings(Clone); tavernSettings1.SetSettings(Clone); toiletteSettings1.SetSettings(Clone); townWatchSettings1.SetSettings(Clone); dungeonTowerSettings1.SetSettings(Clone); arenaSettings1.SetSettings(Clone); gildenSettings1.SetSettings(Clone); characterSettings1.SetSettings(Clone); shopSettings1.SetSettings(Clone); mailSettings1.SetSettings(Clone); }
private string GetClientSettlementAccount(LegalPerson legalPerson, AccountSettings accountSettings) { string settlementAccount = string.Empty; if (accountSettings != null) { var legalPersonBank = legalPerson.LegalPersonBanks .FirstOrDefault(lpb => lpb.Id == accountSettings.LegalPersonBankId); if (legalPersonBank != null) { settlementAccount = legalPersonBank.SettlementAccount; } } return(settlementAccount); }
public void SetSettings(AccountSettings settings) { Settings = settings; CryptManager.Init(Settings); txtFrom.Text = settings.MailFrom; txtTo.Text = settings.MailTo; txtSmtp.Text = settings.MailSmtp; txtUser.Text = settings.MailUserNamer; if (!string.IsNullOrEmpty(settings.MailCryptPasswort)) { txtPasswort.Text = CryptManager.Decrypt(settings.MailCryptPasswort); } numPort.Value = settings.MailPort; ckbSendErrorMail.Checked = settings.SendErrorMail; }
protected void Page_Load(object sender, EventArgs e) { AccountSettings accountSettings = new AccountSettings(); LogoutResponse samlResponse = new LogoutResponse(accountSettings); samlResponse.LoadXmlFromBase64(Request.Form["SAMLResponse"]); if (samlResponse.IsValid()) { HttpContext.Current.Session["user"] = ""; lblMsg.Text = "<h1>You are logged out</h1>"; } else { lblMsg.Text = "Logout failed"; } //Response.Write(samlResponse.ToString()); }
public ActionResult Acs(string response) { // replace with an instance of the users account. AccountSettings accountSettings = new AccountSettings(); Response samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(response); if (samlResponse.IsValid()) { return(Content("OK:" + samlResponse.GetNameID())); } else { return(Content("Failed")); } }
protected void Page_Load(object sender, EventArgs e) { // replace with an instance of the users account. AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.Response samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(Request.Form["SAMLResponse"]); if (samlResponse.IsValid()) { Response.Write("OK!"); Response.Write(samlResponse.GetNameID()); } else { Response.Write("Failed"); } }
private async Task LoadSettings() { var userName = await SecretsHelper.GetUserName(); Account account = await Accounts.GetAccount(userName); Bio = account.Bio; await Task.Delay(100); AccountSettings settings = await Accounts.GetAccountSettings(userName); PublicImages = settings.PublicImages; MessagingEnabled = settings.MessagingEnabled; AlbumPrivacyIndex = ToIndex(settings.AlbumPrivacy); ShowMature = settings.ShowMature; SubscribeNewsletter = settings.NewsletterSubscribed; IsLoaded = true; }
protected void Page_Load(object sender, EventArgs e) { AccountSettings accountSettings = new AccountSettings(); AppSettings settings = new AppSettings(); AuthRequest req = new AuthRequest(settings.issuer,settings.assertionConsumerServiceUrl); XmlDocument doc11 = new XmlDocument(); /*doc11.LoadXml(Encoding.UTF8.GetString(Convert.FromBase64String(req.GetRequest(AuthRequest.AuthRequestFormat.Base64)))); using (XmlTextWriter xmltw = new XmlTextWriter("C:\\Users\\Matvey\\source\\repos\\SamlTestApp\\SamlTestApp\\exampleRequest.xml", new UTF8Encoding(false))) { doc11.WriteTo(xmltw); xmltw.Close(); }*/ Response.Redirect(req.GetRedirectUrl(accountSettings.idp_sso_target_url)); }
public override List <Rectangle> vmethod_16() { AccountSettings account = base.Context.Account; int num = (account != null) ? account.PalladiumCollectionAreaWidth : 0; if (num == this.int_1) { return(this.list_1); } Rectangle value = GClass910.list_0[0]; int num2 = (int)((float)((100 - num) * value.Width) / 100f); value.Width -= num2; value.X += num2; this.list_1[0] = value; this.int_1 = num; return(this.list_1); }
public void AdminUsernameReturnsTrue() { var goodAccount = new Account() { Name = "*****@*****.**" }; var badAccount = new Account() { Name = "*****@*****.**" }; var settings = new AccountSettings { AdminList = goodAccount.Name }; Assert.IsTrue(settings.IsAdmin(goodAccount)); Assert.IsFalse(settings.IsAdmin(badAccount)); }
/// <summary> /// Upload a text file to a cloud blob. /// </summary> /// <param name="accountSettings">The account settings.</param> /// <param name="fileName">The name of the file to upload</param> /// <returns>The URI of the blob.</returns> private static string UploadFileToCloudBlob(AccountSettings accountSettings, string fileName) { CloudBlobClient client = GetCloudBlobClient( accountSettings.StorageAccountName, accountSettings.StorageAccountKey, accountSettings.StorageServiceUrl); //Create the "books" container if it doesn't exist. CloudBlobContainer container = client.GetContainerReference(BooksContainerName); container.CreateIfNotExists(); //Upload the blob. CloudBlockBlob blob = container.GetBlockBlobReference(fileName); blob.UploadFromFile(fileName); return(blob.Uri.ToString()); }
void Start() { Dispatcher = GetComponent <UnityMainThreadDispatcher>(); Logger = new UnityAADLogger(this); _scrollRect = ScrollView.GetComponent <ScrollRect>(); if (AppSettings) { Settings = (AccountSettings)JsonUtility.FromJson(AppSettings.text, typeof(AccountSettings)); } else { Logger.Log("Error: no app settings file - please create an app-settings.json file in your assets folder!"); } LoginProviders.RegisterProviders(Logger, UserStore, Settings.ClientId, Settings.Authority, Settings.TenantId); }
public AccountSettings SetAccountSettings(AccountSettings accountSettings, bool isActual, DbTransaction dbTran) { var accountSettingsId = accountSettings.Id; var lastEditDate = accountSettings.BeginDate; SetAccountSettings( dbTran: dbTran, id: ref accountSettingsId, accountId: accountSettings.AccountId, legalPersonId: accountSettings.LegalPersonId, bankId: accountSettings.LegalPersonBankId, unloadingDateMethod: accountSettings.UnloadingDateMethod, unloadingTo1CTypeId: accountSettings.UnloadingTypeId, unloadingTo1CDayNumber: accountSettings.UnloadingDayNumber, unloadingTo1CActionId: accountSettings.UnloadingTo1CActionId, additionalDescription: accountSettings.AdditionalDescription, accountDescription: accountSettings.AccountDescription, actDescription: accountSettings.ActDescription, shortAccountPositionFormulation: accountSettings.ShortAccountPositionFormulation, advanceAccountPositionFormulation: accountSettings.AdvanceAccountPositionFormulation, contractNumber: accountSettings.ContractNumber, contractDate: accountSettings.ContractDate, showAdditionalDescription: accountSettings.ShowAdditionalDescription, showDetailed: accountSettings.ShowDetailed, showContractInCaption: accountSettings.ShowContractInCaption, showOkpo: accountSettings.ShowOkpo, showSupplier: accountSettings.ShowSupplier, showPositionName: accountSettings.ShowPositionName, showExitDate: accountSettings.ShowExitDate, showExitNumber: accountSettings.ShowExitNumber, showContract: accountSettings.ShowContract, showDiscount: accountSettings.ShowDiscount, addressId: accountSettings.AddressId, isNeedPrepayment: accountSettings.IsNeedPrepayment, interactionBusinessUnitId: accountSettings.InteractionBusinessUnitId, isActual: isActual, lastEditDate: ref lastEditDate, editUserId: _editUserId); accountSettings.Id = accountSettingsId; accountSettings.BeginDate = lastEditDate; return(accountSettings); }
protected Dictionary <string, bool> method_5() { AccountSettings account = base.Context.Account; return(new Dictionary <string, bool> { { "alpha", account != null && account.Spinner_Alpha }, { "beta", account != null && account.Spinner_Beta }, { "gamma", account != null && account.Spinner_Gamma }, { "delta", account != null && account.Spinner_Delta }, { "epsilon", account != null && account.Spinner_Epsilon }, { "zeta", account != null && account.Spinner_Zeta }, { "kappa", account != null && account.Spinner_Kappa }, { "lambda", account != null && account.Spinner_Lambda }, { "streuner", account != null && account.Spinner_Kuiper } }); }
public async Task GetSkillDependingOnMoveList(AccountSettings account, AccountSettings enemy, SocketReaction reaction, int i) { var skills = GetSkillListFromTree(account); var ski = Convert.ToUInt64(skills[GetSkillNum(reaction) - 1]); var skill = _spellAccounts.GetAccount(ski); if (account.SkillCooldowns.Any(x => x.skillId == skill.SpellId)) { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed _awaitForUserMessage.ReplyAndDeleteOvertime("this skill is on cooldown, use another one", 6, reaction); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed return; } Console.WriteLine($"{skill.SpellNameEn} + {skill.SpellId}"); double dmg = 0; switch (account.MoveListPage) { case 1: dmg = _attackDamageActiveTree.AttackDamageActiveSkills(skill.SpellId, account, enemy, false); break; case 2: dmg = _defenceActiveTree.DefSkills(skill.SpellId, account, enemy, false); break; case 3: dmg = _agilityActiveTree.AgiActiveSkills(skill.SpellId, account, enemy, false); break; case 4: dmg = _magicActiveTree.ApSkills(skill.SpellId, account, enemy, false); break; } await _dealDmgToEnemy.DmgHealthHandeling(skill.WhereDmg, dmg, skill.SpellDmgType, account, enemy); await UpdateTurn(account, enemy); }
public WebContext(HttpContext httpcontext) { this.httpcontext = httpcontext; this.requestTime = DateTime.Now; this.design = this.detectDesign(); HttpCookie sessionCookie = this.httprequest.Cookies[Config.instance.CookiesPrefix + "_session"]; if (sessionCookie != null && sessionCookie.Value != null && sessionCookie.Value != "") { try { var session = Session.LoadByKey(sessionCookie.Value); var tmp = session.account; string lastUrl = null; if (this.httprequest.RequestType == "GET") { if (this.design.IsHuman) { lastUrl = this.httprequest.Path; } } session.updateLastActivity(lastUrl); HttpCookie newCookie = this.createCookie(Config.instance.CookiesPrefix + "_session"); newCookie.Value = session.sessionKey; newCookie.Expires = DateTime.Now.AddSeconds(Config.instance.SessionLifetime); this.httpresponse.AppendCookie(newCookie); this.session = session; } catch (NotFoundInDBException) { sessionCookie.Value = ""; sessionCookie.Expires = DateTime.Now.AddDays(-1); this.httpresponse.AppendCookie(sessionCookie); //throw; //TODO: remove me! } } if (this.session != null) { this.userSettings = AccountSettings.LoadByAccount(this.session.account); } else { this.userSettings = new AnonymousUserSettings(null); } }
private static void Main() { // Call the asynchronous version of the Main() method. This is done so that we can await various // calls to async methods within the "Main" method of this console application. try { AccountSettings accountSettings = SampleHelpers.LoadAccountSettings(); MainAsync(accountSettings).Wait(); } catch (AggregateException ex) { SampleHelpers.PrintAggregateException(ex); throw; } Console.WriteLine("Press return to exit..."); Console.ReadLine(); }
private async Task AutoLogin() { #region 每次恢复时自动登录一下 string err = string.Empty; try { await AccountSettings.AutoLogin(); } catch (System.Net.WebException we) { err = string.Format("请检查网络设置 :( \n", we.Message); } if (!string.IsNullOrEmpty(err)) { await new MessageDialog(err, "注意").ShowAsync(); } #endregion }
/// <summary> /// Connect the imap client. /// </summary> /// <param name="accountInfo">The information account</param> public void Connect(AccountSettings.AccountInfo accountInfo) { if (this._imap4Client == null || !this._imap4Client.IsConnected) { if (accountInfo != null && accountInfo.AccType == AccountType.POP3) { this._imap4Client = new Imap4Client(); int port = accountInfo.PortIncomingServer; bool ssl = accountInfo.IsIncomeSecureConnection; string serverName = accountInfo.IncomingNameMailServer; string user = accountInfo.EmailAddress; string password = accountInfo.Password; bool useInPort = accountInfo.PortIncomingChecked; if (ssl) { if (useInPort) { this._imap4Client.ConnectSsl(serverName, port); } else { this._imap4Client.ConnectSsl(serverName); } } else { if (useInPort) { this._imap4Client.Connect(serverName, port); } else { this._imap4Client.Connect(serverName); } } this._imap4Client.Login(user, password); } } }
private void ReadAccountSettingsFile() { try { if(File.Exists(GearFiles.AccountSettingsFilename)) { using (FileStream file = File.OpenRead(GearFiles.AccountSettingsFilename)) { mAccountSettings = Serializer.Deserialize<AccountSettings>(file); } } else if(File.Exists(GearFiles.BackupAccountSettingsFilename)) { using (FileStream file = File.OpenRead(GearFiles.BackupAccountSettingsFilename)) { mAccountSettings = Serializer.Deserialize<AccountSettings>(file); } } else { mAccountSettings = new AccountSettings(); SaveAccountSettingsFile(); } } catch { if(File.Exists(GearFiles.BackupAccountSettingsFilename)) { using (FileStream file = File.OpenRead(GearFiles.BackupAccountSettingsFilename)) { mAccountSettings = Serializer.Deserialize<AccountSettings>(file); } } else { mAccountSettings = new AccountSettings(); SaveAccountSettingsFile(); } } }
/// <summary> /// Submits a job to the Azure Batch service, and waits for it to complete /// </summary> private static async Task HelloWorldAsync(AccountSettings accountSettings, Settings helloWorldConfigurationSettings) { Console.WriteLine("Running with the following settings: "); Console.WriteLine("-------------------------------------"); Console.WriteLine(helloWorldConfigurationSettings.ToString()); Console.WriteLine(accountSettings.ToString()); // Set up the Batch Service credentials used to authenticate with the Batch Service. BatchSharedKeyCredentials credentials = new BatchSharedKeyCredentials( accountSettings.BatchServiceUrl, accountSettings.BatchAccountName, accountSettings.BatchAccountKey); // Get an instance of the BatchClient for a given Azure Batch account. using (BatchClient batchClient = await BatchClient.OpenAsync(credentials)) { // add a retry policy. The built-in policies are No Retry (default), Linear Retry, and Exponential Retry batchClient.CustomBehaviors.Add(RetryPolicyProvider.LinearRetryProvider(TimeSpan.FromSeconds(10), 3)); string jobId = GettingStartedCommon.CreateJobId("HelloWorldJob"); try { // Submit the job await SubmitJobAsync(batchClient, helloWorldConfigurationSettings, jobId); // Wait for the job to complete await WaitForJobAndPrintOutputAsync(batchClient, jobId); } finally { // Delete the job to ensure the tasks are cleaned up if (!string.IsNullOrEmpty(jobId) && helloWorldConfigurationSettings.ShouldDeleteJob) { Console.WriteLine("Deleting job: {0}", jobId); batchClient.JobOperations.DeleteJob(jobId); } } } }
/// <summary> /// Connect the imap4 client. /// </summary> /// <param name="accountInfo">The account information.</param> public void Connect(AccountSettings.AccountInfo accountInfo) { if (accountInfo != null && accountInfo.MailAccountType == AccountType.IMAP) { this.Imap4Client = new Imap4Client(); int port = accountInfo.InPort; bool ssl = accountInfo.IncomingIsSSL; string serverName = accountInfo.IncomingServerName; string user = accountInfo.EmailAddress; string password = accountInfo.Password; bool useInPort = accountInfo.InPortEnabled; if (ssl) { if (useInPort) { this.Imap4Client.ConnectSsl(serverName, port); } else { this.Imap4Client.ConnectSsl(serverName); } } else { if (useInPort) { this.Imap4Client.Connect(serverName, port); } else { this.Imap4Client.Connect(serverName); } } this.Imap4Client.Login(user, password); } }
private void loadAccontSettings() { this.acc = AccountSettings.Load("AccountSettings"); //AccountSettings.AccountInfo acc_info = (AccountSettings.AccountInfo)((IEnumerator)this.acc.Accounts.GetEnumerator()).Current; AccountSettings.AccountInfo [] arrayAcc_info = this.acc.Accounts; if (arrayAcc_info != null) { AccountSettings.AccountInfo acc_info = arrayAcc_info[0]; if(acc_info != null) { TextBoxPassword.Text = acc_info.Password; TextBoxDisplayName.Text = acc_info.DisplayName; int i = 0; foreach (ListItem item in DropDownListIncomingServer.Items) { if (item.Text == acc_info.IncomingMailServer) { DropDownListIncomingServer.SelectedIndex = i; } i++; } TextBoxEmailAddress.Text = acc_info.EmailAddress; TextBoxOutgoingServer.Text = acc_info.OutgoingServer; TextBoxLoginID.Text = acc_info.LoginId; TextBoxPortIncoming.Text = acc_info.PortIncomingServer.ToString(); TextBoxPortOutgoing.Text = acc_info.PortOutgoingServer.ToString(); CheckBoxSecureConnection.Checked = acc_info.IsIncomeSecureConnection; CheckBoxOutgoingSecure.Checked = acc_info.IsOutgoingSecureConnection; CheckBoxOutgoingAuthentication.Checked = acc_info.IsOutgoingWithAuthentication; CheckBoxPortIncoming.Checked = acc_info.PortIncomingChecked; CheckBoxPortOutgoing.Checked = acc_info.PortOutgoingChecked; } } }
/// <summary> /// Method used for send a message. /// </summary> /// <param name="accountInfo">The account information.</param> /// <param name="recipient">The recipients email.</param> /// <param name="subject">The message subject.</param> /// <param name="body">The message body.</param> /// <param name="attachments">The message attachements.</param> /// <returns>The ActiveUp.Net.Mail.Message sent or null if the message was not sent.</returns> public ActiveUp.Net.Mail.Message SendMessage(AccountSettings.AccountInfo accountInfo, string recipient, string subject, string body, string[] attachments) { // We create the message object. ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message(); try { // We assign the sender email. message.From.Email = accountInfo.EmailAddress; string separator = ","; string[] recipients = recipient.Split(separator.ToCharArray()); foreach (string r in recipients) { // We assign the recipient email message.To.Add(r); } // We assign the subject message.Subject = subject; // We assign the body text message.BodyText.Text = body; // We assign the attachments. foreach (string attachment in attachments) { message.Attachments.Add(attachment, false); } int port = accountInfo.OutPort; bool ssl = accountInfo.OutgoingIsSSL; string serverName = accountInfo.OutgoingServerName; string password = accountInfo.Password; bool useOutPort = accountInfo.OutPortEnabled; SaslMechanism saslMechanism = SaslMechanism.Login; // TODO string user = accountInfo.LoginName; if (user == null || user.Equals(string.Empty)) { user = accountInfo.EmailAddress; } if (ssl) { if (useOutPort) { SmtpClient.SendSsl(message, serverName, port, user, password, saslMechanism); } else { SmtpClient.SendSsl(message, serverName, user, password, saslMechanism); } } else { if (useOutPort) { SmtpClient.Send(message, serverName, port, user, password, saslMechanism); } else { SmtpClient.Send(message, serverName, user, password, saslMechanism); } } } catch (Exception ex) { message = null; // TODO - Manipulate the exception properly. throw ex; } return message; }
private void SetSettings(object sender, RoutedEventArgs e) { var account = new Account(this.AccountAddressBox.Text, this.AccountSecretBox.Text); this.SetSettingsButton.IsEnabled = false; this.SetSettingsLabel.Content = "Submiting..."; this.SetSettingsLabel.Foreground = Brushes.Orange; new Thread(() => { object result = null; Exception ex = null; try { result = account.SetSettings(client, settings); } catch (Exception exc) { ex = exc; } this.Dispatcher.Invoke((Action)delegate { this.SetSettingsButton.IsEnabled = true; if (ex != null) { this.SetSettingsLabel.Content = ex.ToString(); this.SetSettingsLabel.Foreground = Brushes.Red; } else { this.SetSettingsLabel.Content = "Successfully submitted."; this.SetSettingsLabel.Foreground = Brushes.DarkGreen; this.GetSettingsBox.SelectedObject = settings = (AccountSettings)result; } }); }).Start(); }
/// <summary> /// Retrieves the Email Account Settings from a file. /// </summary> /// <param name="file">File path to load from.</param> /// <returns>An instance of AccountSettings object.</returns> public static AccountSettings Load(string file) { if (!File.Exists(file)) { return null; } // TODO: MAke this binary System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer( typeof(AccountSettings)); StreamReader reader = File.OpenText(file); AccountSettings c = new AccountSettings(); try { c = (AccountSettings)xs.Deserialize(reader); } catch (Exception) { } reader.Close(); return c; }
/// <summary> /// Saves the Email accont settings to a file. /// </summary> /// <param name="file">The file path to save to.</param> /// <param name="c">AccountSettings object.</param> public static void Save(string file, AccountSettings c) { try { if (File.Exists(file)) File.Delete(file); // TODO: MAke this binary System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(c.GetType()); StreamWriter writer = File.CreateText(file); xs.Serialize(writer, c); writer.Flush(); writer.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static Task Save(this TwitterAccount account) { var settings = new AccountSettings { AccountName = account.User.ScreenName.Value, Tokens = account.Tokens.Select(t => t.ToSettings()).ToList(), CurrentApplicationId = account.CurrentToken.Application.Id, UseUserStreams = account.UserStreams.UseUserStreams }; return settings.Save(); }
public JobSubmitter(AccountSettings accountSettings, Settings settings) { this.jobManagerSettings = settings; this.accountSettings = accountSettings; }
/// <summary> /// Default constructor. /// </summary> /// <param name="accountInfo">The default account information.</param> public Imap4Controller(AccountSettings.AccountInfo accountInfo) { this.Connect(accountInfo); }
public Facade() { this._accSettings = AccountSettings.Load(Constants.ACCOUNT_FILE_NAME_SETTINGS); this.popController = new Pop3Controller(); this._imapController = new ImapController(); this.smtpController = new SmtpController(); this._changeImcoming = false; }
/// <summary> /// Method for sets an Account Information. /// </summary> /// <param name="acc">The Account information</param> public void setAccountInfo(AccountSettings.AccountInfo acc) { if (this._accSettings != null) { this._accSettings.Acc_Info = acc; } else { this.AccSettings = new AccountSettings(); this.AccSettings.Acc_Info = acc; } }
public Response(AccountSettings accountSettings) { this.accountSettings = accountSettings; certificate = new Certificate(); certificate.LoadCertificate(accountSettings.certificate); }
public Pop3Controller(AccountSettings.AccountInfo accountInfo) { //this.Connect(accountInfo); this.ListMessageInbox = new List<Message>(); this.ListHeaderInbox = new List<MailHeader>(); }
private void AddConnectionTreeNode(string accountEndpoint, AccountSettings accountSettings) { try { string suffix = Constants.ApplicationName + "/" + Constants.ProductVersion; DocumentClient client = new DocumentClient(new Uri(accountEndpoint), accountSettings.MasterKey, new ConnectionPolicy { ConnectionMode = accountSettings.ConnectionMode, ConnectionProtocol = accountSettings.Protocol, UserAgentSuffix = suffix }); DatabaseAccountNode dbaNode = new DatabaseAccountNode(accountEndpoint, client); treeView1.Nodes.Add(dbaNode); // Update the map. DocumentClientExtension.AddOrUpdate(client.ServiceEndpoint.Host, accountSettings.IsNameBased); if (accountSettings.IsNameBased) { dbaNode.ForeColor = Color.Green; } else { dbaNode.ForeColor = Color.Blue; } // Set the tag to the DatabaseAccount resource object, this might fail if the service is not available. dbaNode.Tag = client.GetDatabaseAccountAsync().Result; } catch (Exception e) { Program.GetMain().SetResultInBrowser(null, e.ToString(), true); } }
public JobSubmitter() { this.poolsAndResourceFileSettings = Settings.Default; this.accountSettings = AccountSettings.Default; }
private void AddAccountToSettings(string accountEndpoint, AccountSettings accountSettings) { bool found = false; // if the account is not in tree view top level, add it! for (int i = 0; i < Settings.Default.AccountSettingsList.Count; i = i + 2) { if ( string.Compare(accountEndpoint, Settings.Default.AccountSettingsList[i], StringComparison.OrdinalIgnoreCase) == 0) { found = true; break; } } if (!found) { Settings.Default.AccountSettingsList.Add(accountEndpoint); Settings.Default.AccountSettingsList.Add(JsonConvert.SerializeObject(accountSettings)); Settings.Default.Save(); AddConnectionTreeNode(accountEndpoint, accountSettings); } }
public JobSubmitter() { this.jobManagerSettings = Settings.Default; this.accountSettings = AccountSettings.Default; }
public JobSubmitter(AccountSettings accountSettings, Settings settings) { this.poolsAndResourceFileSettings = settings; this.accountSettings = accountSettings; }
public AuthRequest(AppSettings appSettings, AccountSettings accountSettings) { this.appSettings = appSettings; this.accountSettings = accountSettings; id = "_" + System.Guid.NewGuid().ToString(); issue_instant = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"); }