forgot to add registry.cs
This commit is contained in:
		
							parent
							
								
									e9924bded2
								
							
						
					
					
						commit
						4bc7d806a0
					
				
							
								
								
									
										23
									
								
								RobloxLegacy/Utilities/Registry.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								RobloxLegacy/Utilities/Registry.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					using Microsoft.Win32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RobloxLegacy.Utilities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Registry
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static RegistryKey? OpenKey(bool writable = true)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\RobloxLegacy", writable);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void SaveVersion(string appName, string version)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        using var key = OpenKey();
 | 
				
			||||||
 | 
					        key?.SetValue($"{appName}Version", version, RegistryValueKind.String);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public static string? GetVersion(string appName)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        using var key = OpenKey(false);
 | 
				
			||||||
 | 
					        return key?.GetValue($"{appName}Version") as string;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user