/// <summary> /// Creates a local duplicate of a file with a given name. /// </summary> public BvException TryDuplicate(string newName) { string data; BvException exception = TryRead(out data); LocalFileIO newFile; if (exception == null && data != null) { newFile = new LocalFileIO(newName); exception = newFile.TryWrite(data); } return(exception); }
private void ExportBlockData() { BlockData blockData = default(BlockData); blockData.propertyList = new List <PropertyData>(); QuickActionHudSpace.Target?.ExportSettings(ref blockData); LocalFileIO blockIO = new LocalFileIO($"{QuickActionHudSpace.Target?.TypeID}.bin"); byte[] byteData; if (Utils.ProtoBuf.TrySerialize(blockData, out byteData) == null) { blockIO.TryWrite(byteData); } }
private void TryImportBlockData() { LocalFileIO blockIO = new LocalFileIO($"{QuickActionHudSpace.Target?.TypeID}.bin"); byte[] byteData; if (blockIO.FileExists && blockIO.TryRead(out byteData) == null) { BlockData data; if (Utils.ProtoBuf.TryDeserialize(byteData, out data) == null) { QuickActionHudSpace.Target.ImportSettings(data); } } }
private ConfigIO(string configFileName) { cfgFile = new LocalFileIO(configFileName); taskPool = new TaskPool(1, ErrorCallback); SaveInProgress = false; }
private LogIO(string fileName) { Accessible = true; logFile = new LocalFileIO(fileName); taskPool = new TaskPool(1, ErrorCallback); }