/// <summary> /// Frequency Overrides are stored in the registry, in a key labeled /// TS[CountryCode]-[TunerInputType ], so for cable tv in Portugal it /// would be TS351-1 /// </summary> /// <param name="channel"></param> /// <param name="Frequency"></param> /// <param name="TuningSpace"></param> /// <param name="InputType"></param> /// <returns></returns> public bool SetFrequencyOverride(int channel, int Frequency, int TuningSpace, TunerInputType InputType) { try { int IType; if (InputType == TunerInputType.Cable) { IType = 1; } else { IType = 0; } Microsoft.Win32.RegistryKey LocaleOverride; LocaleOverride = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\TV System Services\\TVAutoTune\\TS" + TuningSpace.ToString() + "-" + IType.ToString(), true); if (LocaleOverride == null) { LocaleOverride = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\TV System Services\\TVAutoTune\\TS" + TuningSpace.ToString() + "-" + IType.ToString()); } LocaleOverride.SetValue(channel.ToString(), Frequency); return(true); } catch { return(false); } }
public static void Main(String[] args) { try { // Run as Admin if (!VistaSecurity.IsAdmin()) { VistaSecurity.RestartElevated(); return; } // Trigger OST Load by referencing one of its types OSTForm = null; // Load locales LocaleOverride.Load(); // Patching HarmonyInstance instance = HarmonyInstance.Create("io.tmsp.nost"); instance.PatchAll(typeof(Program).Assembly); // Enable all the options that are only available when being logged in Type[] types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).ToArray(); Type options = types.FirstOrDefault(t => t.Name == "OstOption" && t.Namespace == "Utils"); if (options == null) { throw new Exception("Couldn't start OST!"); } MethodInfo enableOptions = options.GetMethod("EnableAllOptions", BindingFlags.Public | BindingFlags.Static); if (enableOptions == null) { throw new Exception("Couldn't start OST!"); } enableOptions.Invoke(null, null); // Start OST Type OST = types.FirstOrDefault(t => t.Name == "Program" && t.Namespace == "OnlineUpdateTool"); if (OST == null) { throw new Exception("Couldn't start OST!"); } MethodInfo info = OST.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static); if (info == null) { throw new Exception("Couldn't start OST!"); } info.Invoke(null, null); } catch (Exception e) { MessageBox.Show(e.ToString(), "Error!", MessageBoxButtons.OK); } }
// Add a way to override locales public static Boolean Prefix(ref String localeId, ref String regionName, ref String __result) { String localized = LocaleOverride.GetLocale(regionName, localeId); if (localized == localeId) { return(true); } __result = localized; return(false); }