PazScheme QueryEncryption(string arc_name, uint signature) { PazScheme scheme = null; if (!KnownSchemes.TryGetValue(signature, out scheme) && KnownTitles.Count > 1) { var title = FormatCatalog.Instance.LookupGame(arc_name); scheme = GetScheme(title); if (null == scheme) { if (!arc_name.HasExtension(".paz")) { return(null); } var options = Query <PazOptions> (arcStrings.ArcEncryptedNotice); scheme = options.Scheme; } } arc_name = Path.GetFileNameWithoutExtension(arc_name).ToLowerInvariant(); if (null == scheme || !scheme.ArcKeys.ContainsKey(arc_name)) { throw new UnknownEncryptionScheme(); } return(scheme); }
YpfScheme QueryEncryptionScheme(string arc_name, uint version) { var title = FormatCatalog.Instance.LookupGame(arc_name); if (string.IsNullOrEmpty(title)) { title = FormatCatalog.Instance.LookupGame(arc_name, @"..\*.exe"); } YpfScheme scheme; if (!string.IsNullOrEmpty(title) && KnownSchemes.TryGetValue(title, out scheme)) { return(scheme); } var options = Query <YpfOptions> (arcStrings.YPFNotice); if (!KnownSchemes.TryGetValue(options.Scheme, out scheme) || null == scheme) { scheme = new YpfScheme { SwapTable = GuessSwapTable(version), GuessKey = true, ExtraHeaderSize = version >= 0x1D9 ? 4u : version == 0xDE ? 8u : 0u, } } ; return(scheme); }
public EncryptionScheme GetScheme(string title) { EncryptionScheme scheme; if (string.IsNullOrEmpty(title) || !KnownSchemes.TryGetValue(title, out scheme)) { scheme = DefaultScheme; } return(scheme); }
public static ICrypt GetScheme(string scheme) { ICrypt algorithm; if (string.IsNullOrEmpty(scheme) || !KnownSchemes.TryGetValue(scheme, out algorithm)) { algorithm = NoCryptAlgorithm; } return(algorithm); }
public static AImageScheme GetScheme(string title) { AImageScheme scheme = null; if (string.IsNullOrEmpty(title) || !KnownSchemes.TryGetValue(title, out scheme)) { return(null); } return(scheme); }
public static IScriptEncryption GetEncryption(string scheme) { IScriptEncryption enc; if (string.IsNullOrEmpty(scheme) || !KnownSchemes.TryGetValue(scheme, out enc)) { return(null); } return(enc); }
public static string GetPassPhrase(string title) { string pass; if (string.IsNullOrEmpty(title) || !KnownSchemes.TryGetValue(title, out pass)) { return(""); } return(pass); }
protected IDictionary <string, byte[]> QueryScheme(ArcView file) { var title = FormatCatalog.Instance.LookupGame(file.Name, @"..\*.sb"); if (string.IsNullOrEmpty(title) || !KnownSchemes.ContainsKey(title)) { return(null); } return(KnownSchemes[title]); }
internal AImageScheme QueryScheme(string arc_name) { var title = FormatCatalog.Instance.LookupGame(arc_name); if (!string.IsNullOrEmpty(title) && KnownSchemes.ContainsKey(title)) { return(KnownSchemes[title]); } var options = Query <BellOptions> (arcStrings.ArcEncryptedNotice); return(options.Scheme); }
uint?QueryEncryptionInfo(string arc_name) { var title = FormatCatalog.Instance.LookupGame(arc_name); if (!string.IsNullOrEmpty(title) && KnownSchemes.ContainsKey(title)) { return(KnownSchemes[title].Key); } var options = Query <IntOptions> (arcStrings.INTNotice); return(options.EncryptionInfo.GetKey()); }
IScriptEncryption QueryEncryption(string arc_name) { var title = FormatCatalog.Instance.LookupGame(arc_name); if (!string.IsNullOrEmpty(title) && KnownSchemes.ContainsKey(title)) { return(KnownSchemes[title]); } var options = Query <MedOptions> (arcStrings.ArcEncryptedNotice); return(options.Encryption); }
public override ResourceOptions GetDefaultOptions() { IEntryEncryption enc = null; if (!string.IsNullOrEmpty(Settings.Default.EAGLSEncryption)) { KnownSchemes.TryGetValue(Settings.Default.EAGLSEncryption, out enc); } return(new EaglsOptions { Encryption = enc }); }
public override ResourceOptions GetDefaultOptions() { string title = Properties.Settings.Default.TacticsArcTitle; ArcScheme scheme = null; if (!KnownSchemes.TryGetValue(title, out scheme) && !string.IsNullOrEmpty(Properties.Settings.Default.TacticsArcPassword)) { scheme = new ArcScheme(Properties.Settings.Default.TacticsArcPassword); } return(new TacticsOptions { Scheme = scheme }); }
internal ArcFile GetArchive(ArcView file, List <Entry> dir) { if (0 == dir.Count) { return(null); } string arc_id = file.View.ReadString(0, 5); ScrambleScheme scheme; if (!KnownSchemes.TryGetValue(arc_id, out scheme)) { scheme = DefaultScheme; } return(new MkArchive(file, this, dir, scheme)); }
ICrypt GuessCryptAlgorithm(ArcView file) { var title = FormatCatalog.Instance.LookupGame(file.Name); if (string.IsNullOrEmpty(title)) { return(null); } ICrypt algorithm; if (!KnownSchemes.TryGetValue(title, out algorithm) && NoCryptTitles.Contains(title)) { algorithm = NoCryptAlgorithm; } return(algorithm); }
internal Scheme QueryScheme(string arc_name) { var title = FormatCatalog.Instance.LookupGame(arc_name); if (!string.IsNullOrEmpty(title) && KnownSchemes.ContainsKey(title)) { return(KnownSchemes[title]); } var options = Query <ArcDatOptions> (arcStrings.ArcEncryptedNotice); Scheme scheme; if (string.IsNullOrEmpty(options.Scheme) || !KnownSchemes.TryGetValue(options.Scheme, out scheme)) { return(null); } return(scheme); }
byte[] GuessSwapTable(uint version) { if (0x1F4 == version) { YpfScheme scheme; if (KnownSchemes.TryGetValue("Unionism Quartet", out scheme)) { return(scheme.SwapTable); } } if (version < 0x100) { return(SwapTable04); } else if (version >= 0x12c && version < 0x196) { return(SwapTable10); } else { return(SwapTable00); } }
public override ArcFile TryOpen(ArcView file) { if (!file.View.AsciiEqual(4, "0\0")) { return(null); } int count = file.View.ReadInt32(0x12); if (!IsSaneCount(count)) { return(null); } string arc_id = file.View.ReadString(0, 5); uint base_offset = file.View.ReadUInt16(8); uint index_offset = file.View.ReadUInt32(0xE); if (index_offset >= file.MaxOffset) { return(null); } uint index_size = file.View.ReadUInt32(0xA); if (index_size > file.View.Reserve(index_offset, index_size)) { return(null); } uint current_offset = index_offset; var dir = new List <Entry> (count); for (int i = 0; i < 512; ++i) { uint entry_offset = index_offset + file.View.ReadUInt32(current_offset); int n = file.View.ReadUInt16(current_offset + 4); if (n > 0) { for (int j = 0; j < n; ++j) { uint offset = file.View.ReadUInt32(entry_offset) + base_offset; uint size = file.View.ReadUInt32(entry_offset + 4); uint name_length = file.View.ReadByte(entry_offset + 8); if (0 == name_length) { return(null); } var name = file.View.ReadString(entry_offset + 9, name_length); entry_offset += 9 + name_length; var entry = FormatCatalog.Instance.Create <Entry> (name); entry.Offset = offset; entry.Size = size; if (!entry.CheckPlacement(index_offset)) { return(null); } dir.Add(entry); } } else if (-1 == file.View.ReadInt32(entry_offset)) { break; } current_offset += 6; } if (0 == dir.Count) { return(null); } ScrambleScheme scheme; if (!KnownSchemes.TryGetValue(arc_id, out scheme)) { scheme = DefaultScheme; } return(new MkArchive(file, this, dir, scheme)); }