mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Service renamings
This commit is contained in:
parent
08607ef649
commit
c9d39eac36
4 changed files with 18 additions and 18 deletions
|
@ -36,7 +36,7 @@ public string ServiceName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ((Enum)Enum.ToObject(typeof(T), EnumValue)).GetDescription();
|
return ((Enum)(object)EnumValue).GetDescription();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,27 +36,27 @@ public static class UploaderFactory
|
||||||
private static readonly URLShortenerService[] urlShortenerServices = Helpers.GetInstances<URLShortenerService>();
|
private static readonly URLShortenerService[] urlShortenerServices = Helpers.GetInstances<URLShortenerService>();
|
||||||
private static readonly URLSharingService[] sharingServices = Helpers.GetInstances<URLSharingService>();
|
private static readonly URLSharingService[] sharingServices = Helpers.GetInstances<URLSharingService>();
|
||||||
|
|
||||||
public static ImageUploaderService GetImageUploaderServiceByEnum(ImageDestination enumValue)
|
public static ImageUploaderService GetImageUploaderService(ImageDestination enumValue)
|
||||||
{
|
{
|
||||||
return imageUploaderServices.First(x => x.EnumValue == enumValue);
|
return imageUploaderServices.First(x => x.EnumValue == enumValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextUploaderService GetTextUploaderServiceByEnum(TextDestination enumValue)
|
public static TextUploaderService GetTextUploaderService(TextDestination enumValue)
|
||||||
{
|
{
|
||||||
return textUploaderServices.First(x => x.EnumValue == enumValue);
|
return textUploaderServices.First(x => x.EnumValue == enumValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileUploaderService GetFileUploaderServiceByEnum(FileDestination enumValue)
|
public static FileUploaderService GetFileUploaderService(FileDestination enumValue)
|
||||||
{
|
{
|
||||||
return fileUploaderServices.First(x => x.EnumValue == enumValue);
|
return fileUploaderServices.First(x => x.EnumValue == enumValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static URLShortenerService GetURLShortenerServiceByEnum(UrlShortenerType enumValue)
|
public static URLShortenerService GetURLShortenerService(UrlShortenerType enumValue)
|
||||||
{
|
{
|
||||||
return urlShortenerServices.First(x => x.EnumValue == enumValue);
|
return urlShortenerServices.First(x => x.EnumValue == enumValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static URLSharingService GetSharingServiceByEnum(URLSharingServices enumValue)
|
public static URLSharingService GetURLSharingService(URLSharingServices enumValue)
|
||||||
{
|
{
|
||||||
return sharingServices.First(x => x.EnumValue == enumValue);
|
return sharingServices.First(x => x.EnumValue == enumValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,28 +64,28 @@ public static bool Validate<T>(int index, UploadersConfig config)
|
||||||
public static bool Validate(ImageDestination destination, UploadersConfig config)
|
public static bool Validate(ImageDestination destination, UploadersConfig config)
|
||||||
{
|
{
|
||||||
if (destination == ImageDestination.FileUploader) return true;
|
if (destination == ImageDestination.FileUploader) return true;
|
||||||
return UploaderFactory.GetImageUploaderServiceByEnum(destination).CheckConfig(config);
|
return UploaderFactory.GetImageUploaderService(destination).CheckConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Validate(TextDestination destination, UploadersConfig config)
|
public static bool Validate(TextDestination destination, UploadersConfig config)
|
||||||
{
|
{
|
||||||
if (destination == TextDestination.FileUploader) return true;
|
if (destination == TextDestination.FileUploader) return true;
|
||||||
return UploaderFactory.GetTextUploaderServiceByEnum(destination).CheckConfig(config);
|
return UploaderFactory.GetTextUploaderService(destination).CheckConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Validate(FileDestination destination, UploadersConfig config)
|
public static bool Validate(FileDestination destination, UploadersConfig config)
|
||||||
{
|
{
|
||||||
return UploaderFactory.GetFileUploaderServiceByEnum(destination).CheckConfig(config);
|
return UploaderFactory.GetFileUploaderService(destination).CheckConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Validate(UrlShortenerType destination, UploadersConfig config)
|
public static bool Validate(UrlShortenerType destination, UploadersConfig config)
|
||||||
{
|
{
|
||||||
return UploaderFactory.GetURLShortenerServiceByEnum(destination).CheckConfig(config);
|
return UploaderFactory.GetURLShortenerService(destination).CheckConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Validate(URLSharingServices destination, UploadersConfig config)
|
public static bool Validate(URLSharingServices destination, UploadersConfig config)
|
||||||
{
|
{
|
||||||
return UploaderFactory.GetSharingServiceByEnum(destination).CheckConfig(config);
|
return UploaderFactory.GetURLSharingService(destination).CheckConfig(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -861,22 +861,22 @@ public UploadResult UploadData(IGenericUploaderService service, Stream stream, s
|
||||||
|
|
||||||
public UploadResult UploadImage(Stream stream, string fileName)
|
public UploadResult UploadImage(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
return UploadData(UploaderFactory.GetImageUploaderServiceByEnum(Info.TaskSettings.ImageDestination), stream, fileName);
|
return UploadData(UploaderFactory.GetImageUploaderService(Info.TaskSettings.ImageDestination), stream, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadResult UploadText(Stream stream, string fileName)
|
public UploadResult UploadText(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
return UploadData(UploaderFactory.GetTextUploaderServiceByEnum(Info.TaskSettings.TextDestination), stream, fileName);
|
return UploadData(UploaderFactory.GetTextUploaderService(Info.TaskSettings.TextDestination), stream, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadResult UploadFile(Stream stream, string fileName)
|
public UploadResult UploadFile(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
return UploadData(UploaderFactory.GetFileUploaderServiceByEnum(Info.TaskSettings.GetFileDestinationByDataType(Info.DataType)), stream, fileName);
|
return UploadData(UploaderFactory.GetFileUploaderService(Info.TaskSettings.GetFileDestinationByDataType(Info.DataType)), stream, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadResult ShortenURL(string url)
|
public UploadResult ShortenURL(string url)
|
||||||
{
|
{
|
||||||
URLShortener urlShortener = UploaderFactory.GetURLShortenerServiceByEnum(Info.TaskSettings.URLShortenerDestination).CreateShortener(Program.UploadersConfig, taskReferenceHelper);
|
URLShortener urlShortener = UploaderFactory.GetURLShortenerService(Info.TaskSettings.URLShortenerDestination).CreateShortener(Program.UploadersConfig, taskReferenceHelper);
|
||||||
|
|
||||||
if (urlShortener != null)
|
if (urlShortener != null)
|
||||||
{
|
{
|
||||||
|
@ -890,15 +890,15 @@ public void ShareURL(string url)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(url))
|
if (!string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
UploaderFactory.GetSharingServiceByEnum(Info.TaskSettings.URLSharingServiceDestination).ShareURL(url, Program.UploadersConfig);
|
UploaderFactory.GetURLSharingService(Info.TaskSettings.URLSharingServiceDestination).ShareURL(url, Program.UploadersConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private UploadResult GetInvalidConfigResult(IUploaderService uploaderService)
|
private UploadResult GetInvalidConfigResult(IUploaderService uploaderService)
|
||||||
{
|
{
|
||||||
UploadResult ur = new UploadResult();
|
UploadResult ur = new UploadResult();
|
||||||
ur.Errors.Add(string.Format("{0} configuration is invalid or missing. Please check \"Destination settings\" window to configure it.",
|
// TODO: Translate
|
||||||
uploaderService.ServiceName));
|
ur.Errors.Add(string.Format("{0} configuration is invalid or missing. Please check \"Destination settings\" window to configure it.", uploaderService.ServiceName));
|
||||||
return ur;
|
return ur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue