Skip to content
This repository was archived by the owner on Jun 3, 2023. It is now read-only.

Commit c5b74e6

Browse files
committed
Revise
1 parent 4ffa7c5 commit c5b74e6

File tree

3 files changed

+30
-33
lines changed

3 files changed

+30
-33
lines changed

src/Conforyon/Conforyon.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
using Conforyon.Constant;
55
using Conforyon.Enum;
66
using System;
7+
using System.IO;
8+
using System.Runtime.Serialization.Json;
9+
using System.Text;
710
using System.Text.RegularExpressions;
811

912
#endregion
@@ -698,6 +701,30 @@ public static bool UseCheck(string Variable, bool Spaces = false)
698701
return false;
699702
}
700703
}
704+
705+
/// <summary>
706+
///
707+
/// </summary>
708+
/// <typeparam name="T"></typeparam>
709+
/// <param name="Data"></param>
710+
/// <returns></returns>
711+
public static string DataToJson<T>(T Data)
712+
{
713+
MemoryStream MemoryStream = new();
714+
715+
DataContractJsonSerializer Serializer = new
716+
(
717+
Data.GetType(),
718+
new DataContractJsonSerializerSettings()
719+
{
720+
UseSimpleDictionaryFormat = true
721+
}
722+
);
723+
724+
Serializer.WriteObject(MemoryStream, Data);
725+
726+
return Encoding.UTF8.GetString(MemoryStream.ToArray());
727+
}
701728
#endregion
702729
}
703730
#endregion

src/Conforyon/Method/Board/ClipBoard.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#if !NETSTANDARD
2-
3-
#region Imports
1+
#region Imports
42

53
using Conforyon.Constant;
64
using System.IO;
@@ -125,5 +123,4 @@ public static Stream GetAudio(bool Clear = false)
125123
}
126124
#endregion
127125
}
128-
}
129-
#endif
126+
}

src/Conforyon/Value/Values.cs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
using Conforyon.Array;
44
using Conforyon.Constant;
5-
using System;
65
using System.Collections.Generic;
7-
using System.IO;
8-
using System.Linq;
9-
using System.Runtime.Serialization.Json;
10-
using System.Text;
116

127
#endregion
138

@@ -145,35 +140,13 @@ public static string ListValueJson(string Error = Constants.ErrorMessage)
145140
{
146141
try
147142
{
148-
return DataToJson(ListValue());
143+
return Cores.DataToJson(ListValue());
149144
}
150145
catch
151146
{
152147
return Error + Constants.ErrorTitle + "VS-LVJ1!)";
153148
}
154149
}
155-
156-
/// <summary>
157-
///
158-
/// </summary>
159-
/// <typeparam name="T"></typeparam>
160-
/// <param name="Data"></param>
161-
/// <returns></returns>
162-
private static string DataToJson<T>(T Data)
163-
{
164-
MemoryStream MemoryStream = new();
165-
166-
DataContractJsonSerializer Serializer = new(
167-
Data.GetType(),
168-
new DataContractJsonSerializerSettings()
169-
{
170-
UseSimpleDictionaryFormat = true
171-
});
172-
173-
Serializer.WriteObject(MemoryStream, Data);
174-
175-
return Encoding.UTF8.GetString(MemoryStream.ToArray());
176-
}
177150
#endregion
178151
}
179152
}

0 commit comments

Comments
 (0)