mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Set default filename for custom uploader export
This commit is contained in:
parent
5ac5ee5f48
commit
9b5f28e366
4 changed files with 13 additions and 3 deletions
|
@ -58,6 +58,8 @@ public partial class ExportImportControl : UserControl
|
|||
[DefaultValue("")]
|
||||
public string CustomFilter { get; set; } = "";
|
||||
|
||||
public string DefaultFileName { get; set; }
|
||||
|
||||
public ExportImportControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -130,7 +132,7 @@ private void tsmiExportFile_Click(object sender, EventArgs e)
|
|||
filter = CustomFilter + "|" + filter;
|
||||
}
|
||||
|
||||
using (SaveFileDialog sfd = new SaveFileDialog() { Filter = filter })
|
||||
using (SaveFileDialog sfd = new SaveFileDialog() { Filter = filter, FileName = DefaultFileName })
|
||||
{
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
|
|
@ -3260,6 +3260,8 @@ private object eiCustomUploaders_ExportRequested()
|
|||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
eiCustomUploaders.DefaultFileName = uploader.GetFileName();
|
||||
}
|
||||
|
||||
return uploader;
|
||||
|
|
|
@ -1629,7 +1629,7 @@ private void CustomUploaderExportAll()
|
|||
foreach (CustomUploaderItem uploader in Config.CustomUploadersList)
|
||||
{
|
||||
string json = eiCustomUploaders.Serialize(uploader);
|
||||
string filepath = Path.Combine(fsd.FileName, uploader.ToString() + ".sxcu");
|
||||
string filepath = Path.Combine(fsd.FileName, uploader.GetFileName());
|
||||
File.WriteAllText(filepath, json, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,11 @@ public override string ToString()
|
|||
return "Name";
|
||||
}
|
||||
|
||||
public string GetFileName()
|
||||
{
|
||||
return ToString() + ".sxcu";
|
||||
}
|
||||
|
||||
public HttpMethod GetHttpMethod()
|
||||
{
|
||||
switch (RequestType)
|
||||
|
@ -271,9 +276,10 @@ public string ParseURL(string url, bool output)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
escape = false;
|
||||
}
|
||||
else if(url[i] == '\\' && !escape)
|
||||
else if (url[i] == '\\' && !escape)
|
||||
{
|
||||
escape = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue