コード例 #1
0
 public UpdateCollectionItem(SwitchTitle title, bool isFavorite) : base(title, isFavorite)
 {
     if (Title is SwitchUpdate)
     {
         update = Title as SwitchUpdate;
     }
 }
コード例 #2
0
ファイル: Hactool.cs プロジェクト: gnetoak70/SwitchManager
        public static async Task <bool> VerifyNCA(string ncaPath, SwitchTitle title)
        {
            string hactoolExe = (hactoolPath);
            string keysFile   = (keysPath);
            string tkey       = title.TitleKey;

            // NOTE: Using single quotes here instead of single quotes f***s up windows, it CANNOT handle single quotes
            // Anything surrounded in single quotes will throw an error because the file/folder isn't found
            // Must use escaped double quotes!
            string commandLine = $" -k \"{keysFile}\"" +
                                 $" --titlekey=\"{tkey}\"" +
                                 $" \"{ncaPath}\"";

            try
            {
                return(await Task.Run(delegate
                {
                    ProcessStartInfo hactoolSI = new ProcessStartInfo()
                    {
                        FileName = hactoolExe,
                        WorkingDirectory = System.IO.Directory.GetCurrentDirectory(),
                        Arguments = commandLine,
                        UseShellExecute = false,
                        //RedirectStandardOutput = true,
                        RedirectStandardError = true,
                        CreateNoWindow = true,
                    };
                    Process hactool = Process.Start(hactoolSI);

                    string errors = hactool.StandardError.ReadToEnd();
                    hactool.WaitForExit();

                    if (errors.Contains("Error: section 0 is corrupted!") ||
                        errors.Contains("Error: section 1 is corrupted!"))
                    {
                        logger.Error("NCA title key verification failed");
                        return false;
                    }
                    logger.Info("NCA title key verification successful");
                    return true;
                }));
            }
            catch (Exception e)
            {
                throw new HactoolFailedException("Hactool decryption failed!", e);
            }
        }
コード例 #3
0
 public SwitchCollectionItem(SwitchTitle title, SwitchCollectionState state) : this(title, state, false)
 {
 }
コード例 #4
0
 public SwitchCollectionItem(SwitchTitle title, bool isFavorite) : this(title, SwitchCollectionState.NotOwned, isFavorite)
 {
 }
コード例 #5
0
 public SwitchCollectionItem(SwitchTitle title) : this(title, SwitchCollectionState.NotOwned, false)
 {
 }
コード例 #6
0
 public SwitchCollectionItem(SwitchTitle title, SwitchCollectionState state, bool isFavorite)
 {
     this.title = title;
     State      = state;
     IsFavorite = isFavorite;
 }
コード例 #7
0
 public UpdateCollectionItem(SwitchTitle title, SwitchCollectionState state) : base(title, state)
 {
 }