示例#1
0
        }//end write json to file

        /* PRIVATE METHODS */
        private void jpegWriteOne(String path, String tag, String bankFileName, String frackedFileName)
        {
            if (File.Exists(bankFileName))//If the file is a bank file, export a good bank coin
            {
                CloudCoin jpgCoin = this.fileUtils.loadOneCloudCoinFromJsonFile(bankFileName);
                if (this.fileUtils.writeJpeg(jpgCoin, tag)) //If the jpeg writes successfully
                {
                    File.Delete(bankFileName);              //Delete the files if they have been written to
                }//end if write was good.
            }
            else//Export a fracked coin.
            {
                CloudCoin jpgCoin = fileUtils.loadOneCloudCoinFromJsonFile(frackedFileName);
                if (this.fileUtils.writeJpeg(jpgCoin, tag))
                {
                    File.Delete(frackedFileName);//Delete the files if they have been written to
                }//end if
            }//end else
        } //End write one jpeg
示例#2
0
        }    //end fix one

        /* PUBLIC METHODS */
        public int[] fixAll()
        {
            int[]     results          = new int[3];
            String[]  frackedFileNames = new DirectoryInfo(this.fileUtils.frackedFolder).GetFiles().Select(o => o.Name).ToArray();
            CloudCoin frackedCC;

            if (frackedFileNames.Length < 0)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Out.WriteLine(StringHolder.frackfixer_6); // "You have no fracked coins.");
                Console.ForegroundColor = ConsoleColor.White;
            }//no coins to unfrack


            for (int i = 0; i < frackedFileNames.Length; i++)
            {
                Console.WriteLine(StringHolder.frackfixer_unfracking + (i + 1) + " of " + frackedFileNames.Length);
                try
                {
                    frackedCC = fileUtils.loadOneCloudCoinFromJsonFile(this.fileUtils.frackedFolder + frackedFileNames[i]);

                    String value = frackedCC.aoid["fracked"];
                    //  Console.WriteLine("Fracked Coin: ");
                    frackedCC.consoleReport();

                    CloudCoin fixedCC = fixCoin(frackedCC);   // Will attempt to unfrack the coin.

                    fixedCC.consoleReport();
                    switch (fixedCC.getFolder().ToLower())
                    {
                    case "bank":
                        this.totalValueToBank++;
                        this.fileUtils.overWrite(this.fileUtils.bankFolder, fixedCC);
                        this.deleteCoin(this.fileUtils.frackedFolder + frackedFileNames[i]);
                        Console.WriteLine(StringHolder.frackfixer_8);    //"CloudCoin was moved to Bank.");
                        break;

                    case "counterfeit":
                        this.totalValueToCounterfeit++;
                        this.fileUtils.overWrite(this.fileUtils.counterfeitFolder, fixedCC);
                        this.deleteCoin(this.fileUtils.frackedFolder + frackedFileNames[i]);
                        Console.WriteLine(StringHolder.frackfixer_9);    //"CloudCoin was moved to Trash.");
                        break;

                    default:    //Move back to fracked folder
                        this.totalValueToFractured++;
                        this.deleteCoin(this.fileUtils.frackedFolder + frackedFileNames[i]);
                        this.fileUtils.overWrite(this.fileUtils.frackedFolder, fixedCC);
                        Console.WriteLine(StringHolder.frackfixer_10);    //"CloudCoin was moved back to Fraked folder.");
                        break;
                    }
                    // end switch on the place the coin will go
                }
                catch (FileNotFoundException ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(ex);
                    Console.ForegroundColor = ConsoleColor.White;
                }
                catch (IOException ioex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(ioex);
                    Console.ForegroundColor = ConsoleColor.White;
                } // end try catch
            }     // end for each file name that is fracked

            results[0] = this.totalValueToBank;
            results[1] = this.totalValueToCounterfeit; // System.out.println("Counterfeit and Moved to trash: "+totalValueToCounterfeit);
            results[2] = this.totalValueToFractured;   // System.out.println("Fracked and Moved to Fracked: "+ totalValueToFractured);
            return(results);
        }// end fix all