Finish form

This commit is contained in:
Matthew Burnett 2018-04-20 17:16:46 -04:00
parent c215797c8a
commit 7ea80aeaa0
4 changed files with 120 additions and 44 deletions

View file

@ -122,7 +122,6 @@ public override UploadResult Upload(Stream stream, string fileName)
UploadResult result = new UploadResult();
string contentType = Helpers.GetMimeType(fileName);
string uploadpath = GetUploadPath(fileName);
Dictionary<string, string> args = new Dictionary<string, string>
@ -148,10 +147,15 @@ public override UploadResult Upload(Stream stream, string fileName)
SendRequest(HttpMethod.POST, $"https://www.googleapis.com/storage/v1/b/{bucket}/o/{encodeduploadpath}/acl",
requestjson, ContentTypeJSON, headers: googleAuth.GetAuthHeaders());
}
else
{
Errors.Add("Upload to Google Cloud Storage failed.");
return null;
}
if (string.IsNullOrEmpty(domain))
{
domain = "storage.googleapis.com/{bucket}";
domain = $"storage.googleapis.com/{bucket}";
}
result.URL = $"https://{domain}/{uploadpath}";

View file

@ -303,6 +303,12 @@ private void InitializeComponent()
this.lblAmazonS3AccessKey = new System.Windows.Forms.Label();
this.txtAmazonS3AccessKey = new System.Windows.Forms.TextBox();
this.tpGoogleCloudStorage = new System.Windows.Forms.TabPage();
this.txtGoogleCloudStorageObjectPrefix = new System.Windows.Forms.TextBox();
this.lblGoogleCloudStorageObjectPrefix = new System.Windows.Forms.Label();
this.lblGoogleCloudStorageDomain = new System.Windows.Forms.Label();
this.txtGoogleCloudStorageDomain = new System.Windows.Forms.TextBox();
this.lblGoogleCloudStorageBucket = new System.Windows.Forms.Label();
this.txtGoogleCloudStorageBucket = new System.Windows.Forms.TextBox();
this.oauth2GoogleCloudStorage = new ShareX.UploadersLib.OAuthControl();
this.tpAzureStorage = new System.Windows.Forms.TabPage();
this.cbAzureStorageEnvironment = new System.Windows.Forms.ComboBox();
@ -639,10 +645,6 @@ private void InitializeComponent()
this.lblWidthHint = new System.Windows.Forms.Label();
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
this.txtGoogleCloudStorageBucket = new System.Windows.Forms.TextBox();
this.lblGoogleCloudStorageBucket = new System.Windows.Forms.Label();
this.txtGoogleCloudStorageDomain = new System.Windows.Forms.TextBox();
this.lblGoogleCloudStorageDomain = new System.Windows.Forms.Label();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpTwitter.SuspendLayout();
@ -2784,6 +2786,8 @@ private void InitializeComponent()
//
// tpGoogleCloudStorage
//
this.tpGoogleCloudStorage.Controls.Add(this.txtGoogleCloudStorageObjectPrefix);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageObjectPrefix);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageDomain);
this.tpGoogleCloudStorage.Controls.Add(this.txtGoogleCloudStorageDomain);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageBucket);
@ -2793,6 +2797,39 @@ private void InitializeComponent()
this.tpGoogleCloudStorage.Name = "tpGoogleCloudStorage";
this.tpGoogleCloudStorage.UseVisualStyleBackColor = true;
//
// txtGoogleCloudStorageObjectPrefix
//
resources.ApplyResources(this.txtGoogleCloudStorageObjectPrefix, "txtGoogleCloudStorageObjectPrefix");
this.txtGoogleCloudStorageObjectPrefix.Name = "txtGoogleCloudStorageObjectPrefix";
this.txtGoogleCloudStorageObjectPrefix.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageObjectPrefix_TextChanged);
//
// lblGoogleCloudStorageObjectPrefix
//
resources.ApplyResources(this.lblGoogleCloudStorageObjectPrefix, "lblGoogleCloudStorageObjectPrefix");
this.lblGoogleCloudStorageObjectPrefix.Name = "lblGoogleCloudStorageObjectPrefix";
//
// lblGoogleCloudStorageDomain
//
resources.ApplyResources(this.lblGoogleCloudStorageDomain, "lblGoogleCloudStorageDomain");
this.lblGoogleCloudStorageDomain.Name = "lblGoogleCloudStorageDomain";
//
// txtGoogleCloudStorageDomain
//
resources.ApplyResources(this.txtGoogleCloudStorageDomain, "txtGoogleCloudStorageDomain");
this.txtGoogleCloudStorageDomain.Name = "txtGoogleCloudStorageDomain";
this.txtGoogleCloudStorageDomain.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageDomain_TextChanged);
//
// lblGoogleCloudStorageBucket
//
resources.ApplyResources(this.lblGoogleCloudStorageBucket, "lblGoogleCloudStorageBucket");
this.lblGoogleCloudStorageBucket.Name = "lblGoogleCloudStorageBucket";
//
// txtGoogleCloudStorageBucket
//
resources.ApplyResources(this.txtGoogleCloudStorageBucket, "txtGoogleCloudStorageBucket");
this.txtGoogleCloudStorageBucket.Name = "txtGoogleCloudStorageBucket";
this.txtGoogleCloudStorageBucket.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageBucket_TextChanged);
//
// oauth2GoogleCloudStorage
//
resources.ApplyResources(this.oauth2GoogleCloudStorage, "oauth2GoogleCloudStorage");
@ -5220,28 +5257,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
//
// txtGoogleCloudStorageBucket
//
resources.ApplyResources(this.txtGoogleCloudStorageBucket, "txtGoogleCloudStorageBucket");
this.txtGoogleCloudStorageBucket.Name = "txtGoogleCloudStorageBucket";
this.txtGoogleCloudStorageBucket.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageBucket_TextChanged);
//
// lblGoogleCloudStorageBucket
//
resources.ApplyResources(this.lblGoogleCloudStorageBucket, "lblGoogleCloudStorageBucket");
this.lblGoogleCloudStorageBucket.Name = "lblGoogleCloudStorageBucket";
//
// txtGoogleCloudStorageDomain
//
resources.ApplyResources(this.txtGoogleCloudStorageDomain, "txtGoogleCloudStorageDomain");
this.txtGoogleCloudStorageDomain.Name = "txtGoogleCloudStorageDomain";
this.txtGoogleCloudStorageDomain.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageDomain_TextChanged);
//
// lblGoogleCloudStorageDomain
//
resources.ApplyResources(this.lblGoogleCloudStorageDomain, "lblGoogleCloudStorageDomain");
this.lblGoogleCloudStorageDomain.Name = "lblGoogleCloudStorageDomain";
//
// UploadersConfigForm
//
resources.ApplyResources(this, "$this");
@ -6035,5 +6050,7 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblGoogleCloudStorageBucket;
private System.Windows.Forms.TextBox txtGoogleCloudStorageDomain;
private System.Windows.Forms.Label lblGoogleCloudStorageDomain;
private System.Windows.Forms.TextBox txtGoogleCloudStorageObjectPrefix;
private System.Windows.Forms.Label lblGoogleCloudStorageObjectPrefix;
}
}

View file

@ -95,6 +95,7 @@ private void InitializeControls()
CodeMenu.Create<CodeMenuEntryFilename>(txtDropboxPath, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenu.Create<CodeMenuEntryFilename>(txtAmazonS3ObjectPrefix, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenu.Create<CodeMenuEntryFilename>(txtMediaFirePath, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenu.Create<CodeMenuEntryFilename>(txtGoogleCloudStorageObjectPrefix, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenuItem codeMenuItemInput = new CodeMenuItem("$input$", "Text/URL input");
CodeMenuItem codeMenuItemFilename = new CodeMenuItem("$filename$", "File name");
@ -741,6 +742,7 @@ public void LoadSettings()
txtGoogleCloudStorageBucket.Text = Config.GoogleCloudStorageBucket;
txtGoogleCloudStorageDomain.Text = Config.GoogleCloudStorageDomain;
txtGoogleCloudStorageObjectPrefix.Text = Config.GoogleCloudStorageObjectPrefix;
#endregion Google Cloud Storage
@ -3076,6 +3078,11 @@ private void txtGoogleCloudStorageDomain_TextChanged(object sender, EventArgs e)
Config.GoogleCloudStorageDomain = txtGoogleCloudStorageDomain.Text;
}
private void txtGoogleCloudStorageObjectPrefix_TextChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageObjectPrefix = txtGoogleCloudStorageObjectPrefix.Text;
}
#endregion Google Cloud Storage
#endregion File uploaders

View file

@ -5423,13 +5423,13 @@ store.book[0].title</value>
<value>5</value>
</data>
<data name="tpDropbox.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 202</value>
<value>4, 40</value>
</data>
<data name="tpDropbox.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="tpDropbox.Size" type="System.Drawing.Size, System.Drawing">
<value>178, 0</value>
<value>972, 519</value>
</data>
<data name="tpDropbox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -7067,13 +7067,13 @@ store.book[0].title</value>
<value>20</value>
</data>
<data name="tpAmazonS3.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 40</value>
<value>4, 202</value>
</data>
<data name="tpAmazonS3.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="tpAmazonS3.Size" type="System.Drawing.Size, System.Drawing">
<value>972, 519</value>
<value>178, 0</value>
</data>
<data name="tpAmazonS3.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
@ -7093,11 +7093,59 @@ store.book[0].title</value>
<data name="&gt;&gt;tpAmazonS3.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="txtGoogleCloudStorageObjectPrefix.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 349</value>
</data>
<data name="txtGoogleCloudStorageObjectPrefix.Size" type="System.Drawing.Size, System.Drawing">
<value>324, 20</value>
</data>
<data name="txtGoogleCloudStorageObjectPrefix.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageObjectPrefix.Name" xml:space="preserve">
<value>txtGoogleCloudStorageObjectPrefix</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageObjectPrefix.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageObjectPrefix.Parent" xml:space="preserve">
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageObjectPrefix.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="lblGoogleCloudStorageObjectPrefix.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblGoogleCloudStorageObjectPrefix.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 333</value>
</data>
<data name="lblGoogleCloudStorageObjectPrefix.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 13</value>
</data>
<data name="lblGoogleCloudStorageObjectPrefix.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="lblGoogleCloudStorageObjectPrefix.Text" xml:space="preserve">
<value>Path:</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageObjectPrefix.Name" xml:space="preserve">
<value>lblGoogleCloudStorageObjectPrefix</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageObjectPrefix.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageObjectPrefix.Parent" xml:space="preserve">
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageObjectPrefix.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="lblGoogleCloudStorageDomain.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblGoogleCloudStorageDomain.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 313</value>
<value>13, 294</value>
</data>
<data name="lblGoogleCloudStorageDomain.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 13</value>
@ -7118,13 +7166,13 @@ store.book[0].title</value>
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageDomain.ZOrder" xml:space="preserve">
<value>0</value>
<value>2</value>
</data>
<data name="txtGoogleCloudStorageDomain.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 329</value>
<value>16, 310</value>
</data>
<data name="txtGoogleCloudStorageDomain.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
<value>324, 20</value>
</data>
<data name="txtGoogleCloudStorageDomain.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@ -7139,7 +7187,7 @@ store.book[0].title</value>
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageDomain.ZOrder" xml:space="preserve">
<value>1</value>
<value>3</value>
</data>
<data name="lblGoogleCloudStorageBucket.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -7166,13 +7214,13 @@ store.book[0].title</value>
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;lblGoogleCloudStorageBucket.ZOrder" xml:space="preserve">
<value>2</value>
<value>4</value>
</data>
<data name="txtGoogleCloudStorageBucket.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 271</value>
<value>20, 271</value>
</data>
<data name="txtGoogleCloudStorageBucket.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
<value>320, 20</value>
</data>
<data name="txtGoogleCloudStorageBucket.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -7187,7 +7235,7 @@ store.book[0].title</value>
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;txtGoogleCloudStorageBucket.ZOrder" xml:space="preserve">
<value>3</value>
<value>5</value>
</data>
<data name="oauth2GoogleCloudStorage.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 16</value>
@ -7208,7 +7256,7 @@ store.book[0].title</value>
<value>tpGoogleCloudStorage</value>
</data>
<data name="&gt;&gt;oauth2GoogleCloudStorage.ZOrder" xml:space="preserve">
<value>4</value>
<value>6</value>
</data>
<data name="tpGoogleCloudStorage.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 40</value>
@ -12120,7 +12168,7 @@ Using an encrypted library disables sharing.</value>
<value>4, 4, 4, 4</value>
</data>
<data name="ucLocalhostAccounts.Size" type="System.Drawing.Size, System.Drawing">
<value>792, 3067</value>
<value>792, 4624</value>
</data>
<data name="ucLocalhostAccounts.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
@ -15915,7 +15963,7 @@ Using an encrypted library disables sharing.</value>
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>59</value>
<value>54</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>