Exemple #1
0
        //[TestCase(@"C:\code\csharp6\Tagging-Util\storage\delicious-2016-03-16.json"
        //        , @"C:\code\csharp6\Tagging-Util\storage\gitmarks-apr20-2016.json"
        //        , @"C:\code\csharp6\Tagging-Util\storage\bookmarks-merge.json")]
        //[TestCase(@"C:\code\csharp6\Tagging-Util\storage\backup-nov21.txt"
        //        , @"C:\code\csharp6\Tagging-Util\storage\gitmarks-nov21-2016.json"
        //        , @"C:\code\csharp6\Tagging-Util\storage\bookmarks-merge.json")]
        //[TestCase(@"C:\code\csharp6\Tagging-Util\storage\bookmarks-merge-nov21-2016.json"
        //        , @"C:\code\csharp6\Tagging-Util\storage\pinterest-nov21-2016.json"
        //        , @"C:\code\csharp6\Tagging-Util\storage\bookmarks-merge.json")]
        public void TestMergeBookmarks(string file1, string file2, string outputPath)
        {
            var bookmarks = MergeBookmarks.Merge(file1, file2);
            var content   = JsonConvert.SerializeObject(bookmarks);

            using (var writer = new StreamWriter(outputPath))
            {
                writer.Write(content);
            }
        }
        public void TestMergeBookmarks(string file1, string file2, string outputPath)
        {
            var bookmarks = MergeBookmarks.Merge(file1, file2);

            string content = Bookmarks2Json.ExportToMongoFormat(bookmarks);

            using (var writer = new StreamWriter(outputPath))
            {
                writer.Write(content);
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.Write(@"Usage: 
parse -p [parser_type] -i input -o output_file 
merge --file1 [file1] --file2 [file2]");

                Console.ReadKey();
                return;
            }

            string invokedVerb         = null;
            object invokedVerbInstance = null;

            var options = new Options();

            if (!Parser.Default.ParseArguments(args, options, (verb, subOptions) =>
            {
                invokedVerb = verb;
                invokedVerbInstance = subOptions;
            }))
            {
                Environment.Exit(Parser.DefaultExitCodeFail);
            }

            if (invokedVerb == "parse")
            {
                var parseOptions = (ParseOptions)invokedVerbInstance;
                ParseBookmarks(parseOptions.ParserType, parseOptions.InputFile, parseOptions.OutputFile);
            }

            if (invokedVerb == "merge")
            {
                var mergeOptions = (MergeOptions)invokedVerbInstance;
                MergeBookmarks.Merge(mergeOptions.File1, mergeOptions.File2);
            }
        }