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