public static void Init() { var args = Environment.GetCommandLineArgs(); var ipcType = (IPCType)Enum.Parse(typeof(IPCType), args[2]); var launcherUri = args[3]; IPCUtil.CreateService( ipcType, typeof(InjectorService), typeof(IInjectorService), out var serviceUri ); LauncherService = IPCUtil.CreateChannel <ILauncherService>(ipcType, launcherUri); LauncherService.SendInjectorSettings(serviceUri); Harmony = new Harmony("me.failedshack.usbhelperinjector"); var assembly = Assembly.GetExecutingAssembly(); assembly.GetTypes() .Where(type => VersionSpecific.Applies(type, HelperVersion) && !(Overrides.DisableOptionalPatches && Optional.IsOptional(type)) && (!WineOnly.IsWineOnly(type) || WineCompat) ) .Do(type => Harmony.CreateClassProcessor(type).Patch()); if (WineCompat) { RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; } }
public static void Init() { var args = Environment.GetCommandLineArgs(); var ipcType = (IPCType)Enum.Parse(typeof(IPCType), args[2]); var launcherUri = args[3]; IPCUtil.CreateService( ipcType, typeof(InjectorService), typeof(IInjectorService), out var serviceUri ); LauncherService = IPCUtil.CreateChannel <ILauncherService>(ipcType, launcherUri); LauncherService.SendInjectorSettings(serviceUri); Harmony = new Harmony("me.failedshack.usbhelperinjector"); var assembly = Assembly.GetExecutingAssembly(); assembly.GetTypes() .Where(type => VersionSpecific.Applies(type, HelperVersion) && !(Overrides.DisableOptionalPatches && Optional.IsOptional(type)) && (!WineOnly.IsWineOnly(type) || WineCompat) ) .Do(type => Harmony.CreateClassProcessor(type).Patch()); if (WineCompat) { RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; } NusGrabberFormPatch.Shown += (form, e) => { FF player = null; var button = new OnOffButton() { OnImage = Resources.AudioOn, OffImage = Resources.AudioOff, State = PlayMusic }; button.StateChanged += (sender, e1) => { // avoid preloading ffplay // TODO: make this not so hackish if (player == null) { if (!button.State) { return; } player = FF.Play("-loop 0 -nodisp loop.ogg"); } player.Pause = !button.State; LauncherService.SetPlayMusic(button.State); }; var toolWindow = ((Form)form).Controls.Find("toolWindow5", true)[0]; toolWindow.Controls.Add(button); button.BringToFront(); }; }