Exemplo n.º 1
0
        private void Btn_align_analyse_Click(object sender, RoutedEventArgs e)
        {
            FileAnalyseHelper hp   = new FileAnalyseHelper();
            filePathObj       path = hp.SelectFileDialog();

            addMsg("开始分析:" + path.fileName);
            hp.analyseAlignData(path);
            addMsg("处理完成");
        }
Exemplo n.º 2
0
        public void analyseMotionData(filePathObj obj)
        {
            List <List <string> > rawLs    = getMotionRawData(obj);
            List <List <int> >    rawDatas = converToint(rawLs);

            saveAsRawData(obj, rawDatas, "初始数据");

            List <List <int> > relDatas = converToRalaData(rawDatas);

            saveAsRawData(obj, relDatas, "相对用时");
        }
Exemplo n.º 3
0
        private void saveAsRawData(filePathObj obj, List <string> dataLs, string fileName)
        {
            FileStream   fsw = new FileStream(obj.fileDir + $"\\{obj.fileName}_{fileName}.txt", FileMode.Create);
            StreamWriter sw  = new StreamWriter(fsw);

            foreach (var d in dataLs)
            {
                sw.WriteLine(d);
            }
            sw.Close();
            fsw.Close();
        }
Exemplo n.º 4
0
        private List <List <string> > getMotionRawData(filePathObj obj)
        {
            FileStream            fs   = new FileStream(obj.fullName, FileMode.Open);
            StreamReader          sr   = new StreamReader(fs);
            List <List <string> > qrLs = new List <List <string> >();
            string beg = "";
            string tmp = "";

            while (!sr.EndOfStream)
            {
                beg = sr.ReadLine();
                while (beg.Contains("开始上料"))
                {
                    List <string> ls = new List <string>();
                    ls.Add(beg.Substring(26, 10));
                    while (!sr.EndOfStream)
                    {
                        tmp = sr.ReadLine();

                        if (!tmp.Contains("开始上料"))
                        {
                            if (tmp.Contains("点灯压接") ||
                                tmp.Contains("二次点灯") ||
                                tmp.Contains("结束点灯"))
                            {
                                ;
                            }
                            else
                            {
                                ls.Add(tmp.Substring(26, 10));
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    beg = tmp;
                    tmp = "";
                    qrLs.Add(ls);
                }
            }
            sr.Close();
            fs.Close();
            return(qrLs);
        }
Exemplo n.º 5
0
        private List <string> getAlignRawData(filePathObj obj)
        {
            FileStream    fs   = new FileStream(obj.fullName, FileMode.Open);
            StreamReader  sr   = new StreamReader(fs);
            List <string> qrLs = new List <string>();
            string        beg  = "";

            while (!sr.EndOfStream)
            {
                beg = sr.ReadLine();
                if (beg.Contains("图像处理#"))
                {
                    string[] arr = beg.Split('#');
                    qrLs.Add(arr[1]);
                }
            }
            sr.Close();
            fs.Close();
            return(qrLs);
        }
Exemplo n.º 6
0
        public filePathObj SelectFileDialog()
        {
            string         str            = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog().Value)
            {
                str = openFileDialog.FileName;
            }

            filePathObj ret = new filePathObj();

            ret.fullName = str;
            string[] arr = str.Split('\\');
            if (arr.Length != 0)
            {
                string end = arr[arr.Length - 1];
                ret.fileDir  = str.TrimEnd(('\\' + end).ToCharArray());
                ret.fileName = arr[arr.Length - 1].TrimEnd(".log".ToCharArray());
            }
            return(ret);
        }
Exemplo n.º 7
0
        private void saveAsRawData(filePathObj obj, List <List <int> > dataLs, string fileName)
        {
            FileStream   fsw = new FileStream(obj.fileDir + $"\\{obj.fileName}_{fileName}.txt", FileMode.Create);
            StreamWriter sw  = new StreamWriter(fsw);

            int maxSize = dataLs[0].Count;
            List <List <string> > outLs = new List <List <string> >();

            for (int i = 0; i < maxSize; i++)
            {
                List <string> tmpLs = new List <string>();
                foreach (var ls in dataLs)
                {
                    if (ls.Count > i)
                    {
                        tmpLs.Add(ls[i].ToString() + " ");
                    }
                    else
                    {
                        tmpLs.Add("  ");
                    }
                }
                outLs.Add(tmpLs);
            }

            foreach (var ls in outLs)
            {
                string lin = "";
                foreach (string st in ls)
                {
                    lin += st;
                }
                sw.WriteLine(lin);
            }
            sw.Close();
            fsw.Close();
        }
Exemplo n.º 8
0
        public void analyseAlignData(filePathObj obj)
        {
            List <string> rawLs = getAlignRawData(obj);

            saveAsRawData(obj, rawLs, "焦点数据");
        }