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;
|
2018-04-06 17:31:36 +02:00
|
|
|
|
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 :(");
|
|
|
|
|
|
2018-04-06 17:31:36 +02:00
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
var f = Path.GetTempFileName();
|
|
|
|
|
var ini = new IniFileStorer(f);
|
|
|
|
|
System.Console.WriteLine(ini.ReadString("sec","key"));
|
2018-04-06 17:31:36 +02:00
|
|
|
|
|
|
|
|
|
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);
|
2018-04-06 17:31:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2018-04-06 17:31:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.Console.ReadLine();
|
2017-04-12 17:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|