예제 #1
0
        private async static Task ProcessInput(int input)
        {
            switch (input)
            {
            case 1:
                await EchoRaidas();

                break;

            case 2:
                showCoins();
                break;

            case 3:
                //await detect();
                FS.LoadFileSystem();
                await RAIDA.ProcessCoins(false);

                break;

            case 4:
                ExportCoins();
                //export();
                break;

            case 6:
                try
                {
                    Process.Start(FS.RootPath);
                }
                catch (Exception e)
                {
                    updateLog(e.Message);
                }
                ShowFolders();
                break;

            case 5:
                Fix();
                //fix(timeout);
                break;

            case 7:
                help();
                break;

            //case 8:
            //    Console.Write("Enter New Network Number - ");
            //    int nn = Convert.ToInt16(Console.ReadLine());
            //    await SwitchNetwork(nn);
            //    break;
            case 8:
                await SendCoinsTT();

                break;

            default:
                break;
            }
        }
예제 #2
0
        static async void DownloadCoin(string hash)
        {
            using (System.Net.Http.HttpClient cli = new System.Net.Http.HttpClient())
            {
                var httpResponse = await cli.GetAsync("https://escrow.cloudcoin.digital/cc.php?h=" + hash);

                var ccstack = await httpResponse.Content.ReadAsStringAsync();

                File.WriteAllText(FS.ImportFolder + Path.DirectorySeparatorChar + "CloudCoins.FromTrustedTrade.stack", ccstack);
                await RAIDA.ProcessCoins(false);

                DisplayMenu();
            }
        }
예제 #3
0
        public static void Main(params string[] args)
        {
            Setup();

            updateLog("Loading Network Directory");
            SetupRAIDA();
            FS.LoadFileSystem();
            RAIDA.logger = logger;
            fixer        = new Frack_Fixer(FS, Config.milliSecondsToTimeOut);

            Console.Clear();
            // Program.exe <-g|--greeting|-$ <greeting>> [name <fullname>]
            // [-?|-h|--help] [-u|--uppercase]
            #region CommandLineArguments
            CommandLineApplication commandLineApplication =
                new CommandLineApplication(throwOnUnexpectedArg: false);
            CommandArgument names = null;
            commandLineApplication.Command("name",
                                           (target) =>
                                           names = target.Argument(
                                               "fullname",
                                               "Enter the full name of the person to be greeted.",
                                               multipleValues: true));
            CommandOption greeting = commandLineApplication.Option(
                "-$|-g |--greeting <greeting>",
                "The greeting to display. The greeting supports"
                + " a format string where {fullname} will be "
                + "substituted with the full name.",
                CommandOptionType.NoValue);
            CommandOption uppercase = commandLineApplication.Option(
                "-u | --uppercase", "Display the greeting in uppercase.",
                CommandOptionType.NoValue);
            commandLineApplication.HelpOption("-? | -h | --help");

            CommandOption stats = commandLineApplication.Option(
                "-$|-s |--stats ",
                "Displays RAIDA statistics of all networks", CommandOptionType.NoValue);


            CommandOption echo = commandLineApplication.Option(
                "-$|-e |--echo ",
                "The greeting to display. The greeting supports"
                + " a format string where {fullname} will be "
                + "substituted with the full name.",
                CommandOptionType.NoValue);

            CommandOption total = commandLineApplication.Option(
                "-$|-b |--bank ",
                "Shows details of your coins in bank.",
                CommandOptionType.NoValue);

            CommandOption backup = commandLineApplication.Option(
                "-$|-ba |--backup ",
                "Backup your coins to specified folder.",
                CommandOptionType.SingleValue);


            CommandOption folders = commandLineApplication.Option(
                "-$|-f |--folders ",
                "The command to display CloudCoin Working Folder Structure",
                CommandOptionType.NoValue);

            CommandOption pown = commandLineApplication.Option(
                "-$|-p |--pown ",
                "The command to pown/detect/import your CloudCoins.",
                CommandOptionType.NoValue);

            CommandOption detection = commandLineApplication.Option(
                "-$|-d |--detect ",
                "The command to pown/detect/import your CloudCoins.",
                CommandOptionType.NoValue);

            CommandOption import = commandLineApplication.Option(
                "-$|-i |--import ",
                "The command to pown/detect/import your CloudCoins.",
                CommandOptionType.NoValue);

            #endregion

            if (args.Length < 1)
            {
                printWelcome();
                while (true)
                {
                    try
                    {
                        int input = DisplayMenu();
                        ProcessInput(input).Wait();
                        if (input == 9)
                        {
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                        break;
                    }
                }
            }
            else
            {
                commandLineApplication.OnExecute(async() =>
                {
                    if (echo.HasValue())
                    {
                        //ech();
                        await EchoRaidas();
                    }
                    if (folders.HasValue())
                    {
                        ShowFolders();
                    }

                    if (pown.HasValue() || detection.HasValue() || import.HasValue())
                    {
                        await RAIDA.ProcessCoins(false);
                    }
                    if (greeting.HasValue())
                    {
                        printWelcome();
                    }
                    if (stats.HasValue())
                    {
                        await EchoRaidas();
                    }
                    if (total.HasValue())
                    {
                        showCoins();
                    }
                    if (backup.HasValue())
                    {
                        Console.WriteLine(backup.Value());
                    }
                    return(0);
                });
                commandLineApplication.Execute(args);
            }
        }