コード例 #1
0
ファイル: inertness.cs プロジェクト: luckyzjian/VMAS
 public bool writeInertnessIni(inertness inertnessdata)
 {
     try
     {
         if (File.Exists("C:/jcdatatxt/Inertness.ini"))
         {
             File.Delete("C:/jcdatatxt/Inertness.ini");
         }
         //configInfdata preConfigData = getConfigIni();
         ini.INIIO.WritePrivateProfileString("标定数据", "测试方法", inertnessdata.TestMethod, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "T1加载功率", inertnessdata.T1power, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "T2加载功率", inertnessdata.T2power, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "开始滑行区间", inertnessdata.StartSpeed, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "结束滑行区间", inertnessdata.EndSpeed, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第一次ACD1", inertnessdata.Acd1_1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第二次ACD1", inertnessdata.Acd1_2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第三次ACD1", inertnessdata.Acd1_3, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "平均值ACD1", inertnessdata.Acd1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第一次ACD2", inertnessdata.Acd2_1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第二次ACD2", inertnessdata.Acd2_2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第三次ACD2", inertnessdata.Acd2_3, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "平均值ACD2", inertnessdata.Acd2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第一次DIW", inertnessdata.Diw_1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第二次DIW", inertnessdata.Diw_2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "第三次DIW", inertnessdata.Diw_3, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "平均值DIW", inertnessdata.Diw, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force11", inertnessdata.force1_1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force12", inertnessdata.force1_2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force13", inertnessdata.force1_3, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force21", inertnessdata.force2_1, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force22", inertnessdata.force2_2, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "force23", inertnessdata.force2_3, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "标称", inertnessdata.Diw_bc, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "实测", inertnessdata.Diw_sc, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "误差", inertnessdata.Wc, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "判定", inertnessdata.Pd, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "滑行时间", inertnessdata.Hxsj, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "备注说明", inertnessdata.Bz, "C:/jcdatatxt/Inertness.ini");
         ini.INIIO.WritePrivateProfileString("标定数据", "标定结果", inertnessdata.Bdjg, "C:/jcdatatxt/Inertness.ini");
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
        public inertness readInertnessData(string filePath)
        {
            inertness vmas_data = new inertness();

            try
            {
                StringBuilder temp = new StringBuilder();
                temp.Length = 2048;
                if (File.Exists(filePath))
                {
                    ini.INIIO.GetPrivateProfileString("标定数据", "测试方法", "", temp, 2048, filePath);//、
                    vmas_data.TestMethod = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "T1加载功率", "", temp, 2048, filePath);
                    vmas_data.T1power = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "T2加载功率", "", temp, 2048, filePath);
                    vmas_data.T2power = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "开始滑行区间", "", temp, 2048, filePath);
                    vmas_data.StartSpeed = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "结束滑行区间", "", temp, 2048, filePath);
                    vmas_data.EndSpeed = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第一次ACD1", "", temp, 2048, filePath);
                    vmas_data.Acd1_1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第二次ACD1", "", temp, 2048, filePath);
                    vmas_data.Acd1_2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第三次ACD1", "", temp, 2048, filePath);
                    vmas_data.Acd1_3 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "平均值ACD1", "", temp, 2048, filePath);
                    vmas_data.Acd1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第一次ACD2", "", temp, 2048, filePath);
                    vmas_data.Acd2_1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第二次ACD2", "", temp, 2048, filePath);
                    vmas_data.Acd2_2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第三次ACD2", "", temp, 2048, filePath);
                    vmas_data.Acd2_3 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "平均值ACD2", "", temp, 2048, filePath);
                    vmas_data.Acd2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第一次DIW", "", temp, 2048, filePath);
                    vmas_data.Diw_1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第二次DIW", "", temp, 2048, filePath);
                    vmas_data.Diw_2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "第三次DIW", "", temp, 2048, filePath);
                    vmas_data.Diw_3 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "平均值DIW", "", temp, 2048, filePath);
                    vmas_data.Diw = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force11", "", temp, 2048, filePath);
                    vmas_data.force1_1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force12", "", temp, 2048, filePath);
                    vmas_data.force1_2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force13", "", temp, 2048, filePath);
                    vmas_data.force1_3 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force21", "", temp, 2048, filePath);
                    vmas_data.force2_1 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force22", "", temp, 2048, filePath);
                    vmas_data.force2_2 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "force23", "", temp, 2048, filePath);
                    vmas_data.force2_3 = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "标称", "", temp, 2048, filePath);
                    vmas_data.Diw_bc = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "实测", "", temp, 2048, filePath);
                    vmas_data.Diw_sc = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "误差", "", temp, 2048, filePath);
                    vmas_data.Wc = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "判定", "", temp, 2048, filePath);
                    vmas_data.Pd = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "滑行时间", "", temp, 2048, filePath);
                    vmas_data.Hxsj = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "备注说明", "", temp, 2048, filePath);
                    vmas_data.Bz = temp.ToString();
                    ini.INIIO.GetPrivateProfileString("标定数据", "标定结果", "", temp, 2048, filePath);
                    vmas_data.Bdjg = temp.ToString();
                }
                else
                {
                    vmas_data.Bdjg = "-1";
                }
                return(vmas_data);
            }
            catch
            {
                vmas_data.Bdjg = "-1";
                return(vmas_data);
            }
        }