debug pin用

string path = @"d:\test";
                    var files =System.IO.Directory.GetFiles(path, "*.txt");
                    foreach (var file in files)
                    {
                        StreamReader reader = new StreamReader(file);

                        string headText = reader.ReadLine();//读取第一行
                        string bodyText = reader.ReadToEnd();
                        string time = headText.Split(new[] {':'})[0];
                        string type = headText.Split(new[] {':'})[1];
                        switch (type)
                        {
                            case "Ds":
                                target.GpType=GpType.Ds;
                                break;
                            case "Dj":
                                target.GpType = GpType.Dj;
                                break;
                            case "Zd":
                                target.GpType = GpType.Zd;
                                break;
                            case "Zp":
                                target.GpType = GpType.Zp;
                                break;
                            case "Xb":
                                target.GpType = GpType.Xb;
                                break;

                        }
                        items = Provider.Analysis(bodyText, target.GpType);
                        StringBuilder content=new StringBuilder();
                        foreach (HgFootballItem item in items)
                        {
                            string text = string.Format("{0}||{1}-{2}-让:{3}-{4}-{5}大:{6}-{7}-{8}赢:{9}-{10}", time, item.gid, item.gnum_h,item.Plate.ratio, item.Plate.ior_RH, item.Plate.ior_RC, item.Plate.ratio_o,item.Plate.ior_OUH, item.Plate.ior_OUC, item.Plate.ior_MH, item.Plate.ior_MC);
                            content.AppendLine(text);
                        }

                        FileInfo file2 = new FileInfo("D:\\PinLog\\" + time + type + ".txt");

                        if (!file2.Directory.Exists)
                            file2.Directory.Create();
                        FileStream stream = file2.Create();
                        StreamWriter writer = new StreamWriter(stream);
                        writer.Write(content);
                        writer.Close();
                        stream.Close();
                    }


                    break;

 

posted @ 2016-04-12 19:49  楊柳  阅读(230)  评论(0编辑  收藏  举报