Beispiel #1
0
        ///// <summary>
        /////
        ///// </summary>
        //private void CreateDefaultArrays() // ToDo: Rausnehmen
        //{
        //    string[] nameArray =
        //        {
        //    "Notification.Default",
        //    "Ibo.Food.Order",
        //    "Ibo.Food.Success",
        //    "Pc.Started",
        //    "Ibo.Cake",
        //    "EMail.Inbox",
        //    "EMail.Private"
        //        };

        //    string[] tokenArray =
        //        {
        //        "aCbwemDsa3rwWmtqj1BGsecNVgjPK4",
        //    "arZjan33BPf5tQB9DHZCwA4kKXLEsT",
        //    "aygTN3PH58fh1VqRS2zdq5V2o858qH",
        //    "afh6e5289QD1X8efymoDZXunWoPmRb",
        //    "apGMNL9qgxeQVKdCR4crdE7GsstgY3",
        //    "aPbXdi9KALc6dqooGk2SPqJCnTaUdn",
        //    "abyYLX4tp5vdf6jK2XsEnShWNBjyar"
        //        };

        //    List<string> names = new List<string>(nameArray);
        //    List<string> tokens = new List<string>(tokenArray);
        //    names.AddRange(nameArray);
        //    tokens.AddRange(tokenArray);
        //    TokenNames = names.ToArray();
        //    TokenIDs = tokens.ToArray();
        //}

        /// <summary>
        /// Liefert die angeforderte Variable zurück
        /// </summary>
        /// <returns>The variable.</returns>
        /// <param name="expression">Expression.</param>
        public string GetVariable(string expression)
        {
            if (expression == Variables[0]) // Die Systemzeit
            {
                return(string.Format("{0} {1}", DateTime.Now.ToShortTimeString(), Supporter.GetAM(DateTime.Now)));
            }
            else if (expression == Variables[1]) // Das Systemdatum als zahlenfolge
            {
                return(DateTime.Now.ToShortDateString());
            }
            else if (expression == Variables[2]) // Das Systemdatum als Text
            {
                return(DateTime.Now.ToLongDateString());
            }
            else if (expression == Variables[3]) // Systemzeit & datum
            {
                return(string.Format("{0} {1}", DateTime.Now.ToLongDateString(), string.Format("{0} {1}", DateTime.Now.ToShortTimeString(), Supporter.GetAM(DateTime.Now))));
            }
            else if (expression == Variables[4]) // Angemeldeter Nutzer
            {
                return(Environment.UserName);
            }
            else if (expression == Variables[5]) // Domain
            {
                return(Environment.UserDomainName);
            }
            else if (expression == Variables[6]) // Computer
            {
                return(Environment.MachineName);
            }
            else if (expression == Variables[7]) // Domain & Angemeldeter Benutzer
            {
                return(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
            }
            else
            {
                return(string.Empty);
            }
        }
Beispiel #2
0
 private void SetUpUser(string token, string secret)
 {
     if (Settings.Default.userToken == string.Empty) // Neu erstellen
     {
         Settings.Default.userToken  = token;
         Settings.Default.userSecret = secret;
         LoginLabel(true);
     }
     else if (Settings.Default.userToken != string.Empty && Settings.Default.userToken != token) // Vorhandenen überschreiben
     {
         DialogResult result = MessageBox.Show("Override the existing account?\r\n" + Settings.Default.userToken, "Existing UserToken", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
         if (result == DialogResult.Yes)
         {
             Settings.Default.userToken  = token;
             Settings.Default.userSecret = secret;
             LoginLabel(true);
         }
         else
         {
             return;
         }
     }
     else
     {
         LoginLabel(true);
     }
     labelUser.Text = Settings.Default.loginName;
     labelDate.Text = string.Format("{0} {1}", Settings.Default.loginDate.ToLongDateString(), string.Format("{0} {1}", Settings.Default.loginDate.ToShortTimeString(), Supporter.GetAM(Settings.Default.loginDate)));
     Settings.Default.userIsLoggedIn = true;
     SwitchLogStatus(true);
     Settings.Default.Save();
 }