public void Test() { string bnyPath = @"H:\工作文件汇总\铁科院\程序\轨检二期\任务\bny工具文档\20170407广深港上行线(福田~广州南)_001.bny"; BNYRequest request = new BNYRequest(); request.path = bnyPath; request.isinc = false; request.mile = 2310; request.startmile = 2300; request.endmile = 2400; request.startfilepos = 29443392; request.endfilepos = 29448000; string json = JsonConvert.SerializeObject(request); string result = bnytest.GetBNYLastPosition(json); result = bnytest.GetBNYStartMile(json); result = bnytest.GetBNYEndMile(json); result = bnytest.GetMilePosition(json); result = bnytest.GetMilePostions(json); result = bnytest.GetBNYData(json); result = bnytest.GetChannelNameList(json); json = JsonConvert.SerializeObject(request); }
public string GetBNYData(string json) { Response resultInfo = new Response(); try { BNYRequest request = JsonConvert.DeserializeObject <BNYRequest>(json); if (String.IsNullOrEmpty(request.path)) { resultInfo.flag = 0; resultInfo.msg = "BNY文件路径不能为空"; return(JsonConvert.SerializeObject(resultInfo)); } List <float[]> datas = bnyProcess.GetBNYData(request.path, request.startfilepos, request.endfilepos); resultInfo.flag = 1; resultInfo.msg = "Success"; resultInfo.data = JsonConvert.SerializeObject(datas); } catch (Exception ex) { resultInfo.flag = 0; resultInfo.msg = ex.Message; } return(JsonConvert.SerializeObject(resultInfo)); }
public string GetBNYEndMile(string json) { Response resultInfo = new Response(); try { BNYRequest request = JsonConvert.DeserializeObject <BNYRequest>(json); if (String.IsNullOrEmpty(request.path)) { resultInfo.flag = 0; resultInfo.msg = "BNY文件路径不能为空"; return(JsonConvert.SerializeObject(resultInfo)); } float result = bnyProcess.GetBNYEndMile(request.path); resultInfo.flag = 1; resultInfo.msg = "Success"; resultInfo.data = JsonConvert.SerializeObject(result); } catch (Exception ex) { resultInfo.flag = 0; resultInfo.msg = ex.Message; } return(JsonConvert.SerializeObject(resultInfo)); }
public string GetMilePostions(string json) { Response resultInfo = new Response(); try { BNYRequest request = JsonConvert.DeserializeObject <BNYRequest>(json); if (String.IsNullOrEmpty(request.path)) { resultInfo.flag = 0; resultInfo.msg = "BNY文件路径不能为空"; return(JsonConvert.SerializeObject(resultInfo)); } long[] positions = bnyProcess.GetMilePostions(request.path, request.isinc, request.startmile, request.endmile); resultInfo.flag = 1; resultInfo.msg = "Success"; resultInfo.data = JsonConvert.SerializeObject(positions); } catch (Exception ex) { resultInfo.flag = 0; resultInfo.msg = ex.Message; } return(JsonConvert.SerializeObject(resultInfo)); }