Skip to content

Commit f2f4662

Browse files
update: new functions in Convert, new class SimpleFileHandler
1 parent 26daf4f commit f2f4662

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Convert.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ public static string FromBase64(string str)
2424
return Encoding.UTF8.GetString(System.Convert.FromBase64String(str));
2525
}
2626

27+
public static byte[] ToByteArray(string str)
28+
{
29+
return Encoding.UTF8.GetBytes(str);
30+
}
31+
32+
public static string FromByteArray(byte[] array)
33+
{
34+
return Encoding.UTF8.GetString(array);
35+
}
36+
2737
// I have not tested the functions below. Proceed with caution.
2838

2939
public static string FromHex(string str)

SimpleFileHandler.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.IO;
2+
3+
namespace CSSimpleFunctions
4+
{
5+
public class SimpleFileHandler
6+
{
7+
public static void Write(string FilePath, string Content)
8+
{
9+
File.WriteAllText(FilePath, Content);
10+
}
11+
12+
public static string Read(string FilePath)
13+
{
14+
return File.ReadAllText(FilePath);
15+
}
16+
17+
public static void Append(string FilePath, string Content)
18+
{
19+
File.AppendAllText(FilePath, Content);
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)