Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to save current configuration to a file.
        /// </summary>
        private BvException TrySave(ConfigData cfg)
        {
            string      xmlOut    = null;
            BvException exception = TrySerializeToXml(cfg, out xmlOut);

            if (exception == null && xmlOut != null)
            {
                exception = cfgFile.TryWrite(xmlOut);
            }

            return(exception);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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);
            }
        }