Discussion in 'Off Topic' started by Blackmagic, Apr 10, 2017.
Dose anyone know how to unzip and overwrite existing files using C#?
From a plugin? I doubt you'd have access to do that via a plugin.
No i have been creating a rust server manager to install rust and oxide and start the server all with in a gui everything is working fine but i just can't unzip the Oxide-Rust.zip because every option i have tried wont overwrite existing files
Create temporary subfolder, unzip in subfolder, delete existing files, move files from subfolder, delete subfolder.
That was my initial idea but if i delete the RustDedicated_Data file server server won't run.
Only delete selected files.
Yer that is a option but i was trying to avoid deleting and copying over 40 odd files
You can also instead "blacklist" certain files.
Just delete the files one by one and ingore certain files.
To get all files:
Directory.GetFiles Method (System.IO)
Never thought of that that's probably a good way to do it
So i found a solution and i was able to unzip and move a type of file so i just had to replicate it several times
using (ZipArchive archive = ZipFile.OpenRead(oxidepath))
foreach (ZipArchiveEntry entry in archive.Entries)
if (entry.FullName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
entry.ExtractToFile(Path.Combine(installpath, entry.FullName), true);