由于对我的一些误解,我很难在最后几行中提取数据。我原本希望有10个钥匙,但我会得到所有钥匙...
我只想打包数据,并用Linq询问问题...拼出标准:“ Chad”担任SSR 4321的技术员要花几个小时?
List<Dictionary<string, string>> SSRList = new List<Dictionary<string, string>>();
Dictionary<string, string> SSR = new Dictionary<string, string>();
SSRList = Util.Cache(() =>
{
foreach (string line in File.ReadAllLines(@"I:\Mfg\Test Development Workstations\PI\Lee K\DougBLNData.txt"))
{
if (line.Contains("*")) //indicates new record/end of record
{
SSRList.Add(SSR);
SSR = new Dictionary<string, string>();
}
if (line.Length < 1) continue; //ignore Whitespaces
if (line.Contains(": "))
{
string[] lineSplit = line.Split(new string[] { ": " }, StringSplitOptions.None);
if (SSR.ContainsKey(lineSplit[0].Trim()))
{
lineSplit[0].Trim().Dump("Offending Key");
}
else
{
SSR.Add(lineSplit[0].Trim(), lineSplit[1].Trim());
}
}
}
SSRList.Add(SSR);
return SSRList;
});
SSRList.First().Dump();
SSRList.Take(10).Where(x => x.Keys.ToString() == "ServiceTechHrs").Dump("All ServiceTechHrs values selected");
以下是要解析的数据的示例:
Status: In Process
Prefix: 18-
PlantLoc: Lewiston
Date: 08/10/2018
Department: FT
Time: 08/10/2018 02:08:30 PM
StationID: 177
Fixture: initialization
Supervisor: Da Mi
PMOnly:
PartNo: 0735
SerialNum:
FailedStep: Validate/Validate firmware
Reason: Script
OtherReason:
Details: Initalization failure
Urgency: Script Problem
Date_1: 08/10/2018
Time_1: 08/10/2018 04:24:06 PM
Date_2:
Time_2:
ProblemFound:
SolutionCode:
Solution: 8/14/2018 TSR SSR 18-07121 was also entered. 8/14/2018 GAH. The 735 units with B1492-6 boards fail during Test Flash possibly due to a timing issue in the script. These particular board types have 1GB of flash and take longer for the flash test. I will need to contact TMESoftware to see if the WAIT time can be increased for the 735 units with B1492-6-XX boards. 8/14/2018 GAH. Details: https://jira.metro.ad.selinc.com/browse/MTEN-1814
ServiceTechHrs:
ServiceEngHrs:
DocHistory: Assignee #1 xxxxx xxxxx assigned by Alex xxxxx on 08/10/2018,Request submitted by xxxxx on 08/10/2018,Request created by xxxxx Olander on 08/10/2018
Mailed: 1
CloseDate:
HoldOn:
HoldOff:
Authors: *
ISAuthors: IS Notes Developers; LocalDomainAdmins; LocalDomainServers
MgrData:
SaveOptions: 1
IniDate: 08/10/2018
IniTime: 08/10/2018 02:08:30 PM
MOT:
RequestNum: 07011
Initiator: xxxxx xxxxx
Notification: LWS Flex Leaders
ServiceTech: xxxxx xxxxx
ServiceEng:
SolutionCode_1:
FixtureCheck: Stop
Solution_1: 8/14/2018 TSR SSR 18-07121 was also entered. 8/14/2018 GAH. The 735 units with B1492-6 boards fail during Test Flash possibly due to a timing issue in the script. These particular board types have 1GB of flash and take longer for the flash test. I will need to contact TMESofre to see if the WAIT time can be increased for the 735 units with B1492-6-XX boards. 8/14/2018 GAH. Details: https://jira.metro.ad.com/browse/MTEN-1814
$Revisions: 08/10/2018 02:17:28 PM,08/10/2018 02:17:29 PM,08/10/2018 04:24:06 PM,08/10/2018 04:24:07 PM,08/13/2018 08:34:47 AM,08/14/2018 02:59:06 PM,08/14/2018 03:02:59 PM
SupDoc: SSR 18-07121
理想情况下,我想将数据打包为SSR(上面的示例),并将它们保存在我可以选择的列表中。在哪里选择等等。