Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }