update 20241201

This commit is contained in:
Stefan Hutter
2024-12-01 18:34:28 +01:00
parent 470d2e1bb5
commit fcc74b25cb
5244 changed files with 3378608 additions and 267 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnDoc.Helper
{
public class FileHelper
{
public bool SaveBase64ToFile(string Base64String, string filename)
{
try
{
System.IO.File.WriteAllBytes(filename, Convert.FromBase64String(Base64String));
return true;
}
catch
{
return false;
}
}
public Stream GenerateStreamFromString(string s)
{
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.Write(s);
writer.Flush();
stream.Position = 0;
return stream;
}
public String Base64FromFile(string filename)
{
Byte[] bytes = File.ReadAllBytes(filename);
return Convert.ToBase64String(bytes);
}
}
}