RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Small change for BinaryFileWriter

Lichtblitz

Sorceror
Small change for BinaryFileWriter

It would be great if BinaryFileWriter could be changed to take a BinaryWriter as an argument instead of a FileStream.

1. A FileStream can be wrapped in a BinaryWriter so this change is not too big.

2. Other streams (most importantly MemoryStreams) can be wrapped in a BinaryWriter, too. This would allow for alternative (partial) WorldSave/dupe methods without heaps and heaps of copy/paste.

3. It would be consistent compared to the BinaryFileReader which already takes a BinaryReader as an argument.

A good thing would also be to unseal BinaryFileReader and BinaryFileWriter (as in RunUO 1) to allow for personalized save methods.

I'm currently rewriting my new dupe command for RunUO2 which utilizes the Serialize/Deserialize methods to duplicate any item/mobile and the current architecture forces me to copy and paste most of the code from Serialization.cs instead of just extending those classes. Future projects like partial saves, diff saves etc. would also greatly benefit from these changes as people tend to feel uncomfortable with making core changes.
 
Top