Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
afscrome committed Sep 26, 2024
1 parent b0fa437 commit 3959774
Showing 1 changed file with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ void WriteSeries(TextWriter series)
this.reportTextWriter.WriteLine("var historyChartData{0} = {{", id);
this.reportTextWriter.Write(" \"series\" : [");
WriteSeries(this.reportTextWriter);
this.reportTextWriter.WriteLine("],\"");
this.reportTextWriter.WriteLine("],");

this.reportTextWriter.WriteLine(
" \"tooltips\" : [{0}]",
Expand Down Expand Up @@ -1580,27 +1580,33 @@ private void SaveCss(string targetDirectory)
return;
}

using (var fs = new FileStream(targetPath, FileMode.Create))
if (this.htmlMode == HtmlMode.InlineCssAndJavaScript)
{
if (this.htmlMode != HtmlMode.InlineCssAndJavaScript)
using (var fs = new FileStream(targetPath, FileMode.Create))
using (var writer = new StreamWriter(fs))
{
var builder = StringBuilderCache.Get();
using (var writer = new StringWriter(builder))
{
this.WriteCss(writer);
}
this.WriteCss(writer);
}
}
else
{
var builder = StringBuilderCache.Get();
using (var writer = new StringWriter(builder))
{
this.WriteCss(writer);
}

string css = StringBuilderCache.ToStringAndReturnToPool(builder);
var matches = Regex.Matches(css, @"url\(icon_(?<filename>.+).svg\),\surl\(data:image/svg\+xml;base64,(?<base64image>.+)\)");
string css = StringBuilderCache.ToStringAndReturnToPool(builder);

foreach (Match match in matches)
{
System.IO.File.WriteAllBytes(
Path.Combine(targetDirectory, "icon_" + match.Groups["filename"].Value + ".svg"),
Convert.FromBase64String(match.Groups["base64image"].Value));
}
System.IO.File.WriteAllText(targetPath, css);

var matches = Regex.Matches(css, @"url\(icon_(?<filename>.+).svg\),\surl\(data:image/svg\+xml;base64,(?<base64image>.+)\)");

StringBuilderCache.Return(builder);
foreach (Match match in matches)
{
System.IO.File.WriteAllBytes(
Path.Combine(targetDirectory, "icon_" + match.Groups["filename"].Value + ".svg"),
Convert.FromBase64String(match.Groups["base64image"].Value));
}
}

Expand Down

0 comments on commit 3959774

Please sign in to comment.