Few Seafile changes

This commit is contained in:
Jaex 2015-10-13 09:44:51 +03:00
parent 668519bb62
commit a1b41650dc
3 changed files with 2112 additions and 6911 deletions

View file

@ -308,6 +308,11 @@ private void InitializeComponent()
this.lblUp1Key = new System.Windows.Forms.Label();
this.lblUp1Host = new System.Windows.Forms.Label();
this.tpSeafile = new System.Windows.Forms.TabPage();
this.grpSeafileShareSettings = new System.Windows.Forms.GroupBox();
this.txtSeafileSharePassword = new System.Windows.Forms.TextBox();
this.lblSeafileSharePassword = new System.Windows.Forms.Label();
this.nudSeafileExpireDays = new System.Windows.Forms.NumericUpDown();
this.lblSeafileDaysToExpire = new System.Windows.Forms.Label();
this.btnSeafileLibraryPasswordValidate = new System.Windows.Forms.Button();
this.txtSeafileLibraryPassword = new System.Windows.Forms.TextBox();
this.lblSeafileLibraryPassword = new System.Windows.Forms.Label();
@ -322,8 +327,6 @@ private void InitializeComponent()
this.txtSeafileUploadLocationRefresh = new System.Windows.Forms.Button();
this.lblSeafileSelectLibrary = new System.Windows.Forms.Label();
this.grpSeafileAccInfo = new System.Windows.Forms.GroupBox();
this.myListView1 = new ShareX.HelpersLib.MyListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnRefreshSeafileAccInfo = new System.Windows.Forms.Button();
this.txtSeafileAccInfoUsage = new System.Windows.Forms.TextBox();
this.txtSeafileAccInfoEmail = new System.Windows.Forms.TextBox();
@ -340,7 +343,6 @@ private void InitializeComponent()
this.cbSeafileIgnoreInvalidCert = new System.Windows.Forms.CheckBox();
this.cbSeafileCreateShareableURL = new System.Windows.Forms.CheckBox();
this.txtSeafileAuthToken = new System.Windows.Forms.TextBox();
this.txtSeafileAPIURL = new System.Windows.Forms.TextBox();
this.lblSeafileAuthToken = new System.Windows.Forms.Label();
this.lblSeafileAPIURL = new System.Windows.Forms.Label();
this.tpEmail = new System.Windows.Forms.TabPage();
@ -484,11 +486,7 @@ private void InitializeComponent()
this.lblWidthHint = new System.Windows.Forms.Label();
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
this.grpSeafileShareSettings = new System.Windows.Forms.GroupBox();
this.lblSeafileDaysToExpire = new System.Windows.Forms.Label();
this.nudSeafileExpireDays = new System.Windows.Forms.NumericUpDown();
this.txtSeafileSharePassword = new System.Windows.Forms.TextBox();
this.lblSeafileSharePassword = new System.Windows.Forms.Label();
this.cbSeafileAPIURL = new System.Windows.Forms.ComboBox();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpTwitter.SuspendLayout();
@ -531,6 +529,8 @@ private void InitializeComponent()
this.tpPomf.SuspendLayout();
this.tpUp1.SuspendLayout();
this.tpSeafile.SuspendLayout();
this.grpSeafileShareSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudSeafileExpireDays)).BeginInit();
this.grpSeafileAccInfo.SuspendLayout();
this.grpSeafileObtainAuthToken.SuspendLayout();
this.tpEmail.SuspendLayout();
@ -557,8 +557,6 @@ private void InitializeComponent()
this.tpPicasa.SuspendLayout();
this.tpChevereto.SuspendLayout();
this.tcUploaders.SuspendLayout();
this.grpSeafileShareSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudSeafileExpireDays)).BeginInit();
this.SuspendLayout();
//
// txtRapidSharePremiumUserName
@ -2576,6 +2574,7 @@ private void InitializeComponent()
//
// tpSeafile
//
this.tpSeafile.Controls.Add(this.cbSeafileAPIURL);
this.tpSeafile.Controls.Add(this.grpSeafileShareSettings);
this.tpSeafile.Controls.Add(this.btnSeafileLibraryPasswordValidate);
this.tpSeafile.Controls.Add(this.txtSeafileLibraryPassword);
@ -2594,13 +2593,60 @@ private void InitializeComponent()
this.tpSeafile.Controls.Add(this.cbSeafileIgnoreInvalidCert);
this.tpSeafile.Controls.Add(this.cbSeafileCreateShareableURL);
this.tpSeafile.Controls.Add(this.txtSeafileAuthToken);
this.tpSeafile.Controls.Add(this.txtSeafileAPIURL);
this.tpSeafile.Controls.Add(this.lblSeafileAuthToken);
this.tpSeafile.Controls.Add(this.lblSeafileAPIURL);
resources.ApplyResources(this.tpSeafile, "tpSeafile");
this.tpSeafile.Name = "tpSeafile";
this.tpSeafile.UseVisualStyleBackColor = true;
//
// grpSeafileShareSettings
//
this.grpSeafileShareSettings.Controls.Add(this.txtSeafileSharePassword);
this.grpSeafileShareSettings.Controls.Add(this.lblSeafileSharePassword);
this.grpSeafileShareSettings.Controls.Add(this.nudSeafileExpireDays);
this.grpSeafileShareSettings.Controls.Add(this.lblSeafileDaysToExpire);
resources.ApplyResources(this.grpSeafileShareSettings, "grpSeafileShareSettings");
this.grpSeafileShareSettings.Name = "grpSeafileShareSettings";
this.grpSeafileShareSettings.TabStop = false;
//
// txtSeafileSharePassword
//
resources.ApplyResources(this.txtSeafileSharePassword, "txtSeafileSharePassword");
this.txtSeafileSharePassword.Name = "txtSeafileSharePassword";
this.txtSeafileSharePassword.UseSystemPasswordChar = true;
this.txtSeafileSharePassword.TextChanged += new System.EventHandler(this.txtSeafileSharePassword_TextChanged);
//
// lblSeafileSharePassword
//
resources.ApplyResources(this.lblSeafileSharePassword, "lblSeafileSharePassword");
this.lblSeafileSharePassword.Name = "lblSeafileSharePassword";
//
// nudSeafileExpireDays
//
resources.ApplyResources(this.nudSeafileExpireDays, "nudSeafileExpireDays");
this.nudSeafileExpireDays.Maximum = new decimal(new int[] {
900,
0,
0,
0});
this.nudSeafileExpireDays.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudSeafileExpireDays.Name = "nudSeafileExpireDays";
this.nudSeafileExpireDays.Value = new decimal(new int[] {
7,
0,
0,
0});
this.nudSeafileExpireDays.ValueChanged += new System.EventHandler(this.nudSeafileExpireDays_ValueChanged);
//
// lblSeafileDaysToExpire
//
resources.ApplyResources(this.lblSeafileDaysToExpire, "lblSeafileDaysToExpire");
this.lblSeafileDaysToExpire.Name = "lblSeafileDaysToExpire";
//
// btnSeafileLibraryPasswordValidate
//
resources.ApplyResources(this.btnSeafileLibraryPasswordValidate, "btnSeafileLibraryPasswordValidate");
@ -2686,7 +2732,6 @@ private void InitializeComponent()
//
// grpSeafileAccInfo
//
this.grpSeafileAccInfo.Controls.Add(this.myListView1);
this.grpSeafileAccInfo.Controls.Add(this.btnRefreshSeafileAccInfo);
this.grpSeafileAccInfo.Controls.Add(this.txtSeafileAccInfoUsage);
this.grpSeafileAccInfo.Controls.Add(this.txtSeafileAccInfoEmail);
@ -2696,21 +2741,6 @@ private void InitializeComponent()
this.grpSeafileAccInfo.Name = "grpSeafileAccInfo";
this.grpSeafileAccInfo.TabStop = false;
//
// myListView1
//
this.myListView1.AutoFillColumn = true;
this.myListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.myListView1.FullRowSelect = true;
resources.ApplyResources(this.myListView1, "myListView1");
this.myListView1.Name = "myListView1";
this.myListView1.UseCompatibleStateImageBehavior = false;
this.myListView1.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
resources.ApplyResources(this.columnHeader1, "columnHeader1");
//
// btnRefreshSeafileAccInfo
//
resources.ApplyResources(this.btnRefreshSeafileAccInfo, "btnRefreshSeafileAccInfo");
@ -2814,17 +2844,6 @@ private void InitializeComponent()
this.txtSeafileAuthToken.Name = "txtSeafileAuthToken";
this.txtSeafileAuthToken.TextChanged += new System.EventHandler(this.txtSeafileAuthToken_TextChanged);
//
// txtSeafileAPIURL
//
this.txtSeafileAPIURL.AutoCompleteCustomSource.AddRange(new string[] {
resources.GetString("txtSeafileAPIURL.AutoCompleteCustomSource"),
resources.GetString("txtSeafileAPIURL.AutoCompleteCustomSource1")});
this.txtSeafileAPIURL.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.txtSeafileAPIURL.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
resources.ApplyResources(this.txtSeafileAPIURL, "txtSeafileAPIURL");
this.txtSeafileAPIURL.Name = "txtSeafileAPIURL";
this.txtSeafileAPIURL.TextChanged += new System.EventHandler(this.txtSeafileAPIURL_TextChanged);
//
// lblSeafileAuthToken
//
resources.ApplyResources(this.lblSeafileAuthToken, "lblSeafileAuthToken");
@ -3856,53 +3875,15 @@ private void InitializeComponent()
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
//
// grpSeafileShareSettings
// cbSeafileAPIURL
//
this.grpSeafileShareSettings.Controls.Add(this.txtSeafileSharePassword);
this.grpSeafileShareSettings.Controls.Add(this.lblSeafileSharePassword);
this.grpSeafileShareSettings.Controls.Add(this.nudSeafileExpireDays);
this.grpSeafileShareSettings.Controls.Add(this.lblSeafileDaysToExpire);
resources.ApplyResources(this.grpSeafileShareSettings, "grpSeafileShareSettings");
this.grpSeafileShareSettings.Name = "grpSeafileShareSettings";
this.grpSeafileShareSettings.TabStop = false;
//
// lblSeafileDaysToExpire
//
resources.ApplyResources(this.lblSeafileDaysToExpire, "lblSeafileDaysToExpire");
this.lblSeafileDaysToExpire.Name = "lblSeafileDaysToExpire";
//
// nudSeafileExpireDays
//
resources.ApplyResources(this.nudSeafileExpireDays, "nudSeafileExpireDays");
this.nudSeafileExpireDays.Maximum = new decimal(new int[] {
900,
0,
0,
0});
this.nudSeafileExpireDays.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudSeafileExpireDays.Name = "nudSeafileExpireDays";
this.nudSeafileExpireDays.Value = new decimal(new int[] {
7,
0,
0,
0});
this.nudSeafileExpireDays.ValueChanged += new System.EventHandler(this.nudSeafileExpireDays_ValueChanged);
//
// txtSeafileSharePassword
//
resources.ApplyResources(this.txtSeafileSharePassword, "txtSeafileSharePassword");
this.txtSeafileSharePassword.Name = "txtSeafileSharePassword";
this.txtSeafileSharePassword.UseSystemPasswordChar = true;
this.txtSeafileSharePassword.TextChanged += new System.EventHandler(this.txtSeafileSharePassword_TextChanged);
//
// lblSeafileSharePassword
//
resources.ApplyResources(this.lblSeafileSharePassword, "lblSeafileSharePassword");
this.lblSeafileSharePassword.Name = "lblSeafileSharePassword";
this.cbSeafileAPIURL.FormattingEnabled = true;
this.cbSeafileAPIURL.Items.AddRange(new object[] {
resources.GetString("cbSeafileAPIURL.Items"),
resources.GetString("cbSeafileAPIURL.Items1")});
resources.ApplyResources(this.cbSeafileAPIURL, "cbSeafileAPIURL");
this.cbSeafileAPIURL.Name = "cbSeafileAPIURL";
this.cbSeafileAPIURL.TextChanged += new System.EventHandler(this.cbSeafileAPIURL_TextChanged);
//
// UploadersConfigForm
//
@ -3991,6 +3972,9 @@ private void InitializeComponent()
this.tpUp1.PerformLayout();
this.tpSeafile.ResumeLayout(false);
this.tpSeafile.PerformLayout();
this.grpSeafileShareSettings.ResumeLayout(false);
this.grpSeafileShareSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudSeafileExpireDays)).EndInit();
this.grpSeafileAccInfo.ResumeLayout(false);
this.grpSeafileAccInfo.PerformLayout();
this.grpSeafileObtainAuthToken.ResumeLayout(false);
@ -4035,9 +4019,6 @@ private void InitializeComponent()
this.tpChevereto.ResumeLayout(false);
this.tpChevereto.PerformLayout();
this.tcUploaders.ResumeLayout(false);
this.grpSeafileShareSettings.ResumeLayout(false);
this.grpSeafileShareSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudSeafileExpireDays)).EndInit();
this.ResumeLayout(false);
}
@ -4474,7 +4455,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbSeafileIgnoreInvalidCert;
private System.Windows.Forms.CheckBox cbSeafileCreateShareableURL;
private System.Windows.Forms.TextBox txtSeafileAuthToken;
private System.Windows.Forms.TextBox txtSeafileAPIURL;
private System.Windows.Forms.Label lblSeafileAuthToken;
private System.Windows.Forms.Label lblSeafileAPIURL;
private System.Windows.Forms.GroupBox grpSeafileAccInfo;
@ -4491,8 +4471,6 @@ private void InitializeComponent()
private System.Windows.Forms.Button btnSeafilePathValidate;
private System.Windows.Forms.TextBox txtSeafileDirectoryPath;
private System.Windows.Forms.Label lblSeafilePath;
private HelpersLib.MyListView myListView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader colSeafileLibrarySize;
private System.Windows.Forms.ColumnHeader colSeafileLibraryEncrypted;
private System.Windows.Forms.Button btnSeafileLibraryPasswordValidate;
@ -4503,5 +4481,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblSeafileSharePassword;
private System.Windows.Forms.NumericUpDown nudSeafileExpireDays;
private System.Windows.Forms.Label lblSeafileDaysToExpire;
private System.Windows.Forms.ComboBox cbSeafileAPIURL;
}
}

View file

@ -561,12 +561,12 @@ public void LoadSettings()
// Seafile
txtSeafileAPIURL.Text = Config.SeafileAPIURL;
cbSeafileAPIURL.Text = Config.SeafileAPIURL;
txtSeafileAuthToken.Text = Config.SeafileAuthToken;
txtSeafileDirectoryPath.Text = Config.SeafilePath;
txtSeafileLibraryPassword.Text = Config.SeafileEncryptedLibraryPassword;
txtSeafileLibraryPassword.ReadOnly = (Config.SeafileIsLibraryEncrypted ? true : false);
btnSeafileLibraryPasswordValidate.Enabled = (Config.SeafileIsLibraryEncrypted ? false : true);
txtSeafileLibraryPassword.ReadOnly = Config.SeafileIsLibraryEncrypted;
btnSeafileLibraryPasswordValidate.Enabled = !Config.SeafileIsLibraryEncrypted;
cbSeafileCreateShareableURL.Checked = Config.SeafileCreateShareableURL;
cbSeafileIgnoreInvalidCert.Checked = Config.SeafileIgnoreInvalidCert;
nudSeafileExpireDays.Value = Config.SeafileShareDaysToExpire;
@ -2062,19 +2062,19 @@ private void txtPomfResultURL_TextChanged(object sender, EventArgs e)
#region Seafile
private void txtSeafileAPIURL_TextChanged(object sender, EventArgs e)
private void cbSeafileAPIURL_TextChanged(object sender, EventArgs e)
{
Config.SeafileAPIURL = txtSeafileAPIURL.Text;
Config.SeafileAPIURL = cbSeafileAPIURL.Text;
}
private void btnSeafileCheckAPIURL_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSeafileAPIURL.Text))
if (string.IsNullOrEmpty(cbSeafileAPIURL.Text))
{
return;
}
Seafile sf = new Seafile(txtSeafileAPIURL.Text, null, null);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, null, null);
bool checkReturned = sf.CheckAPIURL();
if (checkReturned)
@ -2094,12 +2094,12 @@ private void txtSeafileAuthToken_TextChanged(object sender, EventArgs e)
private void btnSeafileCheckAuthToken_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(txtSeafileAPIURL.Text))
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(cbSeafileAPIURL.Text))
{
return;
}
Seafile sf = new Seafile(txtSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
bool checkReturned = sf.CheckAuthToken();
if (checkReturned)
@ -2129,7 +2129,7 @@ private void btnSeafileGetAuthToken_Click(object sender, EventArgs e)
{
try
{
Seafile sf = new Seafile(txtSeafileAPIURL.Text, null, null);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, null, null);
string authToken = sf.GetAuthToken(username, password);
if (!string.IsNullOrEmpty(authToken))
@ -2168,12 +2168,12 @@ private void cbSeafileIgnoreInvalidCert_CheckedChanged(object sender, EventArgs
private void btnRefreshSeafileAccInfo_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(txtSeafileAPIURL.Text))
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(cbSeafileAPIURL.Text))
{
return;
}
Seafile sf = new Seafile(txtSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
Seafile.SeafileCheckAccInfoResponse SeafileCheckAccInfoResponse = sf.GetAccountInfo();
if (SeafileCheckAccInfoResponse == null)
@ -2182,18 +2182,18 @@ private void btnRefreshSeafileAccInfo_Click(object sender, EventArgs e)
return;
}
txtSeafileAccInfoEmail.Text = SeafileCheckAccInfoResponse.email;
txtSeafileAccInfoUsage.Text = HelpersLib.NumberExtensions.ToSizeString(SeafileCheckAccInfoResponse.usage).ToString() + " / " + HelpersLib.NumberExtensions.ToSizeString(SeafileCheckAccInfoResponse.total).ToString();
txtSeafileAccInfoUsage.Text = SeafileCheckAccInfoResponse.usage.ToSizeString() + " / " + SeafileCheckAccInfoResponse.total.ToSizeString();
}
private void txtSeafileUploadLocationRefresh_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(txtSeafileAPIURL.Text))
if (string.IsNullOrEmpty(txtSeafileAuthToken.Text) || string.IsNullOrEmpty(cbSeafileAPIURL.Text))
{
return;
}
lvSeafileLibraries.Items.Clear();
Seafile sf = new Seafile(txtSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
List<Seafile.SeafileLibraryObj> SeafileLibraries = sf.GetLibraries();
foreach (var SeafileLibrary in SeafileLibraries)
@ -2203,10 +2203,10 @@ private void txtSeafileUploadLocationRefresh_Click(object sender, EventArgs e)
ListViewItem libraryItem = lvSeafileLibraries.Items.Add(SeafileLibrary.name);
libraryItem.Name = SeafileLibrary.id;
libraryItem.Tag = SeafileLibrary;
libraryItem.SubItems.Add(HelpersLib.NumberExtensions.ToSizeString(SeafileLibrary.size));
libraryItem.SubItems.Add(SeafileLibrary.size.ToSizeString());
if (SeafileLibrary.encrypted)
{
ListViewItem.ListViewSubItem isEncrypt = libraryItem.SubItems.Add("\u221A");
libraryItem.SubItems.Add("\u221A");
}
if (SeafileLibrary.id == Config.SeafileRepoID)
{
@ -2253,7 +2253,7 @@ private void btnSeafilePathValidate_Click(object sender, EventArgs e)
return;
}
Seafile sf = new Seafile(txtSeafileAPIURL.Text, txtSeafileAuthToken.Text, Config.SeafileRepoID);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, Config.SeafileRepoID);
bool checkReturned = sf.ValidatePath(txtSeafileDirectoryPath.Text);
if (checkReturned)
@ -2281,7 +2281,7 @@ private void btnSeafileLibraryPasswordValidate_Click(object sender, EventArgs e)
return;
}
Seafile sf = new Seafile(txtSeafileAPIURL.Text, txtSeafileAuthToken.Text, Config.SeafileRepoID);
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, Config.SeafileRepoID);
bool checkReturned = sf.DecryptLibrary(txtSeafileLibraryPassword.Text);
if (checkReturned)

File diff suppressed because it is too large Load diff