private bool CompleteLoading() { try { this.targetFile = this.destFolder.searchForFile(this.targetFilename); if (this.targetFile == null) { this.status = DecypherExe.DecypherStatus.Error; this.errorMessage = LocaleTerms.Loc("File not found"); return(false); } switch (FileEncrypter.FileIsEncrypted(this.targetFile.data, this.password)) { case 0: this.status = DecypherExe.DecypherStatus.Error; this.errorMessage = LocaleTerms.Loc("File is not\nDEC encrypted"); return(false); case 2: this.status = DecypherExe.DecypherStatus.Error; this.errorMessage = !(this.password == "") ? LocaleTerms.Loc("Provided Password\nIs Incorrect") : LocaleTerms.Loc("This File Requires\n a Password"); return(false); default: return(true); } } catch (Exception ex) { this.status = DecypherExe.DecypherStatus.Error; this.errorMessage = LocaleTerms.Loc("Fatal error in loading"); return(false); } }
public DecypherExe(Rectangle location, OS operatingSystem, string[] p) : base(location, operatingSystem) { this.IdentifierName = "Decypher Module"; this.ramCost = 370; if (p.Length < 2) { this.status = DecypherExe.DecypherStatus.Error; this.errorMessage = "No File Provided"; } else { this.InitializeFiles(p[1]); if (p.Length > 2) { this.password = p[2]; } } }
public override void Update(float t) { base.Update(t); this.timeOnThisPhase += t; float num; switch (this.status) { case DecypherExe.DecypherStatus.Error: num = 6f; if ((double)this.timeOnThisPhase >= 6.0) { this.isExiting = true; break; } break; case DecypherExe.DecypherStatus.Working: num = 10f; if ((double)this.timeOnThisPhase >= 10.0) { try { this.CompleteWorking(); } catch (Exception ex) { this.status = DecypherExe.DecypherStatus.Error; this.timeOnThisPhase = 0.0f; this.errorMessage = LocaleTerms.Loc("Fatal error in decryption\nfile may be corrupt"); } this.status = DecypherExe.DecypherStatus.Complete; this.timeOnThisPhase = 0.0f; break; } if ((double)this.percentComplete % 0.100000001490116 < 0.00999999977648258) { this.lastLockedPercentage = this.percentComplete; this.lcgSeed = Utils.random.Next(); this.rowsActive.Clear(); this.columnsActive.Clear(); for (int index = 0; index < this.columnsDrawn; ++index) { if (Utils.random.NextDouble() < 0.2) { this.rowsActive.Add(index); } } for (int index = 0; index < this.rowsDrawn; ++index) { if (Utils.random.NextDouble() < 0.2) { this.columnsActive.Add(index); } } } break; case DecypherExe.DecypherStatus.Complete: num = 3f; if ((double)this.timeOnThisPhase >= 3.0) { this.isExiting = true; break; } break; default: num = 3.5f; if ((double)this.timeOnThisPhase >= 3.5) { if (this.CompleteLoading()) { this.status = DecypherExe.DecypherStatus.Working; } this.timeOnThisPhase = 0.0f; break; } break; } this.percentComplete = this.timeOnThisPhase / num; }