Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions FeedBuilder/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,13 @@ private void Build()
var fileInfoEx = (FileInfoEx)thisItem.Tag;
XmlElement task = doc.CreateElement("FileUpdateTask");
task.SetAttribute("localPath", fileInfoEx.RelativeName);
if (!string.IsNullOrEmpty(txtAddExtension.Text)) task.SetAttribute("updateTo",fileInfoEx.RelativeName+"."+txtAddExtension.Text.Trim());
// generate FileUpdateTask metadata items
task.SetAttribute("lastModified", fileInfoEx.FileInfo.LastWriteTime.ToFileTime().ToString(CultureInfo.InvariantCulture));
if (!string.IsNullOrEmpty(txtAddExtension.Text))
{
task.SetAttribute("updateTo", AddExtensionToPath(fileInfoEx.RelativeName, txtAddExtension.Text));
}

task.SetAttribute("fileSize", fileInfoEx.FileInfo.Length.ToString(CultureInfo.InvariantCulture));
if (!string.IsNullOrEmpty(fileInfoEx.FileVersion)) task.SetAttribute("version", fileInfoEx.FileVersion);

Expand Down Expand Up @@ -400,7 +404,11 @@ private bool CopyFile(string sourceFile, string destFile)
var fi = new FileInfo(destFile);
var d = Directory.GetParent(fi.FullName);
if (!Directory.Exists(d.FullName)) CreateDirectoryPath(d.FullName);
if (!string.IsNullOrEmpty(txtAddExtension.Text)) destFile += "." + txtAddExtension.Text.Trim();
if (!string.IsNullOrEmpty(txtAddExtension.Text))
{
destFile = AddExtensionToPath(destFile, txtAddExtension.Text);
}

// Copy with delayed retry
int retries = 3;
while (retries > 0)
Expand Down Expand Up @@ -563,6 +571,12 @@ private bool IsIgnorable(string filename)
return (chkIgnoreVsHost.Checked && filename.ToLower().Contains("vshost.exe"));
}

private string AddExtensionToPath(string filePath, string extension)
{
string sanitizedExtension = (extension.Trim().StartsWith(".") ? String.Empty : ".") + extension.Trim();
return filePath + sanitizedExtension;
}

private void Save(bool forceDialog)
{
SaveFormSettings();
Expand Down