当前位置: 首页>>代码示例>>C#>>正文


C# Display.WriteResult方法代码示例

本文整理汇总了C#中Display.WriteResult方法的典型用法代码示例。如果您正苦于以下问题:C# Display.WriteResult方法的具体用法?C# Display.WriteResult怎么用?C# Display.WriteResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Display的用法示例。


在下文中一共展示了Display.WriteResult方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var index = s.Scan(this.FieldPattern).Trim();

            display.WriteResult(engine.Max(col, index.Length == 0 ? "_id" : index));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:7,代码来源:Max.cs

示例2: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var doc = JsonSerializer.Deserialize(s.ToString()).AsDocument;

            display.WriteResult(engine.Update(col, doc));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:7,代码来源:Update.cs

示例3: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var newName = s.Scan(@"[\w-]+").ThrowIfEmpty("Invalid new collection name");

            display.WriteResult(engine.RenameCollection(col, newName));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:7,代码来源:Rename.cs

示例4: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var value = JsonSerializer.Deserialize(s.ToString());

            if (value.IsArray)
            {
                display.WriteResult(engine.Insert(col, value.AsArray.RawValue.Select(x => x.AsDocument)));
            }
            else
            {
                engine.Insert(col, new BsonDocument[] { value.AsDocument });

                display.WriteResult(value.AsDocument["_id"]);
            }
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:16,代码来源:Insert.cs

示例5: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var fs = new LiteStorage(engine);
            var id = this.ReadId(s);

            display.WriteResult(fs.Delete(id));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:7,代码来源:Delete.cs

示例6: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var fs = new LiteStorage(engine);

            if (s.HasTerminated)
            {
                var files = fs.FindAll().Select(x => x.AsDocument);

                display.WriteResult(new BsonArray(files));
            }
            else
            {
                var id = this.ReadId(s);

                var files = fs.Find(id).Select(x => x.AsDocument);

                display.WriteResult(new BsonArray(files));
            }
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:19,代码来源:Find.cs

示例7: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);

            display.WriteResult(new BsonArray(engine.GetIndexes(col).Select(x => new BsonDocument
            {
                { "slot", x.Slot },
                { "field", x.Field },
                { "unique", x.Unique }
            })));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:11,代码来源:Indexes.cs

示例8: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var filename = s.Scan(@".*");

            using (var sr = new StreamReader(filename, Encoding.UTF8))
            {
                var docs = JsonSerializer.DeserializeArray(sr);

                display.WriteResult(engine.Insert(col, docs.Select(x => x.AsDocument)));
            }
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:12,代码来源:Bulk.cs

示例9: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var fs = new LiteStorage(engine);
            var id = this.ReadId(s);

            var filename = s.Scan(@"\s*.*").Trim();

            if (!File.Exists(filename)) throw new IOException("File " + filename + " not found");

            var file = fs.Upload(id, filename);

            display.WriteResult(file.AsDocument);
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:13,代码来源:Upload.cs

示例10: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var fs = new LiteStorage(engine);
            var id = this.ReadId(s);
            var filename = s.Scan(@"\s*.*").Trim();

            var file = fs.FindById(id);

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

                display.WriteResult(file.AsDocument);
            }
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:15,代码来源:Download.cs

示例11: Execute

        public void Execute(LiteEngine db, StringScanner s, Display d)
        {
            d.WriteResult("Web Shell Commands - try offline version for more commands");
            d.WriteResult("==========================================================");

            d.WriteHelp("> db.<collection>.insert <jsonDoc>", "Insert a new document into collection");
            d.WriteHelp("> db.<collection>.update <jsonDoc>", "Update a document inside collection");
            d.WriteHelp("> db.<collection>.delete <filter>", "Delete documents using a filter clausule (see find)");
            d.WriteHelp("> db.<collection>.find [top N] <filter>", "Show filtered documents based on index search");
            d.WriteHelp("> db.<collection>.count <filter>", "Show count rows according query filter");
            d.WriteHelp("> db.<collection>.ensureIndex <field> [unique]", "Create a new index document field");
            d.WriteHelp("> db.<collection>.indexes", "List all indexes in this collection");
            d.WriteHelp("<filter> = <field> [=|>|>=|<|<=|!=|like|between] <jsonValue>", "Filter query syntax");
            d.WriteHelp("<filter> = (<filter> [and|or] <filter> [and|or] ...)", "Multi queries syntax");

            d.WriteResult("Try:");
            d.WriteResult(" > db.customers.insert { _id:1, name:\"John Doe\", age: 37 }");
            d.WriteResult(" > db.customers.ensureIndex name");
            d.WriteResult(" > db.customers.find name like \"John\"");
            d.WriteResult(" > db.customers.find top 10 (name like \"John\" and _id between [0, 100])");
        }
开发者ID:suxiaojack,项目名称:LiteDB-WebShell,代码行数:21,代码来源:Help.cs

示例12: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);
            var field = s.Scan(this.FieldPattern).Trim().ThrowIfEmpty("Invalid field name");
            var unique = false;

            s.Scan(@"\s*");

            if (s.HasTerminated == false)
            {
                var options = JsonSerializer.Deserialize(s.ToString());

                if (options.IsBoolean)
                {
                    unique = options.AsBoolean;
                }
                else if (options.IsDocument) // support old version index definitions
                {
                    unique = options.AsDocument["unique"].AsBoolean;
                }
            }

            display.WriteResult(engine.EnsureIndex(col, field, unique));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:24,代码来源:EnsureIndex.cs

示例13: Execute

        public void Execute(LiteEngine engine, StringScanner s, Display display, InputCommand input, Env env)
        {
            var col = this.ReadCollection(engine, s);

            display.WriteResult(engine.DropCollection(col));
        }
开发者ID:apkd,项目名称:LiteDB,代码行数:6,代码来源:Drop.cs


注:本文中的Display.WriteResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。