예제 #1
0
        public OAuthForm(OAuth oauth, string callbackURL)
        {
            InitializeComponent();

              this.oauth = oauth;
              this.callbackURL = callbackURL;

              if (oauth.ServiceIcon != null)
            this.Icon = oauth.ServiceIcon;

              if (oauth.ServiceName != "")
            this.Text = "Authorize " + oauth.ServiceName;

              string authURL = oauth.GetAuthorizeURL(callbackURL);
              if (authURL != "")
            this.webAuth.Navigate(authURL);
              else
            this.webAuth.DocumentText = "<!DOCTYPE html><html><body><center><br/><br/><h1>" + this.oauth.ServiceName + " appears to be offline.</h1><p>Try again in a minute!</p><p><a href=\"" + authURL + "\">Retry now</a></p></center></body></html>";
        }
예제 #2
0
        public void LoadSettings()
        {
            if (settings.Contains("ShortcutModifiers")) {
                // Migrate old 3.00 config file
                settings.SetString("ShortcutDragModifiers", settings.GetString("ShortcutModifiers"));
                settings.SetString("ShortcutDragKey", settings.GetString("ShortcutKey"));
                settings.SetString("ShortcutPasteModifiers", "");
                settings.SetString("ShortcutPasteKey", "");

                settings.Delete("ShortcutModifiers");
                settings.Delete("ShortcutKey");

                settings.Save();
            }

            if (!settings.Contains("AccessToken")) {
                // Migrate old 3.10 config file
                settings.SetString("Username", "");
                settings.SetBool("IsPro", false);
                settings.SetString("AccessToken", "");
                settings.SetString("AccessTokenSecret", "");

                settings.Save();
            }

            imageFormat = settings.GetString("Format");

            shortCutDragModifiers = settings.GetString("ShortcutDragModifiers");
            shortCutDragKey = settings.GetString("ShortcutDragKey");
            shortCutPasteModifiers = settings.GetString("ShortcutPasteModifiers");
            shortCutPasteKey = settings.GetString("ShortcutPasteKey");

            this.oauth = new OAuth("https://" + "api.imgur.com/oauth/", this.imgurConsumerKey, this.imgurConsumerSecret);
            this.oauth.ServiceIcon = new Icon("Addons/Imgur/Icon.ico");
            this.oauth.ServiceName = "Imgur";

            this.username = settings.GetString("Username");
            this.isPro = settings.GetBool("IsPro");
            this.oauth.AccessToken = settings.GetString("AccessToken");
            this.oauth.AccessTokenSecret = settings.GetString("AccessTokenSecret");
            authenticated = username != "" && this.oauth.AccessToken != "";
        }