Example #1
0
        public static SpcResult Read(string path)
        {
            RSpcFile spc = new RSpcFile();

            //判断Spc是否加密,如果加密,解密
            if (!spc.IsRightSpcFile(path))
            {
                //进行解密操作
                string sDesFile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
                sDesFile = Path.Combine(sDesFile, "DesTmp.spc");
                Des desTmp = Des.Instance();
                if (desTmp.DecryptFile(path, sDesFile))
                {
                    path = sDesFile;
                }
            }

            if (spc.Open(path))
            {
                float[] xData, yData;
                spc.Read(out xData, out yData);
                SpcResult r = new SpcResult()
                {
                    XData  = xData,
                    YData  = yData,
                    Length = xData.Length
                };
                spc.Close();
                return(r);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
 // 实例化
 public static Des Instance()
 {
     if (instance == null)
     {
         instance = new Des();
         if (instance.m_bInitError)
         {
             instance = null;
         }
     }
     return(instance);
 }