本文整理汇总了C#中ShareX.UploadersLib.FileUploaders.Minus类的典型用法代码示例。如果您正苦于以下问题:C# Minus类的具体用法?C# Minus怎么用?C# Minus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Minus类属于ShareX.UploadersLib.FileUploaders命名空间,在下文中一共展示了Minus类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MinusAuth
public void MinusAuth()
{
if (!string.IsNullOrEmpty(txtMinusUsername.Text) && !string.IsNullOrEmpty(txtMinusPassword.Text))
{
btnMinusAuth.Enabled = false;
btnMinusRefreshAuth.Enabled = false;
try
{
Config.MinusConfig.Username = txtMinusUsername.Text;
Config.MinusConfig.Password = txtMinusPassword.Text;
Config.MinusOAuth2Info = new OAuth2Info(APIKeys.MinusConsumerKey, APIKeys.MinusConsumerSecret);
Minus minus = new Minus(Config.MinusConfig, Config.MinusOAuth2Info);
if (minus.GetAccessToken())
{
minus.ReadFolderList();
MinusUpdateControls();
MessageBox.Show(Resources.UploadersConfigForm_Login_successful, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show(Resources.UploadersConfigForm_Login_failed, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
MessageBox.Show(Resources.UploadersConfigForm_Error + ": " + ex.Message, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
btnMinusAuth.Enabled = true;
btnMinusRefreshAuth.Enabled = true;
}
}
}
示例2: MinusAuthRefresh
public void MinusAuthRefresh()
{
btnMinusAuth.Enabled = false;
btnMinusRefreshAuth.Enabled = false;
try
{
if (OAuth2Info.CheckOAuth(Config.MinusOAuth2Info))
{
bool result = new Minus(Config.MinusConfig, Config.MinusOAuth2Info).RefreshAccessToken();
if (result)
{
MessageBox.Show(Resources.UploadersConfigForm_Login_successful, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show(Resources.UploadersConfigForm_Login_failed, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
btnMinusAuth.Enabled = true;
btnMinusRefreshAuth.Enabled = true;
}
}
示例3: UploadFile
public UploadResult UploadFile(Stream stream, string fileName)
{
FileUploader fileUploader = null;
FileDestination fileDestination;
switch (Info.DataType)
{
case EDataType.Image:
fileDestination = Info.TaskSettings.ImageFileDestination;
break;
case EDataType.Text:
fileDestination = Info.TaskSettings.TextFileDestination;
break;
default:
case EDataType.File:
fileDestination = Info.TaskSettings.FileDestination;
break;
}
switch (fileDestination)
{
case FileDestination.Dropbox:
fileUploader = new Dropbox(Program.UploadersConfig.DropboxOAuth2Info, Program.UploadersConfig.DropboxAccountInfo)
{
UploadPath = NameParser.Parse(NameParserType.URL, Dropbox.TidyUploadPath(Program.UploadersConfig.DropboxUploadPath)),
AutoCreateShareableLink = Program.UploadersConfig.DropboxAutoCreateShareableLink,
ShareURLType = Program.UploadersConfig.DropboxURLType
};
break;
case FileDestination.OneDrive:
fileUploader = new OneDrive(Program.UploadersConfig.OneDriveOAuth2Info)
{
FolderID = Program.UploadersConfig.OneDriveSelectedFolder.id,
AutoCreateShareableLink = Program.UploadersConfig.OneDriveAutoCreateShareableLink
};
break;
case FileDestination.GoogleDrive:
fileUploader = new GoogleDrive(Program.UploadersConfig.GoogleDriveOAuth2Info)
{
IsPublic = Program.UploadersConfig.GoogleDriveIsPublic,
FolderID = Program.UploadersConfig.GoogleDriveUseFolder ? Program.UploadersConfig.GoogleDriveFolderID : null
};
break;
case FileDestination.Copy:
fileUploader = new Copy(Program.UploadersConfig.CopyOAuthInfo, Program.UploadersConfig.CopyAccountInfo)
{
UploadPath = NameParser.Parse(NameParserType.URL, Copy.TidyUploadPath(Program.UploadersConfig.CopyUploadPath)),
URLType = Program.UploadersConfig.CopyURLType
};
break;
/*case FileDestination.Hubic:
fileUploader = new Hubic(Program.UploadersConfig.HubicOAuth2Info, Program.UploadersConfig.HubicOpenstackAuthInfo)
{
SelectedFolder = Program.UploadersConfig.HubicSelectedFolder,
Publish = Program.UploadersConfig.HubicPublish
};
break;*/
case FileDestination.SendSpace:
fileUploader = new SendSpace(APIKeys.SendSpaceKey);
switch (Program.UploadersConfig.SendSpaceAccountType)
{
case AccountType.Anonymous:
SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey);
break;
case AccountType.User:
SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey, Program.UploadersConfig.SendSpaceUsername, Program.UploadersConfig.SendSpacePassword);
break;
}
break;
case FileDestination.Minus:
fileUploader = new Minus(Program.UploadersConfig.MinusConfig, Program.UploadersConfig.MinusOAuth2Info);
break;
case FileDestination.Box:
fileUploader = new Box(Program.UploadersConfig.BoxOAuth2Info)
{
FolderID = Program.UploadersConfig.BoxSelectedFolder.id,
Share = Program.UploadersConfig.BoxShare
};
break;
case FileDestination.Gfycat:
fileUploader = new GfycatUploader();
break;
case FileDestination.Ge_tt:
fileUploader = new Ge_tt(APIKeys.Ge_ttKey)
{
AccessToken = Program.UploadersConfig.Ge_ttLogin.AccessToken
};
break;
case FileDestination.Localhostr:
fileUploader = new Hostr(Program.UploadersConfig.LocalhostrEmail, Program.UploadersConfig.LocalhostrPassword)
{
DirectURL = Program.UploadersConfig.LocalhostrDirectURL
};
break;
case FileDestination.CustomFileUploader:
CustomUploaderItem customUploader = GetCustomUploader(Program.UploadersConfig.CustomFileUploaderSelected);
if (customUploader != null)
{
fileUploader = new CustomFileUploader(customUploader);
//.........这里部分代码省略.........
示例4: btnMinusReadFolderList_Click
private void btnMinusReadFolderList_Click(object sender, EventArgs e)
{
if (Config.MinusConfig != null)
{
btnMinusReadFolderList.Enabled = false;
List<MinusFolder> tempListMf = new Minus(Config.MinusConfig, Config.MinusOAuth2Info).ReadFolderList();
if (tempListMf.Count > 0)
{
cboMinusFolders.Items.Clear();
cboMinusFolders.Items.AddRange(tempListMf.ToArray());
cboMinusFolders.SelectedIndex = Config.MinusConfig.FolderID;
}
btnMinusReadFolderList.Enabled = true;
}
}
示例5: btnMinusFolderRemove_Click
private void btnMinusFolderRemove_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(cboMinusFolders.Text) && MinusHasFolder(cboMinusFolders.Text))
{
btnMinusFolderRemove.Enabled = false;
Minus minus = new Minus(Config.MinusConfig, Config.MinusOAuth2Info);
int index = cboMinusFolders.SelectedIndex;
if (minus.DeleteFolder(index))
{
cboMinusFolders.Items.RemoveAt(index);
if (cboMinusFolders.Items.Count > 0)
{
cboMinusFolders.SelectedIndex = 0;
}
}
btnMinusFolderRemove.Enabled = true;
}
}
示例6: btnMinusFolderAdd_Click
private void btnMinusFolderAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(cboMinusFolders.Text) && !MinusHasFolder(cboMinusFolders.Text))
{
btnMinusFolderAdd.Enabled = false;
Minus minus = new Minus(Config.MinusConfig, Config.MinusOAuth2Info);
MinusFolder dir = minus.CreateFolder(cboMinusFolders.Text, chkMinusPublic.Checked);
if (dir != null)
{
cboMinusFolders.Items.Add(dir);
cboMinusFolders.SelectedIndex = cboMinusFolders.Items.Count - 1;
}
btnMinusFolderAdd.Enabled = true;
}
}
示例7: UploadFile
private UploadResult UploadFile(string ssPath)
{
FileUploader fileUploader = null;
switch (App.Settings.ProfileActive.ImageFileUploaderType)
{
case FileDestination.Dropbox:
fileUploader = new Dropbox(App.UploadersConfig.DropboxOAuth2Info, App.UploadersConfig.DropboxAccountInfo)
{
UploadPath = NameParser.Parse(NameParserType.URL, Dropbox.TidyUploadPath(App.UploadersConfig.DropboxUploadPath)),
AutoCreateShareableLink = App.UploadersConfig.DropboxAutoCreateShareableLink,
ShareURLType = App.UploadersConfig.DropboxURLType
};
break;
case FileDestination.Copy:
fileUploader = new Copy(App.UploadersConfig.CopyOAuthInfo, App.UploadersConfig.CopyAccountInfo)
{
UploadPath = NameParser.Parse(NameParserType.URL, Copy.TidyUploadPath(App.UploadersConfig.CopyUploadPath)),
URLType = App.UploadersConfig.CopyURLType
};
break;
case FileDestination.GoogleDrive:
fileUploader = new GoogleDrive(App.UploadersConfig.GoogleDriveOAuth2Info)
{
IsPublic = App.UploadersConfig.GoogleDriveIsPublic,
FolderID = App.UploadersConfig.GoogleDriveUseFolder ? App.UploadersConfig.GoogleDriveFolderID : null
};
break;
case FileDestination.SendSpace:
fileUploader = new SendSpace(APIKeys.SendSpaceKey);
switch (App.UploadersConfig.SendSpaceAccountType)
{
case AccountType.Anonymous:
SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey);
break;
case AccountType.User:
SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey, App.UploadersConfig.SendSpaceUsername, App.UploadersConfig.SendSpacePassword);
break;
}
break;
case FileDestination.Minus:
fileUploader = new Minus(App.UploadersConfig.MinusConfig, App.UploadersConfig.MinusOAuth2Info);
break;
case FileDestination.Box:
fileUploader = new Box(App.UploadersConfig.BoxOAuth2Info)
{
FolderID = App.UploadersConfig.BoxSelectedFolder.id,
Share = App.UploadersConfig.BoxShare
};
break;
case FileDestination.Gfycat:
fileUploader = new GfycatUploader();
break;
case FileDestination.Ge_tt:
fileUploader = new Ge_tt(APIKeys.Ge_ttKey)
{
AccessToken = App.UploadersConfig.Ge_ttLogin.AccessToken
};
break;
case FileDestination.Localhostr:
fileUploader = new Hostr(App.UploadersConfig.LocalhostrEmail, App.UploadersConfig.LocalhostrPassword)
{
DirectURL = App.UploadersConfig.LocalhostrDirectURL
};
break;
case FileDestination.CustomFileUploader:
if (App.UploadersConfig.CustomUploadersList.IsValidIndex(App.UploadersConfig.CustomFileUploaderSelected))
{
fileUploader = new CustomFileUploader(App.UploadersConfig.CustomUploadersList[App.UploadersConfig.CustomFileUploaderSelected]);
}
break;
case FileDestination.FTP:
FTPAccount account = App.UploadersConfig.FTPAccountList.ReturnIfValidIndex(App.UploadersConfig.FTPSelectedImage);
if (account != null)
{
if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS)
{
fileUploader = new FTP(account);
}
else if (account.Protocol == FTPProtocol.SFTP)
{
fileUploader = new SFTP(account);
}
}
break;
case FileDestination.SharedFolder:
int idLocalhost = App.UploadersConfig.LocalhostSelectedImages;
if (App.UploadersConfig.LocalhostAccountList.IsValidIndex(idLocalhost))
{
fileUploader = new SharedFolderUploader(App.UploadersConfig.LocalhostAccountList[idLocalhost]);
}
break;
case FileDestination.Email:
using (EmailForm emailForm = new EmailForm(App.UploadersConfig.EmailRememberLastTo ? App.UploadersConfig.EmailLastTo : string.Empty,
App.UploadersConfig.EmailDefaultSubject, App.UploadersConfig.EmailDefaultBody))
{
emailForm.Icon = ShareXResources.Icon;
if (emailForm.ShowDialog() == DialogResult.OK)
//.........这里部分代码省略.........