internal static double TValueToRValue(double t, ABCParam param, ConvertMethod method) { double rnew,tnew; if (method == ConvertMethod.ITS90) { double ac, bc, cc; param.targetT = t; ac = param.a; bc = param.b; cc = param.c; rnew = GetWr(t); return rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1); } if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90 || method == ConvertMethod.ASTM) { double alpha, A, B, C; alpha = A = B = C = 0; if (method == ConvertMethod.DIN68) { alpha = 0.003850; param.rtp = 100; A = 3.90802e-3; B = -5.8020e-7; C = -4.2735e-12; } if (method == ConvertMethod.DIN90) { alpha = 0; param.rtp = 100; A = 3.90823e-3; B = -5.7750e-7; C = -4.1830e-12; if (t >= 0) C = 0; } if (method == ConvertMethod.ASTM) { alpha = 0.003911; param.rtp = 100; A = 3.9692e-3; B = -5.8495e-7; C = -4.2325e-12; } tnew = t; return param.rtp * (1 + A * tnew + B * tnew * tnew + C * (tnew - 100) * tnew * tnew * tnew); } throw new Exception("Unexpected convert method " + method.ToString()); }
/// <summary> /// 根据SAASID跟用户账户密码查询该C/S用户是否存在 /// </summary> /// <param name="theHashtable"></param> /// <param name="theDataAccessor"></param> /// <param name="theSystemMessageInfo"></param> /// <returns></returns> public UserInfo SelectUserCountByID(Dictionary <string, object> arr, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo) { SystemMessage _objSystemMessage = new SystemMessage(); SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo(); UserInfo objUserInfo = new UserInfo(); //转换为Datatable DataTable dt = ConvertMethod.getDateTable("table", arr); //dataTable转换为XML string objXmlDocument = Helper.ConvertMethod.CDataToXml(dt); ////加密xml进行返回 string Parameter = ConvertMethod.EncryptDESByKey8(objXmlDocument, ConfigurationSettings.AppSettings["password"]); DataSet objDataSet = new DataSet(); try { string strReturnXml = ServiceWrapper.Current.ClientUserAuthentication(Parameter); //先解密成xml格式 strReturnXml = ConvertMethod.DecryptDESByKey8(strReturnXml, ConfigurationSettings.AppSettings["password"]); objDataSet = Helper.FormatConvert.CXmlToDataSet(strReturnXml); try { if (objDataSet.Tables.Count > 1) { foreach (DataRow objDataRow in objDataSet.Tables["tb_user"].Rows) { objUserInfo = GetInfoFromDataRow(objDataRow); } } if (objDataSet.Tables.Count == 3) { objUserInfo.IsPower = true; foreach (DataRow objDataRow in objDataSet.Tables["tb_right"].Rows) { //解析权限 2012.01.04 zhangwenjin add objUserInfo.RightInfoList.Add(GetRightInfoFromDataRow(objDataRow)); } } if (objDataSet.Tables.Count == 1) { return(null); } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } } catch (Exception e) { _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("WebServiceConnectFail"); _objSystemMessageInfo.Success = false; _objSystemMessageInfo.Exception = e.Message; } theSystemMessageInfo = _objSystemMessageInfo; return(objUserInfo); }
private void LoadOutputSettings() { string confPath = GetConfPath(); XmlSerializer xml = new XmlSerializer(typeof(AppConfiguration)); StreamReader reader = new StreamReader(confPath); AppConfiguration conf = (AppConfiguration)xml.Deserialize(reader); this.csvOutputSettings.DateFormat = conf.CSVDateFormat; string[] csvFormat = conf.CSVOutputFormat.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); this.csvOutputSettings.CSVFormat = ""; foreach (string s in csvFormat) { if (this.csvOutputSettings.CSVFormat == "") { this.csvOutputSettings.CSVFormat += "{" + s + "}"; } else { this.csvOutputSettings.CSVFormat += ",{" + s + "}"; } } if (conf.OutputFolder.Trim() == "") { conf.OutputFolder = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); } //this.csvOutputSettings.CSVFormat = conf.CSVOutputFormat; this.csvOutputSettings.Delimiter = conf.CSVDelimiter; this.csvOutputSettings.UseSectorValueAsVolume = conf.IndexValueAsVolume; this.csvOutputSettings.OutputDirectory = conf.OutputFolder; this.csvOutputSettings.SectorVolumeDivider = conf.IndexValueDivisor; this.csvOutputSettings.Filename = conf.ReportFilenameFormat; this.convertMethod = ConvertMethod.ConvertFromFiles; reportFilenameFormat = conf.ReportFilenameFormat; edtDownloadLink.Text = conf.ReportUrl; //Uri outpuFolder = new Uri(conf.OutputFolder); edtOutputDir.Text = conf.OutputFolder; //outpuFolder.AbsoluteUri); setCSVComboBoxes(conf.CSVOutputFormat); expConvertFromFiles.Expanded = true; // switch(conf.DataSource) // { // case ConvertMethod.DownloadAndConvert: expDownloadAndConvert1.Expanded = true; // expConvertFromFiles.Expanded = false; // expHistoricalData.Expanded = false; // break; // case ConvertMethod.ConvertFromFiles: expConvertFromFiles.Expanded = true; // expDownloadAndConvert1.Expanded = false; // expHistoricalData.Expanded = false; // break; // case ConvertMethod.DownloadHistoricalData: expHistoricalData.Expanded = true; // expDownloadAndConvert1.Expanded = false; // expConvertFromFiles.Expanded = false; // break; // } reader.Close(); }
/// <summary> /// 执行申请换卡操作并写入卡历史表 /// </summary> /// <param name="theCardTypeInfo">实体层对象</param> /// <param name="key">密码</param> /// <param name="isAdd">判断是否需要写入数据库</param> /// <returns>0所有操作成功,1网络连接不成功,99是远程服务器方法存储失败,其他状态</returns> public int UpdateCarInfoAndApplyChangeCardHistoryRecord(CardInfo _cardInfo, string key, bool isAdd) { try { int p = 0; //默认写入是全部成功 Dictionary <string, object> arr = new Dictionary <string, object>(); //获得对应写入后台的文字描述 if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.金额卡) { arr["volume"] = "-" + Convert.ToDecimal(_cardInfo.money).ToString("0.000").Substring(0, Convert.ToDecimal(_cardInfo.money).ToString("0.000").Length - 2); //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限次卡) { arr["volume"] = "-" + _cardInfo.times; //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限期卡) { arr["volume"] = _cardInfo.end_date.ToString("yyyyMMdd"); //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限时卡) { int g = _cardInfo.charges_date / 60 * 10 + _cardInfo.charges_date % 60 / 10; arr["volume"] = "-" + g; //量 } if (isAdd) { //判断写卡是否成功 if (p != 0) { return(p); } else { //执行数据库存放 arr["ICode"] = "ITSP2_RFID_CS_UpdateCarInfoAndApplyChangeCardHistoryRecord"; arr["IVer"] = "1.0.0.1"; arr["saas_id"] = _cardInfo.saas_id; arr["operation_type"] = "3"; //挂失 arr["card_id"] = _cardInfo.id; arr["no"] = _cardInfo.no; arr["address_type"] = "1"; arr["network_id"] = _cardInfo.Network_id; arr["operation_memo"] = "申请换卡操作成功"; //操作事项 arr["operation_user"] = _cardInfo.modify_user; DataTable table = ConvertMethod.getDateTable("msgTable", arr); string Parameter = ConvertMethod.CDataToXml(table); //加密xml进行返回 Parameter = HelperClass.EncryptDESByKey8(Parameter); string resoue = _objICardInfoDAL.UpdateCarInfoAndApplyChangeCardHistoryRecord(Parameter); //先解密成xml格式 string str = HelperClass.DecryptDESByKey8(resoue); //把字符串转换成表对象 DataSet parameterTable = ConvertMethod.CXmlToDataSet(str); if (parameterTable.Tables[0].Rows[0]["msgCode"].ToString() == "申请换卡操作成功!") { return(0); //未实现,默认全部成功 } else { return(99); } } } else { //否则就是更改值,不进行数据库的存储 return(0); } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "方法名:UpdateCarInfoAndApplyChangeCardHistoryRecord(CardInfo _cardInfo, string key),卡信息BLL层对数据操作时出现异常!", ex.Message); return(1); } }
public NonemitWithConvertAttribute(ConvertMethod method) { this.Method = method; }
public double RValueToTValue(double r, ABCParam param, ConvertMethod method) { if (method == ConvertMethod.ITS90) { double ac, bc, cc; ac = param.a; bc = param.b; cc = param.c; //set the search range of T between GetT(r) +/- 1 degree double tlow = GetT(r) - 1; double tup = tlow + 2; double rnew; double tnew; int count = 0; while ((tup - tlow > 0.00005) && (count++ < 100)) { tnew = (tlow + tup) / 2.0; rnew = GetWr(tnew); rnew = rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1); if (r < rnew) tup = tnew; else tlow = tnew; } return (tlow + tup) / 2.0; } if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90|| method == ConvertMethod.ASTM) { double alpha,A,B,C; alpha = A = B = C = 0; if (method == ConvertMethod.DIN68) { alpha = 0.003850; param.wtp = 100; A = 3.90802e-3; B = -5.8020e-7; C = -4.2735e-12; } if (method == ConvertMethod.DIN90) { alpha = 0; param.wtp = 100; A = 3.90823e-3; B = -5.7750e-7; C = -4.1830e-12; } if (method == ConvertMethod.ASTM) { alpha = 0.003911; param.wtp = 100; A = 3.9692e-3; B = -5.8495e-7; C = -4.2325e-12; } double tlow = -201; double tup = 1000; double rnew; double tnew; int count = 0; while ((tup - tlow > 0.00005) && (count++ < 150)) { tnew = (tlow + tup) / 2.0; if(tnew > 0) rnew = param.wtp * (1 + A * tnew + B * tnew * tnew); else rnew = param.wtp*(1+A*tnew+B*tnew*tnew+C*(tnew-100)*tnew*tnew*tnew); if (r < rnew) tup = tnew; else tlow = tnew; } return (tlow + tup) / 2.0; } if (method == ConvertMethod.PT100) { //todo } if (method == ConvertMethod.PT25) { //todo } return -9999.9999; }
/// <summary> /// bsq 시작하는함수 /// </summary> /// <param name="dialogController"></param> /// <param name="nextButton"></param> public void BSQstart(DialogController dialogController, ConvertMethod nextButton) { dialogController.ShowTexts(0.5f, 1.5f, 0.02f, 0.5f, nextButton, "BSQ를 시작합니다! \n시험 전까지 BSQ를 진행합니다", "랜덤으로 팀원이 배정되었습니다"); }
public JpegColorConverter(JpegCompressStruct cinfo) { m_cinfo = cinfo; /* set start_pass to null method until we find out differently */ m_useNullStart = true; /* Make sure input_components agrees with in_color_space */ switch (cinfo.m_in_color_space) { case JColorSpace.JCS_GRAYSCALE: if (cinfo.m_input_components != 1) { cinfo.ErrExit(JMessageCode.JERR_BAD_IN_COLORSPACE); } break; case JColorSpace.JCS_RGB: case JColorSpace.JCS_BG_RGB: if (cinfo.m_input_components != JpegConstants.RGB_PIXELSIZE) { cinfo.ErrExit(JMessageCode.JERR_BAD_IN_COLORSPACE); } break; case JColorSpace.JCS_YCbCr: case JColorSpace.JCS_BG_YCC: if (cinfo.m_input_components != 3) { cinfo.ErrExit(JMessageCode.JERR_BAD_IN_COLORSPACE); } break; case JColorSpace.JCS_CMYK: case JColorSpace.JCS_YCCK: if (cinfo.m_input_components != 4) { cinfo.ErrExit(JMessageCode.JERR_BAD_IN_COLORSPACE); } break; default: /* JCS_UNKNOWN can be anything */ if (cinfo.m_input_components < 1) { cinfo.ErrExit(JMessageCode.JERR_BAD_IN_COLORSPACE); } break; } /* Support color transform only for RGB colorspaces */ if (cinfo.ColorTransform != JColorTransform.JCT_NONE && cinfo.Jpeg_color_space != JColorSpace.JCS_RGB && cinfo.Jpeg_color_space != JColorSpace.JCS_BG_RGB) { cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); } /* Check num_components, set conversion method based on requested space */ switch (cinfo.m_jpeg_color_space) { case JColorSpace.JCS_GRAYSCALE: if (cinfo.m_num_components != 1) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } switch (cinfo.m_in_color_space) { case JColorSpace.JCS_GRAYSCALE: case JColorSpace.JCS_YCbCr: case JColorSpace.JCS_BG_YCC: color_convert = GrayscaleConvert; break; case JColorSpace.JCS_RGB: m_useNullStart = false; // use rgb_ycc_start color_convert = RgbGrayConvert; break; default: cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); break; } break; case JColorSpace.JCS_RGB: case JColorSpace.JCS_BG_RGB: if (cinfo.m_num_components != 3) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } if (cinfo.m_in_color_space == cinfo.Jpeg_color_space) { switch (cinfo.ColorTransform) { case JColorTransform.JCT_NONE: color_convert = RgbConvert; break; case JColorTransform.JCT_SUBTRACT_GREEN: color_convert = RgbRgb1Convert; break; default: cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); break; } } else { cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); } break; case JColorSpace.JCS_YCbCr: if (cinfo.m_num_components != 3) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } switch (cinfo.m_in_color_space) { case JColorSpace.JCS_RGB: m_useNullStart = false; // use rgb_ycc_start color_convert = RgbYccConvert; break; case JColorSpace.JCS_YCbCr: color_convert = NullConvert; break; default: cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); break; } break; case JColorSpace.JCS_BG_YCC: if (cinfo.m_num_components != 3) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } switch (cinfo.m_in_color_space) { case JColorSpace.JCS_RGB: /* For conversion from normal RGB input to BG_YCC representation, * the Cb/Cr values are first computed as usual, and then * quantized further after DCT processing by a factor of * 2 in reference to the nominal quantization factor. */ /* need quantization scale by factor of 2 after DCT */ cinfo.Component_info[1].component_needed = true; cinfo.Component_info[2].component_needed = true; /* compute normal YCC first */ m_useNullStart = false; // use rgb_ycc_start color_convert = RgbYccConvert; break; case JColorSpace.JCS_YCbCr: /* need quantization scale by factor of 2 after DCT */ cinfo.Component_info[1].component_needed = true; cinfo.Component_info[2].component_needed = true; color_convert = NullConvert; break; case JColorSpace.JCS_BG_YCC: /* Pass through for BG_YCC input */ color_convert = NullConvert; break; default: cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); break; } break; case JColorSpace.JCS_CMYK: if (cinfo.m_num_components != 4) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } if (cinfo.m_in_color_space == JColorSpace.JCS_CMYK) { color_convert = NullConvert; } else { cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); } break; case JColorSpace.JCS_YCCK: if (cinfo.m_num_components != 4) { cinfo.ErrExit(JMessageCode.JERR_BAD_J_COLORSPACE); } switch (cinfo.m_in_color_space) { case JColorSpace.JCS_CMYK: m_useNullStart = false; // use rgb_ycc_start color_convert = CmykYcckConvert; break; case JColorSpace.JCS_YCCK: color_convert = NullConvert; break; default: cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); break; } break; default: /* allow null conversion of JCS_UNKNOWN */ if (cinfo.m_jpeg_color_space != cinfo.m_in_color_space || cinfo.m_num_components != cinfo.m_input_components) { cinfo.ErrExit(JMessageCode.JERR_CONVERSION_NOTIMPL); } color_convert = NullConvert; break; } }
/// <summary> /// 执行充值 /// </summary> /// <param name="theCardTypeInfo">实体层对象</param> /// <param name="key">密码</param> /// <param name="value">充值的数目</param> /// <param name="isAdd">判断是否需要写入数据库</param> /// <returns>0所有操作成功,1网络连接不成功,99是远程服务器方法存储失败,其他状态</returns> public int Update(CardInfo _cardInfo, string key, string value, bool isAdd) { try { Dictionary <string, object> arr = new Dictionary <string, object>(); //先读卡 string[] mary1 = ConvertToBytes(RFIDClass.ReadCardAndReturnStatus(key, 1)); string inputValue = string.Empty; //先进行写卡 int p = -1; if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.金额卡) { //获得要写入的值 inputValue = mary1[1].Substring(0, 4) + ConvertToStringByInt32(_cardInfo.money.ToString("0.000").Substring(0, _cardInfo.money.ToString("0.000").Length - 2).Replace(".", "")) + mary1[1].Substring(9); p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 0, HelperClass.EncryptByString(inputValue)); //修改状态 p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 1, HelperClass.EncryptByString(mary1[2].Substring(0, 13) + "2" + mary1[2].Substring(14))); arr["volume"] = Convert.ToDecimal(value).ToString("0.000").Substring(0, Convert.ToDecimal(value).ToString("0.000").Length - 2); //量 inputValue = "充值" + Convert.ToDecimal(value).ToString("0.000").Substring(0, Convert.ToDecimal(value).ToString("0.000").Length - 2) + "0元"; } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限次卡) { //获得要写入的值 inputValue = mary1[1].Substring(0, 4) + ConvertToStringByInt32(_cardInfo.times.ToString()) + mary1[1].Substring(9); p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 0, HelperClass.EncryptByString(inputValue)); //修改状态 p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 1, HelperClass.EncryptByString(mary1[2].Substring(0, 13) + "2" + mary1[2].Substring(14))); arr["volume"] = value; //量 inputValue = "增加" + value.ToString() + "次"; } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限期卡) { //获得要写入的值 inputValue = mary1[2].Substring(0, 6) + _cardInfo.end_date.ToString("yyyyMMdd").Substring(2) + mary1[2].Substring(12, 1) + "2" + mary1[2].Substring(14); p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 1, HelperClass.EncryptByString(inputValue)); //修改对应的最晚到期时间 arr["volume"] = _cardInfo.end_date.ToString("yyyyMMdd"); //量 inputValue = "更新到期时间为" + _cardInfo.end_date.ToString("yyyy-MM-dd"); } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限时卡) { int g = _cardInfo.charges_date / 60 * 10 + _cardInfo.charges_date % 60 / 10; //获得要写入的值 inputValue = mary1[1].Substring(0, 4) + ConvertToStringByInt32(g.ToString()) + mary1[1].Substring(9); p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 0, HelperClass.EncryptByString(inputValue)); //修改状态 p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 1, HelperClass.EncryptByString(mary1[2].Substring(0, 13) + "2" + mary1[2].Substring(14))); arr["volume"] = value; //量 inputValue = "充值" + value.ToString() + "分钟"; } if (isAdd) { //判断写卡是否成功 if (p != 0) { return(p); } else { //执行数据库存放 arr["ICode"] = "ITSP2_RFID_CS_CarHistoryInsert"; arr["IVer"] = "1.0.0.1"; arr["saas_id"] = _cardInfo.saas_id; arr["operation_type"] = "5"; //充值 arr["card_id"] = _cardInfo.id; arr["no"] = _cardInfo.no; arr["address_type"] = "1"; arr["network_id"] = _cardInfo.Network_id; arr["operation_memo"] = inputValue; //操作事项 arr["operation_user"] = _cardInfo.modify_user; arr["card_cost_type"] = (int)_cardInfo.cost_type; //当前充值卡的扣费类型 DataTable table = ConvertMethod.getDateTable("msgTable", arr); string Parameter = ConvertMethod.CDataToXml(table); //加密xml进行返回 Parameter = HelperClass.EncryptDESByKey8(Parameter); string resoue = _objICardInfoDAL.InsertCarInformationHistoryRecord(Parameter); //先解密成xml格式 string str = HelperClass.DecryptDESByKey8(resoue); //把字符串转换成表对象 DataSet parameterTable = ConvertMethod.CXmlToDataSet(str); if (parameterTable.Tables[0].Rows[0]["msgCode"].ToString() == "充值数据成功!") { return(0); //未实现,默认全部成功 } else { return(99); } } } else { //否则就是更改值,不进行数据库的存储 return(0); } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "方法名:Update(CardInfo _cardInfo, string key),卡信息BLL层对数据操作时出现异常!", ex.Message); return(1); } }
public void SetMethodToCSVFile() { convertMethod = ConvertMethod.GENX2CSV; SetOutputFilename("csv"); }
public void SetMethodToTextFile() { convertMethod = ConvertMethod.GENX2TXT; SetOutputFilename("txt"); }
/// <summary> /// textUI에 texts array중 랜덤으로 하나를 선택하여 texts를 순서대로 출력한후 매개변수로 넘어온 함수를 실행하는 함수 /// </summary> /// <param name="startTerm"> text를 처음에 출력하기전에 대기하는 시간, 첫번째 텍스트에만 적용된다. </param> /// <param name="eachTerm"> 각 text를 출력하기 전에 대기하는 시간, 첫번째 텍스트에는 적용되지 않는다. </param> /// <param name="speed"> 한글자가 나타나는 속도 0.02f를 추천 </param> /// <param name="methodTerm"> func가 실행되기 전에 대기하는 시간 </param> /// <param name="func"> 모든 text가 출력된 후 실행되는 함수 </param> /// <param name="multiTexts"> textUI에 출력되는 2차원 문자열 배열 </param> public void ShowRandomTexts(float startTerm, float eachTerm, float speed, float methodTerm, ConvertMethod func, string[][] multiTexts) { int index = Random.Range(0, multiTexts.Length); ShowTexts(startTerm, eachTerm, speed, methodTerm, func, multiTexts[index]); }
/// <summary> /// textUI에 여러 text를 순서대로 출력한후 매개변수로 넘어온 함수를 실행하는 함수 /// </summary> /// <param name="startTerm"> text를 처음에 출력하기전에 대기하는 시간, 첫번째 텍스트에만 적용된다. </param> /// <param name="eachTerm"> 각 text를 출력하기 전에 대기하는 시간, 첫번째 텍스트에는 적용되지 않는다. </param> /// <param name="speed"> 한글자가 나타나는 속도 0.02f를 추천 </param> /// <param name="methodTerm"> func가 실행되기 전에 대기하는 시간 </param> /// <param name="func"> 모든 text가 출력된 후 실행되는 함수 </param> /// <param name="texts"> textUI에 출력되는 문자열들 </param> public void ShowTexts(float startTerm, float eachTerm, float speed, float methodTerm, ConvertMethod func, params string[] texts) { if (coruoutine != null) { StopCoroutine(coruoutine); } coruoutine = PrintTexts(startTerm, eachTerm, speed, methodTerm, func, texts); StartCoroutine(coruoutine); }
private IEnumerator PrintTexts(float startTerm, float eachTerm, float speed, float methodTerm, ConvertMethod func, params string[] texts) { yield return(new WaitForSeconds(startTerm)); for (int i = 0; i < texts.Length; i++) { if (i == 0) { yield return(StartCoroutine(PrintText(texts[i], 0, speed))); } else { yield return(StartCoroutine(PrintText(texts[i], eachTerm, speed))); } } yield return(new WaitForSeconds(methodTerm)); func(); }
double GetThmoVolt(double t, ConvertMethod type) { double[] coef; int len = 0; switch (type) { case ConvertMethod.T_TYPE: coef = (t < 0) ? TLow : THigh; break; case ConvertMethod.K_TYPE: coef = (t < 0) ? KLow : KHigh; break; case ConvertMethod.N_TYPE: coef = (t < 0) ? NLow : NHigh; break; case ConvertMethod.E_TYPE: coef = (t < 0) ? ELow : EHigh; break; case ConvertMethod.B_TYPE: coef = (t < 630.615) ? NLow : NHigh; break; case ConvertMethod.J_TYPE: coef = (t < 760) ? NLow : NHigh; break; case ConvertMethod.S_TYPE: coef = (t < 1064.18) ? SLow : ((t < 1664.5) ? SMed : SHigh); break; case ConvertMethod.R_TYPE: coef = (t < 1064.18) ? RLow : ((t < 1664.5) ? RMed : RHigh); break; default: return(0.0); } if (len == 0) { return(0.0); } double result = coef[0]; if (type == ConvertMethod.K_TYPE) { result = result + (0.118597600000E+00) * Math.Exp((-0.118343200000E-03) * (t - 0.126968600000E+03) * (t - 0.126968600000E+03)); } double pert = t; for (int i = 1; i < coef.Length; i++) { result = result + coef[i] * t; t = t * pert; } return(result); }
/// <summary> /// 执行卡重置 /// </summary> /// <param name="theCardTypeInfo">实体层对象</param> /// <param name="key">密码</param> /// <returns>0所有操作成功,1网络连接不成功,99是远程服务器方法存储失败,其他状态</returns> public int ResetCarInforAndCarHistoryByID(CardInfo _cardInfo, string key) { try { int cSector = 1; //保存要操作的扇区下标 //先执行密码修改 string[] mary = RFIDClass.UpdateCardPassWordAndReturnStatus(_cardInfo.card_id, cSector, key); if (mary[0] != "0") //修改密码错误就直接返回错误状态 { return(Convert.ToInt32(mary[0])); } else //成功继续往下走 { //先读卡 string[] mary1 = ConvertToBytes(RFIDClass.ReadCardAndReturnStatus(key, cSector)); //保存一份副本 string[] maryback = new string[3]; for (int i = 1; i < mary1.Length - 1; i++) { maryback[i - 1] = mary1[i]; } //传入默认密码,执行初始化写入第一扇区 RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 0, ""); RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 1, ""); int p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 2, ""); if (p != 0) //如果出现异常就执行返回 { return(p); } else //如果初始化卡成功,则执行下一步数据库录入 { Dictionary <string, object> arr = new Dictionary <string, object>(); arr["ICode"] = "ITSP2_RFID_CS_ResetCarInforAndCarHistory"; arr["IVer"] = "1.0.0.1"; arr["card_id"] = _cardInfo.card_id; arr["no"] = _cardInfo.no; arr["modify_user"] = _cardInfo.modify_user; DataTable table = ConvertMethod.getDateTable("msgTable", arr); string Parameter = ConvertMethod.CDataToXml(table); //加密xml进行返回 Parameter = HelperClass.EncryptDESByKey8(Parameter); string resoue = _objICardInfoDAL.ResetCarInforAndCarHistoryByID(Parameter); //先解密成xml格式 string str = HelperClass.DecryptDESByKey8(resoue); //把字符串转换成表对象 DataSet parameterTable = ConvertMethod.CXmlToDataSet(str); if (parameterTable.Tables[0].Rows[0]["msgCode"].ToString() == "卡重置成功!") { return(0); //未实现,默认全部成功 } else { //否则就是失败,需要执行还原 RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 0, HelperClass.EncryptByString(maryback[0])); RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 1, HelperClass.EncryptByString(maryback[1])); RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, "", cSector, 2, HelperClass.EncryptByString(maryback[2])); RFIDClass.UpdateCardPassWordAndReturnStatus(_cardInfo.card_id, cSector, "", key); //修改密码 return(99); } } //结束 } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "方法名:ResetCarInforAndCarHistoryByID(CardInfo _cardInfo, string key),卡信息BLL层对数据操作时出现异常!", ex.Message); return(1); } }
//mV to T(degree) convert public double MValueToTValue(double r, ConvertMethod type) { double tlow = 0; double tup = 0; switch (type) { case ConvertMethod.T_TYPE: tlow = -270; tup = 400; break; case ConvertMethod.K_TYPE: tlow = -270; tup = 1372; break; case ConvertMethod.N_TYPE: tlow = -270; tup = 1300; break; case ConvertMethod.E_TYPE: tlow = -270; tup = 1000; break; case ConvertMethod.B_TYPE: tlow = 0; tup = 1280; break; case ConvertMethod.J_TYPE: tlow = -210; tup = 1200; break; case ConvertMethod.S_TYPE: tlow = -50; tup = 1768; break; case ConvertMethod.R_TYPE: tlow = -50; tup = 1768; break; default: return -9999.9999; } double rnew; double tnew; int count = 0; while ((tup - tlow > 0.00005) || (count++ < 100)) { tnew = (tlow + tup) / 2.0; rnew = GetThmoVolt(tnew, type); if (r < rnew) tup = tnew; else tlow = tnew; } return (tlow + tup) / 2; }
/// <summary> /// 执行退卡操作并写入卡历史表 /// </summary> /// <param name="theCardTypeInfo">实体层对象</param> /// <param name="key">密码</param> /// <param name="isAdd">判断是否需要写入数据库</param> /// <returns>0所有操作成功,1网络连接不成功,99是远程服务器方法存储失败,其他状态</returns> public int UpdateCarInfoAndBackCardHistoryRecord(CardInfo _cardInfo, string key, bool isAdd) { try { Dictionary <string, object> arr = new Dictionary <string, object>(); //先读卡 string[] mary1 = ConvertToBytes(RFIDClass.ReadCardAndReturnStatus(key, 1)); //先进行写卡 int p = -1; //先修改卡内状态,退卡状态为 3 p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 1, HelperClass.EncryptByString(mary1[2].Substring(0, 13) + ((int)_cardInfo.status) + mary1[2].Substring(14))); //修改最后操作时间为当前时间 p = RFIDClass.WriterCardAndReturnStatus(_cardInfo.card_id, key, 1, 2, HelperClass.EncryptByString(DateTime.Now.ToString("yyyyMMddHHmmss") + mary1[3].Substring(12))); //获得对应写入后台的文字描述 if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.金额卡) { arr["volume"] = "-" + Convert.ToDecimal(_cardInfo.money).ToString("0.000").Substring(0, Convert.ToDecimal(_cardInfo.money).ToString("0.000").Length - 2); //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限次卡) { arr["volume"] = "-" + _cardInfo.times; //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限期卡) { arr["volume"] = _cardInfo.end_date.ToString("yyyyMMdd"); //量 } else if (_cardInfo.cost_type == CardInfo.CardTypeInfoCostType.限时卡) { int g = _cardInfo.charges_date / 60 * 10 + _cardInfo.charges_date % 60 / 10; arr["volume"] = "-" + g; //量 } if (isAdd) { //判断写卡是否成功 if (p != 0) { return(p); } else { //执行数据库存放 arr["ICode"] = "ITSP2_RFID_CS_UpdateCarInfoAndBackCardHistory"; arr["IVer"] = "1.0.0.1"; arr["saas_id"] = _cardInfo.saas_id; arr["operation_type"] = "2"; //退卡 arr["card_id"] = _cardInfo.id; arr["no"] = _cardInfo.no; arr["address_type"] = "1"; arr["network_id"] = _cardInfo.Network_id; arr["operation_memo"] = "退卡操作成功"; //操作事项 arr["operation_user"] = _cardInfo.modify_user; DataTable table = ConvertMethod.getDateTable("msgTable", arr); string Parameter = ConvertMethod.CDataToXml(table); //加密xml进行返回 Parameter = HelperClass.EncryptDESByKey8(Parameter); string resoue = _objICardInfoDAL.UpdateCarInfoAndBackCardHistoryRecord(Parameter); //先解密成xml格式 string str = HelperClass.DecryptDESByKey8(resoue); //把字符串转换成表对象 DataSet parameterTable = ConvertMethod.CXmlToDataSet(str); if (parameterTable.Tables[0].Rows[0]["msgCode"].ToString() == "退卡操作成功!") { return(0); //未实现,默认全部成功 } else { return(99); } } } else { //否则就是更改值,不进行数据库的存储 return(0); } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "方法名:UpdateCarInfoAndBackCardHistoryRecord(CardInfo _cardInfo, string key),卡信息BLL层对数据操作时出现异常!", ex.Message); return(1); } }
double GetThmoVolt(double t, ConvertMethod type) { double[] coef; int len = 0; switch (type) { case ConvertMethod.T_TYPE: coef = (t < 0) ? TLow : THigh; break; case ConvertMethod.K_TYPE: coef = (t < 0) ? KLow : KHigh; break; case ConvertMethod.N_TYPE: coef = (t < 0) ? NLow : NHigh; break; case ConvertMethod.E_TYPE: coef = (t < 0) ? ELow : EHigh; break; case ConvertMethod.B_TYPE: coef = (t < 630.615) ? NLow : NHigh; break; case ConvertMethod.J_TYPE: coef = (t < 760) ? NLow : NHigh; break; case ConvertMethod.S_TYPE: coef = (t < 1064.18) ? SLow : ((t < 1664.5) ? SMed : SHigh); break; case ConvertMethod.R_TYPE: coef = (t < 1064.18) ? RLow : ((t < 1664.5) ? RMed : RHigh); break; default: return 0.0; } if (len == 0) return 0.0; double result = coef[0]; if (type == ConvertMethod.K_TYPE) { result = result + (0.118597600000E+00) * Math.Exp((-0.118343200000E-03) * (t - 0.126968600000E+03) * (t - 0.126968600000E+03)); } double pert = t; for (int i = 1; i < coef.Length; i++) { result = result + coef[i] * t; t = t * pert; } return result; }
/// <summary> /// 러시 시작하는 함수 /// </summary> /// <param name="dialogController">대사를 출력하는 스크립트</param> /// <param name="nextButton">넥스트 버튼을 나타내는 함수</param> public void RushStart(DialogController dialogController, ConvertMethod nextButton) { dialogController.ShowTexts(0.5f, 1.5f, 0.02f, 0.5f, nextButton, "러시를 시작합니다!", "랜덤으로 팀원이 배정되었습니다"); }