mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-28 23:42:13 +12:00
Rename variables
This commit is contained in:
parent
7792e7d244
commit
241619cc07
37 changed files with 196 additions and 199 deletions
|
@ -227,9 +227,9 @@ private void tsmiImportFile_Click(object sender, EventArgs e)
|
|||
{
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
foreach (string filename in ofd.FileNames)
|
||||
foreach (string fileName in ofd.FileNames)
|
||||
{
|
||||
ImportFile(filename);
|
||||
ImportFile(fileName);
|
||||
}
|
||||
|
||||
OnImportCompleted();
|
||||
|
|
|
@ -92,7 +92,7 @@ public static Cursor[] CursorList
|
|||
}
|
||||
}
|
||||
|
||||
public static string GetFilenameExtension(string filePath, bool includeDot = false, bool checkSecondExtension = true)
|
||||
public static string GetFileNameExtension(string filePath, bool includeDot = false, bool checkSecondExtension = true)
|
||||
{
|
||||
string extension = "";
|
||||
|
||||
|
@ -107,7 +107,7 @@ public static string GetFilenameExtension(string filePath, bool includeDot = fal
|
|||
if (checkSecondExtension)
|
||||
{
|
||||
filePath = filePath.Remove(pos);
|
||||
string extension2 = GetFilenameExtension(filePath, false, false);
|
||||
string extension2 = GetFileNameExtension(filePath, false, false);
|
||||
|
||||
if (!string.IsNullOrEmpty(extension2))
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ public static string GetFilenameExtension(string filePath, bool includeDot = fal
|
|||
return extension;
|
||||
}
|
||||
|
||||
public static string GetFilenameSafe(string filePath)
|
||||
public static string GetFileNameSafe(string filePath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ public static string GetFilenameSafe(string filePath)
|
|||
return filePath;
|
||||
}
|
||||
|
||||
public static string ChangeFilenameExtension(string fileName, string extension)
|
||||
public static string ChangeFileNameExtension(string fileName, string extension)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ public static string AppendExtension(string filePath, string extension)
|
|||
|
||||
public static bool CheckExtension(string filePath, IEnumerable<string> extensions)
|
||||
{
|
||||
string ext = GetFilenameExtension(filePath);
|
||||
string ext = GetFileNameExtension(filePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(ext))
|
||||
{
|
||||
|
|
|
@ -1767,7 +1767,7 @@ public static string[] OpenImageFileDialog(bool multiselect, Form form = null, s
|
|||
public static ImageFormat GetImageFormat(string filePath)
|
||||
{
|
||||
ImageFormat imageFormat = ImageFormat.Png;
|
||||
string ext = Helpers.GetFilenameExtension(filePath);
|
||||
string ext = Helpers.GetFileNameExtension(filePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(ext))
|
||||
{
|
||||
|
@ -1840,7 +1840,7 @@ public static string SaveImageFileDialog(Image img, string filePath = "", bool u
|
|||
|
||||
sfd.FileName = Path.GetFileName(filePath);
|
||||
|
||||
string ext = Helpers.GetFilenameExtension(filePath);
|
||||
string ext = Helpers.GetFileNameExtension(filePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(ext))
|
||||
{
|
||||
|
|
|
@ -121,7 +121,7 @@ public static bool CheckStringValue(string path, string name = null, string valu
|
|||
|
||||
public static string SearchProgramPath(string fileName)
|
||||
{
|
||||
// First method: HKEY_CLASSES_ROOT\Applications\{filename}\shell\{command}\command
|
||||
// First method: HKEY_CLASSES_ROOT\Applications\{fileName}\shell\{command}\command
|
||||
|
||||
string[] commands = new string[] { "open", "edit" };
|
||||
|
||||
|
|
|
@ -111,14 +111,14 @@ private static bool Delete(string shortcutPath)
|
|||
private static string GetShortcutTargetPath(string shortcutPath)
|
||||
{
|
||||
string directory = Path.GetDirectoryName(shortcutPath);
|
||||
string filename = Path.GetFileName(shortcutPath);
|
||||
string fileName = Path.GetFileName(shortcutPath);
|
||||
|
||||
try
|
||||
{
|
||||
Type t = Type.GetTypeFromProgID("Shell.Application");
|
||||
object shell = Activator.CreateInstance(t);
|
||||
Folder folder = (Folder)t.InvokeMember("NameSpace", BindingFlags.InvokeMethod, null, shell, new object[] { directory });
|
||||
FolderItem folderItem = folder.ParseName(filename);
|
||||
FolderItem folderItem = folder.ParseName(fileName);
|
||||
|
||||
if (folderItem != null)
|
||||
{
|
||||
|
@ -145,11 +145,11 @@ public static void PinUnpinTaskBar(string filePath, bool pin)
|
|||
if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
|
||||
{
|
||||
string directory = Path.GetDirectoryName(filePath);
|
||||
string filename = Path.GetFileName(filePath);
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
|
||||
Shell shell = new ShellClass();
|
||||
Folder folder = shell.NameSpace(directory);
|
||||
FolderItem folderItem = folder.ParseName(filename);
|
||||
FolderItem folderItem = folder.ParseName(fileName);
|
||||
|
||||
FolderItemVerbs verbs = folderItem.Verbs();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public string ProcessFilePath
|
|||
}
|
||||
}
|
||||
|
||||
public string ProcessFileName => Helpers.GetFilenameSafe(ProcessFilePath);
|
||||
public string ProcessFileName => Helpers.GetFileNameSafe(ProcessFilePath);
|
||||
|
||||
public int ProcessId
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ public override void CheckUpdate()
|
|||
throw new Exception("Unable to find setup file.");
|
||||
}
|
||||
|
||||
Filename = artifact.fileName;
|
||||
FileName = artifact.fileName;
|
||||
DownloadURL = appveyor.GetArtifactDownloadURL(job.jobId, artifact.fileName);
|
||||
if (Version.TryParse(project.build.version, out Version version))
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ public partial class DownloaderForm : BlackStyleForm
|
|||
public event DownloaderInstallEventHandler InstallRequested;
|
||||
|
||||
public string URL { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string DownloadLocation { get; private set; }
|
||||
public IWebProxy Proxy { get; set; }
|
||||
public string AcceptHeader { get; set; }
|
||||
|
@ -64,14 +64,14 @@ private DownloaderForm()
|
|||
RunInstallerInBackground = true;
|
||||
}
|
||||
|
||||
public DownloaderForm(string url, string filename) : this()
|
||||
public DownloaderForm(string url, string fileName) : this()
|
||||
{
|
||||
URL = url;
|
||||
Filename = filename;
|
||||
lblFilename.Text = Helpers.SafeStringFormat(Resources.DownloaderForm_DownloaderForm_Filename___0_, Filename);
|
||||
FileName = fileName;
|
||||
lblFilename.Text = Helpers.SafeStringFormat(Resources.DownloaderForm_DownloaderForm_Filename___0_, FileName);
|
||||
}
|
||||
|
||||
public DownloaderForm(UpdateChecker updateChecker) : this(updateChecker.DownloadURL, updateChecker.Filename)
|
||||
public DownloaderForm(UpdateChecker updateChecker) : this(updateChecker.DownloadURL, updateChecker.FileName)
|
||||
{
|
||||
Proxy = updateChecker.Proxy;
|
||||
|
||||
|
@ -216,7 +216,7 @@ private void StartDownload()
|
|||
|
||||
string folderPath = Path.Combine(Path.GetTempPath(), "ShareX");
|
||||
Helpers.CreateDirectory(folderPath);
|
||||
DownloadLocation = Path.Combine(folderPath, Filename);
|
||||
DownloadLocation = Path.Combine(folderPath, FileName);
|
||||
|
||||
DebugHelper.WriteLine($"Downloading: \"{URL}\" -> \"{DownloadLocation}\"");
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ protected override bool UpdateReleaseInfo(GitHubRelease release, bool isPortable
|
|||
{
|
||||
if (asset != null && !string.IsNullOrEmpty(asset.name) && asset.name.EndsWith(endsWith, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Filename = asset.name;
|
||||
FileName = asset.name;
|
||||
|
||||
if (isBrowserDownloadURL)
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ protected virtual bool UpdateReleaseInfo(GitHubRelease release, bool isPortable,
|
|||
{
|
||||
if (asset != null && !string.IsNullOrEmpty(asset.name) && asset.name.EndsWith(endsWith, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Filename = asset.name;
|
||||
FileName = asset.name;
|
||||
|
||||
if (isBrowserDownloadURL)
|
||||
{
|
||||
|
|
|
@ -43,22 +43,22 @@ public abstract class UpdateChecker
|
|||
public bool IsPortable { get; set; }
|
||||
public IWebProxy Proxy { get; set; }
|
||||
|
||||
private string filename;
|
||||
private string fileName;
|
||||
|
||||
public string Filename
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
return HttpUtility.UrlDecode(DownloadURL.Substring(DownloadURL.LastIndexOf('/') + 1));
|
||||
}
|
||||
|
||||
return filename;
|
||||
return fileName;
|
||||
}
|
||||
set
|
||||
{
|
||||
filename = value;
|
||||
fileName = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ private string OutputStats(HistoryItem[] historyItems)
|
|||
|
||||
IEnumerable<string> fileExtensions = historyItems.
|
||||
Where(x => !string.IsNullOrEmpty(x.FileName) && !x.FileName.EndsWith(")")).
|
||||
Select(x => Helpers.GetFilenameExtension(x.FileName)).
|
||||
Select(x => Helpers.GetFileNameExtension(x.FileName)).
|
||||
GroupBy(x => x).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
||||
|
|
|
@ -149,7 +149,7 @@ private void btnGenerate_Click(object sender, EventArgs e)
|
|||
int height = (int)nudHeight.Value;
|
||||
int quality = (int)nudQuality.Value;
|
||||
string outputFolder = txtOutputFolder.Text;
|
||||
string outputFilename = txtOutputFilename.Text;
|
||||
string outputFileName = txtOutputFilename.Text;
|
||||
|
||||
Cursor = Cursors.WaitCursor;
|
||||
|
||||
|
@ -167,8 +167,8 @@ private void btnGenerate_Click(object sender, EventArgs e)
|
|||
{
|
||||
using (Bitmap thumbnail = ImageHelpers.CreateThumbnail(bmp, width, height))
|
||||
{
|
||||
string filename = Path.GetFileNameWithoutExtension(filePath);
|
||||
string outputPath = Path.Combine(outputFolder, outputFilename.Replace("$filename", filename));
|
||||
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
string outputPath = Path.Combine(outputFolder, outputFileName.Replace("$filename", fileName));
|
||||
outputPath = Path.ChangeExtension(outputPath, "jpg");
|
||||
|
||||
using (Bitmap newImage = ImageHelpers.FillBackground(thumbnail, Color.White))
|
||||
|
|
|
@ -84,8 +84,8 @@ public List<VideoThumbnailInfo> TakeThumbnails(string mediaPath)
|
|||
timeSliceElapsed = GetTimeSlice(Options.ThumbnailCount) * (i + 1);
|
||||
}
|
||||
|
||||
string filename = string.Format("{0}-{1}.{2}", mediaFileName, timeSliceElapsed, Options.ImageFormat.GetDescription());
|
||||
string tempThumbnailPath = Path.Combine(GetOutputDirectory(), filename);
|
||||
string fileName = string.Format("{0}-{1}.{2}", mediaFileName, timeSliceElapsed, Options.ImageFormat.GetDescription());
|
||||
string tempThumbnailPath = Path.Combine(GetOutputDirectory(), fileName);
|
||||
|
||||
using (Process process = new Process())
|
||||
{
|
||||
|
|
|
@ -260,11 +260,11 @@ internal void UpdateTitle()
|
|||
text += $" - {Canvas.Width}x{Canvas.Height}";
|
||||
}
|
||||
|
||||
string filename = Helpers.GetFilenameSafe(ImageFilePath);
|
||||
string fileName = Helpers.GetFileNameSafe(ImageFilePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
text += " - " + filename;
|
||||
text += " - " + fileName;
|
||||
}
|
||||
|
||||
if (!IsFullscreen && Options.ShowFPS)
|
||||
|
|
|
@ -233,11 +233,11 @@ private static void CompileSetup()
|
|||
CompileISSFile("ShareX-setup.iss");
|
||||
}
|
||||
|
||||
private static void CompileISSFile(string filename)
|
||||
private static void CompileISSFile(string fileName)
|
||||
{
|
||||
if (File.Exists(InnoSetupCompilerPath))
|
||||
{
|
||||
Console.WriteLine("Compiling setup file: " + filename);
|
||||
Console.WriteLine("Compiling setup file: " + fileName);
|
||||
|
||||
using (Process process = new Process())
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ private static void CompileISSFile(string filename)
|
|||
{
|
||||
FileName = InnoSetupCompilerPath,
|
||||
WorkingDirectory = Path.GetFullPath(InnoSetupDir),
|
||||
Arguments = $"\"{filename}\"",
|
||||
Arguments = $"\"{fileName}\"",
|
||||
UseShellExecute = false
|
||||
};
|
||||
|
||||
|
@ -337,8 +337,8 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
|||
Helpers.CreateEmptyFile(Path.Combine(destination, "Portable"));
|
||||
|
||||
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(ReleaseExecutablePath);
|
||||
string zipFilename = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart);
|
||||
string zipPath = Path.Combine(OutputDir, zipFilename);
|
||||
string zipFileName = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart);
|
||||
string zipPath = Path.Combine(OutputDir, zipFileName);
|
||||
//string zipPath = Path.Combine(OutputDir, "ShareX-portable.zip");
|
||||
ZipManager.Compress(Path.GetFullPath(destination), Path.GetFullPath(zipPath));
|
||||
|
||||
|
|
|
@ -63,11 +63,11 @@ public static void CopyFiles(IEnumerable<string> files, string toFolder)
|
|||
Directory.CreateDirectory(toFolder);
|
||||
}
|
||||
|
||||
foreach (string filepath in files)
|
||||
foreach (string filePath in files)
|
||||
{
|
||||
string filename = Path.GetFileName(filepath);
|
||||
string dest = Path.Combine(toFolder, filename);
|
||||
File.Copy(filepath, dest);
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
string dest = Path.Combine(toFolder, fileName);
|
||||
File.Copy(filePath, dest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,9 +81,9 @@ public static void CopyFiles(string directory, string searchPattern, string toFo
|
|||
|
||||
foreach (string file in files)
|
||||
{
|
||||
string filename = Path.GetFileName(file);
|
||||
string fileName = Path.GetFileName(file);
|
||||
|
||||
if (ignoreFiles.All(x => !filename.Equals(x, StringComparison.InvariantCultureIgnoreCase)))
|
||||
if (ignoreFiles.All(x => !fileName.Equals(x, StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
newFiles.Add(file);
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ namespace ShareX.UploadersLib
|
|||
{
|
||||
public class CustomUploaderInput
|
||||
{
|
||||
public string Filename { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Input { get; set; }
|
||||
|
||||
public CustomUploaderInput(string filename, string input)
|
||||
public CustomUploaderInput(string fileName, string input)
|
||||
{
|
||||
Filename = filename;
|
||||
FileName = fileName;
|
||||
Input = input;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ public void ParseResponse(UploadResult result, ResponseInfo responseInfo, Custom
|
|||
}
|
||||
|
||||
CustomUploaderParser parser = new CustomUploaderParser(responseInfo, RegexList);
|
||||
parser.Filename = input.Filename;
|
||||
parser.FileName = input.FileName;
|
||||
parser.URLEncode = true;
|
||||
|
||||
if (responseInfo.IsSuccess)
|
||||
|
|
|
@ -43,7 +43,7 @@ public class CustomUploaderParser
|
|||
public const char SyntaxEscapeChar = '\\';
|
||||
|
||||
public bool IsOutput { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Input { get; set; }
|
||||
public ResponseInfo ResponseInfo { get; set; }
|
||||
public List<Match> RegexMatches { get; set; }
|
||||
|
@ -61,9 +61,9 @@ public CustomUploaderParser()
|
|||
IsOutput = false;
|
||||
}
|
||||
|
||||
public CustomUploaderParser(string filename, string input)
|
||||
public CustomUploaderParser(string fileName, string input)
|
||||
{
|
||||
Filename = filename;
|
||||
FileName = fileName;
|
||||
Input = input;
|
||||
|
||||
IsOutput = false;
|
||||
|
@ -87,7 +87,7 @@ public CustomUploaderParser(ResponseInfo responseInfo, List<string> regexList)
|
|||
IsOutput = true;
|
||||
}
|
||||
|
||||
public CustomUploaderParser(CustomUploaderInput input) : this(input.Filename, input.Input)
|
||||
public CustomUploaderParser(CustomUploaderInput input) : this(input.FileName, input.Input)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ private string ParseSyntax(string syntax, bool isOutput)
|
|||
|
||||
if (CheckKeyword(syntax, "filename")) // Example: $filename$
|
||||
{
|
||||
return AutoEncode(Filename);
|
||||
return AutoEncode(FileName);
|
||||
}
|
||||
else if (CheckKeyword(syntax, "random", out value)) // Example: $random:domain1.com|domain2.com$
|
||||
{
|
||||
|
|
|
@ -192,17 +192,17 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
|
||||
public string GetLinkURL(CopyLinksInfo link, string path, CopyURLType urlType = CopyURLType.Default)
|
||||
{
|
||||
string filename = URLHelpers.URLEncode(URLHelpers.GetFileName(path));
|
||||
string fileName = URLHelpers.URLEncode(URLHelpers.GetFileName(path));
|
||||
|
||||
switch (urlType)
|
||||
{
|
||||
default:
|
||||
case CopyURLType.Default:
|
||||
return string.Format("https://www.copy.com/s/{0}/{1}", link.id, filename);
|
||||
return string.Format("https://www.copy.com/s/{0}/{1}", link.id, fileName);
|
||||
case CopyURLType.Shortened:
|
||||
return string.Format("https://copy.com/{0}", link.id);
|
||||
case CopyURLType.Direct:
|
||||
return string.Format("https://copy.com/{0}/{1}", link.id, filename);
|
||||
return string.Format("https://copy.com/{0}/{1}", link.id, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,20 +33,17 @@ namespace ShareX.UploadersLib.FileUploaders
|
|||
public sealed class DropIO : FileUploader
|
||||
{
|
||||
public string DropName { get; set; }
|
||||
|
||||
public string DropDescription { get; set; }
|
||||
|
||||
public class Asset
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string OriginalFilename { get; set; }
|
||||
}
|
||||
|
||||
public class Drop
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string AdminToken { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
@ -149,24 +149,24 @@ private NameValueCollection GetAuthHeaders()
|
|||
return headers;
|
||||
}
|
||||
|
||||
public static string VerifyPath(string path, string filename = null)
|
||||
public static string VerifyPath(string path, string fileName = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
path = path.Trim().Replace('\\', '/').Trim('/');
|
||||
path = URLHelpers.AddSlash(path, SlashType.Prefix);
|
||||
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
path = URLHelpers.CombineURL(path, filename);
|
||||
path = URLHelpers.CombineURL(path, fileName);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
return filename;
|
||||
return fileName;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -205,7 +205,7 @@ public bool DownloadFile(string path, Stream downloadStream)
|
|||
return false;
|
||||
}
|
||||
|
||||
public UploadResult UploadFile(Stream stream, string path, string filename, bool createShareableLink = false, bool useDirectLink = false)
|
||||
public UploadResult UploadFile(Stream stream, string path, string fileName, bool createShareableLink = false, bool useDirectLink = false)
|
||||
{
|
||||
if (stream.Length > 150000000)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ public UploadResult UploadFile(Stream stream, string path, string filename, bool
|
|||
|
||||
string json = JsonConvert.SerializeObject(new
|
||||
{
|
||||
path = VerifyPath(path, filename),
|
||||
path = VerifyPath(path, fileName),
|
||||
mode = "overwrite",
|
||||
autorename = false,
|
||||
mute = true
|
||||
|
|
|
@ -302,18 +302,18 @@ public void UploadFiles(string[] localPaths, string remotePath)
|
|||
{
|
||||
if (!string.IsNullOrEmpty(file))
|
||||
{
|
||||
string filename = Path.GetFileName(file);
|
||||
string fileName = Path.GetFileName(file);
|
||||
|
||||
if (File.Exists(file))
|
||||
{
|
||||
UploadFile(file, URLHelpers.CombineURL(remotePath, filename));
|
||||
UploadFile(file, URLHelpers.CombineURL(remotePath, fileName));
|
||||
}
|
||||
else if (Directory.Exists(file))
|
||||
{
|
||||
List<string> filesList = new List<string>();
|
||||
filesList.AddRange(Directory.GetFiles(file));
|
||||
filesList.AddRange(Directory.GetDirectories(file));
|
||||
string path = URLHelpers.CombineURL(remotePath, filename);
|
||||
string path = URLHelpers.CombineURL(remotePath, fileName);
|
||||
CreateDirectory(path);
|
||||
UploadFiles(filesList.ToArray(), path);
|
||||
}
|
||||
|
@ -454,8 +454,8 @@ public void DeleteDirectory(string remotePath)
|
|||
{
|
||||
if (Connect())
|
||||
{
|
||||
string filename = URLHelpers.GetFileName(remotePath);
|
||||
if (filename == "." || filename == "..")
|
||||
string fileName = URLHelpers.GetFileName(remotePath);
|
||||
if (fileName == "." || fileName == "..")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -99,10 +99,10 @@ public string FTPAddress
|
|||
}
|
||||
}
|
||||
|
||||
private string exampleFilename = "example.png";
|
||||
private string exampleFileName = "example.png";
|
||||
|
||||
[Category("FTP"), Description("Preview of the FTP path based on the settings above")]
|
||||
public string PreviewFtpPath => GetFtpPath(exampleFilename);
|
||||
public string PreviewFtpPath => GetFtpPath(exampleFileName);
|
||||
|
||||
[Category("FTP"), Description("Preview of the HTTP path based on the settings above")]
|
||||
public string PreviewHttpPath
|
||||
|
@ -111,7 +111,7 @@ public string PreviewHttpPath
|
|||
{
|
||||
try
|
||||
{
|
||||
return GetUriPath(exampleFilename);
|
||||
return GetUriPath(exampleFileName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -150,10 +150,10 @@ public FTPAccount()
|
|||
FTPSCertificateLocation = "";
|
||||
}
|
||||
|
||||
public string GetSubFolderPath(string filename = null, NameParserType nameParserType = NameParserType.URL)
|
||||
public string GetSubFolderPath(string fileName = null, NameParserType nameParserType = NameParserType.URL)
|
||||
{
|
||||
string path = NameParser.Parse(nameParserType, SubFolderPath.Replace("%host", Host));
|
||||
return URLHelpers.CombineURL(path, filename);
|
||||
return URLHelpers.CombineURL(path, fileName);
|
||||
}
|
||||
|
||||
public string GetHttpHomePath()
|
||||
|
@ -166,7 +166,7 @@ public string GetHttpHomePath()
|
|||
return parser.Parse(homePath);
|
||||
}
|
||||
|
||||
public string GetUriPath(string filename, string subFolderPath = null)
|
||||
public string GetUriPath(string fileName, string subFolderPath = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Host))
|
||||
{
|
||||
|
@ -175,10 +175,10 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
|
||||
if (HttpHomePathNoExtension)
|
||||
{
|
||||
filename = Path.GetFileNameWithoutExtension(filename);
|
||||
fileName = Path.GetFileNameWithoutExtension(fileName);
|
||||
}
|
||||
|
||||
filename = URLHelpers.URLEncode(filename);
|
||||
fileName = URLHelpers.URLEncode(fileName);
|
||||
|
||||
if (subFolderPath == null)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
url = URLHelpers.CombineURL(url, subFolderPath);
|
||||
}
|
||||
|
||||
url = URLHelpers.CombineURL(url, filename);
|
||||
url = URLHelpers.CombineURL(url, fileName);
|
||||
|
||||
httpHomeUri = new UriBuilder(url);
|
||||
httpHomeUri.Port = -1; //Since httpHomePath is not set, it's safe to erase UriBuilder's assumed port number
|
||||
|
@ -237,11 +237,11 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
//Setting URIBuilder.Query automatically prepends a ? so we must trim it first.
|
||||
if (HttpHomePathAutoAddSubFolderPath)
|
||||
{
|
||||
httpHomeUri.Query = URLHelpers.CombineURL(httpHomeUri.Query.Substring(1), subFolderPath, filename);
|
||||
httpHomeUri.Query = URLHelpers.CombineURL(httpHomeUri.Query.Substring(1), subFolderPath, fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
httpHomeUri.Query = httpHomeUri.Query.Substring(1) + filename;
|
||||
httpHomeUri.Query = httpHomeUri.Query.Substring(1) + fileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -251,7 +251,7 @@ public string GetUriPath(string filename, string subFolderPath = null)
|
|||
httpHomeUri.Path = URLHelpers.CombineURL(httpHomeUri.Path, subFolderPath);
|
||||
}
|
||||
|
||||
httpHomeUri.Path = URLHelpers.CombineURL(httpHomeUri.Path, filename);
|
||||
httpHomeUri.Path = URLHelpers.CombineURL(httpHomeUri.Path, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,14 +78,14 @@ public string LocalUri
|
|||
}
|
||||
}
|
||||
|
||||
private string exampleFilename = "screenshot.jpg";
|
||||
private string exampleFileName = "screenshot.jpg";
|
||||
|
||||
[Category("Localhost"), Description("Preview of the Localhost Path based on the settings above")]
|
||||
public string PreviewLocalPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetLocalhostUri(exampleFilename);
|
||||
return GetLocalhostUri(exampleFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public string PreviewRemotePath
|
|||
{
|
||||
get
|
||||
{
|
||||
return GetUriPath(exampleFilename);
|
||||
return GetUriPath(exampleFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public string GetHttpHomePath()
|
|||
return NameParser.Parse(NameParserType.URL, HttpHomePath.Replace("%host", Helpers.ExpandFolderVariables(LocalhostRoot)));
|
||||
}
|
||||
|
||||
public string GetUriPath(string filename)
|
||||
public string GetUriPath(string fileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(LocalhostRoot))
|
||||
{
|
||||
|
@ -138,10 +138,10 @@ public string GetUriPath(string filename)
|
|||
|
||||
if (HttpHomePathNoExtension)
|
||||
{
|
||||
filename = Path.GetFileNameWithoutExtension(filename);
|
||||
fileName = Path.GetFileNameWithoutExtension(fileName);
|
||||
}
|
||||
|
||||
filename = URLHelpers.URLEncode(filename);
|
||||
fileName = URLHelpers.URLEncode(fileName);
|
||||
|
||||
string subFolderPath = GetSubFolderPath();
|
||||
subFolderPath = URLHelpers.URLEncode(subFolderPath, true);
|
||||
|
@ -170,7 +170,7 @@ public string GetUriPath(string filename)
|
|||
path = URLHelpers.CombineURL(path, subFolderPath);
|
||||
}
|
||||
|
||||
path = URLHelpers.CombineURL(path, filename);
|
||||
path = URLHelpers.CombineURL(path, fileName);
|
||||
|
||||
string remoteProtocol = RemoteProtocol.GetDescription();
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public override UploadResult UploadText(string text, string fileName)
|
|||
|
||||
if (UseFileExtension)
|
||||
{
|
||||
string ext = Helpers.GetFilenameExtension(fileName);
|
||||
string ext = Helpers.GetFileNameExtension(fileName);
|
||||
|
||||
if (!string.IsNullOrEmpty(ext) && !ext.Equals("txt", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
|
|
|
@ -46,9 +46,9 @@ public UploaderFilter(string uploader, params string[] extensions)
|
|||
Extensions = extensions.ToList();
|
||||
}
|
||||
|
||||
public bool IsValidFilter(string filename)
|
||||
public bool IsValidFilter(string fileName)
|
||||
{
|
||||
string extension = Helpers.GetFilenameExtension(filename);
|
||||
string extension = Helpers.GetFileNameExtension(fileName);
|
||||
|
||||
return !string.IsNullOrEmpty(extension) && Extensions.Any(x => x.TrimStart('.').Equals(extension, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public AfterCaptureForm(TaskMetadata metadata, TaskSettings taskSettings) : this
|
|||
btnCopy.Enabled = true;
|
||||
}
|
||||
|
||||
FileName = TaskHelpers.GetFilename(TaskSettings, null, metadata);
|
||||
FileName = TaskHelpers.GetFileName(TaskSettings, null, metadata);
|
||||
txtFileName.Text = FileName;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,22 +33,22 @@ namespace ShareX
|
|||
{
|
||||
public partial class FileExistForm : Form
|
||||
{
|
||||
public string Filepath { get; private set; }
|
||||
public string FilePath { get; private set; }
|
||||
|
||||
private string filename;
|
||||
private string uniqueFilepath;
|
||||
private string fileName;
|
||||
private string uniqueFilePath;
|
||||
|
||||
public FileExistForm(string filepath)
|
||||
public FileExistForm(string filePath)
|
||||
{
|
||||
InitializeComponent();
|
||||
ShareXResources.ApplyTheme(this);
|
||||
|
||||
Filepath = filepath;
|
||||
filename = Path.GetFileNameWithoutExtension(Filepath);
|
||||
txtNewName.Text = filename;
|
||||
btnOverwrite.Text += Path.GetFileName(Filepath);
|
||||
uniqueFilepath = Helpers.GetUniqueFilePath(Filepath);
|
||||
btnUniqueName.Text += Path.GetFileName(uniqueFilepath);
|
||||
FilePath = filePath;
|
||||
fileName = Path.GetFileNameWithoutExtension(FilePath);
|
||||
txtNewName.Text = fileName;
|
||||
btnOverwrite.Text += Path.GetFileName(FilePath);
|
||||
uniqueFilePath = Helpers.GetUniqueFilePath(FilePath);
|
||||
btnUniqueName.Text += Path.GetFileName(uniqueFilePath);
|
||||
}
|
||||
|
||||
private void FileExistForm_Shown(object sender, EventArgs e)
|
||||
|
@ -56,46 +56,46 @@ private void FileExistForm_Shown(object sender, EventArgs e)
|
|||
this.ForceActivate();
|
||||
}
|
||||
|
||||
private string GetNewFilename()
|
||||
private string GetNewFileName()
|
||||
{
|
||||
string newFilename = txtNewName.Text;
|
||||
string newFileName = txtNewName.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(newFilename))
|
||||
if (!string.IsNullOrEmpty(newFileName))
|
||||
{
|
||||
return newFilename + Path.GetExtension(Filepath);
|
||||
return newFileName + Path.GetExtension(FilePath);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private void UseNewFilename()
|
||||
private void UseNewFileName()
|
||||
{
|
||||
string newFilename = GetNewFilename();
|
||||
string newFileName = GetNewFileName();
|
||||
|
||||
if (!string.IsNullOrEmpty(newFilename))
|
||||
if (!string.IsNullOrEmpty(newFileName))
|
||||
{
|
||||
Filepath = Path.Combine(Path.GetDirectoryName(Filepath), newFilename);
|
||||
FilePath = Path.Combine(Path.GetDirectoryName(FilePath), newFileName);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void UseUniqueFilename()
|
||||
private void UseUniqueFileName()
|
||||
{
|
||||
Filepath = uniqueFilepath;
|
||||
FilePath = uniqueFilePath;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
Filepath = "";
|
||||
FilePath = "";
|
||||
Close();
|
||||
}
|
||||
|
||||
private void txtNewName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
string newFilename = txtNewName.Text;
|
||||
btnNewName.Enabled = !string.IsNullOrEmpty(newFilename) && !newFilename.Equals(filename, StringComparison.InvariantCultureIgnoreCase);
|
||||
btnNewName.Text = Resources.FileExistForm_txtNewName_TextChanged_Use_new_name__ + GetNewFilename();
|
||||
string newFileName = txtNewName.Text;
|
||||
btnNewName.Enabled = !string.IsNullOrEmpty(newFileName) && !newFileName.Equals(fileName, StringComparison.InvariantCultureIgnoreCase);
|
||||
btnNewName.Text = Resources.FileExistForm_txtNewName_TextChanged_Use_new_name__ + GetNewFileName();
|
||||
}
|
||||
|
||||
private void txtNewName_KeyDown(object sender, KeyEventArgs e)
|
||||
|
@ -110,17 +110,17 @@ private void txtNewName_KeyUp(object sender, KeyEventArgs e)
|
|||
{
|
||||
if (e.KeyData == Keys.Enter)
|
||||
{
|
||||
string newFilename = txtNewName.Text;
|
||||
string newFileName = txtNewName.Text;
|
||||
|
||||
if (!string.IsNullOrEmpty(newFilename))
|
||||
if (!string.IsNullOrEmpty(newFileName))
|
||||
{
|
||||
if (newFilename.Equals(filename, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (newFileName.Equals(fileName, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
UseNewFilename();
|
||||
UseNewFileName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ private void txtNewName_KeyUp(object sender, KeyEventArgs e)
|
|||
|
||||
private void btnNewName_Click(object sender, EventArgs e)
|
||||
{
|
||||
UseNewFilename();
|
||||
UseNewFileName();
|
||||
}
|
||||
|
||||
private void btnOverwrite_Click(object sender, EventArgs e)
|
||||
|
@ -142,7 +142,7 @@ private void btnOverwrite_Click(object sender, EventArgs e)
|
|||
|
||||
private void btnUniqueName_Click(object sender, EventArgs e)
|
||||
{
|
||||
UseUniqueFilename();
|
||||
UseUniqueFileName();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -179,7 +179,7 @@ public static string PersonalFolder
|
|||
}
|
||||
}
|
||||
|
||||
public const string HistoryFilename = "History.json";
|
||||
public const string HistoryFileName = "History.json";
|
||||
|
||||
public static string HistoryFilePath
|
||||
{
|
||||
|
@ -187,11 +187,11 @@ public static string HistoryFilePath
|
|||
{
|
||||
if (Sandbox) return null;
|
||||
|
||||
return Path.Combine(PersonalFolder, HistoryFilename);
|
||||
return Path.Combine(PersonalFolder, HistoryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public const string HistoryFilenameOld = "History.xml";
|
||||
public const string HistoryFileNameOld = "History.xml";
|
||||
|
||||
public static string HistoryFilePathOld
|
||||
{
|
||||
|
@ -199,20 +199,20 @@ public static string HistoryFilePathOld
|
|||
{
|
||||
if (Sandbox) return null;
|
||||
|
||||
return Path.Combine(PersonalFolder, HistoryFilenameOld);
|
||||
return Path.Combine(PersonalFolder, HistoryFileNameOld);
|
||||
}
|
||||
}
|
||||
|
||||
public const string LogsFoldername = "Logs";
|
||||
public const string LogsFolderName = "Logs";
|
||||
|
||||
public static string LogsFolder => Path.Combine(PersonalFolder, LogsFoldername);
|
||||
public static string LogsFolder => Path.Combine(PersonalFolder, LogsFolderName);
|
||||
|
||||
public static string LogsFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
string filename = string.Format("ShareX-Log-{0:yyyy-MM}.txt", DateTime.Now);
|
||||
return Path.Combine(LogsFolder, filename);
|
||||
string fileName = string.Format("ShareX-Log-{0:yyyy-MM}.txt", DateTime.Now);
|
||||
return Path.Combine(LogsFolder, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public string FileName
|
|||
text = URL;
|
||||
}
|
||||
|
||||
return Helpers.GetFilenameSafe(text);
|
||||
return Helpers.GetFileNameSafe(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
|
|||
extension = taskSettings.CaptureSettings.FFmpegOptions.Extension;
|
||||
}
|
||||
string screenshotsFolder = TaskHelpers.GetScreenshotsFolder(taskSettings, metadata);
|
||||
string fileName = TaskHelpers.GetFilename(taskSettings, extension, metadata);
|
||||
string fileName = TaskHelpers.GetFileName(taskSettings, extension, metadata);
|
||||
path = TaskHelpers.HandleExistsFile(screenshotsFolder, fileName, taskSettings);
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
|
@ -291,10 +291,10 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
|
|||
{
|
||||
if (!string.IsNullOrEmpty(customFileName))
|
||||
{
|
||||
string currentFilename = Path.GetFileNameWithoutExtension(path);
|
||||
string currentFileName = Path.GetFileNameWithoutExtension(path);
|
||||
string ext = Path.GetExtension(path);
|
||||
|
||||
if (!currentFilename.Equals(customFileName, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!currentFileName.Equals(customFileName, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
path = Helpers.RenameFile(path, customFileName + ext);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ private static void ScreenRecorder_EncodingProgressChanged(int progress)
|
|||
private static string ProcessTwoPassEncoding(string input, TaskMetadata metadata, TaskSettings taskSettings, bool deleteInputFile = true)
|
||||
{
|
||||
string screenshotsFolder = TaskHelpers.GetScreenshotsFolder(taskSettings, metadata);
|
||||
string fileName = TaskHelpers.GetFilename(taskSettings, taskSettings.CaptureSettings.FFmpegOptions.Extension, metadata);
|
||||
string fileName = TaskHelpers.GetFileName(taskSettings, taskSettings.CaptureSettings.FFmpegOptions.Extension, metadata);
|
||||
string output = Path.Combine(screenshotsFolder, fileName);
|
||||
|
||||
try
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ShareX
|
|||
{
|
||||
internal static class SettingManager
|
||||
{
|
||||
private const string ApplicationConfigFilename = "ApplicationConfig.json";
|
||||
private const string ApplicationConfigFileName = "ApplicationConfig.json";
|
||||
|
||||
private static string ApplicationConfigFilePath
|
||||
{
|
||||
|
@ -49,11 +49,11 @@ private static string ApplicationConfigFilePath
|
|||
{
|
||||
if (Program.Sandbox) return null;
|
||||
|
||||
return Path.Combine(Program.PersonalFolder, ApplicationConfigFilename);
|
||||
return Path.Combine(Program.PersonalFolder, ApplicationConfigFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private const string UploadersConfigFilename = "UploadersConfig.json";
|
||||
private const string UploadersConfigFileName = "UploadersConfig.json";
|
||||
|
||||
private static string UploadersConfigFilePath
|
||||
{
|
||||
|
@ -72,11 +72,11 @@ private static string UploadersConfigFilePath
|
|||
uploadersConfigFolder = Program.PersonalFolder;
|
||||
}
|
||||
|
||||
return Path.Combine(uploadersConfigFolder, UploadersConfigFilename);
|
||||
return Path.Combine(uploadersConfigFolder, UploadersConfigFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private const string HotkeysConfigFilename = "HotkeysConfig.json";
|
||||
private const string HotkeysConfigFileName = "HotkeysConfig.json";
|
||||
|
||||
private static string HotkeysConfigFilePath
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ private static string HotkeysConfigFilePath
|
|||
hotkeysConfigFolder = Program.PersonalFolder;
|
||||
}
|
||||
|
||||
return Path.Combine(hotkeysConfigFolder, HotkeysConfigFilename);
|
||||
return Path.Combine(hotkeysConfigFolder, HotkeysConfigFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,13 +364,13 @@ public static bool Export(string archivePath, bool settings, bool history)
|
|||
if (settings)
|
||||
{
|
||||
msApplicationConfig = Settings.SaveToMemoryStream(false);
|
||||
entries.Add(new ZipEntryInfo(msApplicationConfig, ApplicationConfigFilename));
|
||||
entries.Add(new ZipEntryInfo(msApplicationConfig, ApplicationConfigFileName));
|
||||
|
||||
msUploadersConfig = UploadersConfig.SaveToMemoryStream(false);
|
||||
entries.Add(new ZipEntryInfo(msUploadersConfig, UploadersConfigFilename));
|
||||
entries.Add(new ZipEntryInfo(msUploadersConfig, UploadersConfigFileName));
|
||||
|
||||
msHotkeysConfig = HotkeysConfig.SaveToMemoryStream(false);
|
||||
entries.Add(new ZipEntryInfo(msHotkeysConfig, HotkeysConfigFilename));
|
||||
entries.Add(new ZipEntryInfo(msHotkeysConfig, HotkeysConfigFileName));
|
||||
}
|
||||
|
||||
if (history)
|
||||
|
|
|
@ -298,12 +298,12 @@ public static ImageData PrepareImage(Image img, TaskSettings taskSettings)
|
|||
return imageData;
|
||||
}
|
||||
|
||||
public static string CreateThumbnail(Bitmap bmp, string folder, string filename, TaskSettings taskSettings)
|
||||
public static string CreateThumbnail(Bitmap bmp, string folder, string fileName, TaskSettings taskSettings)
|
||||
{
|
||||
if ((taskSettings.ImageSettings.ThumbnailWidth > 0 || taskSettings.ImageSettings.ThumbnailHeight > 0) && (!taskSettings.ImageSettings.ThumbnailCheckSize ||
|
||||
(bmp.Width > taskSettings.ImageSettings.ThumbnailWidth && bmp.Height > taskSettings.ImageSettings.ThumbnailHeight)))
|
||||
{
|
||||
string thumbnailFileName = Path.GetFileNameWithoutExtension(filename) + taskSettings.ImageSettings.ThumbnailName + ".jpg";
|
||||
string thumbnailFileName = Path.GetFileNameWithoutExtension(fileName) + taskSettings.ImageSettings.ThumbnailName + ".jpg";
|
||||
string thumbnailFilePath = HandleExistsFile(folder, thumbnailFileName, taskSettings);
|
||||
|
||||
if (!string.IsNullOrEmpty(thumbnailFilePath))
|
||||
|
@ -370,7 +370,7 @@ public static void SaveImageAsFile(Bitmap bmp, TaskSettings taskSettings, bool o
|
|||
using (ImageData imageData = PrepareImage(bmp, taskSettings))
|
||||
{
|
||||
string screenshotsFolder = GetScreenshotsFolder(taskSettings);
|
||||
string fileName = GetFilename(taskSettings, imageData.ImageFormat.GetDescription(), bmp);
|
||||
string fileName = GetFileName(taskSettings, imageData.ImageFormat.GetDescription(), bmp);
|
||||
string filePath = Path.Combine(screenshotsFolder, fileName);
|
||||
|
||||
if (!overwriteFile)
|
||||
|
@ -386,15 +386,15 @@ public static void SaveImageAsFile(Bitmap bmp, TaskSettings taskSettings, bool o
|
|||
}
|
||||
}
|
||||
|
||||
public static string GetFilename(TaskSettings taskSettings, string extension, Bitmap bmp)
|
||||
public static string GetFileName(TaskSettings taskSettings, string extension, Bitmap bmp)
|
||||
{
|
||||
TaskMetadata metadata = new TaskMetadata(bmp);
|
||||
return GetFilename(taskSettings, extension, metadata);
|
||||
return GetFileName(taskSettings, extension, metadata);
|
||||
}
|
||||
|
||||
public static string GetFilename(TaskSettings taskSettings, string extension = null, TaskMetadata metadata = null)
|
||||
public static string GetFileName(TaskSettings taskSettings, string extension = null, TaskMetadata metadata = null)
|
||||
{
|
||||
string filename;
|
||||
string fileName;
|
||||
|
||||
NameParser nameParser = new NameParser(NameParserType.FileName)
|
||||
{
|
||||
|
@ -418,21 +418,21 @@ public static string GetFilename(TaskSettings taskSettings, string extension = n
|
|||
|
||||
if (!string.IsNullOrEmpty(taskSettings.UploadSettings.NameFormatPatternActiveWindow) && !string.IsNullOrEmpty(nameParser.WindowText))
|
||||
{
|
||||
filename = nameParser.Parse(taskSettings.UploadSettings.NameFormatPatternActiveWindow);
|
||||
fileName = nameParser.Parse(taskSettings.UploadSettings.NameFormatPatternActiveWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = nameParser.Parse(taskSettings.UploadSettings.NameFormatPattern);
|
||||
fileName = nameParser.Parse(taskSettings.UploadSettings.NameFormatPattern);
|
||||
}
|
||||
|
||||
Program.Settings.NameParserAutoIncrementNumber = nameParser.AutoIncrementNumber;
|
||||
|
||||
if (!string.IsNullOrEmpty(extension))
|
||||
{
|
||||
filename += "." + extension.TrimStart('.');
|
||||
fileName += "." + extension.TrimStart('.');
|
||||
}
|
||||
|
||||
return filename;
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public static string GetScreenshotsFolder(TaskSettings taskSettings = null, TaskMetadata metadata = null)
|
||||
|
@ -596,9 +596,9 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ public static string HandleExistsFile(string filepath, TaskSettings taskSettings
|
|||
using (FileExistForm form = new FileExistForm(filepath))
|
||||
{
|
||||
form.ShowDialog();
|
||||
filepath = form.Filepath;
|
||||
filepath = form.FilePath;
|
||||
}
|
||||
break;
|
||||
case FileExistAction.UniqueName:
|
||||
|
@ -952,7 +952,7 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
if (string.IsNullOrEmpty(newFilePath))
|
||||
{
|
||||
string screenshotsFolder = GetScreenshotsFolder(taskSettings);
|
||||
string fileName = GetFilename(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output);
|
||||
string fileName = GetFileName(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output);
|
||||
newFilePath = Path.Combine(screenshotsFolder, fileName);
|
||||
}
|
||||
|
||||
|
@ -969,7 +969,7 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
if (string.IsNullOrEmpty(newFilePath))
|
||||
{
|
||||
string screenshotsFolder = GetScreenshotsFolder(taskSettings);
|
||||
string fileName = GetFilename(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output);
|
||||
string fileName = GetFileName(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output);
|
||||
newFilePath = Path.Combine(screenshotsFolder, fileName);
|
||||
}
|
||||
|
||||
|
|
|
@ -449,13 +449,13 @@ public static void UploadText(string text, TaskSettings taskSettings = null, boo
|
|||
}
|
||||
}
|
||||
|
||||
public static void UploadImageStream(Stream stream, string filename, TaskSettings taskSettings = null)
|
||||
public static void UploadImageStream(Stream stream, string fileName, TaskSettings taskSettings = null)
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
if (stream != null && stream.Length > 0 && !string.IsNullOrEmpty(filename))
|
||||
if (stream != null && stream.Length > 0 && !string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
WorkerTask task = WorkerTask.CreateDataUploaderTask(EDataType.Image, stream, filename, taskSettings);
|
||||
WorkerTask task = WorkerTask.CreateDataUploaderTask(EDataType.Image, stream, fileName, taskSettings);
|
||||
TaskManager.Start(task);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ public static WorkerTask CreateFileUploaderTask(string filePath, TaskSettings ta
|
|||
|
||||
if (task.Info.TaskSettings.UploadSettings.FileUploadUseNamePattern)
|
||||
{
|
||||
string ext = Helpers.GetFilenameExtension(task.Info.FilePath);
|
||||
task.Info.FileName = TaskHelpers.GetFilename(task.Info.TaskSettings, ext);
|
||||
string ext = Helpers.GetFileNameExtension(task.Info.FilePath);
|
||||
task.Info.FileName = TaskHelpers.GetFileName(task.Info.TaskSettings, ext);
|
||||
}
|
||||
|
||||
if (task.Info.TaskSettings.AdvancedSettings.ProcessImagesDuringFileUpload && task.Info.DataType == EDataType.Image)
|
||||
|
@ -141,7 +141,7 @@ public static WorkerTask CreateImageUploaderTask(TaskMetadata metadata, TaskSett
|
|||
}
|
||||
else
|
||||
{
|
||||
task.Info.FileName = TaskHelpers.GetFilename(taskSettings, "bmp", metadata);
|
||||
task.Info.FileName = TaskHelpers.GetFileName(taskSettings, "bmp", metadata);
|
||||
}
|
||||
|
||||
task.Info.Metadata = metadata;
|
||||
|
@ -154,7 +154,7 @@ public static WorkerTask CreateTextUploaderTask(string text, TaskSettings taskSe
|
|||
WorkerTask task = new WorkerTask(taskSettings);
|
||||
task.Info.Job = TaskJob.TextUpload;
|
||||
task.Info.DataType = EDataType.Text;
|
||||
task.Info.FileName = TaskHelpers.GetFilename(taskSettings, taskSettings.AdvancedSettings.TextFileExtension);
|
||||
task.Info.FileName = TaskHelpers.GetFileName(taskSettings, taskSettings.AdvancedSettings.TextFileExtension);
|
||||
task.Text = text;
|
||||
return task;
|
||||
}
|
||||
|
@ -187,13 +187,13 @@ public static WorkerTask CreateFileJobTask(string filePath, TaskMetadata metadat
|
|||
|
||||
if (!string.IsNullOrEmpty(customFileName))
|
||||
{
|
||||
string ext = Helpers.GetFilenameExtension(task.Info.FilePath);
|
||||
string ext = Helpers.GetFileNameExtension(task.Info.FilePath);
|
||||
task.Info.FileName = Helpers.AppendExtension(customFileName, ext);
|
||||
}
|
||||
else if (task.Info.TaskSettings.UploadSettings.FileUploadUseNamePattern)
|
||||
{
|
||||
string ext = Helpers.GetFilenameExtension(task.Info.FilePath);
|
||||
task.Info.FileName = TaskHelpers.GetFilename(task.Info.TaskSettings, ext);
|
||||
string ext = Helpers.GetFileNameExtension(task.Info.FilePath);
|
||||
task.Info.FileName = TaskHelpers.GetFileName(task.Info.TaskSettings, ext);
|
||||
}
|
||||
|
||||
task.Info.Metadata = metadata;
|
||||
|
@ -212,22 +212,22 @@ public static WorkerTask CreateDownloadTask(string url, bool upload, TaskSetting
|
|||
WorkerTask task = new WorkerTask(taskSettings);
|
||||
task.Info.Job = upload ? TaskJob.DownloadUpload : TaskJob.Download;
|
||||
|
||||
string filename = URLHelpers.URLDecode(url, 10);
|
||||
filename = URLHelpers.GetFileName(filename);
|
||||
filename = Helpers.GetValidFileName(filename);
|
||||
string fileName = URLHelpers.URLDecode(url, 10);
|
||||
fileName = URLHelpers.GetFileName(fileName);
|
||||
fileName = Helpers.GetValidFileName(fileName);
|
||||
|
||||
if (task.Info.TaskSettings.UploadSettings.FileUploadUseNamePattern)
|
||||
{
|
||||
string ext = Helpers.GetFilenameExtension(filename);
|
||||
filename = TaskHelpers.GetFilename(task.Info.TaskSettings, ext);
|
||||
string ext = Helpers.GetFileNameExtension(fileName);
|
||||
fileName = TaskHelpers.GetFileName(task.Info.TaskSettings, ext);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
task.Info.FileName = filename;
|
||||
task.Info.FileName = fileName;
|
||||
task.Info.DataType = TaskHelpers.FindDataType(task.Info.FileName, taskSettings);
|
||||
task.Info.Result.URL = url;
|
||||
return task;
|
||||
|
@ -443,7 +443,7 @@ private void DoUploadJob()
|
|||
}
|
||||
}
|
||||
|
||||
private bool DoUpload(Stream data, string filename, int retry = 0)
|
||||
private bool DoUpload(Stream data, string fileName, int retry = 0)
|
||||
{
|
||||
bool isError = false;
|
||||
|
||||
|
@ -472,18 +472,18 @@ private bool DoUpload(Stream data, string filename, int retry = 0)
|
|||
sslBypassHelper = new SSLBypassHelper();
|
||||
}
|
||||
|
||||
if (!CheckUploadFilters(data, filename))
|
||||
if (!CheckUploadFilters(data, fileName))
|
||||
{
|
||||
switch (Info.UploadDestination)
|
||||
{
|
||||
case EDataType.Image:
|
||||
Info.Result = UploadImage(data, filename);
|
||||
Info.Result = UploadImage(data, fileName);
|
||||
break;
|
||||
case EDataType.Text:
|
||||
Info.Result = UploadText(data, filename);
|
||||
Info.Result = UploadText(data, fileName);
|
||||
break;
|
||||
case EDataType.File:
|
||||
Info.Result = UploadFile(data, filename);
|
||||
Info.Result = UploadFile(data, fileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -689,20 +689,20 @@ private bool DoAfterCaptureJobs()
|
|||
|
||||
if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SaveThumbnailImageToFile))
|
||||
{
|
||||
string thumbnailFilename, thumbnailFolder;
|
||||
string thumbnailFileName, thumbnailFolder;
|
||||
|
||||
if (!string.IsNullOrEmpty(Info.FilePath))
|
||||
{
|
||||
thumbnailFilename = Path.GetFileName(Info.FilePath);
|
||||
thumbnailFileName = Path.GetFileName(Info.FilePath);
|
||||
thumbnailFolder = Path.GetDirectoryName(Info.FilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
thumbnailFilename = Info.FileName;
|
||||
thumbnailFileName = Info.FileName;
|
||||
thumbnailFolder = TaskHelpers.GetScreenshotsFolder(Info.TaskSettings, Info.Metadata);
|
||||
}
|
||||
|
||||
Info.ThumbnailFilePath = TaskHelpers.CreateThumbnail(Image, thumbnailFolder, thumbnailFilename, Info.TaskSettings);
|
||||
Info.ThumbnailFilePath = TaskHelpers.CreateThumbnail(Image, thumbnailFolder, thumbnailFileName, Info.TaskSettings);
|
||||
|
||||
if (!string.IsNullOrEmpty(Info.ThumbnailFilePath))
|
||||
{
|
||||
|
@ -747,8 +747,8 @@ private void DoFileJobs()
|
|||
|
||||
if (isFileModified)
|
||||
{
|
||||
string extension = Helpers.GetFilenameExtension(Info.FilePath);
|
||||
Info.FileName = Helpers.ChangeFilenameExtension(fileName, extension);
|
||||
string extension = Helpers.GetFileNameExtension(Info.FilePath);
|
||||
Info.FileName = Helpers.ChangeFileNameExtension(fileName, extension);
|
||||
|
||||
LoadFileStream();
|
||||
}
|
||||
|
@ -927,11 +927,11 @@ public UploadResult UploadData(IGenericUploaderService service, Stream stream, s
|
|||
return null;
|
||||
}
|
||||
|
||||
private bool CheckUploadFilters(Stream stream, string filename)
|
||||
private bool CheckUploadFilters(Stream stream, string fileName)
|
||||
{
|
||||
if (Info.TaskSettings.UploadSettings.UploaderFilters != null && !string.IsNullOrEmpty(filename) && stream != null)
|
||||
if (Info.TaskSettings.UploadSettings.UploaderFilters != null && !string.IsNullOrEmpty(fileName) && stream != null)
|
||||
{
|
||||
UploaderFilter filter = Info.TaskSettings.UploadSettings.UploaderFilters.FirstOrDefault(x => x.IsValidFilter(filename));
|
||||
UploaderFilter filter = Info.TaskSettings.UploadSettings.UploaderFilters.FirstOrDefault(x => x.IsValidFilter(fileName));
|
||||
|
||||
if (filter != null)
|
||||
{
|
||||
|
@ -939,7 +939,7 @@ private bool CheckUploadFilters(Stream stream, string filename)
|
|||
|
||||
if (service != null)
|
||||
{
|
||||
Info.Result = UploadData(service, stream, filename);
|
||||
Info.Result = UploadData(service, stream, fileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue