Skip to content

Commit

Permalink
[1.4.3] 性能优化
Browse files Browse the repository at this point in the history
* 优化 StringStructure 性能
未实装,等待下次更新
  • Loading branch information
LorisYounger committed Aug 25, 2022
1 parent ee2b8c8 commit 32632a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 6 additions & 2 deletions LinePutScript/Line.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ public string Text
/// </summary>
public StringStructure Texts
{
get => new StringStructure((x) => text = x, () => text);
get
{
texts ??= new StringStructure((x) => text = x, () => text);
return texts;
}
}

StringStructure texts;

/// <summary>
/// 注释 ///为注释
Expand Down
13 changes: 9 additions & 4 deletions LinePutScript/Sub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ public string Info
/// </summary>
public StringStructure Infos
{
get => new StringStructure((x) => info = x, () => info);
get
{
infos ??= new StringStructure((x) => info = x, () => info);
return infos;
}
}
private StringStructure? infos;

/// <summary>
/// 信息 (int)
Expand Down Expand Up @@ -215,7 +220,7 @@ public string[] GetInfos()
sts[i] = TextDeReplace(sts[i]);
return sts;
}

/// <summary>
/// 将当前Sub转换成文本格式 (info已经被转义/去除关键字)
/// </summary>
Expand Down Expand Up @@ -298,7 +303,7 @@ public static List<string> Split(string text, string separator, int count = -1)
list.Add(lasttext);
return list;
}

/// <summary>
/// 将文本进行反转义处理(成为正常显示的文本)
/// </summary>
Expand All @@ -319,7 +324,7 @@ public static string TextDeReplace(string Reptex)
Reptex = Reptex.Replace("/|", "|");
return Reptex;
}

/// <summary>
/// 将文本进行转义处理(成为去除关键字的文本)
/// </summary>
Expand Down

0 comments on commit 32632a3

Please sign in to comment.