コード例 #1
0
        // ReSharper disable once InconsistentNaming
        private static void listAction(IBaseWorker w, IBaseOpt cmd, IEnumerable <string> args)
        {
            var enumerable = args.ToList();
            var mdxFile    = enumerable.ElementAtOrDefault(0);
            var word       = enumerable.ElementAtOrDefault(1);

            if (string.IsNullOrWhiteSpace(mdxFile))
            {
                w.ShowHelpScreen(w, enumerable);
                // w.ErrorPrint("no valid mdx file specified.");
                return;
            }

            Console.WriteLine($"{mdxFile} / {word}");
            var mdx = new MDictLoader(mdxFile)
            {
                PreloadAll = true
            };

            if (!mdx.Process())
            {
                // w.ErrorPrint($"CANNOT load and process the mdx file: {mdxFile}.");
                return;
            }

            Console.WriteLine($"Header: \n\n{mdx.DictHeader}\n\nIndex: \n\n{mdx.DictIndex}\n\n");
        }
コード例 #2
0
        // ReSharper disable once InconsistentNaming
        private static void lookupAction(IBaseWorker w, IBaseOpt cmd, IEnumerable <string> args)
        {
            var enumerable = args.ToList();
            var mdxFile    = enumerable.ElementAtOrDefault(0);
            var word       = enumerable.ElementAtOrDefault(1);

            if (string.IsNullOrWhiteSpace(mdxFile))
            {
                w.ShowHelpScreen(w, enumerable);
                // w.ErrorPrint("no valid mdx file specified.");
                return;
            }

            var mdx = new MDictLoader(mdxFile);

            if (!mdx.Process())
            {
                // w.ErrorPrint($"CANNOT load and process the mdx file: {mdxFile}.");
                return;
            }

            Console.WriteLine($"<!--\n\nHeader: \n\n{mdx.DictHeader}\n\nIndex: \n\n{mdx.DictIndex}\n\n-->\n");

            if (!string.IsNullOrWhiteSpace(word))
            {
                // Console.WriteLine($"Lookup for word '{word}'...");
                // Console.WriteLine(word);
                var s = mdx.Query(word);
                Console.WriteLine(s);
            }
        }
コード例 #3
0
 public void Execute(IBaseWorker w, IBaseOpt cmd, IEnumerable <string> remainArgs)
 {
     // throw new System.NotImplementedException();
     Console.WriteLine(
         value:
         $"Hit: {cmd}, Remains: {remainArgs}. Count: {Cmdr.Instance.Store.GetAs<int>(key: "count")}");
     // for (var i = 0; i < Count; i++)
     // {
     //     // Prompt.GetPassword("Enter your password: ");
     // }
 }