using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.VisualBasic;
using CommonClassLib;
namespace SimensCP5611
{
    class CReadTextConfig
    {
        public static string GetMPIErrors(int ErrCode)
        {
            string filePath = System.IO.Path.GetFullPath(System.Reflection.Assembly.GetExecutingAssembly().GetName().ToString());
            filePath = System.IO.Path.GetDirectoryName(filePath);
            filePath = System.IO.Path.Combine(filePath, "Error.eng");
            string errtext = "";
           
            StreamReader sr = new StreamReader(filePath);
            while (sr.EndOfStream==false)
            {
                errtext = sr.ReadLine();
                char[] ss=new char[1]{':'};
                string[] sss = errtext.Split(ss,StringSplitOptions.RemoveEmptyEntries);
                if (Strings.Right("000"+ CCarryConvert.DecimalToHex(ErrCode),4) == sss[0])
                {
                    sr.Close();
                    return sss[1];
                }
            }

            
            sr.Close();

            return "这个错误没有被记载，请与供应商联系！";
        }
    }
}
