//in this func use class member BFGen.isITC private bool GenBeaconXMLFile(IBeaconInfo beacon, string filename) { Balise xmlFile = new Balise(); //BMGR-0002 xmlFile.name = new StringData(beacon.Name); //BMGR-0003 xmlFile.Telegram.type = new StringData("LONG"); //Telegram get if (isITC) {//BMGR-0004 TraceMethod.RecordInfo("error:iTC not support now!"); xmlFile.Telegram.Value = new StringData("iTC not support"); } else { BeaconMessage bm = new BeaconMessage(); xmlFile.Telegram.Value = new StringData(bm.GenerateMessage(beacon, sydb.LineID)); } FileSerializer.Serialize(xmlFile, filename, AddLogHead()); return(true); }
public static void Serialize(string mappingsTextFilePath, IEnumerable <RepositoryUrlToLocalRelativeDirectoryPathMapping> mappings, bool overwrite = true) { FileSerializer.Serialize(mappingsTextFilePath, mappings, MappingsTextSerializer.Instance, overwrite); }
public void Save(IEnumerable <Month> months) { FileSerializer.Serialize(months, FileName); }
private void SaveSettings() { var path = AppDomain.CurrentDomain.BaseDirectory + "settings.json"; FileSerializer.Serialize(_viewModel.Settings, path); }
private bool GenLEUXmlFile(LEU_filtered_values.leu leurf, GID gid, string filename) { try { XmlFileHelper xmlFile = XmlFileHelper.CreateFromString(null); AddLogHead(ref xmlFile); //根据LEU Result Filtered Values文件的内容修改可变部分的值 leuXmlTemplate.name = leurf.NAME; //5.2.1生成Output_balise leuXmlTemplate.Output_balise.Clear();//先清掉已有数据 //calculate leugb.obList by leurf.beaconList #region [cal oblist] foreach (LEU_filtered_values.leu.BEACON beacon in leurf.beaconList) { LEUXML.LEU.OUTPUT_BALISE ob = new LEUXML.LEU.OUTPUT_BALISE(beacon.NAME, beacon.NUM); string[] varInputs = beacon.Variants_inputs.ToString().Split(' '); int index = 0; //BMGR-0064 foreach (string varInput in varInputs) { if (varInput != "0") { LEUXML.LEU.OUTPUT_BALISE.INPUT input = new LEUXML.LEU.OUTPUT_BALISE.INPUT(); input.Channel = new StringData("00"); input.Number = new StringData(varInput.PadLeft(2, '0')); input.index = index; ob.Input.Add(input); } ++index;//BMGR-0072 this is the pos index in variant_input and varait_state } ob.Input.Sort((x, y) => { return(x.Number.ToString().CompareTo(y.Number.ToString())); //根据intNum重新排序,这个排序影响mask的值 }); foreach (LEU_filtered_values.leu.BEACON.MESSAGE msg in beacon.msgList) { if (0 != msg.RANK)//BMGR-0071 { LEUXML.LEU.OUTPUT_BALISE.ASPECT asp = new LEUXML.LEU.OUTPUT_BALISE.ASPECT(); string mask = ""; //BMGR-0072 //根据Input的顺序确定其在MASK中的位置,根据其num找到其在Variants_inputs中的索引 //根据其在Variants_inputs中索引,确定此码位在Variant_state中的索引.[两个索引相等] //判断此索引位置的值,为0则取0,为1则取1,为P或S则取X,然后将MASK不足X至30位 foreach (var inNode in ob.Input) { string value = msg.VarState.Substring(inNode.index, 1); if (value == "0") { mask += '0'; } else if (value == "1") { mask += '1'; } else if (value == "P" || value == "S") { mask += 'X'; } } //补足30位 for (int i = mask.Length; i < 30; i++) { mask += 'X'; } asp.Mask = new StringData(mask); //BMGR-0073 if (isITC) { throw new NotImplementedException(); } else { asp.Telegram = msg.Interoperable; } ob.CheckAspect(asp); ob.Aspect.Add(asp); } } //BMGR-0074 LEU_filtered_values.leu.BEACON.MESSAGE dftMsg = beacon.msgList.Find(x => (int)x.RANK == 0); if (isITC) { throw new NotImplementedException(); } else { ob.Default_telegram = dftMsg.Interoperable; } leuXmlTemplate.Output_balise.Add(ob); } #endregion //GMBR-0060 leuXmlTemplate.updateGid(gid); FileSerializer.Serialize(leuXmlTemplate, filename, AddLogHead()); return(true); } catch (System.Exception ex) { TraceMethod.Record(TraceMethod.TraceKind.ERROR, ex.Message); return(false); } }