mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 22:13:23 -07:00
Compress Emojis.xml too
This commit is contained in:
parent
c1dcf94956
commit
12b42774de
2 changed files with 9 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
@ -31,7 +32,7 @@ namespace Greenshot.Editor.Controls.Emoji
|
|||
/// </summary>
|
||||
public static class EmojiData
|
||||
{
|
||||
private const string EmojisXmlFilePath = "emojis.xml";
|
||||
private const string EmojisXmlFilePath = "emojis.xml.gz";
|
||||
|
||||
public static Emojis Data { get; private set; } = new();
|
||||
|
||||
|
@ -41,7 +42,12 @@ namespace Greenshot.Editor.Controls.Emoji
|
|||
|
||||
if (File.Exists(EmojisXmlFilePath))
|
||||
{
|
||||
Data = (Emojis)x.Deserialize(new XmlTextReader(EmojisXmlFilePath));
|
||||
using var fileStream = new FileStream(EmojisXmlFilePath, FileMode.Open, FileAccess.Read);
|
||||
using var gzStream = new GZipStream(fileStream, CompressionMode.Decompress);
|
||||
using var memoryStream = new MemoryStream();
|
||||
gzStream.CopyTo(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
Data = (Emojis)x.Deserialize(new XmlTextReader(memoryStream));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
|
||||
<Target Name="GenerateEmojiTestTxtFile" BeforeTargets="BeforeBuild">
|
||||
<EmojiDataTask EmojiTestTxtFile="..\Greenshot.Editor\Controls\Emoji\emoji-test.txt" OutputFilename="$(SolutionDir)$(SolutionName)\$(OutDir)\emojis.xml" />
|
||||
<GZipTask InputFile="$(SolutionDir)$(SolutionName)\$(OutDir)\emojis.xml" OutputFile="$(SolutionDir)$(SolutionName)\$(OutDir)\emojis.xml.gz" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Generate hashes" BeforeTargets="PostBuildEvent">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue