public Package GetPackage() { //throw new NotImplementedException(); //Type type = this.GetType(); //Console.WriteLine("json type:" + jsonType.Type.Name); //byte[] bs = builder. //IDictionary<string, string> headers = new Dictionary<string, string>(); Lin.Util.MapIndexProperty<string, string> headers = new Util.MapIndexProperty<string, string>(); int end = 0; int start = 0; for (int n = 0; n < count - 2; n++) { if (buffer[n] == LINE_FLAG[0] && buffer[n + 1] == LINE_FLAG[1]) { end = n; if (start == end) { start = end = end + 2; break; } string tmp = Encoding.Default.GetString(buffer, start, end-start); string[] tmp2 = tmp.Split(':'); headers[tmp2[0]] = tmp2[1]; start = end = end + 2; } } String json = Encoding.Default.GetString(buffer, start, count - start); JsonPackage package = Activator.CreateInstance(paths[headers["path"]]) as JsonPackage; package.Parser(json); return package; }
internal Session(Communicate communicate, Socket socket) { if (communicate.IsServer) { sequeue = 2; } this.Socket = socket; Attributes = new Util.MapIndexProperty<string, object>(); this.communicate = communicate; }