Set default filename for custom uploader export

This commit is contained in:
Jaex 2018-01-02 10:38:28 +03:00
parent 5ac5ee5f48
commit 9b5f28e366
4 changed files with 13 additions and 3 deletions

View file

@ -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)
{

View file

@ -3260,6 +3260,8 @@ private object eiCustomUploaders_ExportRequested()
MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
eiCustomUploaders.DefaultFileName = uploader.GetFileName();
}
return uploader;

View file

@ -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);
}
}

View file

@ -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;
}