direct upload
This commit is contained in:
parent
4bffee136c
commit
e1f50eb57f
|
@ -8,6 +8,7 @@
|
|||
"SettingsForm_Language": "Jazyk",
|
||||
"SettingsForm_Save": "Uložit",
|
||||
"SettingsForm_Open": "Otevřit soubor nastavení",
|
||||
"SettingsForm_DirectUpload": "Nahrát soubor ihned",
|
||||
"UploadForm_Info": "Informace o souboru",
|
||||
"UploadForm_Upload": "Nahrát",
|
||||
"UploadForm_Cancel": "Zrušit",
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"SettingsForm_Language": "Language",
|
||||
"SettingsForm_Save": "Save",
|
||||
"SettingsForm_Open": "Open settings file",
|
||||
"SettingsForm_DirectUpload": "Direct file upload",
|
||||
"UploadForm_Info": "File information",
|
||||
"UploadForm_Upload": "Upload",
|
||||
"UploadForm_Cancel": "Cancel",
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace uploader
|
|||
public string SettingsForm_Language = "Language";
|
||||
public string SettingsForm_Save = "Save";
|
||||
public string SettingsForm_Open = "Open settings file";
|
||||
public string SettingsForm_DirectUpload = "Direct file upload";
|
||||
|
||||
public string UploadForm_Info = "File information";
|
||||
public string UploadForm_Upload = "Upload";
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace uploader
|
|||
{
|
||||
public string ApiKey = "";
|
||||
public string Language = "";
|
||||
public bool DirectUpload = false;
|
||||
|
||||
public static string GetSettingsFilename()
|
||||
{
|
||||
|
|
|
@ -38,12 +38,14 @@
|
|||
this.saveButton = new DarkUI.Controls.DarkButton();
|
||||
this.openButton = new DarkUI.Controls.DarkButton();
|
||||
this.statusLabel = new DarkUI.Controls.DarkLabel();
|
||||
this.directCheckbox = new DarkUI.Controls.DarkCheckBox();
|
||||
this.generalGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// generalGroupBox
|
||||
//
|
||||
this.generalGroupBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
|
||||
this.generalGroupBox.Controls.Add(this.directCheckbox);
|
||||
this.generalGroupBox.Controls.Add(this.languageCombo);
|
||||
this.generalGroupBox.Controls.Add(this.languageLabel);
|
||||
this.generalGroupBox.Controls.Add(this.getApiButton);
|
||||
|
@ -51,7 +53,7 @@
|
|||
this.generalGroupBox.Controls.Add(this.apiLabel);
|
||||
this.generalGroupBox.Location = new System.Drawing.Point(13, 13);
|
||||
this.generalGroupBox.Name = "generalGroupBox";
|
||||
this.generalGroupBox.Size = new System.Drawing.Size(403, 126);
|
||||
this.generalGroupBox.Size = new System.Drawing.Size(403, 154);
|
||||
this.generalGroupBox.TabIndex = 0;
|
||||
this.generalGroupBox.TabStop = false;
|
||||
this.generalGroupBox.Text = "General settings";
|
||||
|
@ -108,7 +110,7 @@
|
|||
// saveButton
|
||||
//
|
||||
this.saveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.saveButton.Location = new System.Drawing.Point(13, 145);
|
||||
this.saveButton.Location = new System.Drawing.Point(13, 173);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.saveButton.Size = new System.Drawing.Size(75, 23);
|
||||
|
@ -118,7 +120,7 @@
|
|||
//
|
||||
// openButton
|
||||
//
|
||||
this.openButton.Location = new System.Drawing.Point(94, 145);
|
||||
this.openButton.Location = new System.Drawing.Point(94, 173);
|
||||
this.openButton.Name = "openButton";
|
||||
this.openButton.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.openButton.Size = new System.Drawing.Size(153, 23);
|
||||
|
@ -135,11 +137,20 @@
|
|||
this.statusLabel.TabIndex = 4;
|
||||
this.statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// directCheckbox
|
||||
//
|
||||
this.directCheckbox.AutoSize = true;
|
||||
this.directCheckbox.Location = new System.Drawing.Point(13, 122);
|
||||
this.directCheckbox.Name = "directCheckbox";
|
||||
this.directCheckbox.Size = new System.Drawing.Size(105, 17);
|
||||
this.directCheckbox.TabIndex = 5;
|
||||
this.directCheckbox.Text = "Direct file upload";
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(428, 180);
|
||||
this.ClientSize = new System.Drawing.Size(428, 208);
|
||||
this.Controls.Add(this.statusLabel);
|
||||
this.Controls.Add(this.openButton);
|
||||
this.Controls.Add(this.saveButton);
|
||||
|
@ -167,5 +178,6 @@
|
|||
private DarkUI.Controls.DarkButton saveButton;
|
||||
private DarkUI.Controls.DarkButton openButton;
|
||||
private DarkUI.Controls.DarkLabel statusLabel;
|
||||
private DarkUI.Controls.DarkCheckBox directCheckbox;
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ namespace uploader
|
|||
var settings = Settings.LoadSettings();
|
||||
|
||||
apiTextbox.Text = settings.ApiKey;
|
||||
directCheckbox.Checked = settings.DirectUpload;
|
||||
|
||||
var languages = LocalizationHelper.GetLanguages();
|
||||
languageCombo.Items.Clear();
|
||||
|
@ -56,6 +57,7 @@ namespace uploader
|
|||
saveButton.Text = LocalizationHelper.Base.SettingsForm_Save;
|
||||
openButton.Text = LocalizationHelper.Base.SettingsForm_Open;
|
||||
this.Text = LocalizationHelper.Base.SettingsForm_Title;
|
||||
directCheckbox.Text = LocalizationHelper.Base.SettingsForm_DirectUpload;
|
||||
|
||||
//LocalizationHelper.Export();
|
||||
}
|
||||
|
@ -80,7 +82,8 @@ namespace uploader
|
|||
var settings = new Settings
|
||||
{
|
||||
ApiKey = apiTextbox.Text,
|
||||
Language = languageCombo.Text
|
||||
Language = languageCombo.Text,
|
||||
DirectUpload = directCheckbox.Checked
|
||||
};
|
||||
|
||||
Settings.SaveSettings(settings);
|
||||
|
|
|
@ -63,6 +63,17 @@ namespace uploader
|
|||
uploadButton.Text = LocalizationHelper.Base.UploadForm_Upload;
|
||||
}
|
||||
|
||||
private void CloseWindow()
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.Invoke(new Action(() => CloseWindow()));
|
||||
return;
|
||||
}
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Upload()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_settings.ApiKey))
|
||||
|
@ -98,6 +109,8 @@ namespace uploader
|
|||
{
|
||||
var reportLink = reportJson.permalink.ToString();
|
||||
Process.Start(reportLink);
|
||||
|
||||
if (_settings.DirectUpload) CloseWindow();
|
||||
}
|
||||
catch (RuntimeBinderException)
|
||||
{
|
||||
|
@ -116,6 +129,8 @@ namespace uploader
|
|||
{
|
||||
var scanLink = scanJson.permalink.ToString();
|
||||
Process.Start(scanLink);
|
||||
|
||||
if (_settings.DirectUpload) CloseWindow();
|
||||
}
|
||||
catch (RuntimeBinderException)
|
||||
{
|
||||
|
@ -129,18 +144,7 @@ namespace uploader
|
|||
Finish(true);
|
||||
}
|
||||
|
||||
private void UploadForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
mdTextbox.Text = Utils.GetMD5(_fileName);
|
||||
shaTextbox.Text = Utils.GetSHA1(_fileName);
|
||||
sha2Textbox.Text = Utils.GetSHA256(_fileName);
|
||||
|
||||
settingsGroup.Text = LocalizationHelper.Base.UploadForm_Info;
|
||||
uploadButton.Text = LocalizationHelper.Base.UploadForm_Upload;
|
||||
statusLabel.Text = LocalizationHelper.Base.Message_Idle;
|
||||
}
|
||||
|
||||
private void uploadButton_Click(object sender, EventArgs e)
|
||||
private void StartUploadThread()
|
||||
{
|
||||
if (_uploadThread != null && _uploadThread.IsAlive)
|
||||
{
|
||||
|
@ -154,6 +158,27 @@ namespace uploader
|
|||
_uploadThread.Start();
|
||||
}
|
||||
|
||||
private void UploadForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
mdTextbox.Text = Utils.GetMD5(_fileName);
|
||||
shaTextbox.Text = Utils.GetSHA1(_fileName);
|
||||
sha2Textbox.Text = Utils.GetSHA256(_fileName);
|
||||
|
||||
settingsGroup.Text = LocalizationHelper.Base.UploadForm_Info;
|
||||
uploadButton.Text = LocalizationHelper.Base.UploadForm_Upload;
|
||||
statusLabel.Text = LocalizationHelper.Base.Message_Idle;
|
||||
|
||||
if (_settings.DirectUpload)
|
||||
{
|
||||
StartUploadThread();
|
||||
}
|
||||
}
|
||||
|
||||
private void uploadButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
StartUploadThread();
|
||||
}
|
||||
|
||||
private void UploadForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (_reopen)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net472" />
|
||||
<package id="RestSharp" version="106.11.2" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
|
||||
<package id="RestSharp" version="106.11.4" targetFramework="net46" />
|
||||
</packages>
|
|
@ -42,11 +42,11 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\darkui\DarkUI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=106.11.2.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.11.2\lib\net452\RestSharp.dll</HintPath>
|
||||
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
|
Loading…
Reference in New Issue