RocksmithToolkitLib.PsarcLoader.PSARC.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

Same methods

PSARC::Dispose ( bool disposing ) : void

Usage Example

        public static bool RemoveArchiveEntry(string psarcPath, string entryName)
        {
            if (!File.Exists(psarcPath))
            {
                return(false);
            }

            using (PSARC archive = new PSARC(true))
                using (var psarcStream = File.OpenRead(psarcPath))
                {
                    archive.Read(psarcStream);
                    psarcStream.Dispose(); // CRITICAL

                    var tocEntry = archive.TOC.FirstOrDefault(entry => entry.Name == entryName);

                    if (tocEntry == null)
                    {
                        archive.Dispose(); // CRITICAL
                        return(true);
                    }

                    archive.TOC.Remove(tocEntry);
                    archive.TOC.Insert(0, new Entry()
                    {
                        Name = "NamesBlock.bin"
                    });

                    using (var fs = File.Create(psarcPath))
                        archive.Write(fs, true);

                    archive.Dispose(); // CRITICAL
                    return(true);
                }
        }
All Usage Examples Of RocksmithToolkitLib.PsarcLoader.PSARC::Dispose