Beispiel #1
0
        public bool SaveTxtResult(string FilePath, ref List <string> lCmpInfo, bool delFile)
        {
            SL_IO_Util imgUtil = new SL_IO_Util();
            string     Addr    = string.Format("{0,8}", "Addr");

            Addr += "\t,\t";
            Addr += string.Format("{0,12}", "(R,G,B)");
            Addr += "\t,\t";
            Addr += string.Format("{0,12}", "(CR,CG,CB)");
            string TxtPath = Path.ChangeExtension(FilePath, "txt");

            if (lCmpInfo.Count == 0)
            {
                lCmpInfo.Add(BMPCMPMATCH);
            }
            if (delFile)
            {
                imgUtil.FileDelete(TxtPath);
            }
            lCmpInfo.Insert(0, Addr);
            FileStream   fs = new FileStream(TxtPath, FileMode.Append, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);

            foreach (string item in lCmpInfo)
            {
                sw.WriteLine(item);
            }
            sw.Close();
            lCmpInfo.Clear();
            return(true);
        }
Beispiel #2
0
        private bool InstrScopeImage(int Count, string instruCmd, ref string RdStr)
        {
            bool       ret = true;
            string     strPath = null, FileName = null;
            SL_IO_Util IOUtil = new SL_IO_Util();

            byte[]         ScopeScreenResultsArray; // Screen Results array.
            int            g_ScreenLength;
            VisaInstrument visaScope = new VisaInstrument(EquipUtil[Count].getInstrName());

            //ScopeList.SimpleScopeGraph(devices[1], ":DISPLAY:DATA? PNG, SCREEN, COLOR\r\n");
            // Download the screen image.
            // -----------------------------------------------------------
            visaScope.SetTimeoutSeconds(30000);
            visaScope.DoCommand(":STOP");
            visaScope.DoCommand(":HARDcopy:INKSaver OFF");
            // Get the screen data.
            g_ScreenLength = visaScope.DoQueryIEEEBlock(":DISPlay:DATA? PNG, COLor", out ScopeScreenResultsArray);

            if (instruCmd.CompareTo("auto") == 0)
            {
                FileName = "Scope_" + DateTime.Now.ToLocalTime().ToString("yyyyMMdd-HHmmss") + ".png";
            }
            else
            {
                FileName = instruCmd;
            }

            strPath = Setting.ExeScopeDirPath + "\\" + FileName;
            if (IOUtil.isFileExist(strPath))
            {
                IOUtil.FileDelete(strPath);
            }
            if (IOUtil.GetExtName(strPath).CompareTo("png") != 0)
            {
                strPath += ".png";
            }
            FileStream fStream = File.Open(strPath, FileMode.Create);

            fStream.Write(ScopeScreenResultsArray, 0, g_ScreenLength);
            fStream.Close();

            visaScope.DoCommand(":RUN");
            visaScope.Close();
            return(ret);
        }