Example #1
0
        private static void ExtractStrings(String dbFilePath)
        {
            using (var parser = new SqliteFileParser(dbFilePath))
            {
                parser.FieldRead += (s, e) =>
                {
                    if (FieldType.String == e.Type)
                    {
                        var text = e.Value as String;
                        if (!String.IsNullOrEmpty(text))
                        {
                            Console.WriteLine(text);
                        }
                    }
                };

                parser.ParseAllPages();
            }
        }
Example #2
0
        protected override Int32 Execute()
        {
            var command    = "";
            var dbFilePath = "";

            if (1 == this._commandLineParser.FileNames.Length)
            {
                command    = "all";
                dbFilePath = this._commandLineParser.FileNames[0];
            }
            else if (2 == this._commandLineParser.FileNames.Length)
            {
                command    = this._commandLineParser.FileNames[0];
                dbFilePath = this._commandLineParser.FileNames[1];
            }
            else
            {
                this.Help();
            }

            using (var parser = new SqliteFileParser(dbFilePath))
            {
                switch (command)
                {
                case "all":
                    this.DumpFileInfo(dbFilePath);
                    PrintLine();
                    this.DumpFileHeader(parser);
                    PrintLine();
                    this.DumpFilePages(parser);
                    break;

                case "h":
                case "header":
                    this.DumpFileHeader(parser);
                    break;

                case "p":
                case "pages":
                    this.DumpFilePages(parser);
                    break;

                case "m":
                case "master":
                    this.DumpTables(parser);
                    return(0);

                case "t":
                case "table":
                    if (this._commandLineParser.OptionHasValue("name"))
                    {
                        this.DumpTable(parser, this._commandLineParser.GetOptionString("name"));
                    }
                    else
                    {
                        this.Help();
                    }
                    return(0);

                default:
                    this.Help();
                    return(0);
                }

                parser.ParseAllPages();
            }

            return(0);

            void PrintLine() => Console.WriteLine("------------------------------------------------------------------------------");
        }