Rename enum

This commit is contained in:
Jaex 2023-10-26 16:46:01 +03:00
parent c49ce8bb98
commit 6b9d74e60f
3 changed files with 13 additions and 13 deletions

View file

@ -411,13 +411,13 @@ public enum TaskViewMode // Localized
ThumbnailView ThumbnailView
} }
public enum NativeMessagingContentType public enum NativeMessagingAction
{ {
None, None,
Image, UploadImage,
Video, UploadVideo,
Audio, UploadAudio,
Text, UploadText,
Link ShortenURL
} }
} }

View file

@ -27,7 +27,7 @@ namespace ShareX
{ {
public class NativeMessagingInput public class NativeMessagingInput
{ {
public NativeMessagingContentType ContentType { get; set; } public NativeMessagingAction Action { get; set; }
public string URL { get; set; } public string URL { get; set; }
public string Text { get; set; } public string Text { get; set; }
} }

View file

@ -1926,7 +1926,7 @@ public static async Task HandleNativeMessagingInput(string filePath, TaskSetting
{ {
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings(); if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
switch (nativeMessagingInput.ContentType) switch (nativeMessagingInput.Action)
{ {
// TEMP: For backward compatibility // TEMP: For backward compatibility
default: default:
@ -1939,7 +1939,7 @@ public static async Task HandleNativeMessagingInput(string filePath, TaskSetting
UploadManager.UploadText(nativeMessagingInput.Text, taskSettings); UploadManager.UploadText(nativeMessagingInput.Text, taskSettings);
} }
break; break;
case NativeMessagingContentType.Image: case NativeMessagingAction.UploadImage:
if (!string.IsNullOrEmpty(nativeMessagingInput.URL)) if (!string.IsNullOrEmpty(nativeMessagingInput.URL))
{ {
Bitmap bmp = null; Bitmap bmp = null;
@ -1965,20 +1965,20 @@ public static async Task HandleNativeMessagingInput(string filePath, TaskSetting
} }
} }
break; break;
case NativeMessagingContentType.Video: case NativeMessagingAction.UploadVideo:
case NativeMessagingContentType.Audio: case NativeMessagingAction.UploadAudio:
if (!string.IsNullOrEmpty(nativeMessagingInput.URL)) if (!string.IsNullOrEmpty(nativeMessagingInput.URL))
{ {
UploadManager.DownloadAndUploadFile(nativeMessagingInput.URL, taskSettings); UploadManager.DownloadAndUploadFile(nativeMessagingInput.URL, taskSettings);
} }
break; break;
case NativeMessagingContentType.Text: case NativeMessagingAction.UploadText:
if (!string.IsNullOrEmpty(nativeMessagingInput.Text)) if (!string.IsNullOrEmpty(nativeMessagingInput.Text))
{ {
UploadManager.UploadText(nativeMessagingInput.Text, taskSettings); UploadManager.UploadText(nativeMessagingInput.Text, taskSettings);
} }
break; break;
case NativeMessagingContentType.Link: case NativeMessagingAction.ShortenURL:
if (!string.IsNullOrEmpty(nativeMessagingInput.URL)) if (!string.IsNullOrEmpty(nativeMessagingInput.URL))
{ {
UploadManager.ShortenURL(nativeMessagingInput.URL, taskSettings); UploadManager.ShortenURL(nativeMessagingInput.URL, taskSettings);