Closed Ferroreson closed 7 months ago
Bug isn't with OpenMCDF.
This should work. You can change a storage from its parent storage.
CompoundFile cf = new CompoundFile();
cf.RootStorage.AddStorage("AStorage")
.AddStream("AStream")
.SetData(Helpers.GetBuffer(100));
cf.SaveAs("Hello$File");
cf.Close();
CompoundFile cf1 = new CompoundFile("Hello$File", CFSUpdateMode.Update, CFSConfiguration.Default);
try
{
cf1.RootStorage.RenameItem("AStorage", "NewStorage");
cf1.Commit();
cf1.Close();
}
catch (Exception ex)
{
Assert.Fail(ex.Message);
}
Kind Regards, Federico
Thank you!!
On Tue, Feb 27, 2024, 3:30 PM Federico Blaseotto @.***> wrote:
This should work. You can change a storage from its parent storage.
CompoundFile cf = new CompoundFile(); cf.RootStorage.AddStorage("AStorage") .AddStream("AStream") .SetData(Helpers.GetBuffer(100));
cf.SaveAs("Hello$File"); cf.Close(); CompoundFile cf1 = new CompoundFile("Hello$File", CFSUpdateMode.Update, CFSConfiguration.Default);try{ cf1.RootStorage.RenameItem("AStorage", "NewStorage"); cf1.Commit(); cf1.Close();}catch (Exception ex){ Assert.Fail(ex.Message);}
Kind Regards, Federico
— Reply to this email directly, view it on GitHub https://github.com/ironfede/openmcdf/issues/116#issuecomment-1967770522, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGPIWSXROIJBCC4R74P2NXDYVZM7VAVCNFSM6AAAAABD27O2PGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRXG43TANJSGI . You are receiving this because you authored the thread.Message ID: @.***>
I'm attempting to rename a CFStorage within a CFStorage. The root CFStorage is called "Relays". Within Relays is one CFStorage that I'm attempting to rename.
I pass in the Compound File as an array of bytes to ReadFileBytes, then call the RenameSettingFileEntry, then call GetRDBFileData() and write the byte array to a file. The "RenameItem" function runs without error but doesn't rename the CFStorage. Thanks for your help!