/* PRIVATE METHODS */ private void jpegWriteOne(String path, String tag, String bankFileName, String frackedFileName, String partialFileName) { if (File.Exists(bankFileName))//If the file is a bank file, export a good bank coin { CloudCoin jpgCoin = this.fileSystem.LoadCoin(bankFileName); if (this.fileSystem.writeJpeg(jpgCoin, tag))//If the jpeg writes successfully { File.Delete(bankFileName);//Delete the files if they have been written to pge.MajorProgressMessage = "Exported file " + bankFileName; raida.OnLogRecieved(pge); }//end if write was good. } else if (File.Exists(partialFileName))//If the file is a bank file, export a good bank coin { CloudCoin jpgCoin = this.fileSystem.LoadCoin(partialFileName); if (this.fileSystem.writeJpeg(jpgCoin, tag))//If the jpeg writes successfully { File.Delete(partialFileName);//Delete the files if they have been written to pge.MajorProgressMessage = "Exported file " + partialFileName; raida.OnLogRecieved(pge); }//end if write was good. } else//Export a fracked coin. { CloudCoin jpgCoin = fileSystem.LoadCoin(frackedFileName); if (this.fileSystem.writeJpeg(jpgCoin, tag)) { File.Delete(frackedFileName);//Delete the files if they have been written to pge.MajorProgressMessage = "Exported file " + frackedFileName; raida.OnLogRecieved(pge); }//end if }//end else }//End write one jpeg
}//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