本文整理汇总了C#中IProgress.WriteError方法的典型用法代码示例。如果您正苦于以下问题:C# IProgress.WriteError方法的具体用法?C# IProgress.WriteError怎么用?C# IProgress.WriteError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgress
的用法示例。
在下文中一共展示了IProgress.WriteError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeCloneFromLocalToLocal
//TODO: get rid of this, or somehow combine it with the other Clone() options out there
/// <returns>path to clone, or empty if it failed</returns>
private static string MakeCloneFromLocalToLocal(string sourcePath, string targetDirectory, bool cloningFromUsb, IProgress progress)
{
RequireThat.Directory(sourcePath).Exists();
//Handled by GetUniqueFolderPath call now down in CloneLocal call. RequireThat.Directory(targetDirectory).DoesNotExist();
RequireThat.Directory(targetDirectory).Parent().Exists();
HgRepository local = new HgRepository(sourcePath, progress);
if (!local.RemoveOldLocks())
{
progress.WriteError("Chorus could not create the clone at this time. Try again after restarting the computer.");
return string.Empty;
}
using (new ConsoleProgress("Trying to Create repository clone at {0}", targetDirectory))
{
// Make a backward compatibile clone if cloning to USB (http://mercurial.selenic.com/wiki/UpgradingMercurial)
targetDirectory = local.CloneLocalWithoutUpdate(targetDirectory, cloningFromUsb ? null : "--config format.dotencode=false --pull");
File.WriteAllText(Path.Combine(targetDirectory, "~~Folder has an invisible repository.txt"), "In this folder, there is a (possibly hidden) folder named '.hg' that contains the actual data of this Chorus repository. Depending on your Operating System settings, that leading '.' might make the folder invisible to you. But Chorus clients (WeSay, FLEx, OneStory, etc.) can see it and can use this folder to perform Send/Receive operations.");
if (cloningFromUsb)
{
var clone = new HgRepository(targetDirectory, progress);
clone.Update();
}
return targetDirectory;
}
}
示例2: MakeCloneFromLocalToLocal
//TODO: get rid of this, or somehow combine it with the other Clone() options out there
/// <returns>path to clone, or empty if it failed</returns>
public static string MakeCloneFromLocalToLocal(string sourcePath, string targetDirectory, bool alsoDoCheckout, IProgress progress)
{
RequireThat.Directory(sourcePath).Exists();
//Handled by GetUniqueFolderPath call now down in CloneLocal call. RequireThat.Directory(targetDirectory).DoesNotExist();
RequireThat.Directory(targetDirectory).Parent().Exists();
HgRepository local = new HgRepository(sourcePath, progress);
if (!local.RemoveOldLocks())
{
progress.WriteError("Chorus could not create the clone at this time. Try again after restarting the computer.");
return string.Empty;
}
using (new ConsoleProgress("Trying to Create repository clone at {0}", targetDirectory))
{
targetDirectory = local.CloneLocalWithoutUpdate(targetDirectory);
File.WriteAllText(Path.Combine(targetDirectory, "~~Folder has an invisible repository.txt"), "In this folder, there is a (possibly hidden) folder named '.hg' that contains the actual data of this Chorus repository. Depending on your Operating System settings, that leading '.' might make the folder invisible to you. But Chorus clients (WeSay, FLEx, OneStory, etc.) can see it and can use this folder to perform Send/Receive operations.");
if (alsoDoCheckout)
{
// string userIdForCLone = string.Empty; /* don't assume it's this user... a repo on a usb key probably shouldn't have a user default */
var clone = new HgRepository(targetDirectory, progress);
clone.Update();
}
return targetDirectory;
}
}
示例3: UploadBook
public static string UploadBook(string bucketName, string bookZipPath, IProgress progress)
{
try
{
using(var s3Client = new BloomS3Client(bucketName))
{
var url = s3Client.UploadSingleFile(bookZipPath, progress);
progress.WriteMessage("Upload Success");
return url;
}
}
catch (WebException e)
{
progress.WriteError("There was a problem uploading your book: "+e.Message);
throw;
}
catch (AmazonS3Exception e)
{
if (e.Message.Contains("The difference between the request time and the current time is too large"))
{
progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.TimeProblem",
"There was a problem uploading your book. This is probably because your computer is set to use the wrong timezone or your system time is badly wrong. See http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html for how to fix this."));
}
else
{
progress.WriteError("There was a problem uploading your book: " + e.Message);
}
throw;
}
catch (AmazonServiceException e)
{
progress.WriteError("There was a problem uploading your book: " + e.Message);
throw;
}
catch (Exception e)
{
progress.WriteError("There was a problem uploading your book.");
progress.WriteError(e.Message.Replace("{", "{{").Replace("}", "}}"));
progress.WriteVerbose(e.StackTrace);
throw;
}
}
示例4: DisplayNetworkUploadProblem
private static void DisplayNetworkUploadProblem(Exception e, IProgress progress)
{
progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.GenericUploadProblemNotice",
"There was a problem uploading your book."));
progress.WriteError(e.Message.Replace("{", "{{").Replace("}", "}}"));
progress.WriteVerbose(e.StackTrace);
}
示例5: UploadBook
public string UploadBook(string bookFolder, IProgress progress, out string parseId, string pdfToInclude = null)
{
// Books in the library should generally show as locked-down, so new users are automatically in localization mode.
// Occasionally we may want to upload a new authoring template, that is, a 'book' that is suitableForMakingShells.
// Such books must never be locked.
// So, typically we will try to lock it. What we want to do is Book.RecordedAsLockedDown = true; Book.Save().
// But all kinds of things have to be set up before we can create a Book. So we duplicate a few bits of code.
var htmlFile = BookStorage.FindBookHtmlInFolder(bookFolder);
bool wasLocked = false;
bool allowLocking = false;
HtmlDom domForLocking = null;
var metaDataText = MetaDataText(bookFolder);
var metadata = BookMetaData.FromString(metaDataText);
if (!string.IsNullOrEmpty(htmlFile))
{
var xmlDomFromHtmlFile = XmlHtmlConverter.GetXmlDomFromHtmlFile(htmlFile, false);
domForLocking = new HtmlDom(xmlDomFromHtmlFile);
wasLocked = Book.Book.HtmlHasLockedDownFlag(domForLocking);
allowLocking = !metadata.IsSuitableForMakingShells;
if (allowLocking && !wasLocked)
{
Book.Book.RecordAsLockedDown(domForLocking, true);
XmlHtmlConverter.SaveDOMAsHtml5(domForLocking.RawDom, htmlFile);
}
}
string s3BookId;
try
{
// In case we somehow have a book with no ID, we must have one to upload it.
if (string.IsNullOrEmpty(metadata.Id))
{
metadata.Id = Guid.NewGuid().ToString();
}
// And similarly it should have SOME title.
if (string.IsNullOrEmpty(metadata.Title))
{
metadata.Title = Path.GetFileNameWithoutExtension(bookFolder);
}
metadata.SetUploader(UserId);
s3BookId = S3BookId(metadata);
metadata.DownloadSource = s3BookId;
// Any updated ID at least needs to become a permanent part of the book.
// The file uploaded must also contain the correct DownloadSource data, so that it can be used
// as an 'order' to download the book.
// It simplifies unit testing if the metadata file is also updated with the uploadedBy value.
// Not sure if there is any other reason to do it (or not do it).
// For example, do we want to send/receive who is the latest person to upload?
metadata.WriteToFolder(bookFolder);
// The metadata is also a book order...but we need it on the server with the desired file name,
// because we can't rename on download. The extension must be the one Bloom knows about,
// and we want the file name to indicate which book, so use the name of the book folder.
var metadataPath = BookMetaData.MetaDataPath(bookFolder);
var orderPath = Path.Combine(bookFolder, Path.GetFileName(bookFolder) + BookOrderExtension);
RobustFile.Copy(metadataPath, orderPath, true);
parseId = "";
try
{
_s3Client.UploadBook(s3BookId, bookFolder, progress, pdfToInclude: pdfToInclude);
metadata.BaseUrl = _s3Client.BaseUrl;
metadata.BookOrder = _s3Client.BookOrderUrlOfRecentUpload;
progress.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.UploadingBookMetadata", "Uploading book metadata", "In this step, Bloom is uploading things like title, languages, and topic tags to the BloomLibrary.org database."));
// Do this after uploading the books, since the ThumbnailUrl is generated in the course of the upload.
var response = _parseClient.SetBookRecord(metadata.WebDataJson);
parseId = response.ResponseUri.LocalPath;
int index = parseId.LastIndexOf('/');
parseId = parseId.Substring(index + 1);
if (parseId == "books")
{
// For NEW books the response URL is useless...need to do a new query to get the ID.
var json = _parseClient.GetSingleBookRecord(metadata.Id);
parseId = json.objectId.Value;
}
// if (!UseSandbox) // don't make it seem like there are more uploads than their really are if this a tester pushing to the sandbox
{
Analytics.Track("UploadBook-Success", new Dictionary<string, string>() { { "url", metadata.BookOrder }, { "title", metadata.Title } });
}
}
catch (WebException e)
{
DisplayNetworkUploadProblem(e, progress);
if (!UseSandbox) // don't make it seem like there are more upload failures than their really are if this a tester pushing to the sandbox
Analytics.Track("UploadBook-Failure", new Dictionary<string, string>() { { "url", metadata.BookOrder }, { "title", metadata.Title }, { "error", e.Message } });
return "";
}
catch (AmazonS3Exception e)
{
if (e.Message.Contains("The difference between the request time and the current time is too large"))
{
progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.TimeProblem",
"There was a problem uploading your book. This is probably because your computer is set to use the wrong timezone or your system time is badly wrong. See http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html for how to fix this."));
if (!UseSandbox)
Analytics.Track("UploadBook-Failure-SystemTime");
}
else
{
DisplayNetworkUploadProblem(e, progress);
if (!UseSandbox)
// don't make it seem like there are more upload failures than their really are if this a tester pushing to the sandbox
Analytics.Track("UploadBook-Failure",
new Dictionary<string, string>() { { "url", metadata.BookOrder }, { "title", metadata.Title }, { "error", e.Message } });
//.........这里部分代码省略.........
示例6: DoNotifications
public void DoNotifications(HgRepository repository, IProgress progress)
{
if(progress.CancelRequested)
{
progress.WriteWarning("Cancelled.");
return;
}
if (InnerException != null)
{
progress.WriteVerbose("inner exception:");
progress.WriteError(Message);
}
progress.WriteError(Message);
progress.WriteVerbose(StackTrace);
if ((WhatToDo & WhatToDo.CheckAddressAndConnection) > 0)
{
//todo: seems we could do some of this ourselves, like pinging the destination
progress.WriteError("Check your network connection and server address, or try again later.");
}
if ((WhatToDo & WhatToDo.CheckSettings) > 0)
{
progress.WriteError("Check your server settings, such as project name, user name, and password.");
}
if ((WhatToDo & WhatToDo.VerifyIntegrity) > 0)
{
if (HgRepository.IntegrityResults.Bad == repository.CheckIntegrity(progress))
{
throw new ApplicationException(
"Bad news: The mecurial repository is damaged. You will need to seek expert help to resolve this problem."
);
// Removing windows forms dependency CP 2012-08
//MessageBox.Show(
// "Bad news: The mecurial repository is damaged. You will need to seek expert help to resolve this problem.", "Chorus", MessageBoxButtons.OK, MessageBoxIcon.Error);
//return;//don't suggest anything else
}
}
if ((WhatToDo & WhatToDo.SuggestRestart) > 0)
{
progress.WriteError("The problem might be helped by restarting your computer.");
}
if ((WhatToDo & WhatToDo.NeedExpertHelp) > 0)
{
progress.WriteError("You may need expert help.");
}
}
示例7: CheckBook
/// <summary>
///
/// </summary>
/// <remarks>The image-replacement feature is perhaps a one-off for a project where the an advisor replaced the folders
/// with a version that lacked most of the images (perhaps because dropbox copies small files first and didn't complete the sync)</remarks>
/// <param name="progress"></param>
/// <param name="pathToFolderOfReplacementImages">We'll find any matches in the entire folder, regardless of sub-folder name</param>
public void CheckBook(IProgress progress, string pathToFolderOfReplacementImages = null)
{
var error = GetValidateErrors();
if(!string.IsNullOrEmpty(error))
progress.WriteError(error);
//check for missing images
foreach (XmlElement imgNode in Dom.SafeSelectNodes("//img"))
{
var imageFileName = imgNode.GetAttribute("src");
if (string.IsNullOrEmpty(imageFileName))
{
var classNames=imgNode.GetAttribute("class");
if (classNames == null || !classNames.Contains("licenseImage"))//bit of hack... it's ok for licenseImages to be blank
{
progress.WriteWarning("image src is missing");
//review: this, we could fix with a new placeholder... maybe in the javascript edit stuff?
}
continue;
}
//trim off the end of "license.png?123243"
var startOfDontCacheHack = imageFileName.IndexOf('?');
if (startOfDontCacheHack > -1)
imageFileName = imageFileName.Substring(0, startOfDontCacheHack);
while (Uri.UnescapeDataString(imageFileName) != imageFileName)
imageFileName = Uri.UnescapeDataString(imageFileName);
if (!File.Exists(Path.Combine(_folderPath, imageFileName)))
{
if (!string.IsNullOrEmpty(pathToFolderOfReplacementImages))
{
if (!AttemptToReplaceMissingImage(imageFileName, pathToFolderOfReplacementImages, progress))
{
progress.WriteWarning(string.Format("Could not find replacement for image {0} in {1}", imageFileName, _folderPath));
}
}
else
{
progress.WriteWarning(string.Format("Image {0} is missing from the folder {1}", imageFileName, _folderPath));
}
}
}
}
示例8: MakeLowQualitySmallPicture
/// <summary>
/// Converts to low-quality, small picture
/// </summary>
/// <returns>log of the run</returns>
public static ExecutionResult MakeLowQualitySmallPicture(string inputPath, string outputPath, IProgress progress)
{
if (string.IsNullOrEmpty(LocateAndRememberFFmpeg()))
{
return new ExecutionResult() { StandardError = "Could not locate FFMpeg" };
}
//enhance: how to lower the quality?
var arguments = "-i \"" + inputPath + "\" -f image2 -s 176x144 \"" + outputPath + "\"";
progress.WriteMessage("ffmpeg " + arguments);
var result = CommandLineProcessing.CommandLineRunner.Run(LocateAndRememberFFmpeg(),
arguments,
Environment.CurrentDirectory,
60 * 10, //10 minutes
progress
);
progress.WriteVerbose(result.StandardOutput);
if (result.StandardError.ToLower().Contains("error")) //ffmpeg always outputs config info to standarderror
progress.WriteError(result.StandardError);
return result;
}
示例9: MakeLowQualityCompressedAudio
/// <summary>
/// Converts to low-quality, mono mp3
/// </summary>
/// <returns>log of the run</returns>
public static ExecutionResult MakeLowQualityCompressedAudio(string inputPath, string outputPath, IProgress progress)
{
if (string.IsNullOrEmpty(LocateAndRememberFFmpeg()))
{
return new ExecutionResult() { StandardError = "Could not locate FFMpeg" };
}
var arguments = "-i \"" + inputPath + "\" -acodec libmp3lame -ac 1 -ar 8000 \"" + outputPath + "\"";
progress.WriteMessage("ffmpeg " + arguments);
var result = CommandLineProcessing.CommandLineRunner.Run(LocateAndRememberFFmpeg(),
arguments,
Environment.CurrentDirectory,
60 * 10, //10 minutes
progress
);
progress.WriteVerbose(result.StandardOutput);
//hide a meaningless error produced by some versions of liblame
if (result.StandardError.Contains("lame: output buffer too small")
&& File.Exists(outputPath))
{
result = new ExecutionResult
{
ExitCode = 0,
StandardOutput = result.StandardOutput,
StandardError = string.Empty
};
}
if (result.StandardError.ToLower().Contains("error")
|| result.StandardError.ToLower().Contains("unable to")
|| result.StandardError.ToLower().Contains("invalid")
|| result.StandardError.ToLower().Contains("could not")
) //ffmpeg always outputs config info to standarderror
progress.WriteError(result.StandardError);
return result;
}
示例10: ChangeNumberOfAudioChannels
/// <summary>
/// Creates an audio file, using the received one as the bases, with the specified number
/// of channels. For example, this can be used to convert a 2-channel audio file to a
/// single channel audio file.
/// </summary>
/// <returns>log of the run</returns>
public static ExecutionResult ChangeNumberOfAudioChannels(string inputPath,
string outputPath, int channels, IProgress progress)
{
if (string.IsNullOrEmpty(LocateFFmpeg()))
return new ExecutionResult { StandardError = "Could not locate FFMpeg" };
var arguments = string.Format("-i \"{0}\" -vn -ac {1} \"{2}\"",
inputPath, channels, outputPath);
var result = CommandLineRunner.Run(LocateAndRememberFFmpeg(),
arguments,
Environment.CurrentDirectory,
60 * 10, //10 minutes
progress);
progress.WriteVerbose(result.StandardOutput);
//hide a meaningless error produced by some versions of liblame
if (result.StandardError.Contains("lame: output buffer too small") && File.Exists(outputPath))
{
var doctoredResult = new ExecutionResult
{
ExitCode = 0,
StandardOutput = result.StandardOutput,
StandardError = string.Empty
};
return doctoredResult;
}
// ffmpeg always outputs config info to standarderror
if (result.StandardError.ToLower().Contains("error"))
progress.WriteError(result.StandardError);
return result;
}
示例11: ExtractAudio
/// <summary>
/// Extracts the audio from a video. Note, it will fail if the file exists, so the client
/// is responsible for verifying with the user and deleting the file before calling this.
/// </summary>
/// <param name="inputPath"></param>
/// <param name="outputPath"></param>
/// <param name="audioCodec">e.g. copy, pcm_s16le, pcm_s32le, etc.</param>
/// <param name="sampleRate">e.g. 22050, 44100, 4800. Use 0 to use ffmpeg's default</param>
/// <param name="channels">0 for same, 1 for mono, 2 for stereo</param>
/// <param name="progress"></param>
/// <returns>log of the run</returns>
private static ExecutionResult ExtractAudio(string inputPath, string outputPath,
string audioCodec, int sampleRate, int channels, IProgress progress)
{
if (string.IsNullOrEmpty(LocateFFmpeg()))
{
return new ExecutionResult() { StandardError = "Could not locate FFMpeg" };
}
var sampleRateArg = "";
if (sampleRate > 0)
sampleRateArg = string.Format("-ar {0}", sampleRate);
//TODO: this will output whatever mp3 or wav or whatever is in the video... might not be wav at all!
var channelsArg = "";
if (channels > 0)
channelsArg = string.Format(" -ac {0}", channels);
var arguments = string.Format("-i \"{0}\" -vn -acodec {1} {2} {3} \"{4}\"",
inputPath, audioCodec, sampleRateArg, channelsArg, outputPath);
progress.WriteMessage("ffmpeg " + arguments);
var result = CommandLineProcessing.CommandLineRunner.Run(LocateAndRememberFFmpeg(),
arguments,
Environment.CurrentDirectory,
60 * 10, //10 minutes
progress);
progress.WriteVerbose(result.StandardOutput);
//hide a meaningless error produced by some versions of liblame
if (result.StandardError.Contains("lame: output buffer too small")
&& File.Exists(outputPath))
{
var doctoredResult = new ExecutionResult
{
ExitCode = 0,
StandardOutput = result.StandardOutput,
StandardError = string.Empty
};
return doctoredResult;
}
if (result.StandardError.ToLower().Contains("error")) //ffmpeg always outputs config info to standarderror
progress.WriteError(result.StandardError);
return result;
}
示例12: MakeClone
public void MakeClone(IProgress progress)
{
var client = new ChorusHubClient();
var server = client.FindServer();
if (server == null)
{
progress.WriteError("The Chorus Server is not available.");
CloneSucceeded = false;
return;
}
if (!server.ServerIsCompatibleWithThisClient)
{
progress.WriteError("The Chorus Server is not compatible with ths client.");
CloneSucceeded = false;
return;
}
var targetFolder = Path.Combine(_baseFolder, RepositoryName);
try
{
NewlyClonedFolder= HgRepository.Clone(new HttpRepositoryPath(RepositoryName, client.GetUrl(RepositoryName), false), targetFolder, progress);
CloneSucceeded = true;
}
catch (Exception)
{
NewlyClonedFolder = null;
CloneSucceeded = false;
throw;
}
}
示例13: ValidateFile
public string ValidateFile(string pathToFile, IProgress progress)
{
if (progress == null)
throw new ArgumentNullException("progress");
if (string.IsNullOrEmpty(pathToFile))
return "No file to work with.";
if (!File.Exists(pathToFile))
return "File does not exist.";
var extension = Path.GetExtension(pathToFile);
if (string.IsNullOrEmpty(extension))
return "File has no extension.";
if (extension[0] != '.')
return "File has no extension.";
var handler = GetHandlerfromExtension(extension.Substring(1));
var results = handler.ValidateFile(pathToFile);
if (results != null)
{
progress.WriteError("File '{0}' is not valid with message:{1}\t{2}", pathToFile, Environment.NewLine, results);
progress.WriteWarning("It may also have other problems in addition to the one that was reported.");
}
return results;
}
示例14: GuessPrimaryLexicalFormWritingSystem
/// <summary>
/// Guess the writing system for the primary lexical form.
/// </summary>
public static string GuessPrimaryLexicalFormWritingSystem(LiftLexEntryRepository repo, IProgress progress)
{
progress.WriteMessage("Looking at 1st 1000 entries to determine which Writing System to use for matching...");
var choices = new Dictionary<string, Counter>();
RepositoryId[] ids = repo.GetAllItems();
for (int i = 0; i < 1000 && i < ids.Length; i++)
{
var entry = repo.GetItem(ids[i]);
foreach (var languageForm in entry.LexicalForm.Forms)
{
Counter counter;
if (choices.TryGetValue(languageForm.WritingSystemId, out counter))
{
++counter.Count;
}
else
{
choices.Add(languageForm.WritingSystemId, new Counter(languageForm.WritingSystemId));
}
}
}
if (choices.Count == 0)
{
progress.WriteError("Could not determine a primary writing system for matching entries.");
return null;
}
KeyValuePair<string, Counter> z = choices.OrderByDescending(p => p.Value.Count).FirstOrDefault();
progress.WriteMessage("Will use '{0}' for matching.", z.Value.Id);
return z.Value.Id;
}
示例15: CheckBook
/// <summary>
///
/// </summary>
/// <remarks>The image-replacement feature is perhaps a one-off for a project where an advisor replaced the folders
/// with a version that lacked most of the images (perhaps because dropbox copies small files first and didn't complete the sync)</remarks>
/// <param name="progress"></param>
/// <param name="pathToFolderOfReplacementImages">We'll find any matches in the entire folder, regardless of sub-folder name</param>
public void CheckBook(IProgress progress, string pathToFolderOfReplacementImages = null)
{
var error = GetValidateErrors();
if(!string.IsNullOrEmpty(error))
progress.WriteError(error);
//check for missing images
foreach (XmlElement imgNode in HtmlDom.SelectChildImgAndBackgroundImageElements(Dom.Body))
{
var imageFileName = HtmlDom.GetImageElementUrl(imgNode).PathOnly.NotEncoded;
if (string.IsNullOrEmpty(imageFileName))
{
var classNames=imgNode.GetAttribute("class");
if (classNames == null || !classNames.Contains("licenseImage"))//bit of hack... it's ok for licenseImages to be blank
{
progress.WriteWarning("image src is missing");
//review: this, we could fix with a new placeholder... maybe in the javascript edit stuff?
}
continue;
}
// Certain .svg files (cogGrey.svg, FontSizeLetter.svg) aren't really part of the book and are stored elsewhere.
// Also, at present the user can't insert them into a book. Don't report them.
// TODO: if we ever allow the user to add .svg files, we'll need to change this
if (Path.HasExtension(imageFileName) && Path.GetExtension(imageFileName).ToLowerInvariant() == ".svg")
continue;
// Branding images are handled in a special way in BrandingApi.cs.
// Without this, we get "Warning: Image /bloom/api/branding/image is missing from the folder xxx" (see BL-3975)
if (imageFileName.EndsWith(BrandingApi.kBrandingImageUrlPart))
continue;
//trim off the end of "license.png?123243"
var startOfDontCacheHack = imageFileName.IndexOf('?');
if (startOfDontCacheHack > -1)
imageFileName = imageFileName.Substring(0, startOfDontCacheHack);
while (Uri.UnescapeDataString(imageFileName) != imageFileName)
imageFileName = Uri.UnescapeDataString(imageFileName);
if (!RobustFile.Exists(Path.Combine(_folderPath, imageFileName)))
{
if (!string.IsNullOrEmpty(pathToFolderOfReplacementImages))
{
if (!AttemptToReplaceMissingImage(imageFileName, pathToFolderOfReplacementImages, progress))
{
progress.WriteWarning(string.Format("Could not find replacement for image {0} in {1}", imageFileName, _folderPath));
}
}
else
{
progress.WriteWarning(string.Format("Image {0} is missing from the folder {1}", imageFileName, _folderPath));
}
}
}
}