コード例 #1
0
ファイル: HttpHelper.cs プロジェクト: Duke-Jones/ED-IBE
 public HttpHelper(Profile profile)
 {
     _CurrentProfile = profile;
     if (profile.Cookies == null)
     {
         profile.Cookies = new CookieContainer();
     }
 }
コード例 #2
0
ファイル: EliteCompanion.cs プロジェクト: Duke-Jones/ED-IBE
 /// <summary>
 /// Creates a user profile, which is stored on disk. Password will be encrypted using machine key. Created profile will be set as active profile.
 /// </summary>
 /// <param name="email">Email of user</param>
 /// <param name="password">Password of user</param>
 public void CreateProfile(string email, string password)
 {
     Profile profile = new Profile();
     profile.Email = email.ToLower();
     //Encrypt password
     var passwordData = Encoding.UTF8.GetBytes(password);
     var encryptedData = MachineKey.Protect(passwordData);
     profile.Password = Convert.ToBase64String(encryptedData);
     profile.Save();
     _Cache.Remove(Constants.CACHE_PROFILEJSON);
     _sWatch.stopMeasuring();
     _CurrentProfile = profile;
     _Http = new HttpHelper(_CurrentProfile);
 }
コード例 #3
0
ファイル: EliteCompanion.cs プロジェクト: Duke-Jones/ED-IBE
 /// <summary>
 /// Loads a profile and sets it as active.
 /// </summary>
 /// <param name="email">Email of user</param>
 /// <returns>false if profile was not created</returns>
 public bool LoadProfile(string email)
 {
     var profile = Profile.Load(email);
     if (profile == null)
     {
         return false;
     }
     _Cache.Remove(Constants.CACHE_PROFILEJSON);
     _sWatch.stopMeasuring();
     _CurrentProfile = profile;
     _Http = new HttpHelper(_CurrentProfile);
     return true;
 }
コード例 #4
0
ファイル: EliteCompanion.cs プロジェクト: Duke-Jones/ED-IBE
        public void DeleteProfile(string email)
        {
            Profile.Delete(email);

            if(_CurrentProfile.Email.Equals(email, StringComparison.CurrentCultureIgnoreCase))
            { 
                _Cache.Remove(Constants.CACHE_PROFILEJSON);
                _sWatch.stopMeasuring();
                _CurrentProfile = null;;
            }

        }