public string GetKeyValue(string key) { string result = ""; AppInfoItemKey key2 = GetKey(key, this); if (key2 != null) { result = key2.Value; } return(result); }
private string GetValue(string name, AppInfoItemKey AIIKParent) { string result = ""; name = name.ToLower(); foreach (AppInfoItemKey current in AIIKParent.keys) { if (current.Name.ToLower() == name.ToLower()) { result = current.Value; break; } if (current.keys.Count > 0) { result = GetValue(name, current); } } return(result); }
public List <AppInfoItem> GetAppInfoItem(string AppPath, string AppExe) { List <AppInfoItem> list = new List <AppInfoItem>(); foreach (AppInfoItem current in AppInfoItems) { string a = current.AppInfoKey.GetKeyValue("installdir").ToLower(); AppInfoItemKey key = current.AppInfoKey.GetKey("launch", current.AppInfoKey); if (key != null) { foreach (AppInfoItemKey arg_72_0 in key.keys) { string a2 = key.GetKeyValue("executable").ToLower(); if (a == AppPath.ToLower() && (a2 == AppExe.ToLower() || a2 == AppExe.ToLower().Replace("\\", "/"))) { list.Add(current); break; } } } } return(list); }
public AppInfoItemKey GetKey(string name, AppInfoItemKey AIIKParent) { AppInfoItemKey appInfoItemKey = null; name = name.ToLower(); foreach (AppInfoItemKey current in AIIKParent.keys) { if (current.Name.ToLower() == name) { appInfoItemKey = current; break; } if (current.keys.Count > 0) { appInfoItemKey = GetKey(name, current); } if (appInfoItemKey != null) { break; } } return(appInfoItemKey); }
public AppInfoVDF(string appinfofile) { if (new FileInfo(appinfofile).Exists) { using (FileStream fileStream = new FileStream(appinfofile, FileMode.Open, FileAccess.Read, FileShare.Read)) { BinaryReader binaryReader = new BinaryReader(fileStream); m_VersionSignature = binaryReader.ReadUInt32(); m_Universe = binaryReader.ReadUInt32(); if (m_VersionSignature == 123094054u) { bool flag = true; while (flag) { uint num = binaryReader.ReadUInt32(); if (num == 0u) { flag = false; } else { int num2 = binaryReader.ReadInt32(); byte[] arg_8D_0 = binaryReader.ReadBytes(num2); AppInfoItem appInfoItem = new AppInfoItem(num, num2); using (BinaryReader binaryReader2 = new BinaryReader(new MemoryStream(arg_8D_0, false))) { appInfoItem.State = binaryReader2.ReadUInt32(); appInfoItem.LastUpdated = binaryReader2.ReadUInt32(); appInfoItem.AccessToken = binaryReader2.ReadUInt64(); string text = ""; for (int i = 0; i < 20; i++) { text += binaryReader2.ReadByte().ToString(); } appInfoItem.SHA1 = text; appInfoItem.ChangeNumber = binaryReader2.ReadUInt32(); var appInfoItemKey = new AppInfoItemKey { Name = "App Info Section", Type = 1 }; bool flag2 = true; while (flag2) { if (binaryReader2.ReadByte() == 0) { flag2 = false; } else { appInfoItem.AddKeyValues(binaryReader2, appInfoItemKey); } } appInfoItem.AppInfoKey = appInfoItemKey; } AppInfoItems.Add(appInfoItem); } } } } } }
public void AddKeyValues(BinaryReader reader, AppInfoItemKey AIIK) { try { for (byte b = reader.ReadByte(); b != 8; b = reader.ReadByte()) { string name = AppInfoItem.ReadString(reader); AppInfoItemKey appInfoItemKey = new AppInfoItemKey { Name = name, Type = b }; string typeDescription; switch (b) { case 1: { string value = AppInfoItem.ReadString(reader); appInfoItemKey.Value = value; typeDescription = "String"; break; } case 2: appInfoItemKey.Value = reader.ReadInt32().ToString(); typeDescription = "Int32"; break; case 3: appInfoItemKey.Value = reader.ReadSingle().ToString(); typeDescription = "Single"; break; case 4: typeDescription = "Pointer"; break; case 5: { string text = AppInfoItem.ReadWideString(reader); appInfoItemKey.Value = text.ToString(); typeDescription = "WString"; break; } case 6: { byte b2 = reader.ReadByte(); byte b3 = reader.ReadByte(); byte b4 = reader.ReadByte(); appInfoItemKey.Value = string.Concat(new string[] { b2.ToString(), " ", b3.ToString(), " ", b4.ToString() }); typeDescription = "Color"; break; } case 7: appInfoItemKey.Value = reader.ReadUInt64().ToString(); typeDescription = "UInt64"; break; default: typeDescription = "String"; break; } appInfoItemKey.TypeDescription = typeDescription; AIIK.keys.Add(appInfoItemKey); if (b == 0) { AddKeyValues(reader, appInfoItemKey); } } } catch { } }