public String[] gradeStatus = new String[3];// What passed, what failed, what was undetected


        //CONSTRUCTORS
        public CoinUtils(CloudCoinCore.CloudCoin cc)
        {
            //  initialise instance variables
            this.cc = cc;
            for (int i = 0; i < 25; i++)
            {
                pans[i] = this.generatePan();
            }                // end for each pan
            edHex    = "FF"; //Max allowed.
            hp       = 25;   //Max allowed
            fileName = this.getDenomination() + ".CloudCoin." + cc.nn + "." + cc.sn + ".";
            json     = "";
            jpeg     = null;
        }//end constructor
        }//constructor

        public string fixOneGuidCorner(int raida_ID, CloudCoin cc, int corner, int[] trustedTriad)
        {
            //RAIDA raida = RAIDA.GetInstance();
            CoinUtils cu = new CoinUtils(cc);
            ProgressChangedEventArgs pge = new ProgressChangedEventArgs();

            /*1. WILL THE BROKEN RAIDA FIX? check to see if it has problems echo, detect, or fix. */
            if (raida.nodes[raida_ID].FailsFix || raida.nodes[raida_ID].FailsEcho || raida.nodes[raida_ID].FailsEcho)
            {
                Console.Out.WriteLine("RAIDA Fails Echo or Fix. Try again when RAIDA online.");
                pge.MajorProgressMessage = ("RAIDA Fails Echo or Fix. Try again when RAIDA online.");
                raida.OnLogRecieved(pge);
                return "RAIDA Fails Echo or Fix. Try again when RAIDA online.";
            }
            else
            {
                /*2. ARE ALL TRUSTED RAIDA IN THE CORNER READY TO HELP?*/

                if (!raida.nodes[trustedTriad[0]].FailsEcho || !raida.nodes[trustedTriad[0]].FailsDetect || !raida.nodes[trustedTriad[1]].FailsEcho || !!raida.nodes[trustedTriad[1]].FailsDetect || !raida.nodes[trustedTriad[2]].FailsEcho || !raida.nodes[trustedTriad[2]].FailsDetect)
                {
                    /*3. GET TICKETS AND UPDATE RAIDA STATUS TICKETS*/
                    string[] ans = { cc.an[trustedTriad[0]], cc.an[trustedTriad[1]], cc.an[trustedTriad[2]] };
                    raida.GetTickets(trustedTriad, ans, cc.nn, cc.sn, cu.getDenomination(), 3000);

                    /*4. ARE ALL TICKETS GOOD?*/
                    if (raida.nodes[trustedTriad[0]].HasTicket && raida.nodes[trustedTriad[1]].HasTicket && raida.nodes[trustedTriad[2]].HasTicket)
                    {
                        /*5.T YES, so REQUEST FIX*/
                        //DetectionAgent da = new DetectionAgent(raida_ID, 5000);
                        if (!continueExecution)
                        {
                            Debug.WriteLine("Aborting Fix ");
                            return "Aborting for new operation";
                        }
                        Response fixResponse = RAIDA.GetInstance().nodes[raida_ID].Fix(trustedTriad, raida.nodes[trustedTriad[0]].Ticket, raida.nodes[trustedTriad[1]].Ticket, raida.nodes[trustedTriad[2]].Ticket, cc.an[raida_ID]).Result;
                        /*6. DID THE FIX WORK?*/
                        if (fixResponse.success)
                        {
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Out.WriteLine("");
                            Console.Out.WriteLine("RAIDA" + raida_ID + " unfracked successfully.");
                            pge.MajorProgressMessage = "RAIDA" + raida_ID + " unfracked successfully.";
                            raida.OnLogRecieved(pge);
                            //CoreLogger.Log("RAIDA" + raida_ID + " unfracked successfully.");
                            Console.Out.WriteLine("");
                            Console.ForegroundColor = ConsoleColor.White;
                            return "RAIDA" + raida_ID + " unfracked successfully.";

                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Out.WriteLine("");
                            Console.Out.WriteLine("RAIDA failed to accept tickets on corner " + corner);
                            pge.MajorProgressMessage = "RAIDA failed to accept tickets on corner " + corner;
                            raida.OnLogRecieved(pge);
                            //CoreLogger.Log("RAIDA failed to accept tickets on corner " + corner);
                            Console.Out.WriteLine("");
                            Console.ForegroundColor = ConsoleColor.White;
                            return "RAIDA failed to accept tickets on corner " + corner;
                        }//end if fix respons was success or fail
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Out.WriteLine("");
                        Console.Out.WriteLine("Trusted servers failed to provide tickets for corner " + corner);
                        pge.MajorProgressMessage = "Trusted servers failed to provide tickets for corner " + corner;
                        raida.OnLogRecieved(pge);
                        //CoreLogger.Log("Trusted servers failed to provide tickets for corner " + corner);
                        Console.Out.WriteLine("");
                        Console.ForegroundColor = ConsoleColor.White;

                        return "Trusted servers failed to provide tickets for corner " + corner;//no three good tickets
                    }//end if all good
                }//end if trused triad will echo and detect (Detect is used to get ticket)

                Console.ForegroundColor = ConsoleColor.Red;
                Console.Out.WriteLine("");
                Console.Out.WriteLine("One or more of the trusted triad will not echo and detect.So not trying.");
                pge.MajorProgressMessage = "One or more of the trusted triad will not echo and detect.So not trying.";
                raida.OnLogRecieved(pge);

                //CoreLogger.Log("One or more of the trusted triad will not echo and detect.So not trying.");
                Console.Out.WriteLine("");
                Console.ForegroundColor = ConsoleColor.White;
                return "One or more of the trusted triad will not echo and detect. So not trying.";
            }//end if RAIDA fails to fix. 

        }//end fix one
        }//end delete coin


        public CoinUtils fixCoin(CloudCoin brokeCoin)
        {
            CoinUtils cu = new CoinUtils(brokeCoin);
            ProgressChangedEventArgs pge = new ProgressChangedEventArgs();
            /*0. RESET TICKETS IN RAIDA STATUS TO EMPTY*/

            //RAIDA_Status.resetTickets();
            RAIDA.GetInstance().nodes.ToList().ForEach(x => x.ResetTicket());

            /*0. RESET THE DETECTION to TRUE if it is a new COIN */
            RAIDA.GetInstance().nodes.ToList().ForEach(x => x.NewCoin());

            //RAIDA_Status.newCoin();

            cu.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++)
            {
                if (!continueExecution)
                {
                    Debug.Write("Stopping Execution");
                    return cu;
                }
                //  Console.WriteLine("Past Status for " + raida_ID + ", " + brokeCoin.pastStatus[raida_ID]);

                if (cu.getPastStatus(raida_ID).ToLower() != "pass")//will try to fix everything that is not perfect pass.
                {

                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Out.WriteLine("");
                    Console.WriteLine("Attempting to fix RAIDA " + raida_ID);
                    pge.MajorProgressMessage = "Attempting to fix RAIDA " + raida_ID;
                    raida.OnLogRecieved(pge);
                    // CoreLogger.Log("Attempting to fix RAIDA " + raida_ID);
                    Console.Out.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.White;

                    fixer = new FixitHelper(raida_ID, brokeCoin.an.ToArray());

                    //trustedServerAns = new String[] { brokeCoin.ans[fixer.currentTriad[0]], brokeCoin.ans[fixer.currentTriad[1]], brokeCoin.ans[fixer.currentTriad[2]] };
                    corner = 1;
                    while (!fixer.finished)
                    {
                        if (!continueExecution)
                        {
                            Debug.Write("Stopping Execution");
                            return cu;
                        }
                        Console.WriteLine(" Using corner " + corner);
                        pge.MajorProgressMessage = " Using corner " + corner;
                        raida.OnLogRecieved(pge);
                        //   CoreLogger.Log(" 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
                            cu.setPastStatus("pass", raida_ID);
                            fixer.finished = 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

            for (int raida_ID = 24; raida_ID > 0; raida_ID--)
            {
                //  Console.WriteLine("Past Status for " + raida_ID + ", " + brokeCoin.pastStatus[raida_ID]);
                if (!continueExecution)
                {
                    return cu;
                }

                if (cu.getPastStatus(raida_ID).ToLower() != "pass")//will try to fix everything that is not perfect pass.
                {

                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Out.WriteLine("");
                    Console.WriteLine("Attempting to fix RAIDA " + raida_ID);
                    pge.MajorProgressMessage = "Attempting to fix RAIDA " + raida_ID;
                    raida.OnLogRecieved(pge);
                    //  CoreLogger.Log("Attempting to fix RAIDA " + raida_ID);
                    Console.Out.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.White;

                    fixer = new FixitHelper(raida_ID, brokeCoin.an.ToArray());

                    //trustedServerAns = new String[] { brokeCoin.ans[fixer.currentTriad[0]], brokeCoin.ans[fixer.currentTriad[1]], brokeCoin.ans[fixer.currentTriad[2]] };
                    corner = 1;
                    while (!fixer.finished)
                    {
                        Console.WriteLine(" Using corner " + corner);
                        pge.MajorProgressMessage = " Using corner " + corner;
                        raida.OnLogRecieved(pge);
                        //CoreLogger.Log(" 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
                            cu.setPastStatus("pass", raida_ID);
                            fixer.finished = 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("Time spent fixing RAIDA in milliseconds: " + ts.Milliseconds);
            pge.MajorProgressMessage = "Time spent fixing RAIDA in milliseconds: " + ts.Milliseconds;
            raida.OnLogRecieved(pge);
            //CoreLogger.Log("Time spent fixing RAIDA in milliseconds: " + ts.Milliseconds);

            cu.calculateHP();//how many fails did it get
                             //  cu.gradeCoin();// sets the grade and figures out what the file extension should be (bank, fracked, counterfeit, lost

            cu.grade();
            cu.calcExpirationDate();
            return cu;
        }// end fix coin
        public override bool WriteCoinToJpeg(CloudCoin cloudCoin, string TemplateFile, string OutputFile, string tag)
        {
            OutputFile = OutputFile.Replace("\\\\", "\\");
            bool fileSavedSuccessfully = true;

            /* BUILD THE CLOUDCOIN STRING */
            String cloudCoinStr = "01C34A46494600010101006000601D05"; //THUMBNAIL HEADER BYTES

            for (int i = 0; (i < 25); i++)
            {
                cloudCoinStr = cloudCoinStr + cloudCoin.an[i];
            } // end for each an

            //cloudCoinStr += "204f42455920474f4420262044454645415420545952414e545320";// Hex for " OBEY GOD & DEFEAT TYRANTS "
            //cloudCoinStr += "20466f756e6465727320372d352d3137";// Founders 7-5-17
            cloudCoinStr += "4c6976652046726565204f7220446965"; // Live Free or Die
            cloudCoinStr += "00000000000000000000000000";       //Set to unknown so program does not Withdraw user data
                                                                // for (int i =0; i < 25; i++) {
                                                                //     switch () { }//end switch pown char
                                                                // }//end for each pown
            cloudCoinStr += "00";                               // HC: Has comments. 00 = No
            cloudCoin.CalcExpirationDate();
            cloudCoinStr += cloudCoin.edHex;                    // 01;//Expiration date Sep 2016 (one month after zero month)
            cloudCoinStr += "01";                               //  cc.nn;//network number
            String hexSN     = cloudCoin.sn.ToString("X6");
            String fullHexSN = "";

            switch (hexSN.Length)
            {
            case 1: fullHexSN = ("00000" + hexSN); break;

            case 2: fullHexSN = ("0000" + hexSN); break;

            case 3: fullHexSN = ("000" + hexSN); break;

            case 4: fullHexSN = ("00" + hexSN); break;

            case 5: fullHexSN = ("0" + hexSN); break;

            case 6: fullHexSN = hexSN; break;
            }
            cloudCoinStr = (cloudCoinStr + fullHexSN);
            /* BYTES THAT WILL GO FROM 04 to 454 (Inclusive)*/
            byte[] ccArray = this.hexStringToByteArray(cloudCoinStr);


            /* READ JPEG TEMPLATE*/
            byte[] jpegBytes = null;
            switch (cloudCoin.getDenomination())
            {
            case 1: jpegBytes = readAllBytes(this.TemplateFolder + "jpeg1.jpg"); break;

            case 5: jpegBytes = readAllBytes(this.TemplateFolder + "jpeg5.jpg"); break;

            case 25: jpegBytes = readAllBytes(this.TemplateFolder + "jpeg25.jpg"); break;

            case 100: jpegBytes = readAllBytes(this.TemplateFolder + "jpeg100.jpg"); break;

            case 250: jpegBytes = readAllBytes(this.TemplateFolder + "jpeg250.jpg"); break;
            }// end switch


            /* WRITE THE SERIAL NUMBER ON THE JPEG */

            //Bitmap bitmapimage;
            SKBitmap bitmapimage;
            //using (var ms = new MemoryStream(jpegBytes))
            {
                //bitmapimage = new Bitmap(ms);
                bitmapimage = SKBitmap.Decode(jpegBytes);
            }
            SKCanvas canvas = new SKCanvas(bitmapimage);
            //Graphics graphics = Graphics.FromImage(bitmapimage);
            //graphics.SmoothingMode = SmoothingMode.AntiAlias;
            //graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            SKPaint textPaint = new SKPaint()
            {
                IsAntialias = true,
                Color       = SKColors.White,
                TextSize    = 14,
                Typeface    = SKTypeface.FromFamilyName("Arial")
            };

            //PointF drawPointAddress = new PointF(30.0F, 25.0F);

            canvas.DrawText(String.Format("{0:N0}", cloudCoin.sn) + " of 16,777,216 on Network: 1", 30, 40, textPaint);
            //graphics.DrawString(String.Format("{0:N0}", cc.sn) + " of 16,777,216 on Network: 1", new Font("Arial", 10), Brushes.White, drawPointAddress);

            //ImageConverter converter = new ImageConverter();
            //byte[] snBytes = (byte[])converter.ConvertTo(bitmapimage, typeof(byte[]));
            SKImage image = SKImage.FromBitmap(bitmapimage);
            SKData  data  = image.Encode(SKEncodedImageFormat.Jpeg, 100);

            byte[] snBytes = data.ToArray();

            List <byte> b1 = new List <byte>(snBytes);
            List <byte> b2 = new List <byte>(ccArray);

            b1.InsertRange(4, b2);

            if (tag == "random")
            {
                Random r    = new Random();
                int    rInt = r.Next(100000, 1000000); //for ints
                tag = rInt.ToString();
            }

            string fileName = WithdrawFolder + cloudCoin.FileName + tag + ".jpg";

            File.WriteAllBytes(fileName, b1.ToArray());
            Console.Out.WriteLine("Writing to " + fileName);
            CoreLogger.Log("Writing to " + fileName);
            return(fileSavedSuccessfully);
        }
 public DetectEventArgs(CloudCoin coin)
 {
     this.detectedCoin = coin;
 }
        }//end write json to file

        public bool writeJSONFile(int m1, int m5, int m25, int m100, int m250, String tag, int mode = 0, string backupDir = "")
        {
            bool jsonExported = true;
            int  totalSaved   = m1 + (m5 * 5) + (m25 * 25) + (m100 * 100) + (m250 * 250);
            // Track the total coins
            int coinCount = m1 + m5 + m25 + m100 + m250;

            String[] coinsToDelete    = new String[coinCount];
            String[] bankedFileNames  = new DirectoryInfo(this.fileSystem.BankFolder).GetFiles().Select(o => o.Name).ToArray();//Get all names in bank folder
            String[] frackedFileNames = new DirectoryInfo(this.fileSystem.FrackedFolder).GetFiles().Select(o => o.Name).ToArray();;
            String[] partialFileNames = new DirectoryInfo(this.fileSystem.PartialFolder).GetFiles().Select(o => o.Name).ToArray();
            // Add the two arrays together
            var list = new List <String>();

            list.AddRange(bankedFileNames);
            list.AddRange(frackedFileNames);
            list.AddRange(partialFileNames);

            // Program will spend fracked files like perfect files
            bankedFileNames = list.ToArray();


            // Check to see the denomination by looking at the file start
            int c = 0;
            // c= counter
            String json = "{" + Environment.NewLine;

            json = json + "\t\"cloudcoin\": " + Environment.NewLine;
            json = json + "\t[" + Environment.NewLine;
            String bankFileName;
            String frackedFileName;
            String partialFileName;
            string denomination;

            // Put all the JSON together and add header and footer
            for (int i = 0; (i < bankedFileNames.Length); i++)
            {
                denomination    = bankedFileNames[i].Split('.')[0];
                bankFileName    = this.fileSystem.BankFolder + bankedFileNames[i];    //File name in bank folder
                frackedFileName = this.fileSystem.FrackedFolder + bankedFileNames[i]; //File name in fracked folder
                partialFileName = this.fileSystem.PartialFolder + bankedFileNames[i];
                if (denomination == "1" && m1 > 0)
                {
                    if (c != 0)//This is the json seperator between each coin. It is not needed on the first coin
                    {
                        json += ",\n";
                    }

                    if (File.Exists(bankFileName)) // Is it a bank file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(bankFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = bankFileName;
                        c++;
                    }
                    else if (File.Exists(partialFileName)) // Is it a partial file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(partialFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = partialFileName;
                        c++;
                    }
                    else
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(frackedFileName);
                        coinNote.aoid    = null;
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = frackedFileName;
                        c++;
                    }

                    m1--;
                    // Get the clean JSON of the coin
                }// end if coin is a 1

                if (denomination == "5" && m5 > 0)
                {
                    if ((c != 0))
                    {
                        json += ",\n";
                    }

                    if (File.Exists(bankFileName))
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(bankFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = bankFileName;
                        c++;
                    }
                    else if (File.Exists(partialFileName)) // Is it a partial file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(partialFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = partialFileName;
                        c++;
                    }
                    else
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(frackedFileName);
                        coinNote.aoid    = null;
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = frackedFileName;
                        c++;
                    }

                    m5--;
                } // end if coin is a 5

                if (denomination == "25" && m25 > 0)
                {
                    if ((c != 0))
                    {
                        json += ",\n";
                    }

                    if (File.Exists(bankFileName))
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(bankFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = bankFileName;
                        c++;
                    }
                    else if (File.Exists(partialFileName)) // Is it a partial file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(partialFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = partialFileName;
                        c++;
                    }
                    else
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(frackedFileName);
                        coinNote.aoid    = null;
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = frackedFileName;
                        c++;
                    }

                    m25--;
                }// end if coin is a 25

                if (denomination == "100" && m100 > 0)
                {
                    if ((c != 0))
                    {
                        json += ",\n";
                    }

                    if (File.Exists(bankFileName))
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(bankFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = bankFileName;
                        c++;
                    }
                    else if (File.Exists(partialFileName)) // Is it a partial file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(partialFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = partialFileName;
                        c++;
                    }
                    else
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(frackedFileName);
                        coinNote.aoid    = null;
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = frackedFileName;
                        c++;
                    }

                    m100--;
                } // end if coin is a 100

                if (denomination == "250" && m250 > 0)
                {
                    if ((c != 0))
                    {
                        json += ",\n";
                    }

                    if (File.Exists(bankFileName))
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(bankFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = bankFileName;
                        c++;
                    }
                    else if (File.Exists(partialFileName)) // Is it a partial file
                    {
                        CloudCoin coinNote = fileSystem.loadOneCloudCoinFromJsonFile(partialFileName);
                        coinNote.aoid    = null;//Clear all owner data
                        json             = json + fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = partialFileName;
                        c++;
                    }
                    else
                    {
                        CloudCoin coinNote = this.fileSystem.loadOneCloudCoinFromJsonFile(frackedFileName);
                        coinNote.aoid    = null;
                        json             = json + this.fileSystem.setJSON(coinNote);
                        coinsToDelete[c] = frackedFileName;
                        c++;
                    }

                    m250--;
                }// end if coin is a 250

                if (m1 == 0 && m5 == 0 && m25 == 0 && m100 == 0 && m250 == 0)
                {
                    break;
                } // Break if all the coins have been called for.
                string status           = String.Format("exported %d of %d coin.", i, bankedFileNames.Length);
                int    percentCompleted = (i + 1) * 100 / bankedFileNames.Length;
            }// end for each coin needed

            /*WRITE JSON TO FILE*/
            json  = json + "\t] " + Environment.NewLine;
            json += "}";
            String filename = (this.fileSystem.ExportFolder + Path.DirectorySeparatorChar + totalSaved + ".EOS Stealth." + tag + ".stack");

            if (mode == 1)
            {
                filename = (backupDir + Path.DirectorySeparatorChar + totalSaved + ".EOS Stealth." + tag + ".stack");
            }
            if (File.Exists(filename))
            {
                // tack on a random number if a file already exists with the same tag
                Random rnd     = new Random();
                int    tagrand = rnd.Next(999);
                filename = (this.fileSystem.ExportFolder + Path.DirectorySeparatorChar + totalSaved + ".EOS Stealth." + tag + tagrand + ".stack");
            }//end if file exists

            File.WriteAllText(filename, json);
            Console.Out.WriteLine("Writing to : ");
            //CoreLogger.Log("Writing to : " + filename);
            Console.Out.WriteLine(filename);
            /*DELETE FILES THAT HAVE BEEN EXPORTED*/
            if (mode == 0)
            {
                for (int cc = 0; cc < coinsToDelete.Length; cc++)
                {
                    // Console.Out.WriteLine("Deleting " + coinsToDelete[cc]);
                    if (coinsToDelete[cc] != null)
                    {
                        File.Delete(coinsToDelete[cc]);
                    }
                }//end for all coins to delete
            }
            // end if write was good
            return(jsonExported);
        }//end write json to file
 public Stack(CloudCoin coin)
 {
     cc    = new CloudCoin[1];
     cc[0] = coin;
 }
Beispiel #8
0
 public abstract bool WriteCoinToJpeg(CloudCoin cloudCoin, string TemplateFile, string OutputFile, string tag);
 public override bool WriteCoinToQRCode(CloudCoin cloudCoin, string OutputFile, string tag)
 {
     throw new NotImplementedException();
 }