Beispiel #1
0
        }//end delete coin

        public CloudCoin fixCoin(CloudCoin brokeCoin)
        {
            /*0. RESET TICKETS IN RAIDA STATUS TO EMPTY*/
            RAIDA_Status.resetTickets();
            /*0. RESET THE DETECTION to TRUE if it is a new COIN */
            RAIDA_Status.newCoin();

            brokeCoin.setAnsToPans();// Make sure we set the RAIDA to the cc ans and not new pans.
            DateTime before = DateTime.Now;

            String      fix_result = "";
            FixitHelper fixer;

            /*START*/
            /*1. PICK THE CORNER TO USE TO TRY TO FIX */
            int corner = 1;

            // For every guid, check to see if it is fractured
            for (int raida_ID = 0; raida_ID < 25; raida_ID++)
            {
                //  Console.WriteLine("Past Status for " + raida_ID + ", " + brokeCoin.pastStatus[raida_ID]);

                if (brokeCoin.getPastStatus(raida_ID).ToLower() == "fail")
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Out.WriteLine("");
                    Console.WriteLine(StringHolder.frackfixer_11); //"Attempting to fix RAIDA " + raida_ID);
                    Console.Out.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.White;

                    fixer = new FixitHelper(raida_ID, brokeCoin.ans);

                    //trustedServerAns = new String[] { brokeCoin.ans[fixer.currentTriad[0]], brokeCoin.ans[fixer.currentTriad[1]], brokeCoin.ans[fixer.currentTriad[2]] };
                    corner = 1;
                    while (!fixer.finnished)
                    {
                        Console.WriteLine(StringHolder.frackfixer_12 + corner);  //" Using corner " + corner);
                        fix_result = fixOneGuidCorner(raida_ID, brokeCoin, corner, fixer.currentTriad);
                        // Console.WriteLine(" fix_result: " + fix_result + " for corner " + corner);
                        if (fix_result.Contains("success"))
                        {
                            //Fixed. Do the fixed stuff
                            brokeCoin.setPastStatus("pass", raida_ID);
                            fixer.finnished = true;
                            corner          = 1;
                        }
                        else
                        {
                            //Still broken, do the broken stuff.
                            corner++;
                            fixer.setCornerToCheck(corner);
                        }
                    } //End whild fixer not finnished
                }     //end if RAIDA past status is passed and does not need to be fixed
            }         //end for each AN
            DateTime after = DateTime.Now;
            TimeSpan ts    = after.Subtract(before);

            Console.WriteLine(StringHolder.frackfixer_13); //"Time spent fixing RAIDA in milliseconds: " + ts.Milliseconds);

            brokeCoin.calculateHP();                       //how many fails did it get
            brokeCoin.gradeCoin();
            // sets the grade and figures out what the file extension should be (bank, fracked, counterfeit, lost
            brokeCoin.calcExpirationDate();
            brokeCoin.grade();
            return(brokeCoin);
        } // end fix coin
Beispiel #2
0
        } // End print welcome

        public static bool echoRaida()
        {
            RAIDA_Status.resetEcho();
            RAIDA raida1 = new RAIDA(5000);

            Response[] results    = raida1.echoAll(5000);
            int        totalReady = 0;

            //For every RAIDA check its results
            int longestCountryName = 15;

            Console.Out.WriteLine();
            for (int i = 0; i < 25; i++)
            {
                int    padding = longestCountryName - countries[i].Length;
                string strPad  = "";
                for (int j = 0; j < padding; j++)
                {
                    strPad += " ";
                }//end for padding

                if (!RAIDA_Status.failsEcho[i])
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.Out.Write(countries[i] + strPad);
                    totalReady++;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Out.Write(countries[i] + strPad);
                }
                if (i == 4 || i == 9 || i == 14 || i == 19)
                {
                    Console.WriteLine();
                }
            }//end for
            Console.ForegroundColor = ConsoleColor.White;
            Console.Out.WriteLine("");
            Console.Out.WriteLine("");
            Console.Out.WriteLine(StringHolder.program_echo_1 + totalReady + " out of 25"); //"RAIDA Health: " + totalReady );
            Console.Out.WriteLine();
            //Check if enough are good
            if (totalReady < 16)//
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Out.Write("");
                Console.Out.Write(StringHolder.program_echo_3); // "Not enough RAIDA servers can be contacted to import new coins.");
                Console.Out.Write(StringHolder.program_echo_4); // "Is your device connected to the Internet?");
                Console.Out.Write(StringHolder.program_echo_5); // "Is a router blocking your connection?");
                Console.ForegroundColor = ConsoleColor.White;
                return(false);
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Out.WriteLine("");
                Console.Out.WriteLine(StringHolder.program_echo_6);// "The RAIDA is ready for counterfeit detection.");
                Console.ForegroundColor = ConsoleColor.White;
                return(true);
            } //end if enough RAIDA
        }     //End echo