示例#1
0
		/// <summary>
		/// 从本地读取 api_start2 通信数据
		/// </summary>
		static object ReadSessionData(string path)
		{
			//var path = Settings.Current.CacheFolder + "\\api_start2.dat";
			//var bytes = Encoding.UTF8.GetBytes(File.ReadAllText(path));

			//var serializer = new DataContractJsonSerializer(typeof(svdata<kcsapi_start2>));
			//using (var stream = new MemoryStream(bytes))
			//{
			//	return serializer.ReadObject(stream) as svdata<kcsapi_start2>;
			//}

			Session session = new Session(new byte[] { 0 }, new byte[] { 0 });
			if (!session.LoadRequestBodyFromFile(path))
			{
				throw new ApplicationException("LoadRequestBodyFromFile Failed!! " + path);
			}
			if (!session.LoadResponseFromFile(path))
			{
				throw new ApplicationException("LoadResponseFromFile Failed!! " + path);
			}
			return session;
		}