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


C# Manifest.LogContents方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Console.WriteLine("RazorDB Utility\n");

            if (args.Length == 0) {
                Console.WriteLine("Commands:");
                Console.WriteLine("\tdump-journal  <basedir> <version>");
                Console.WriteLine("\tdump-table <basedir> <level> <version>");
                Console.WriteLine("\tdump-manifest <manifest file> ");
                Console.WriteLine("\tdump-manifest-all <basedir>");
                Console.WriteLine("\tsplit-manifest <basedir>");
                Console.WriteLine("\tcheck-each-table <basedir>");
                Console.WriteLine("\tcheck-database <basedir>");
                Console.WriteLine("\tremove-orphans <basedir>");
                Console.WriteLine("\tremove-page <basedir> <level> <version>");
            } else {
                switch (args[0].ToLower()) {
                    case "dump-journal":
                        if (args.Length < 3) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            DumpJournal(args[1], int.Parse(args[2]));
                        }
                        break;
                    case "dump-table":
                        if (args.Length < 4) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            DumpFile(args[1], int.Parse(args[2]), int.Parse(args[3]));
                        }
                        break;
                    case "dump-manifest":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            var mf = new Manifest(args[1]);
                            mf.Logger = msg => Console.WriteLine(msg);
                            mf.LogContents();
                        }
                        break;
                    case "dump-manifest-all":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            var dummyMf = Manifest.NewDummyManifest();
                            dummyMf.Logger = msg => Console.WriteLine(msg);
                            foreach (var mf in Manifest.ReadAllManifests(args[1])) {
                                mf.LogContents(dummyMf);
                            }
                        }
                        break;
                    case "split-manifest":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            var dummyMf = Manifest.NewDummyManifest();
                            dummyMf.Logger = msg => Console.WriteLine(msg);
                            int ct = 0;
                            foreach (var mf in Manifest.ReadAllManifests(args[1])) {
                                using (var bw = new BinaryWriter(new FileStream(Path.Combine(args[1], "S" + ct.ToString() + ".mf"), FileMode.CreateNew, FileAccess.Write, FileShare.None, 40096))) {
                                    mf.WriteManifestContents(bw);
                                }
                                ct++;
                            }
                        }
                        break;
                    case "check-each-table":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            CheckBlockTableFiles(args[1]);
                        }
                        break;
                    case "check-database":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            CheckDatabase(args[1]);
                        }
                        break;
                    case "remove-orphans":
                        if (args.Length < 2) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            RemoveOrphanedTables(args[1]);
                        }
                        break;
                    case "remove-page":
                        if (args.Length < 4) {
                            Console.WriteLine("Invalid parameters");
                        } else {
                            var pageRef = new PageRef { Level = int.Parse(args[2]), Version = int.Parse(args[3]) };
                            var mf = new Manifest(args[1]);
                            mf.ModifyPages(new List<PageRecord>(), new List<PageRef> { { pageRef } });
                        }
                        break;
                    default:
                        Console.WriteLine("Unknown command: {0}", args[0]);
                        break;
                }
//.........这里部分代码省略.........
开发者ID:gnoso,项目名称:razordb,代码行数:101,代码来源:Program.cs


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