예제 #1
0
 private static string CheckGameDirValid()
 {
     // Check if LOL executable directory is found
     if (GameLocator.CheckLeagueExecutable())
     {
         return(RoflSettings.Default.LoLExecLocation);
     }
     else
     {
         if (!string.IsNullOrEmpty(RoflSettings.Default.StartFolder))
         {
             var execPath = GameLocator.FindLeagueExecutable(RoflSettings.Default.StartFolder);
             RoflSettings.Default.LoLExecLocation = execPath;
             RoflSettings.Default.Save();
             return(execPath);
         }
         else
         {
             if (GameLocator.FindLeagueInstallPath(out string path))
             {
                 RoflSettings.Default.StartFolder = path;
                 var execPath = GameLocator.FindLeagueExecutable(path);
                 RoflSettings.Default.LoLExecLocation = execPath;
                 RoflSettings.Default.Save();
                 return(execPath);
             }
             else
             {
                 MessageBox.Show("Could not find League of Legends, please open ROFLPlayer and set the path.\n\n" + path + ".", "Error playing replay", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(string.Empty);
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Attempt to find League exec and save as default
        /// </summary>
        public static string FindAndAddLeagueExec(string startPath = "")
        {
            // If start path is empty, use game locator to find one to use
            if (startPath == "")
            {
                if (GameLocator.FindLeagueInstallPath(out string foundPath))
                {
                    startPath = foundPath;
                }
                else
                {
                    return("FALSE: Could not find install path");
                }
            }

            try
            {
                var targetPath = GameLocator.FindLeagueExecutable(startPath);

                var fileInfo = FileVersionInfo.GetVersionInfo(targetPath);

                var newExec = new LeagueExecutable
                {
                    StartFolder  = startPath,
                    TargetPath   = targetPath,
                    IsDefault    = true,
                    AllowUpdates = true,
                    PatchVersion = fileInfo.FileVersion,
                    Name         = "Default",
                    ModifiedDate = File.GetLastWriteTime(targetPath)
                };

                SaveExecFile(newExec);
            }
            catch (Exception ex)
            {
                return("FALSE: Exception - " + ex.ToString());
            }

            return("Default");
        }
예제 #3
0
        public static string UpdateLeaguePath(string target)
        {
            // Get exec
            var exec = GetExec(target);

            // If the target path does not exist
            if (!File.Exists(exec.TargetPath))
            {
                // If target starting folder exists
                if (Directory.Exists(exec.StartFolder))
                {
                    try
                    {
                        // Find executable
                        exec.TargetPath = GameLocator.FindLeagueExecutable(exec.StartFolder);
                        var fileInfo = FileVersionInfo.GetVersionInfo(exec.TargetPath);

                        exec.PatchVersion = fileInfo.FileVersion;
                        exec.ModifiedDate = File.GetLastWriteTime(exec.TargetPath);

                        SaveExecFile(exec);

                        return("TRUE");
                    }
                    catch (Exception ex)
                    {
                        // Error trying to navigate and find league exec
                        return("FALSE: Exception - " + ex.ToString());
                    }
                }
                else
                {
                    // No information to continue
                    return("FALSE: Start folder does not exist");
                }
            }

            return("FALSE: League path already exists");
        }