/// <summary>
        /// Reads file from storage
        /// </summary>
        /// <param name="idOrName">Name or Id</param>
        /// <returns>Null if not found otherwise filled <see cref="TFile"/></returns>
        public TFile Get(String idOrName)
        {
            LiteFileInfo fileInfo = _fileStorage.FindById(idOrName);

            if (fileInfo == null)
            {
                return(null);
            }

            return(fileInfo.ToStorageFile <TFile>());
        }
Пример #2
0
        public BsonValue Execute(DbEngine engine, StringScanner s)
        {
            var fs       = new LiteFileStorage(engine);
            var id       = ReadId(s);
            var filename = s.Scan(@"\s*.*").Trim();

            var file = fs.FindById(id);

            if (file != null)
            {
                file.SaveAs(filename, true);

                return(file.AsDocument);
            }
            return(false);
        }
Пример #3
0
        public BsonValue Execute(DbEngine engine, StringScanner s)
        {
            var fs = new LiteFileStorage(engine);
            var id = this.ReadId(s);
            var filename = s.Scan(@"\s*.*").Trim();

            var file = fs.FindById(id);

            if (file != null)
            {
                file.SaveAs(filename, true);

                return file.AsDocument;
            }
            else
            {
                return false;
            }
        }