OSDN Git Service

TwitterOAuthSetupDialogを追加
authorKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 May 2024 18:13:06 +0000 (03:13 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sun, 19 May 2024 18:02:06 +0000 (03:02 +0900)
OpenTween.Tests/SocialProtocol/Twitter/TwitterOAuthSetupDialogTest.cs [new file with mode: 0644]
OpenTween/SocialProtocol/Twitter/TwitterOAuthSetup.cs [new file with mode: 0644]
OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.Designer.cs [new file with mode: 0644]
OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.cs [new file with mode: 0644]
OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.en.resx [new file with mode: 0644]
OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.resx [new file with mode: 0644]

diff --git a/OpenTween.Tests/SocialProtocol/Twitter/TwitterOAuthSetupDialogTest.cs b/OpenTween.Tests/SocialProtocol/Twitter/TwitterOAuthSetupDialogTest.cs
new file mode 100644 (file)
index 0000000..faf79ad
--- /dev/null
@@ -0,0 +1,34 @@
+// OpenTween - Client of Twitter
+// Copyright (c) 2024 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
+// All rights reserved.
+//
+// This file is part of OpenTween.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+using Xunit;
+
+namespace OpenTween.SocialProtocol.Twitter
+{
+    public class TwitterOAuthSetupDialogTest
+    {
+        [WinFormsFact]
+        public void Initialize_Test()
+        {
+            using var dialog = new TwitterOAuthSetupDialog();
+        }
+    }
+}
diff --git a/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetup.cs b/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetup.cs
new file mode 100644 (file)
index 0000000..a7920f6
--- /dev/null
@@ -0,0 +1,134 @@
+// OpenTween - Client of Twitter
+// Copyright (c) 2024 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
+// All rights reserved.
+//
+// This file is part of OpenTween.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#nullable enable
+
+using System;
+using System.Threading.Tasks;
+using OpenTween.Connection;
+
+namespace OpenTween.SocialProtocol.Twitter
+{
+    public class TwitterOAuthSetup : NotifyPropertyChangedBase
+    {
+        public bool UseCustomConsumerKey
+        {
+            get => this.useCustomConsumerKey;
+            set => this.SetProperty(ref this.useCustomConsumerKey, value);
+        }
+
+        public string CustomConsumerKey
+        {
+            get => this.customConsumerKey;
+            set => this.SetProperty(ref this.customConsumerKey, value);
+        }
+
+        public string CustomConsumerSecret
+        {
+            get => this.customConsumerSecret;
+            set => this.SetProperty(ref this.customConsumerSecret, value);
+        }
+
+        public Uri? AuthorizeUri
+        {
+            get => this.authorizeUri;
+            private set => this.SetProperty(ref this.authorizeUri, value);
+        }
+
+        public bool AcquirePinCode
+        {
+            get => this.acquirePinCode;
+            private set => this.SetProperty(ref this.acquirePinCode, value);
+        }
+
+        public string PinCode
+        {
+            get => this.pinCode;
+            set => this.SetProperty(ref this.pinCode, value);
+        }
+
+        public UserAccount? AuthorizedAccount { get; private set; }
+
+        private bool useCustomConsumerKey = true;
+        private string customConsumerKey = "";
+        private string customConsumerSecret = "";
+        private TwitterCredentialOAuth1? requestToken;
+        private Uri? authorizeUri = null;
+        private bool acquirePinCode = false;
+        private string pinCode = "";
+
+        public async Task GetAuthorizeUri()
+        {
+            var appToken = this.GetAppToken();
+            var requestToken = await TwitterApiConnection.GetRequestTokenAsync(appToken);
+            var authorizeUri = TwitterApiConnection.GetAuthorizeUri(requestToken);
+
+            this.GotoPinCodeStep(requestToken, authorizeUri);
+        }
+
+        private TwitterAppToken GetAppToken()
+        {
+            if (this.UseCustomConsumerKey &&
+                !MyCommon.IsNullOrEmpty(this.CustomConsumerKey) &&
+                !MyCommon.IsNullOrEmpty(this.CustomConsumerSecret))
+            {
+                return new()
+                {
+                    AuthType = APIAuthType.OAuth1,
+                    OAuth1CustomConsumerKey = ApiKey.Create(this.CustomConsumerKey),
+                    OAuth1CustomConsumerSecret = ApiKey.Create(this.CustomConsumerSecret),
+                };
+            }
+
+            return TwitterAppToken.GetDefault();
+        }
+
+        private void GotoPinCodeStep(TwitterCredentialOAuth1 requestToken, Uri authorizeUri)
+        {
+            this.requestToken = requestToken;
+            this.AuthorizeUri = authorizeUri;
+            this.AcquirePinCode = true;
+        }
+
+        public async Task DoAuthorize()
+        {
+            if (this.requestToken == null)
+                throw new InvalidOperationException($"{nameof(this.requestToken)} is null");
+
+            if (MyCommon.IsNullOrEmpty(this.PinCode))
+                throw new InvalidOperationException($"{nameof(this.PinCode)} is empty");
+
+            var accessTokenResponse = await TwitterApiConnection.GetAccessTokenAsync(this.requestToken, this.PinCode);
+            var authorizedAccount = new UserAccount
+            {
+                TwitterAuthType = APIAuthType.OAuth1,
+                TwitterOAuth1ConsumerKey = this.CustomConsumerKey,
+                TwitterOAuth1ConsumerSecret = this.CustomConsumerSecret,
+                Username = accessTokenResponse["screen_name"],
+                UserId = accessTokenResponse["user_id"],
+                Token = accessTokenResponse["oauth_token"],
+                TokenSecret = accessTokenResponse["oauth_token_secret"],
+            };
+
+            this.AuthorizedAccount = authorizedAccount;
+        }
+    }
+}
diff --git a/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.Designer.cs b/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.Designer.cs
new file mode 100644 (file)
index 0000000..4e383fc
--- /dev/null
@@ -0,0 +1,205 @@
+namespace OpenTween.SocialProtocol.Twitter
+{
+    partial class TwitterOAuthSetupDialog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TwitterOAuthSetupDialog));
+            this.buttonCancel = new System.Windows.Forms.Button();
+            this.groupBoxInputConsumerKey = new System.Windows.Forms.GroupBox();
+            this.checkBoxUseCustomConsumerKey = new System.Windows.Forms.CheckBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.textBoxCustomConsumerKey = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.textBoxCustomConsumerSecret = new System.Windows.Forms.TextBox();
+            this.buttonGetAuthorizeUri = new System.Windows.Forms.Button();
+            this.groupBoxInputPinCode = new System.Windows.Forms.GroupBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.linkLabelAuthorize = new System.Windows.Forms.LinkLabel();
+            this.contextMenuLinkLabel = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.menuItemCopyLink = new System.Windows.Forms.ToolStripMenuItem();
+            this.label4 = new System.Windows.Forms.Label();
+            this.textBoxPinCode = new System.Windows.Forms.TextBox();
+            this.buttonGetAccessToken = new System.Windows.Forms.Button();
+            this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
+            this.groupBoxInputConsumerKey.SuspendLayout();
+            this.groupBoxInputPinCode.SuspendLayout();
+            this.contextMenuLinkLabel.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // buttonCancel
+            // 
+            resources.ApplyResources(this.buttonCancel, "buttonCancel");
+            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.buttonCancel.Name = "buttonCancel";
+            this.buttonCancel.UseVisualStyleBackColor = true;
+            // 
+            // groupBoxInputConsumerKey
+            // 
+            resources.ApplyResources(this.groupBoxInputConsumerKey, "groupBoxInputConsumerKey");
+            this.groupBoxInputConsumerKey.Controls.Add(this.checkBoxUseCustomConsumerKey);
+            this.groupBoxInputConsumerKey.Controls.Add(this.label1);
+            this.groupBoxInputConsumerKey.Controls.Add(this.textBoxCustomConsumerKey);
+            this.groupBoxInputConsumerKey.Controls.Add(this.label2);
+            this.groupBoxInputConsumerKey.Controls.Add(this.textBoxCustomConsumerSecret);
+            this.groupBoxInputConsumerKey.Controls.Add(this.buttonGetAuthorizeUri);
+            this.groupBoxInputConsumerKey.Name = "groupBoxInputConsumerKey";
+            this.groupBoxInputConsumerKey.TabStop = false;
+            // 
+            // checkBoxUseCustomConsumerKey
+            // 
+            resources.ApplyResources(this.checkBoxUseCustomConsumerKey, "checkBoxUseCustomConsumerKey");
+            this.checkBoxUseCustomConsumerKey.Name = "checkBoxUseCustomConsumerKey";
+            this.checkBoxUseCustomConsumerKey.UseVisualStyleBackColor = true;
+            // 
+            // label1
+            // 
+            resources.ApplyResources(this.label1, "label1");
+            this.label1.Name = "label1";
+            // 
+            // textBoxCustomConsumerKey
+            // 
+            resources.ApplyResources(this.textBoxCustomConsumerKey, "textBoxCustomConsumerKey");
+            this.textBoxCustomConsumerKey.Name = "textBoxCustomConsumerKey";
+            // 
+            // label2
+            // 
+            resources.ApplyResources(this.label2, "label2");
+            this.label2.Name = "label2";
+            // 
+            // textBoxCustomConsumerSecret
+            // 
+            resources.ApplyResources(this.textBoxCustomConsumerSecret, "textBoxCustomConsumerSecret");
+            this.textBoxCustomConsumerSecret.Name = "textBoxCustomConsumerSecret";
+            // 
+            // buttonGetAuthorizeUri
+            // 
+            resources.ApplyResources(this.buttonGetAuthorizeUri, "buttonGetAuthorizeUri");
+            this.buttonGetAuthorizeUri.Name = "buttonGetAuthorizeUri";
+            this.buttonGetAuthorizeUri.UseVisualStyleBackColor = true;
+            this.buttonGetAuthorizeUri.Click += new System.EventHandler(this.ButtonGetAuthorizeUri_Click);
+            // 
+            // groupBoxInputPinCode
+            // 
+            resources.ApplyResources(this.groupBoxInputPinCode, "groupBoxInputPinCode");
+            this.groupBoxInputPinCode.Controls.Add(this.label3);
+            this.groupBoxInputPinCode.Controls.Add(this.linkLabelAuthorize);
+            this.groupBoxInputPinCode.Controls.Add(this.label4);
+            this.groupBoxInputPinCode.Controls.Add(this.textBoxPinCode);
+            this.groupBoxInputPinCode.Controls.Add(this.buttonGetAccessToken);
+            this.groupBoxInputPinCode.Name = "groupBoxInputPinCode";
+            this.groupBoxInputPinCode.TabStop = false;
+            // 
+            // label3
+            // 
+            resources.ApplyResources(this.label3, "label3");
+            this.label3.Name = "label3";
+            // 
+            // linkLabelAuthorize
+            // 
+            resources.ApplyResources(this.linkLabelAuthorize, "linkLabelAuthorize");
+            this.linkLabelAuthorize.AutoEllipsis = true;
+            this.linkLabelAuthorize.ContextMenuStrip = this.contextMenuLinkLabel;
+            this.linkLabelAuthorize.Name = "linkLabelAuthorize";
+            this.linkLabelAuthorize.TabStop = true;
+            this.linkLabelAuthorize.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelAuthorize_LinkClicked);
+            // 
+            // contextMenuLinkLabel
+            // 
+            this.contextMenuLinkLabel.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.menuItemCopyLink});
+            this.contextMenuLinkLabel.Name = "contextMenuLinkLabel";
+            resources.ApplyResources(this.contextMenuLinkLabel, "contextMenuLinkLabel");
+            // 
+            // menuItemCopyLink
+            // 
+            this.menuItemCopyLink.Name = "menuItemCopyLink";
+            resources.ApplyResources(this.menuItemCopyLink, "menuItemCopyLink");
+            this.menuItemCopyLink.Click += new System.EventHandler(this.MenuItemCopyLink_Click);
+            // 
+            // label4
+            // 
+            resources.ApplyResources(this.label4, "label4");
+            this.label4.Name = "label4";
+            // 
+            // textBoxPinCode
+            // 
+            resources.ApplyResources(this.textBoxPinCode, "textBoxPinCode");
+            this.textBoxPinCode.Name = "textBoxPinCode";
+            // 
+            // buttonGetAccessToken
+            // 
+            resources.ApplyResources(this.buttonGetAccessToken, "buttonGetAccessToken");
+            this.buttonGetAccessToken.Name = "buttonGetAccessToken";
+            this.buttonGetAccessToken.UseVisualStyleBackColor = true;
+            this.buttonGetAccessToken.Click += new System.EventHandler(this.ButtonGetAccessToken_Click);
+            // 
+            // TwitterOAuthSetupDialog
+            // 
+            resources.ApplyResources(this, "$this");
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+            this.CancelButton = this.buttonCancel;
+            this.Controls.Add(this.groupBoxInputConsumerKey);
+            this.Controls.Add(this.groupBoxInputPinCode);
+            this.Controls.Add(this.buttonCancel);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+            this.MaximizeBox = false;
+            this.Name = "TwitterOAuthSetupDialog";
+            this.groupBoxInputConsumerKey.ResumeLayout(false);
+            this.groupBoxInputConsumerKey.PerformLayout();
+            this.groupBoxInputPinCode.ResumeLayout(false);
+            this.groupBoxInputPinCode.PerformLayout();
+            this.contextMenuLinkLabel.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button buttonCancel;
+        private System.Windows.Forms.GroupBox groupBoxInputConsumerKey;
+        private System.Windows.Forms.CheckBox checkBoxUseCustomConsumerKey;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox textBoxCustomConsumerKey;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox textBoxCustomConsumerSecret;
+        private System.Windows.Forms.Button buttonGetAuthorizeUri;
+        private System.Windows.Forms.GroupBox groupBoxInputPinCode;
+        private System.Windows.Forms.LinkLabel linkLabelAuthorize;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox textBoxPinCode;
+        private System.Windows.Forms.Button buttonGetAccessToken;
+        private System.Windows.Forms.ContextMenuStrip contextMenuLinkLabel;
+        private System.Windows.Forms.ToolStripMenuItem menuItemCopyLink;
+        private System.Windows.Forms.BindingSource bindingSource;
+    }
+}
\ No newline at end of file
diff --git a/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.cs b/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.cs
new file mode 100644 (file)
index 0000000..eafd1d8
--- /dev/null
@@ -0,0 +1,173 @@
+// OpenTween - Client of Twitter
+// Copyright (c) 2024 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
+// All rights reserved.
+//
+// This file is part of OpenTween.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General public License
+// for more details.
+//
+// You should have received a copy of the GNU General public License along
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#nullable enable
+
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+using OpenTween.Api;
+
+namespace OpenTween.SocialProtocol.Twitter
+{
+    public partial class TwitterOAuthSetupDialog : OTBaseForm
+    {
+        public TwitterOAuthSetup Model { get; } = new();
+
+        public TwitterOAuthSetupDialog()
+        {
+            this.InitializeComponent();
+            this.InitializeBinding();
+
+            // textBoxPinCode のフォントを OTBaseForm.GlobalFont に変更
+            this.textBoxPinCode.Font = this.ReplaceToGlobalFont(this.textBoxPinCode.Font);
+        }
+
+        private void InitializeBinding()
+        {
+            this.bindingSource.DataSource = this.Model;
+
+            this.checkBoxUseCustomConsumerKey.DataBindings.Add(
+                nameof(CheckBox.Checked),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.UseCustomConsumerKey),
+                formattingEnabled: false,
+                DataSourceUpdateMode.OnPropertyChanged
+            );
+
+            this.textBoxCustomConsumerKey.DataBindings.Add(
+                nameof(TextBox.Enabled),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.UseCustomConsumerKey)
+            );
+
+            this.textBoxCustomConsumerKey.DataBindings.Add(
+                nameof(TextBox.Text),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.CustomConsumerKey)
+            );
+
+            this.textBoxCustomConsumerSecret.DataBindings.Add(
+                nameof(TextBox.Enabled),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.UseCustomConsumerKey)
+            );
+
+            this.textBoxCustomConsumerSecret.DataBindings.Add(
+                nameof(TextBox.Text),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.CustomConsumerSecret)
+            );
+
+            this.groupBoxInputPinCode.DataBindings.Add(
+                nameof(GroupBox.Enabled),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.AcquirePinCode)
+            );
+
+            this.linkLabelAuthorize.DataBindings.Add(
+                nameof(LinkLabel.Text),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.AuthorizeUri)
+            );
+
+            this.textBoxPinCode.DataBindings.Add(
+                nameof(TextBox.Text),
+                this.bindingSource,
+                nameof(TwitterOAuthSetup.PinCode)
+            );
+        }
+
+        private async void ButtonGetAuthorizeUri_Click(object sender, EventArgs e)
+        {
+            using (ControlTransaction.Disabled(this))
+            {
+                try
+                {
+                    await this.Model.GetAuthorizeUri();
+                }
+                catch (WebApiException ex)
+                {
+                    this.ShowAuthErrorMessage(ex);
+                }
+            }
+
+            if (this.Model.AcquirePinCode)
+                this.groupBoxInputPinCode.Focus();
+        }
+
+        private async void LinkLabelAuthorize_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            if (this.Model.AuthorizeUri == null)
+                return;
+
+            // 右クリックの場合は無視する
+            if (e.Button == MouseButtons.Right)
+                return;
+
+            await MyCommon.OpenInBrowserAsync(this, this.Model.AuthorizeUri);
+        }
+
+        private void MenuItemCopyLink_Click(object sender, EventArgs e)
+        {
+            if (this.Model.AuthorizeUri == null)
+                return;
+
+            try
+            {
+                Clipboard.SetText(this.Model.AuthorizeUri.ToString());
+            }
+            catch (ExternalException)
+            {
+            }
+        }
+
+        private async void ButtonGetAccessToken_Click(object sender, EventArgs e)
+        {
+            if (MyCommon.IsNullOrEmpty(this.Model.PinCode))
+                return;
+
+            using (ControlTransaction.Disabled(this))
+            {
+                try
+                {
+                    await this.Model.DoAuthorize();
+
+                    this.DialogResult = DialogResult.OK;
+                }
+                catch (WebApiException ex)
+                {
+                    this.ShowAuthErrorMessage(ex);
+                }
+            }
+        }
+
+        private void ShowAuthErrorMessage(WebApiException ex)
+        {
+            var errorBody = ex is TwitterApiException twError
+                ? string.Join(Environment.NewLine, twError.LongMessages)
+                : ex.Message;
+
+            var message = Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + errorBody;
+            MessageBox.Show(this, message, "Authorize", MessageBoxButtons.OK);
+        }
+    }
+}
diff --git a/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.en.resx b/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.en.resx
new file mode 100644 (file)
index 0000000..0038bfd
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?><root xml:space="preserve">
+       <resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
+       <resheader name="version"><value>2.0</value></resheader>
+       <resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
+       <resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
+       <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+
+       <data name="$this.Text"><value>Add Twitter Account</value></data>
+       <data name="buttonCancel.Text"><value>&amp;Cancel</value></data>
+       <data name="buttonGetAuthorizeUri.Text"><value>Continue</value></data>
+       <data name="checkBoxUseCustomConsumerKey.Size" type="System.Drawing.Size, System.Drawing"><value>160, 16</value></data>
+       <data name="checkBoxUseCustomConsumerKey.Text"><value>Use custom consumer key</value></data>
+       <data name="label3.Size" type="System.Drawing.Size, System.Drawing"><value>166, 12</value></data>
+       <data name="label3.Text"><value>Open below url in your browser:</value></data>
+       <data name="label4.Size" type="System.Drawing.Size, System.Drawing"><value>268, 12</value></data>
+       <data name="label4.Text"><value>Please enter the PIN code displayed after approval:</value></data>
+</root>
diff --git a/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.resx b/OpenTween/SocialProtocol/Twitter/TwitterOAuthSetupDialog.resx
new file mode 100644 (file)
index 0000000..3745461
--- /dev/null
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="utf-8"?><root xml:space="preserve">
+       <resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
+       <resheader name="version"><value>2.0</value></resheader>
+       <resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
+       <resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
+       <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+       <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+       <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+
+       <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"><value>96, 96</value></data>
+       <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"><value>500, 425</value></data>
+       <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><value>True</value></metadata>
+       <data name="$this.Text"><value>Twitterアカウントを追加</value></data>
+       <data name="&gt;&gt;$this.Name"><value>TwitterOAuthSetupDialog</value></data>
+       <data name="&gt;&gt;$this.Type"><value>OpenTween.OTBaseForm, OpenTween, Version=3.13.0.1, Culture=neutral, PublicKeyToken=null</value></data>
+       <data name="&gt;&gt;bindingSource.Name"><value>bindingSource</value></data>
+       <data name="&gt;&gt;bindingSource.Type"><value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;buttonCancel.Name"><value>buttonCancel</value></data>
+       <data name="&gt;&gt;buttonCancel.Parent"><value>$this</value></data>
+       <data name="&gt;&gt;buttonCancel.Type"><value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;buttonCancel.ZOrder"><value>3</value></data>
+       <data name="&gt;&gt;buttonGetAccessToken.Name"><value>buttonGetAccessToken</value></data>
+       <data name="&gt;&gt;buttonGetAccessToken.Parent"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;buttonGetAccessToken.Type"><value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;buttonGetAccessToken.ZOrder"><value>4</value></data>
+       <data name="&gt;&gt;buttonGetAuthorizeUri.Name"><value>buttonGetAuthorizeUri</value></data>
+       <data name="&gt;&gt;buttonGetAuthorizeUri.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;buttonGetAuthorizeUri.Type"><value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;buttonGetAuthorizeUri.ZOrder"><value>5</value></data>
+       <data name="&gt;&gt;checkBoxUseCustomConsumerKey.Name"><value>checkBoxUseCustomConsumerKey</value></data>
+       <data name="&gt;&gt;checkBoxUseCustomConsumerKey.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;checkBoxUseCustomConsumerKey.Type"><value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;checkBoxUseCustomConsumerKey.ZOrder"><value>0</value></data>
+       <data name="&gt;&gt;contextMenuLinkLabel.Name"><value>contextMenuLinkLabel</value></data>
+       <data name="&gt;&gt;contextMenuLinkLabel.Type"><value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;groupBoxInputConsumerKey.Name"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;groupBoxInputConsumerKey.Parent"><value>$this</value></data>
+       <data name="&gt;&gt;groupBoxInputConsumerKey.Type"><value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;groupBoxInputConsumerKey.ZOrder"><value>1</value></data>
+       <data name="&gt;&gt;groupBoxInputPinCode.Name"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;groupBoxInputPinCode.Parent"><value>$this</value></data>
+       <data name="&gt;&gt;groupBoxInputPinCode.Type"><value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;groupBoxInputPinCode.ZOrder"><value>2</value></data>
+       <data name="&gt;&gt;label1.Name"><value>label1</value></data>
+       <data name="&gt;&gt;label1.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;label1.Type"><value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;label1.ZOrder"><value>1</value></data>
+       <data name="&gt;&gt;label2.Name"><value>label2</value></data>
+       <data name="&gt;&gt;label2.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;label2.Type"><value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;label2.ZOrder"><value>3</value></data>
+       <data name="&gt;&gt;label3.Name"><value>label3</value></data>
+       <data name="&gt;&gt;label3.Parent"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;label3.Type"><value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;label3.ZOrder"><value>0</value></data>
+       <data name="&gt;&gt;label4.Name"><value>label4</value></data>
+       <data name="&gt;&gt;label4.Parent"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;label4.Type"><value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;label4.ZOrder"><value>2</value></data>
+       <data name="&gt;&gt;linkLabelAuthorize.Name"><value>linkLabelAuthorize</value></data>
+       <data name="&gt;&gt;linkLabelAuthorize.Parent"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;linkLabelAuthorize.Type"><value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;linkLabelAuthorize.ZOrder"><value>1</value></data>
+       <data name="&gt;&gt;menuItemCopyLink.Name"><value>menuItemCopyLink</value></data>
+       <data name="&gt;&gt;menuItemCopyLink.Type"><value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerKey.Name"><value>textBoxCustomConsumerKey</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerKey.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerKey.Type"><value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerKey.ZOrder"><value>2</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerSecret.Name"><value>textBoxCustomConsumerSecret</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerSecret.Parent"><value>groupBoxInputConsumerKey</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerSecret.Type"><value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;textBoxCustomConsumerSecret.ZOrder"><value>4</value></data>
+       <data name="&gt;&gt;textBoxPinCode.Name"><value>textBoxPinCode</value></data>
+       <data name="&gt;&gt;textBoxPinCode.Parent"><value>groupBoxInputPinCode</value></data>
+       <data name="&gt;&gt;textBoxPinCode.Type"><value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>
+       <data name="&gt;&gt;textBoxPinCode.ZOrder"><value>3</value></data>
+       <metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"><value>192, 17</value></metadata>
+       <data name="buttonCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Bottom, Right</value></data>
+       <data name="buttonCancel.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="buttonCancel.Location" type="System.Drawing.Point, System.Drawing"><value>398, 390</value></data>
+       <data name="buttonCancel.Size" type="System.Drawing.Size, System.Drawing"><value>90, 23</value></data>
+       <data name="buttonCancel.TabIndex" type="System.Int32, mscorlib"><value>2</value></data>
+       <data name="buttonCancel.Text"><value>キャンセル (&amp;C)</value></data>
+       <data name="buttonGetAccessToken.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Bottom, Right</value></data>
+       <data name="buttonGetAccessToken.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"><value>NoControl</value></data>
+       <data name="buttonGetAccessToken.Location" type="System.Drawing.Point, System.Drawing"><value>362, 152</value></data>
+       <data name="buttonGetAccessToken.Size" type="System.Drawing.Size, System.Drawing"><value>100, 23</value></data>
+       <data name="buttonGetAccessToken.TabIndex" type="System.Int32, mscorlib"><value>4</value></data>
+       <data name="buttonGetAccessToken.Text"><value>OK</value></data>
+       <data name="buttonGetAuthorizeUri.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Bottom, Right</value></data>
+       <data name="buttonGetAuthorizeUri.Location" type="System.Drawing.Point, System.Drawing"><value>362, 140</value></data>
+       <data name="buttonGetAuthorizeUri.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>3, 10, 3, 3</value></data>
+       <data name="buttonGetAuthorizeUri.Size" type="System.Drawing.Size, System.Drawing"><value>100, 23</value></data>
+       <data name="buttonGetAuthorizeUri.TabIndex" type="System.Int32, mscorlib"><value>5</value></data>
+       <data name="buttonGetAuthorizeUri.Text"><value>次へ進む</value></data>
+       <data name="checkBoxUseCustomConsumerKey.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="checkBoxUseCustomConsumerKey.Location" type="System.Drawing.Point, System.Drawing"><value>13, 25</value></data>
+       <data name="checkBoxUseCustomConsumerKey.Size" type="System.Drawing.Size, System.Drawing"><value>188, 16</value></data>
+       <data name="checkBoxUseCustomConsumerKey.TabIndex" type="System.Int32, mscorlib"><value>0</value></data>
+       <data name="checkBoxUseCustomConsumerKey.Text"><value>Consumer Key を自分で指定する</value></data>
+       <data name="contextMenuLinkLabel.Size" type="System.Drawing.Size, System.Drawing"><value>148, 26</value></data>
+       <metadata name="contextMenuLinkLabel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"><value>17, 17</value></metadata>
+       <data name="groupBoxInputConsumerKey.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Top, Left, Right</value></data>
+       <data name="groupBoxInputConsumerKey.Location" type="System.Drawing.Point, System.Drawing"><value>13, 13</value></data>
+       <data name="groupBoxInputConsumerKey.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>10, 10, 10, 10</value></data>
+       <data name="groupBoxInputConsumerKey.Size" type="System.Drawing.Size, System.Drawing"><value>475, 176</value></data>
+       <data name="groupBoxInputConsumerKey.TabIndex" type="System.Int32, mscorlib"><value>0</value></data>
+       <data name="groupBoxInputConsumerKey.Text"><value>Step 1</value></data>
+       <data name="groupBoxInputPinCode.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Top, Left, Right</value></data>
+       <data name="groupBoxInputPinCode.Location" type="System.Drawing.Point, System.Drawing"><value>13, 196</value></data>
+       <data name="groupBoxInputPinCode.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>10, 10, 10, 10</value></data>
+       <data name="groupBoxInputPinCode.Size" type="System.Drawing.Size, System.Drawing"><value>475, 188</value></data>
+       <data name="groupBoxInputPinCode.TabIndex" type="System.Int32, mscorlib"><value>1</value></data>
+       <data name="groupBoxInputPinCode.Text"><value>Step 2</value></data>
+       <data name="label1.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"><value>NoControl</value></data>
+       <data name="label1.Location" type="System.Drawing.Point, System.Drawing"><value>30, 47</value></data>
+       <data name="label1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>20, 3, 3, 3</value></data>
+       <data name="label1.Size" type="System.Drawing.Size, System.Drawing"><value>132, 12</value></data>
+       <data name="label1.TabIndex" type="System.Int32, mscorlib"><value>1</value></data>
+       <data name="label1.Text"><value>Consumer Key (API Key)</value></data>
+       <data name="label2.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"><value>NoControl</value></data>
+       <data name="label2.Location" type="System.Drawing.Point, System.Drawing"><value>30, 90</value></data>
+       <data name="label2.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>3, 3, 3, 3</value></data>
+       <data name="label2.Size" type="System.Drawing.Size, System.Drawing"><value>160, 12</value></data>
+       <data name="label2.TabIndex" type="System.Int32, mscorlib"><value>3</value></data>
+       <data name="label2.Text"><value>Consumer Secret (API Secret)</value></data>
+       <data name="label3.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="label3.Location" type="System.Drawing.Point, System.Drawing"><value>14, 26</value></data>
+       <data name="label3.Size" type="System.Drawing.Size, System.Drawing"><value>351, 12</value></data>
+       <data name="label3.TabIndex" type="System.Int32, mscorlib"><value>0</value></data>
+       <data name="label3.Text"><value>以下のURLにアクセスし、内容を確認してアプリとの連携を許可してください:</value></data>
+       <data name="label4.AutoSize" type="System.Boolean, mscorlib"><value>True</value></data>
+       <data name="label4.Location" type="System.Drawing.Point, System.Drawing"><value>13, 83</value></data>
+       <data name="label4.Size" type="System.Drawing.Size, System.Drawing"><value>241, 12</value></data>
+       <data name="label4.TabIndex" type="System.Int32, mscorlib"><value>2</value></data>
+       <data name="label4.Text"><value>認可後に表示される PIN コードを入力してください:</value></data>
+       <data name="linkLabelAuthorize.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Top, Left, Right</value></data>
+       <data name="linkLabelAuthorize.Location" type="System.Drawing.Point, System.Drawing"><value>25, 53</value></data>
+       <data name="linkLabelAuthorize.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>15, 15, 15, 15</value></data>
+       <data name="linkLabelAuthorize.Size" type="System.Drawing.Size, System.Drawing"><value>425, 15</value></data>
+       <data name="linkLabelAuthorize.TabIndex" type="System.Int32, mscorlib"><value>1</value></data>
+       <data name="linkLabelAuthorize.Text"><value>linkLabel</value></data>
+       <data name="linkLabelAuthorize.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing"><value>MiddleLeft</value></data>
+       <data name="menuItemCopyLink.Size" type="System.Drawing.Size, System.Drawing"><value>147, 22</value></data>
+       <data name="menuItemCopyLink.Text"><value>URLをコピー (&amp;C)</value></data>
+       <data name="textBoxCustomConsumerKey.Location" type="System.Drawing.Point, System.Drawing"><value>32, 65</value></data>
+       <data name="textBoxCustomConsumerKey.Size" type="System.Drawing.Size, System.Drawing"><value>430, 19</value></data>
+       <data name="textBoxCustomConsumerKey.TabIndex" type="System.Int32, mscorlib"><value>2</value></data>
+       <data name="textBoxCustomConsumerSecret.Location" type="System.Drawing.Point, System.Drawing"><value>32, 108</value></data>
+       <data name="textBoxCustomConsumerSecret.Size" type="System.Drawing.Size, System.Drawing"><value>430, 19</value></data>
+       <data name="textBoxCustomConsumerSecret.TabIndex" type="System.Int32, mscorlib"><value>4</value></data>
+       <data name="textBoxPinCode.AccessibleName"><value>PINコード</value></data>
+       <data name="textBoxPinCode.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"><value>Top, Left, Right</value></data>
+       <data name="textBoxPinCode.Font" type="System.Drawing.Font, System.Drawing"><value>MS UI Gothic, 24pt</value></data>
+       <data name="textBoxPinCode.Location" type="System.Drawing.Point, System.Drawing"><value>142, 105</value></data>
+       <data name="textBoxPinCode.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms"><value>10, 10, 10, 5</value></data>
+       <data name="textBoxPinCode.Size" type="System.Drawing.Size, System.Drawing"><value>190, 39</value></data>
+       <data name="textBoxPinCode.TabIndex" type="System.Int32, mscorlib"><value>3</value></data>
+       <data name="textBoxPinCode.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms"><value>Center</value></data>
+</root>