Exemplo n.º 1
0
 public bool writeCarIni(carInidata carinidata)
 {
     try
     {
         //configInfdata preConfigData = getConfigIni();
         ini.INIIO.WritePrivateProfileString("检测信息", "车辆ID", carinidata.CarID, @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "车辆牌照号", carinidata.CarPH, @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "基准质量", carinidata.CarJzzl.ToString("0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "燃料种类", carinidata.CarRlzl, @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "额定功率", carinidata.CarEdgl.ToString("0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "额定转速", carinidata.CarEdzs.ToString("0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "变速箱", carinidata.CarBsxlx, @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "连续超差", carinidata.CarLxcc.ToString("0.0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "累计超差", carinidata.CarLjcc.ToString("0.0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "浓度值", carinidata.CarNdz.ToString("0.0"), @"C:\jcdatatxt\carinfo.ini");
         ini.INIIO.WritePrivateProfileString("检测信息", "冲程", carinidata.CarCc, @"C:\jcdatatxt\carinfo.ini");
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public carInidata getCarIni()
        {
            float         a          = 0;
            carInidata    carinidata = new carInidata();
            StringBuilder temp       = new StringBuilder();

            temp.Length = 2048;
            ini.INIIO.GetPrivateProfileString("检测信息", "车辆ID", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            carinidata.CarID = temp.ToString().Trim();
            ini.INIIO.GetPrivateProfileString("检测信息", "车辆牌照号", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            carinidata.CarPH = temp.ToString().Trim();
            ini.INIIO.GetPrivateProfileString("检测信息", "基准质量", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarJzzl = a;
            }
            else
            {
                carinidata.CarJzzl = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "燃料种类", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            carinidata.CarRlzl = temp.ToString().Trim();
            ini.INIIO.GetPrivateProfileString("检测信息", "额定功率", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarEdgl = a;
            }
            else
            {
                carinidata.CarEdgl = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "额定转速", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarEdzs = a;
            }
            else
            {
                carinidata.CarEdzs = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "变速箱", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            carinidata.CarBsxlx = temp.ToString().Trim();
            ini.INIIO.GetPrivateProfileString("检测信息", "连续超差", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarLxcc = a;
            }
            else
            {
                carinidata.CarLxcc = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "累计超差", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarLjcc = a;
            }
            else
            {
                carinidata.CarLjcc = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "浓度值", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            if (float.TryParse(temp.ToString().Trim(), out a))
            {
                carinidata.CarNdz = a;
            }
            else
            {
                carinidata.CarNdz = 0;
            }
            ini.INIIO.GetPrivateProfileString("检测信息", "冲程", "", temp, 2048, @"C:\jcdatatxt\carinfo.ini");
            carinidata.CarCc = temp.ToString().Trim();
            return(carinidata);
        }