public void Test_NotConnected() { QuickFinder uf = new QuickFinder(3); uf.Union(0, 1); Assert.False(uf.IsConnected(0, 2)); }
public void Test_Find() { QuickFinder uf = new QuickFinder(3); uf.Union(0, 1); uf.Union(0, 2); Assert.Equal(2, uf.Find(1)); }
public void Test_IsConnected() { QuickFinder uf = new QuickFinder(3); uf.Union(0, 1); uf.Union(0, 2); Assert.True(uf.IsConnected(0, 1)); }
public void Test_Count() { QuickFinder uf = new QuickFinder(5); //Component 1 uf.Union(0, 1); uf.Union(0, 2); //COmponent 2 uf.Union(3, 4); Assert.Equal(2, uf.Count); }
static void Main(string[] args) { var quickFinder = new QuickFinder(10); quickFinder.Union(1, 3); /*0 3 2 3 4 5 6 7 8 9 */ quickFinder.Union(3, 8); /*0 8 2 8 4 5 6 7 8 9 */ quickFinder.Union(7, 4); /*0 8 2 8 4 5 6 4 8 9 */ quickFinder.Union(5, 8); /*0 8 2 8 4 8 6 4 8 9 */ Console.WriteLine(quickFinder.Find(1, 5)); quickFinder.Print(); }
public void Test_quickFinder() { List <string> targetPaths = new List <string>(); targetPaths.Add("alba\\pcbagent\\games\\cave"); targetPaths.Add("alba\\pcbagent\\games\\SW"); QuickFinder finder = new QuickFinder("SoulWorker.exe", targetPaths); string foundFile = finder.findInAllDrive(); Console.WriteLine("found file path:{0}", foundFile); QuickFinder finder2 = new QuickFinder("gamemanifest_11.upf", targetPaths); string foundFile2 = finder2.findInAllDrive(); Console.WriteLine("found file path:{0}", foundFile2); }
public PcbGame executeGameCommand(GameCommand gameCmd) { Console.WriteLine("[executeGameCommand] gameCmd:" + gameCmd.ToString()); //find exefile from expectedPaths List <string> targetPaths = new List <string>(); foreach (InstallPath aPath in gameCmd.expectedPaths) { if (aPath.type.Equals("exe")) { targetPaths.Add(aPath.path); } } QuickFinder finder = new QuickFinder(gameCmd.exeFile, targetPaths); string foundFile = finder.findInAllDrive(); if (foundFile == null) { return(null); } //check verify type if (gameCmd.verifyType.Equals("INSTALL")) { return(new PcbGame(gameCmd.gsn, foundFile, "N/A", VersionChecker.checkLastWriteTime(foundFile))); } else { //find verfile from expectedPaths List <string> verTargetPaths = new List <string>(); foreach (InstallPath aPath in gameCmd.expectedPaths) { if (aPath.type.Equals("ver")) { verTargetPaths.Add(aPath.path); } } //verfile을 위한 path가 없다면 exefile의 path에서 찾는다. if (verTargetPaths.Count == 0) { //foundFile에서 exefile명을 제외한 path verTargetPaths.Add(foundFile.Substring(0, foundFile.Length - gameCmd.exeFile.Length)); } QuickFinder verFinder = new QuickFinder(gameCmd.verFile, verTargetPaths); // string foundVerFile = verFinder.findRInAllDrive(); string foundVerFile = verFinder.findInAllDrive(); if (foundVerFile == null) { return(null); } //check version file Console.WriteLine("[executeGameCommand] foundVerFile:{0}", foundVerFile); if (gameCmd.verFileFmt.Equals("XML")) { return(new PcbGame(gameCmd.gsn, foundFile, VersionChecker.checkXmlFile(foundVerFile), VersionChecker.checkLastWriteTime(foundFile))); } else if (gameCmd.verFileFmt.Equals("JSON")) { return(new PcbGame(gameCmd.gsn, foundFile, VersionChecker.checkJsonFile(foundVerFile), VersionChecker.checkLastWriteTime(foundFile))); } else if (gameCmd.verFileFmt.Equals("BIN")) { return(new PcbGame(gameCmd.gsn, foundFile, VersionChecker.checkLastWriteTime(foundVerFile), VersionChecker.checkLastWriteTime(foundFile))); } else if (gameCmd.verFileFmt.Equals("EPIC")) { return(new PcbGame(gameCmd.gsn, foundFile, VersionChecker.checkEpicFile(foundVerFile, gameCmd.verKey), VersionChecker.checkLastWriteTime(foundFile))); } else { //no process Console.WriteLine("[executeGameCommand] not supprot version format:{0}", gameCmd.verFileFmt); } } return(null); }