SweetLib/SweetLib.Demo.Console/Program.cs

52 lines
1.7 KiB
C#
Raw Permalink Normal View History

2018-04-06 17:45:53 +02:00
using System;
using System.IO;
2017-04-16 18:07:30 +02:00
using SweetLib.Classes.Storer;
using SweetLib.IO.Classes.Streaming;
2017-04-12 17:44:02 +02:00
using SweetLib.Utils.Logger;
namespace SweetLib.Demo.Console
{
class Program
{
static void Main(string[] args)
{
//Logger.GlobalLogLevel |= LogLevel.Debug | LogLevel.Trace;
Logger.GlobalLogLevel=LogLevel.All;
Logger.Trace("Trace!");
Logger.Debug("Debug");
Logger.Info("Hallo Welt");
Logger.Warn("WARN!");
Logger.Error("Error :(");
2017-04-16 18:07:30 +02:00
var f = Path.GetTempFileName();
var ini = new IniFileStorer(f);
System.Console.WriteLine(ini.ReadString("sec","key"));
using (var stream = File.Create(@"S:\test.dat"))
{
StreamManager.SaveToStream(stream, 5);
2018-04-06 17:45:53 +02:00
StreamManager.SaveToStream(stream, "Hallo Wellt eksde");
StreamManager.SaveToStream(stream, 12d);
StreamManager.SaveToStream(stream, DateTime.UtcNow);
}
using (var stream = File.OpenRead(@"S:\test.dat"))
{
2018-04-06 17:45:53 +02:00
StreamManager.LoadFromStream(stream, out int iValue);
StreamManager.LoadFromStream(stream, out string sValue);
StreamManager.LoadFromStream(stream, out double dValue);
StreamManager.LoadFromStream(stream, out DateTime dtValue);
System.Console.WriteLine(iValue);
System.Console.WriteLine(sValue);
System.Console.WriteLine(dValue);
System.Console.WriteLine(dtValue);
}
System.Console.ReadLine();
2017-04-12 17:44:02 +02:00
}
}
}