//using Pomelo.DotNetClient.Test;
//using Pomelo;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Threading;
using System.Web.Helpers;
using System.Web.Script.Serialization;
using ZeusServerEdgeJS;
namespace ZeusServerEdgeJSTest
{
static class Program
{
//static void testJson()
//{
// JavaScriptSerializer js = new JavaScriptSerializer();
// string input = "{\"name\":\"test1\"}";
// var obj = js.DeserializeObject(input);
// dynamic data = Json.Decode(input);
//}
//static void start()
//{
// string workDir = "c:/work/zeus/game-server/";
// string json = @"{
// iceConfig:{host:""127.0.0.1"",port:3900},
// zoneConfig:{startPath:""C:/work/zeus/game-server/node_modules/zeus-csharp/lib/dll"",assetPath:""C:/work/zeus/game-server/node_modules/zeus-csharp/data""},
// fastStreamConfig:{port:3360},
// logConfig:{
// configFile:""c:/work/zeus/game-server/config/log/log4net.config"",
// outputPath:""c:/work/zeus/game-server/"",
// level:100
// }
// }";
// dynamic config = Json.Decode(json);
// //dynamic config = new
// //{
// // zoneConfig = new
// // {
// // startPath = Environment.CurrentDirectory,
// // assetPath = workDir + "node_modules/zeus-csharp/data",
// // },
// // iceConfig = new
// // {
// // host = "127.0.0.1",
// // port = 3900
// // },
// // fastStreamConfig = new
// // {
// // port = 3360,
// // },
// // logConfig = new
// // {
// // configFile = workDir + "config/log/log4net.config",
// // outputPath = workDir,
// // level = 100
// // }
// //};
// string t = (string)config.zoneConfig.startPath;
// new EdgeJS().init(config);
// //Console.WriteLine("program start ok");
//}
///
/// 应用程序的主入口点。
///
[STAThread]
static void Main()
{
Console.WriteLine(DateTime.Now.ToString("o"));
dynamic data = new ExpandoObject();
data.type = "csharpStat";
data.activeObjectCount = 6;
data.activeZoneCount = 4;
data.zoneCount = 1;
data.playerCount = 2;
data.private_memory_mb = 500;
data.@timestamp = DateTime.Now.ToString("o");
string msg = JsonConvert.SerializeObject(data);
msg = msg.Replace("timestamp", "@timestamp");
// msg = msg.Insert(msg.Length - 1, ",\"@timestamp\":\"" + DateTime.Now.ToString("o") + "\"");
// ((IDictionary)msg).Add("b", "aaa");
// Console.WriteLine(msg.name);
//(msg as dynamic)["@timestamp"] = DateTime.Now.ToString("o");
//(msg as dynamic)["fields"] = new
//{
// level = "info",
// category = "monitor",
// serverType = "csharp",
// serverId = "s1"
//};
Console.WriteLine(msg);
// start();
// var currentDir = Environment.GetCommandLineArgs
// testJson();
// IceManager.Init(new string[0], "127.0.0.1",3900);
// ZoneService.instance().start(config);
do
{
Thread.Sleep(500);
}
while (true);
}
}
}