Rename variables

This commit is contained in:
Jaex 2022-01-05 10:44:18 +03:00
parent 50707de4d8
commit 46e8387766
8 changed files with 39 additions and 39 deletions

View file

@ -705,13 +705,13 @@ public static void PlaySoundAsync(Stream stream)
} }
} }
public static void PlaySoundAsync(string filepath) public static void PlaySoundAsync(string filePath)
{ {
if (!string.IsNullOrEmpty(filepath) && File.Exists(filepath)) if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
{ {
Task.Run(() => Task.Run(() =>
{ {
using (SoundPlayer soundPlayer = new SoundPlayer(filepath)) using (SoundPlayer soundPlayer = new SoundPlayer(filePath))
{ {
soundPlayer.PlaySync(); soundPlayer.PlaySync();
} }

View file

@ -1916,11 +1916,11 @@ public static Bitmap LoadImage(string filePath)
public static Bitmap LoadImageWithFileDialog() public static Bitmap LoadImageWithFileDialog()
{ {
string filepath = OpenImageFileDialog(); string filePath = OpenImageFileDialog();
if (!string.IsNullOrEmpty(filepath)) if (!string.IsNullOrEmpty(filePath))
{ {
return LoadImage(filepath); return LoadImage(filePath);
} }
return null; return null;

View file

@ -30,17 +30,17 @@ namespace ShareX.MediaLib
{ {
public class VideoThumbnailInfo public class VideoThumbnailInfo
{ {
public string Filepath { get; set; } public string FilePath { get; set; }
public TimeSpan Timestamp { get; set; } public TimeSpan Timestamp { get; set; }
public VideoThumbnailInfo(string filepath) public VideoThumbnailInfo(string filePath)
{ {
Filepath = filepath; FilePath = filePath;
} }
public override string ToString() public override string ToString()
{ {
return Path.GetFileName(Filepath); return Path.GetFileName(FilePath);
} }
} }
} }

View file

@ -128,14 +128,14 @@ private List<VideoThumbnailInfo> Finish(List<VideoThumbnailInfo> tempThumbnails)
{ {
using (Image img = CombineScreenshots(tempThumbnails)) using (Image img = CombineScreenshots(tempThumbnails))
{ {
string tempFilepath = Path.Combine(GetOutputDirectory(), Path.GetFileNameWithoutExtension(MediaPath) + Options.FilenameSuffix + "." + Options.ImageFormat.GetDescription()); string tempFilePath = Path.Combine(GetOutputDirectory(), Path.GetFileNameWithoutExtension(MediaPath) + Options.FilenameSuffix + "." + Options.ImageFormat.GetDescription());
ImageHelpers.SaveImage(img, tempFilepath); ImageHelpers.SaveImage(img, tempFilePath);
thumbnails.Add(new VideoThumbnailInfo(tempFilepath)); thumbnails.Add(new VideoThumbnailInfo(tempFilePath));
} }
if (!Options.KeepScreenshots) if (!Options.KeepScreenshots)
{ {
tempThumbnails.ForEach(x => File.Delete(x.Filepath)); tempThumbnails.ForEach(x => File.Delete(x.FilePath));
} }
} }
else else
@ -145,7 +145,7 @@ private List<VideoThumbnailInfo> Finish(List<VideoThumbnailInfo> tempThumbnails)
if (Options.OpenDirectory && thumbnails.Count > 0) if (Options.OpenDirectory && thumbnails.Count > 0)
{ {
Helpers.OpenFolderWithFile(thumbnails[0].Filepath); Helpers.OpenFolderWithFile(thumbnails[0].FilePath);
} }
} }
@ -219,7 +219,7 @@ private Image CombineScreenshots(List<VideoThumbnailInfo> thumbnails)
foreach (VideoThumbnailInfo thumbnail in thumbnails) foreach (VideoThumbnailInfo thumbnail in thumbnails)
{ {
Bitmap bmp = ImageHelpers.LoadImage(thumbnail.Filepath); Bitmap bmp = ImageHelpers.LoadImage(thumbnail.FilePath);
if (Options.MaxThumbnailWidth > 0 && bmp.Width > Options.MaxThumbnailWidth) if (Options.MaxThumbnailWidth > 0 && bmp.Width > Options.MaxThumbnailWidth)
{ {

View file

@ -60,9 +60,9 @@ private bool OpenImageDialog(bool centerImage)
{ {
Manager.IsMoving = false; Manager.IsMoving = false;
Manager.Form.Pause(); Manager.Form.Pause();
string filepath = ImageHelpers.OpenImageFileDialog(Manager.Form); string filePath = ImageHelpers.OpenImageFileDialog(Manager.Form);
Manager.Form.Resume(); Manager.Form.Resume();
return LoadImageFile(filepath, centerImage); return LoadImageFile(filePath, centerImage);
} }
private bool LoadImageFile(string filePath, bool centerImage) private bool LoadImageFile(string filePath, bool centerImage)

View file

@ -309,9 +309,9 @@ public static void CreateChromeExtensionSupport(bool create)
} }
} }
private static void CreateChromeHostManifest(string filepath) private static void CreateChromeHostManifest(string filePath)
{ {
Helpers.CreateDirectoryFromFilePath(filepath); Helpers.CreateDirectoryFromFilePath(filePath);
ChromeManifest manifest = new ChromeManifest() ChromeManifest manifest = new ChromeManifest()
{ {
@ -324,7 +324,7 @@ private static void CreateChromeHostManifest(string filepath)
string json = JsonConvert.SerializeObject(manifest, Formatting.Indented); string json = JsonConvert.SerializeObject(manifest, Formatting.Indented);
File.WriteAllText(filepath, json, Encoding.UTF8); File.WriteAllText(filePath, json, Encoding.UTF8);
} }
private static void RegisterChromeExtensionSupport() private static void RegisterChromeExtensionSupport()
@ -379,9 +379,9 @@ public static void CreateFirefoxAddonSupport(bool create)
} }
} }
private static void CreateFirefoxHostManifest(string filepath) private static void CreateFirefoxHostManifest(string filePath)
{ {
Helpers.CreateDirectoryFromFilePath(filepath); Helpers.CreateDirectoryFromFilePath(filePath);
FirefoxManifest manifest = new FirefoxManifest() FirefoxManifest manifest = new FirefoxManifest()
{ {
@ -394,7 +394,7 @@ private static void CreateFirefoxHostManifest(string filepath)
string json = JsonConvert.SerializeObject(manifest, Formatting.Indented); string json = JsonConvert.SerializeObject(manifest, Formatting.Indented);
File.WriteAllText(filepath, json, Encoding.UTF8); File.WriteAllText(filePath, json, Encoding.UTF8);
} }
private static void RegisterFirefoxAddonSupport() private static void RegisterFirefoxAddonSupport()

View file

@ -598,33 +598,33 @@ private static void AddExternalProgramFromRegistry(TaskSettings taskSettings, st
public static string HandleExistsFile(string folder, string fileName, TaskSettings taskSettings) public static string HandleExistsFile(string folder, string fileName, TaskSettings taskSettings)
{ {
string filepath = Path.Combine(folder, fileName); string filePath = Path.Combine(folder, fileName);
return HandleExistsFile(filepath, taskSettings); return HandleExistsFile(filePath, taskSettings);
} }
public static string HandleExistsFile(string filepath, TaskSettings taskSettings) public static string HandleExistsFile(string filePath, TaskSettings taskSettings)
{ {
if (File.Exists(filepath)) if (File.Exists(filePath))
{ {
switch (taskSettings.ImageSettings.FileExistAction) switch (taskSettings.ImageSettings.FileExistAction)
{ {
case FileExistAction.Ask: case FileExistAction.Ask:
using (FileExistForm form = new FileExistForm(filepath)) using (FileExistForm form = new FileExistForm(filePath))
{ {
form.ShowDialog(); form.ShowDialog();
filepath = form.FilePath; filePath = form.FilePath;
} }
break; break;
case FileExistAction.UniqueName: case FileExistAction.UniqueName:
filepath = Helpers.GetUniqueFilePath(filepath); filePath = Helpers.GetUniqueFilePath(filePath);
break; break;
case FileExistAction.Cancel: case FileExistAction.Cancel:
filepath = ""; filePath = "";
break; break;
} }
} }
return filepath; return filePath;
} }
public static void OpenDropWindow(TaskSettings taskSettings = null) public static void OpenDropWindow(TaskSettings taskSettings = null)
@ -853,7 +853,7 @@ public static void OpenVideoThumbnailer(TaskSettings taskSettings = null)
{ {
foreach (VideoThumbnailInfo thumbnailInfo in thumbnails) foreach (VideoThumbnailInfo thumbnailInfo in thumbnails)
{ {
UploadManager.UploadFile(thumbnailInfo.Filepath, taskSettings); UploadManager.UploadFile(thumbnailInfo.FilePath, taskSettings);
} }
} }
}; };

View file

@ -167,8 +167,8 @@ private static void Task_UploadStarted(WorkerTask task)
{ {
TaskInfo info = task.Info; TaskInfo info = task.Info;
string status = string.Format("Upload started. Filename: {0}", info.FileName); string status = string.Format("Upload started. File name: {0}", info.FileName);
if (!string.IsNullOrEmpty(info.FilePath)) status += ", Filepath: " + info.FilePath; if (!string.IsNullOrEmpty(info.FilePath)) status += ", File path: " + info.FilePath;
DebugHelper.WriteLine(status); DebugHelper.WriteLine(status);
ListViewItem lvi = TaskListView.FindItem(task); ListViewItem lvi = TaskListView.FindItem(task);
@ -289,7 +289,7 @@ private static void Task_TaskCompleted(WorkerTask task)
if (task.Status == TaskStatus.Stopped) if (task.Status == TaskStatus.Stopped)
{ {
DebugHelper.WriteLine($"Task stopped. Filename: {info.FileName}"); DebugHelper.WriteLine($"Task stopped. File name: {info.FileName}");
if (lvi != null) if (lvi != null)
{ {
@ -302,7 +302,7 @@ private static void Task_TaskCompleted(WorkerTask task)
{ {
string errors = string.Join("\r\n\r\n", info.Result.Errors.ToArray()); string errors = string.Join("\r\n\r\n", info.Result.Errors.ToArray());
DebugHelper.WriteLine($"Task failed. Filename: {info.FileName}, Errors:\r\n{errors}"); DebugHelper.WriteLine($"Task failed. File name: {info.FileName}, Errors:\r\n{errors}");
if (lvi != null) if (lvi != null)
{ {
@ -332,7 +332,7 @@ private static void Task_TaskCompleted(WorkerTask task)
} }
else else
{ {
DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms"); DebugHelper.WriteLine($"Task completed. File name: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms");
string result = info.ToString(); string result = info.ToString();