Exemplo n.º 1
0
        private CloudCoin DepositJPEG(String fileName)//Move one jpeg to suspect folder.
        {
            // bool isSuccessful = false;
            // Console.Out.WriteLine("Trying to load: " + this.fileUtils.DepositFolder + fileName );
            Debug.WriteLine("Trying to load: " + DepositFolder + fileName);
            try
            {
                //  Console.Out.WriteLine("Loading coin: " + fileUtils.DepositFolder + fileName);
                //CloudCoin tempCoin = this.fileUtils.loadOneCloudCoinFromJPEGFile( fileUtils.DepositFolder + fileName );

                /*Begin Deposit from jpeg*/

                /* GET the first 455 bytes of he jpeg where the coin is located */
                String wholeString = "";
                byte[] jpegHeader  = new byte[455];
                // Console.Out.WriteLine("Load file path " + fileUtils.DepositFolder + fileName);
                FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                try
                {
                    int count;                            // actual number of bytes read
                    int sum = 0;                          // total number of bytes read

                    // read until Read method returns 0 (end of the stream has been reached)
                    while ((count = fileStream.Read(jpegHeader, sum, 455 - sum)) > 0)
                    {
                        sum += count;  // sum is a buffer offset for next reading
                    }
                }
                finally
                {
                    fileStream.Dispose();
                    //fileStream.Close();
                }
                wholeString = bytesToHexString(jpegHeader);

                CloudCoin tempCoin = parseJpeg(wholeString);
                // Console.Out.WriteLine("From FileUtils returnCC.fileName " + tempCoin.fileName);

                /*end Deposit from jpeg file */



                //   Console.Out.WriteLine("Loaded coin filename: " + tempCoin.fileName);

                writeTo(SuspectFolder, tempCoin);
                return(tempCoin);
            }
            catch (FileNotFoundException ex)
            {
                Console.Out.WriteLine("File not found: " + fileName + ex);
                CoreLogger.Log("File not found: " + fileName + ex);
            }
            catch (IOException ioex)
            {
                Console.Out.WriteLine("IO Exception:" + fileName + ioex);
                CoreLogger.Log("IO Exception:" + fileName + ioex);
            }// end try catch
            return(null);
        }
Exemplo n.º 2
0
        }//end read all bytes

        public bool writeTo(String folder, CloudCoin cc)
        {
            //CoinUtils cu = new CoinUtils(cc);
            const string quote         = "\"";
            const string tab           = "\t";
            String       wholeJson     = "{" + Environment.NewLine; //{
            bool         alreadyExists = true;
            String       json          = this.setJSON(cc);

            if (!File.Exists(folder + cc.FileName + ".stack"))
            {
                wholeJson += tab + quote + "cloudcoin" + quote + ": [" + Environment.NewLine; // "cloudcoin" : [
                wholeJson += json;
                wholeJson += Environment.NewLine + tab + "]" + Environment.NewLine + "}";
                File.WriteAllText(folder + cc.FileName + ".stack", wholeJson);
            }
            else
            {
                if (folder.Contains("Counterfeit") || folder.Contains("Trash"))
                {
                    //Let the program delete it
                    alreadyExists = false;
                    return(alreadyExists);
                }
                else if (folder.Contains("Deposited"))
                {
                    File.Delete(folder + cc.FileName + ".stack");
                    File.WriteAllText(folder + cc.FileName + ".stack", wholeJson);
                    alreadyExists = false;
                    return(alreadyExists);
                }
                else
                {
                    Console.WriteLine(cc.FileName + ".stack" + " already exists in the folder " + folder);
                    CoreLogger.Log(cc.FileName + ".stack" + " already exists in the folder " + folder);
                    return(alreadyExists);
                } //end else
            }     //File Exists
            File.WriteAllText(folder + cc.FileName + ".stack", wholeJson);
            alreadyExists = false;
            return(alreadyExists);
        }//End Write To
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        }//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 jsonWithdrawed = 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("Withdrawed %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.WithdrawFolder + Path.DirectorySeparatorChar + totalSaved + ".CloudCoins." + tag + ".stack");

            if (mode == 1)
            {
                filename = (backupDir + Path.DirectorySeparatorChar + totalSaved + ".CloudCoins." + 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.WithdrawFolder + Path.DirectorySeparatorChar + totalSaved + ".CloudCoins." + 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 WithdrawED*/
            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(jsonWithdrawed);
        }//end write json to file
Exemplo n.º 5
0
        /* PUBLIC METHODS */

/*        public void writeQRCodeFiles(int m1, int m5, int m25, int m100, int m250, String tag)
 *      {
 *          int totalSaved = m1 + (m5 * 5) + (m25 * 25) + (m100 * 100) + (m250 * 250);// Total value of all coins
 *          int coinCount = m1 + m5 + m25 + m100 + m250; // Total number of coins
 *          String[] coinsToDelete = new String[coinCount];
 *          String[] bankedFileNames = new DirectoryInfo(this.fileSystem.BankFolder).GetFiles().Select(o => o.Name).ToArray(); // list all file names with bank extension
 *          String[] frackedFileNames = new DirectoryInfo(this.fileSystem.FrackedFolder).GetFiles().Select(o => o.Name).ToArray(); // list all file names with bank extension
 *          String[] partialFileNames = new DirectoryInfo(this.fileSystem.PartialFolder).GetFiles().Select(o => o.Name).ToArray();
 *
 *          var list = new List<string>();
 *          list.AddRange(bankedFileNames);
 *          list.AddRange(frackedFileNames);
 *          list.AddRange(partialFileNames);
 *
 *          bankedFileNames = list.ToArray(); // Add the two arrays together
 *
 *          String path = this.fileSystem.WithdrawFolder;//the word path is shorter than other stuff
 *
 *          // Look at all the money files and choose the ones that are needed.
 *          for (int i = 0; i < bankedFileNames.Length; i++)
 *          {
 *              String bankFileName = (this.fileSystem.BankFolder + bankedFileNames[i]);
 *              String frackedFileName = (this.fileSystem.FrackedFolder + bankedFileNames[i]);
 *              String partialFileName = (this.fileSystem.PartialFolder + bankedFileNames[i]);
 *
 *              // Get denominiation
 *              String denomination = bankedFileNames[i].Split('.')[0];
 *              try
 *              {
 *                  switch (denomination)
 *                  {
 *                      case "1":
 *                          if (m1 > 0)
 *                          {
 *                              this.qrCodeWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m1--;
 *                          }
 *                          break;
 *                      case "5":
 *                          if (m5 > 0)
 *                          {
 *
 *                              this.qrCodeWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m5--;
 *                          }
 *                          break;
 *                      case "25":
 *                          if (m25 > 0)
 *                          {
 *
 *                              this.qrCodeWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m25--;
 *                          }
 *                          break;
 *
 *                      case "100":
 *                          if (m100 > 0)
 *                          {
 *                              this.qrCodeWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m100--;
 *                          }
 *                          break;
 *
 *                      case "250":
 *                          if (m250 > 0)
 *                          { this.qrCodeWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m250--; }
 *                          break;
 *                  }//end switch
 *
 *                  if (m1 == 0 && m5 == 0 && m25 == 0 && m100 == 0 && m250 == 0)// end if file is needed to write jpeg
 *                  {
 *                      break;// Break if all the coins have been called for.
 *                  }
 *              }
 *              catch (FileNotFoundException ex)
 *              {
 *                  Console.Out.WriteLine(ex);
 *                  CoreLogger.Log(ex.ToString());
 *              }
 *              catch (IOException ioex)
 *              {
 *                  Console.Out.WriteLine(ioex);
 *                  CoreLogger.Log(ioex.ToString());
 *              }//end catch
 *          }// for each 1 note
 *      }//end write all jpegs
 *
 *      public void writeBarCode417CodeFiles(int m1, int m5, int m25, int m100, int m250, String tag)
 *      {
 *          int totalSaved = m1 + (m5 * 5) + (m25 * 25) + (m100 * 100) + (m250 * 250);// Total value of all coins
 *          int coinCount = m1 + m5 + m25 + m100 + m250; // Total number of coins
 *          String[] coinsToDelete = new String[coinCount];
 *          String[] bankedFileNames = new DirectoryInfo(this.fileSystem.BankFolder).GetFiles().Select(o => o.Name).ToArray(); // list all file names with bank extension
 *          String[] frackedFileNames = new DirectoryInfo(this.fileSystem.FrackedFolder).GetFiles().Select(o => o.Name).ToArray(); // list all file names with bank extension
 *          String[] partialFileNames = new DirectoryInfo(this.fileSystem.PartialFolder).GetFiles().Select(o => o.Name).ToArray();
 *
 *          var list = new List<string>();
 *          list.AddRange(bankedFileNames);
 *          list.AddRange(frackedFileNames);
 *          list.AddRange(partialFileNames);
 *
 *          bankedFileNames = list.ToArray(); // Add the two arrays together
 *
 *          String path = this.fileSystem.WithdrawFolder;//the word path is shorter than other stuff
 *
 *          // Look at all the money files and choose the ones that are needed.
 *          for (int i = 0; i < bankedFileNames.Length; i++)
 *          {
 *              String bankFileName = (this.fileSystem.BankFolder + bankedFileNames[i]);
 *              String frackedFileName = (this.fileSystem.FrackedFolder + bankedFileNames[i]);
 *              String partialFileName = (this.fileSystem.PartialFolder + bankedFileNames[i]);
 *
 *              // Get denominiation
 *              String denomination = bankedFileNames[i].Split('.')[0];
 *              try
 *              {
 *                  switch (denomination)
 *                  {
 *                      case "1":
 *                          if (m1 > 0)
 *                          {
 *                              this.barCode417WriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m1--;
 *                          }
 *                          break;
 *                      case "5":
 *                          if (m5 > 0)
 *                          {
 *
 *                              this.barCode417WriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m5--;
 *                          }
 *                          break;
 *                      case "25":
 *                          if (m25 > 0)
 *                          {
 *
 *                              this.barCode417WriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m25--;
 *                          }
 *                          break;
 *
 *                      case "100":
 *                          if (m100 > 0)
 *                          {
 *                              this.barCode417WriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m100--;
 *                          }
 *                          break;
 *
 *                      case "250":
 *                          if (m250 > 0)
 *                          { this.barCode417WriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m250--; }
 *                          break;
 *                  }//end switch
 *
 *                  if (m1 == 0 && m5 == 0 && m25 == 0 && m100 == 0 && m250 == 0)// end if file is needed to write jpeg
 *                  {
 *                      break;// Break if all the coins have been called for.
 *                  }
 *              }
 *              catch (FileNotFoundException ex)
 *              {
 *                  Console.Out.WriteLine(ex);
 *                  CoreLogger.Log(ex.ToString());
 *              }
 *              catch (IOException ioex)
 *              {
 *                  Console.Out.WriteLine(ioex);
 *                  CoreLogger.Log(ioex.ToString());
 *              }//end catch
 *          }// for each 1 note
 *      }//end write all jpegs*/

        public void writeJPEGFiles(int m1, int m5, int m25, int m100, int m250, String tag)
        {
            int totalSaved = m1 + (m5 * 5) + (m25 * 25) + (m100 * 100) + (m250 * 250); // Total value of all coins
            int coinCount  = m1 + m5 + m25 + m100 + m250;                              // Total number of coins

            String[] coinsToDelete    = new String[coinCount];
            String[] bankedFileNames  = new DirectoryInfo(this.fileSystem.BankFolder).GetFiles().Select(o => o.Name).ToArray();    // list all file names with bank extension
            String[] frackedFileNames = new DirectoryInfo(this.fileSystem.FrackedFolder).GetFiles().Select(o => o.Name).ToArray(); // list all file names with bank extension
            String[] partialFileNames = new DirectoryInfo(this.fileSystem.PartialFolder).GetFiles().Select(o => o.Name).ToArray();

            var list = new List <string>();

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

            bankedFileNames = list.ToArray();             // Add the two arrays together

            String path = this.fileSystem.WithdrawFolder; //the word path is shorter than other stuff

            // Look at all the money files and choose the ones that are needed.
            for (int i = 0; i < bankedFileNames.Length; i++)
            {
                String bankFileName    = (this.fileSystem.BankFolder + bankedFileNames[i]);
                String frackedFileName = (this.fileSystem.FrackedFolder + bankedFileNames[i]);
                String partialFileName = (this.fileSystem.PartialFolder + bankedFileNames[i]);

                // Get denominiation
                String denomination = bankedFileNames[i].Split('.')[0];
                try
                {
                    switch (denomination)
                    {
                    case "1":
                        if (m1 > 0)
                        {
                            this.jpegWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m1--;
                        }
                        break;

                    case "5":
                        if (m5 > 0)
                        {
                            this.jpegWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m5--;
                        }
                        break;

                    case "25":
                        if (m25 > 0)
                        {
                            this.jpegWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m25--;
                        }
                        break;

                    case "100":
                        if (m100 > 0)
                        {
                            this.jpegWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m100--;
                        }
                        break;

                    case "250":
                        if (m250 > 0)
                        {
                            this.jpegWriteOne(path, tag, bankFileName, frackedFileName, partialFileName); m250--;
                        }
                        break;
                    }//end switch

                    if (m1 == 0 && m5 == 0 && m25 == 0 && m100 == 0 && m250 == 0)// end if file is needed to write jpeg
                    {
                        break;// Break if all the coins have been called for.
                    }
                }
                catch (FileNotFoundException ex)
                {
                    Console.Out.WriteLine(ex);
                    CoreLogger.Log(ex.ToString());
                }
                catch (IOException ioex)
                {
                    Console.Out.WriteLine(ioex);
                    CoreLogger.Log(ioex.ToString());
                } //end catch
            }     // for each 1 note
        }         //end write all jpegs