public void Parse() { Log.Debug("SourceFolder: '{0}'", SourceFolder); Log.Debug("args: '{0}'", this.FormatArgs(args)); Log.Debug("rescanFolder: '{0}'", rescanFolder); directoryInfo = new DirectoryInfo(SourceFolder); System.IO.FileInfo[] sfvFiles = directoryInfo.GetFiles("*.sfv"); if (sfvFiles.Length >= 1) { string sfvFile = sfvFiles [0].FullName; dataParserSfv = new DataParserSfv(sfvFile); dataParserSfv.Parse(); } }
public void SfvData() { Race race = new Race (ArgsSfv); race.ParseUpload (); DataParserSfv sfvParser = new DataParserSfv (race); sfvParser.Parse (); sfvParser.Process (); Assert.AreEqual (4, race.TotalFilesExpected, "TotalFilesExpected"); Dictionary<string, string> sfvData = sfvParser.SfvData; Assert.IsNotNull (sfvData, "sfvData"); Dictionary<string, string> expectedSfvData = new Dictionary<string, string> { {"infected.part1.rar", "2e04944c"}, {"infected.part2.rar", "1c7c24a5"}, {"infected.part3.rar", "d5d617e3"}, {"infected.part4.rar", "0edb20ea"} }; Assert.AreEqual (expectedSfvData, sfvData); }
/// <summary> /// Starts with the file check. /// </summary> public void Process() { if (SkipCheck()) { return; } RefuseFileExtension(); if (!IsValid) { Log.Debug("Not Valid!"); return; } IDataParser dataParser; if (CurrentRaceData.RaceType == RaceType.Nfo) { dataParser = new DataParserNfo(this); dataParser.Parse(); dataParser.Process(); return; } if (CurrentRaceData.RaceType == RaceType.Zip) { dataParser = new DataParserZip(this); dataParser.Parse(); dataParser.Process(); return; } if (CurrentRaceData.RaceType == RaceType.Diz) { IsValid = false; Log.Debug("DIZ not allowed!"); return; } if (CurrentRaceData.RaceType == RaceType.Sfv) { dataParser = new DataParserSfv(this); dataParser.Parse(); dataParser.Process(); return; } if (!SfvCheck()) { return; } dataParser = new DataParser(this); dataParser.Parse(); dataParser.Process(); }