Skip to content

Commit

Permalink
[LPS1.4.3]优化性能和SS支持换行
Browse files Browse the repository at this point in the history
* 优化储存性能
* StringStructure支持储存换行
  • Loading branch information
LorisYounger committed Sep 1, 2022
1 parent e33bdd4 commit 82a0786
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LinePutScript/LinePutScript.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LinePutScript</RootNamespace>
<AssemblyName>LinePutScript</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<LangVersion>8.0</LangVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
Expand Down
4 changes: 2 additions & 2 deletions LinePutScript/StringStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private Dictionary<string, string> Cache
{
if (Cache.ContainsKey(key))
{
return Sub.TextDeReplace(Cache[key]);
return Sub.TextDeReplace(Cache[key]).Replace("/!n", "\n");
}
else
return defaultvalue;
Expand All @@ -87,7 +87,7 @@ public void SetString(string key, string? value)
if (value == null)
c.Remove(key);
else
c[key] = Sub.TextReplace(value);
c[key] = Sub.TextReplace(value.Replace("\n", "/!n"));
Cache = c;
}

Expand Down
6 changes: 6 additions & 0 deletions TestConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ static void Text()

Console.WriteLine("标准测试:" + lps.ToString().Equals(Properties.Resources.test1.Replace("\r", "")));

lps[(gflt)"flt"] = 3.1415926;
Console.WriteLine("标准测试1:" + lps[(gflt)"flt"].Equals(3.1415926));
lps["flt"][(gflt)"flt"] = 3.1415926;
Console.WriteLine("标准测试2:" + lps["flt"][(gflt)"flt"].Equals(3.1415926));

lps = new LpsDocument();
lps[(gstr)"str"] = "abc=abc";
Expand All @@ -61,6 +65,8 @@ static void Text()

Console.WriteLine("SS测试:" + lps.ToString().Equals(Properties.Resources.test2.Replace("\r", "")));

lps["str2"].Texts["crlf"] = "ab\nabc\nc";
Console.WriteLine("SS测试7:" + lps["str2"].Texts["crlf"].Equals("ab\nabc\nc"));
}
}
}
Binary file added nuget/LinePutScript.1.4.3.nupkg
Binary file not shown.

0 comments on commit 82a0786

Please sign in to comment.