Пример #1
0
        public OperationResult PlayGameMusic(string gameTitle)
        {
            var musicPlayer = GetPlayerPath();
            var result = new OperationResult();
            if (string.IsNullOrEmpty(gameTitle))
            {
                result.Success = false;
                result.Information = "No music file found";
                return result;
            }

            if (!string.IsNullOrEmpty(musicPlayer.PlayerPath) && File.Exists(musicPlayer.PlayerPath))
            {
                try
                {
                    Process.Start(musicPlayer.PlayerPath,
                        "\"" + Path.Combine(musicPlayer.PlayerPath, gameTitle) + "\"");
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Information = ex.InnerException.ToString();
                }
            }
            else
            {
                result.Success = false; 
                result.Information = 
                    "Sorry, but you have no music player set-up in Preferences!\nWithout one, it's not possible to play the game's music...";
            }
            return result;
        }
Пример #2
0
 /// <summary>
 ///     Delete the game's specified Screenshot
 /// </summary>
 /// <param name="filename">The Filename to delete</param>
 public OperationResult Delete(string filename)
 {
     var result = new OperationResult();
     try
     {
         File.Delete(filename);
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Information = ex.InnerException.ToString();
         return result;
     }
     result.Success = true;
     return result;
 }