Esempio n. 1
0
        public IList <PluralsightFileLink> ParseFileLinks(string logFileName)
        {
            var fileLinks    = new List <PluralsightFileLink>();
            var rawAllLines  = File.ReadAllLines(logFileName);
            var readAllLines = FixLines(rawAllLines);

            if (readAllLines.Count == 0)
            {
                Console.WriteLine("no record find!");
                Console.Read();
            }

            for (int i = 0; i < readAllLines.Count; i++)
            {
                var readAllLine = readAllLines[i];
                if (string.IsNullOrWhiteSpace(readAllLine))
                {
                    break;
                }
                if (readAllLine == PluralsightFileLink.EmptyLine)
                {
                    var fileLink = new PluralsightFileLink();
                    //Pluralsight/Java Fundamentals The Java Language/02 - Introduction and Setting up Your Environment/01 - Introduction.mp4
                    var nameLine = readAllLines[i + 1].Trim().FixEmpty();
                    fileLink.FixSaveFilePath = nameLine.Replace("/", "\\").FixEmpty();
                    fileLink.Link            = readAllLines[i + 2].Trim().FixEmpty();
                    fileLinks.Add(fileLink);
                }
            }
            return(fileLinks);
        }
Esempio n. 2
0
        public static XLTaskItem ConvertToXLTaskItem(PluralsightFileLink fileLink)
        {
            var xlTaskItem = new XLTaskItem();
            var fileName   = Path.GetFileName(fileLink.FixSaveFilePath);
            var folderName = Path.GetDirectoryName(fileLink.FixSaveFilePath);

            xlTaskItem.FileName = fileName;
            xlTaskItem.SaveTo   = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\" + folderName;
            xlTaskItem.Url      = fileLink.Link;
            return(xlTaskItem);
        }