This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
linear-app-launcher/RyzStudio/String.cs

36 lines
885 B
C#
Raw Normal View History

2020-04-27 12:17:13 +00:00
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace RyzStudio
{
public class String
{
public static string EncodeTo64(string value)
{
try
{
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(value);
return System.Convert.ToBase64String(toEncodeAsBytes);
}
catch
{
return string.Empty;
}
}
public static string DecodeFrom64(string value)
{
try
{
byte[] encodedDataAsBytes = System.Convert.FromBase64String(value);
return System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
}
catch
{
return string.Empty;
}
}
}
}