Exemplo n.º 1
0
        /// <summary>
        /// 根据数据进行转换
        /// </summary>
        /// <param name="listGeo2Cit">geo转cit通道数据</param>
        /// <param name="citFileHeader">cit头部数据</param>
        public void ConvertData(string trainCode, FileInformation citFileHeader)
        {
            try
            {
                string geoFilePath             = _geoFilePath;
                string geoNameWithoutExtension = Path.GetFileNameWithoutExtension(geoFilePath).ToUpper();
                string geoDirectory            = Path.GetDirectoryName(geoFilePath);
                string destFileName            = Path.Combine(geoDirectory, geoNameWithoutExtension + ".cit");


                _geoHelper.InitChannelMapping(dicTrainCodeAndConfigPath[trainCode]);

                _geoHelper.ConvertData(_geoFilePath, destFileName, citFileHeader);
                if (_isKmInc)
                {
                    _citProcess.ModifyCitMergeKmInc(destFileName);
                }
                if (_isReverseToForward)
                {
                    _citProcess.ModifyCitReverseToForward(destFileName);
                }

                if (_isIICRevise)
                {
                    ConvertIIC();
                }
                isConverting = false;
                MessageBox.Show("导出成功,导出路径为:" + destFileName);
            }
            catch (Exception ex)
            {
                MyLogger.LogError("导出Cit文件失败", ex);
                MessageBox.Show("导出失败:" + ex.Message);
                isConverting = false;
            }
            if (this != null && this.IsHandleCreated && btnConvertToCIT.IsHandleCreated)
            {
                this.Invoke(new Action(() =>
                {
                    btnConvertToCIT.Enabled = true;
                    labLoading.Visible      = false;
                }));
            }
        }
Exemplo n.º 2
0
        public string ModifyCitReverseToForward(string json)
        {
            //公共方法
            ResultInfo resultInfo = new ResultInfo();

            try
            {
                JObject obj     = (JObject)JsonConvert.DeserializeObject(json);
                string  citFile = Convert.ToString(obj["citFile"]);

                cfprocess.ModifyCitReverseToForward(citFile);
                resultInfo.flag = 1;
                resultInfo.msg  = "";
                resultInfo.data = "";
            }
            catch (Exception ex)
            {
                resultInfo.flag = 0;
                resultInfo.msg  = ex.Message;
            }

            return(JsonConvert.SerializeObject(resultInfo));
        }