コード例 #1
0
ファイル: LocalFileIO.cs プロジェクト: KiwiBear/BuildVision2
        /// <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);
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 private ConfigIO(string configFileName)
 {
     cfgFile        = new LocalFileIO(configFileName);
     taskPool       = new TaskPool(1, ErrorCallback);
     SaveInProgress = false;
 }
コード例 #5
0
 private LogIO(string fileName)
 {
     Accessible = true;
     logFile    = new LocalFileIO(fileName);
     taskPool   = new TaskPool(1, ErrorCallback);
 }