debug pin用

string path = @"d:	est";
                    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;
原文地址:https://www.cnblogs.com/dennysong/p/5384034.html