Я получаю сообщение об ошибке:
Код: Выделить всё
System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'
Код: Выделить всё
while (line != null)
{
//Console.WriteLine("I am here");
if (line.Contains("TIMESTAMP"))
{
//Console.WriteLine("I am TS");
TSitems = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
TScount += 1;
}
else if (line.Contains("OUT:"))
{
//Console.WriteLine("I am CO");
LicenseCheckout checkoutInfo = new LicenseCheckout();
COitems = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
checkoutInfo.Date = DateTime.ParseExact(TSitems[3], "M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture);
checkoutInfo.TScount = TScount;
checkoutInfo.checkoutTimeString = COitems[0];
DateTime time = DateTime.ParseExact(COitems[0], "H:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
checkoutInfo.CheckoutTime = checkoutInfo.Date.Add(time.TimeOfDay);
//Console.WriteLine(checkoutInfo.CheckoutTime);
checkoutInfo.LicenseType = COitems[3].Trim('"');
checkoutInfo.PcName = COitems[4].Split('@')[1];
checkoutInfo.UserName = COitems[4].Split('@')[0].ToLower().Trim();
checkoutInfo.SiteCode = COitems[4].Split('@')[1].Substring(0, 3);
if (UserNameDict.ContainsKey(checkoutInfo.UserName))
{
checkoutInfo.FullUserName = UserNameDict[checkoutInfo.UserName];
}
else
[img]https:/ /i.sstatic.net/oTPiMbGA.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/791 ... -the-array