private bool IsUpdateApplied(string titleId, out IFileSystem updatedControlFs) { updatedControlFs = null; string updatePath = "(unknown)"; try { (Nca patchNca, Nca controlNca) = ApplicationLoader.GetGameUpdateData(_virtualFileSystem, titleId, 0, out updatePath); if (patchNca != null && controlNca != null) { updatedControlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); return(true); } } catch (InvalidDataException) { Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {updatePath}"); } catch (MissingKeyException exception) { Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}. Errored File: {updatePath}"); } return(false); }
// Token: 0x0600000D RID: 13 RVA: 0x00002320 File Offset: 0x00000520 private async Task Monitor() { bool hasProcess = false; string dir = AppDomain.CurrentDomain.BaseDirectory; DirectoryInfo parentDir = Directory.GetParent(dir).Parent; while (true) { await Task.Delay(1000); var processes = Process.GetProcessesByName("HeroesOfTheStorm").Union(Process.GetProcessesByName("HeroesOfTheStorm" + "_x64")); if (processes.Any() && !hasProcess) { var hotsBpProcesses = Process.GetProcessesByName("HotsBpHelper"); if (!hotsBpProcesses.Any()) { string applicationName = parentDir.FullName + @"\HotsBpHelper.exe"; ApplicationLoader.StartProcessAsCurrentUser(applicationName, string.Empty); } } hasProcess = processes.Any(); } }
public void SetUp() { // This will set up the URI registrations for the pack:// and application var a = Application.Current; this.applicationLoader = new ApplicationLoader(); }
public Switch(VirtualFileSystem fileSystem, ContentManager contentManager, IRenderer renderer, IAalOutput audioOut) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioOut == null) { throw new ArgumentNullException(nameof(audioOut)); } AudioOut = audioOut; Memory = new MemoryBlock(1UL << 32); Gpu = new GpuContext(renderer); FileSystem = fileSystem; System = new Horizon(this, contentManager); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); Application = new ApplicationLoader(this, fileSystem, contentManager); }
private bool IsUpdateApplied(string titleId, out string version) { string updatePath = "(unknown)"; try { (Nca patchNca, Nca controlNca) = ApplicationLoader.GetGameUpdateData(_virtualFileSystem, titleId, 0, out updatePath); if (patchNca != null && controlNca != null) { ApplicationControlProperty controlData = new ApplicationControlProperty(); controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(out IFile nacpFile, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure(); nacpFile.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure(); version = controlData.DisplayVersion.ToString(); return(true); } } catch (InvalidDataException) { Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {updatePath}"); } catch (MissingKeyException exception) { Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}. Errored File: {updatePath}"); } version = ""; return(false); }
private void button1_Click(object sender, EventArgs e) { ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(@"C:\Windows\System32\notepad.exe", out procInfo); return; ProcessStartInfo info = new ProcessStartInfo(); //info.WorkingDirectory = @"D:\work\source\POC\WinServicesControl\WinServicesControl\bin\Release\"; //info.CreateNoWindow = true; //info.UserName = "******"; //string strPWD = "pronto"; //SecureString password = new SecureString(); //foreach (char c in strPWD.ToCharArray()) //{ password.AppendChar(c); } //info.Password = password; //info.FileName = @"D:\work\source\POC\WinServicesControl\WinServicesControl\bin\Release\WinServicesControl.exe"; info.FileName = @"C:\Windows\System32\notepad.exe"; //info.Arguments = ""; info.WindowStyle = ProcessWindowStyle.Normal; info.UseShellExecute = false; Process pro = Process.Start(info); pro.WaitForExit(); }
public Switch(VirtualFileSystem fileSystem, ContentManager contentManager, UserChannelPersistence userChannelPersistence, IRenderer renderer, IAalOutput audioOut) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioOut == null) { throw new ArgumentNullException(nameof(audioOut)); } if (userChannelPersistence == null) { throw new ArgumentNullException(nameof(userChannelPersistence)); } UserChannelPersistence = userChannelPersistence; AudioOut = audioOut; Memory = new MemoryBlock(1UL << 32); Gpu = new GpuContext(renderer); Host1x = new Host1xDevice(Gpu.Synchronization); var nvdec = new NvdecDevice(Gpu.MemoryManager); var vic = new VicDevice(Gpu.MemoryManager); Host1x.RegisterDevice(ClassId.Nvdec, nvdec); Host1x.RegisterDevice(ClassId.Vic, vic); nvdec.FrameDecoded += (FrameDecodedEventArgs e) => { // FIXME: // Figure out what is causing frame ordering issues on H264. // For now this is needed as workaround. if (e.CodecId == CodecId.H264) { vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0); } else { vic.DisableSurfaceOverride(); } }; FileSystem = fileSystem; System = new Horizon(this, contentManager); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); Application = new ApplicationLoader(this, fileSystem, contentManager); }
public static void Load(IServiceCollection services) { ApplicationLoader.Load(services); InfrasctuctureLoader.Load(services); services.AddScoped <ISecurityProvider, SecurityProvider>(); services.AddScoped <IJwtService, JwtService>(); }
private void GetControlFsAndTitleId(PartitionFileSystem pfs, out IFileSystem controlFs, out string titleId) { (_, _, Nca controlNca) = ApplicationLoader.GetGameData(_virtualFileSystem, pfs, 0); // Return the ControlFS controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); titleId = controlNca?.Header.TitleId.ToString("x16"); }
public ApplicationLoader NewSubjectUnderTest() { // This will set up the URI registrations for the pack:// and application var a = Application.Current; var subject = new ApplicationLoader(); return subject; }
private void AddUpdate(string path, bool showErrorDialog = true) { if (File.Exists(path)) { using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) { PartitionFileSystem nsp = new PartitionFileSystem(file.AsStorage()); try { (Nca patchNca, Nca controlNca) = ApplicationLoader.GetGameUpdateDataFromPartition(_virtualFileSystem, nsp, _titleId, 0); if (controlNca != null && patchNca != null) { ApplicationControlProperty controlData = new ApplicationControlProperty(); controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(out IFile nacpFile, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure(); nacpFile.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure(); RadioButton radioButton = new RadioButton($"Version {controlData.DisplayVersion.ToString()} - {path}"); radioButton.JoinGroup(_noUpdateRadioButton); _availableUpdatesBox.Add(radioButton); _radioButtonToPathDictionary.Add(radioButton, path); radioButton.Show(); radioButton.Active = true; } else { GtkDialog.CreateErrorDialog("The specified file does not contain an update for the selected title!"); } } catch (InvalidDataException exception) { Logger.Error?.Print(LogClass.Application, $"{exception.Message}. Errored File: {path}"); if (showErrorDialog) { GtkDialog.CreateInfoDialog("Ryujinx - Error", "Add Update Failed!", "The NCA header content type check has failed. This is usually because the header key is incorrect or missing."); } } catch (MissingKeyException exception) { Logger.Error?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}. Errored File: {path}"); if (showErrorDialog) { GtkDialog.CreateInfoDialog("Ryujinx - Error", "Add Update Failed!", $"Your key set is missing a key with the name: {exception.Name}"); } } } } }
private void Server_CommandReceived(object sender, ExecuteCommandEventArgs e) { LogHelper.Log("Server_CommandReceived::" + e.Command); // windows service runs in isolation and cannot normally execute batch scripts or executables in the session of logged in user. // so the below ApplicationLoader class will identify the current user using winlogon and then execute programs in that session. LogHelper.Log("Starting process from windows service..."); ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(e.Command, out procInfo); }
//----- Start Worker ----- //******** Work With Running Applications ******** //Skontroluje spustene aplikacie void WorkWithRunningApplications() { if (day != ((short)DateTime.Now.Day)) { PCHour = 0; PCMin = 0; appinfo.Clear(); day = (short)DateTime.Now.Day; } if (File.Exists(PathMS + "/Temp/appreport.dat")) { try { save.Destroy(); save = new SaveWriter(PathMS + "/Temp/appreport.dat"); save.Load(); int count = save.GetItemInt("Count"); for (int i = 0; i < count; i++) { bool found = false; string executable = save.GetItem("Module_" + i); for (int j = 0; j < appinfo.Count; j++) { if (appinfo[j].ExecutableName.Equals(executable)) { found = true; appinfo[j].AddTime(5); } } if (!found) { appinfo.Add(new ApplicationInfo(save.GetItem("Title_" + i), executable)); } } save.Destroy(); } catch (Exception ex) { ApplicationLoader.PROCESS_INFORMATION procInfos; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfos); DebugService.WriteError("Bad load data: " + ex); return; } } ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo); }
/// <summary> /// SharpBoss initializer, the listen URL can be defined on: /// <list type="bullet"> /// <item>On environment: <b>SHARPBOSS_URL</b></item> /// <item>On config as: <b>SHARPBOSS_URL</b></item> /// <item>On constructor argument: <b>listenUrl</b></item> /// </list> /// </summary> /// <param name="listenUrl">Listen URL for base endpoint</param> /// <returns>New SharpBoss instance</returns> public SharpBoss(string listenUrl = null, dynamic appSettings = null) { SetAppSettings(appSettings); if (listenUrl == null) { listenUrl = GetListenUrl(); } this._applicationLoader = new ApplicationLoader(); listenUrl = listenUrl + (listenUrl.EndsWith("/") ? "" : "/"); this._server = new HttpServer(listenUrl, ProcessHttpCalls); }
public HomeApplicationInstance(IApplicationService appService, IApplicationManager appManager) { IApplication application = null; this.appService = appService; this.applications = new List <ApplicationInstanceVisual>(); this.GoHome = () => appManager.GoHome(); var applicationTypes = ApplicationLoader.GetApplicationsInstances(); // Load all the application instances for (int i = 0; i < applicationTypes.Count; i++) { var type = applicationTypes[i]; // Try to create an instance of our ApplicationInstance who has a constructor containing requiging our main applicaiton. IApplicationInstance applicationInstance; try { applicationInstance = (IApplicationInstance)appService.Kernel.Get(type); ConfigureBackBehaviour(applicationInstance, appManager); } catch (Exception e) { Debug.WriteLine($"Failed to load '{type.Name}', with error:\n{e.InnerException}"); continue; } // If the application has not set a thumbnail, use our default. if (applicationInstance.Thumbnail == null) { Texture texture = new Texture(new Image("Resources\\DemoApp.png")); texture.GenerateMipmap(); texture.Smooth = true; applicationInstance.Thumbnail = new RectangleShape(new SFML.System.Vector2f(300, 300)) { Texture = texture }; } // Hard coded for 2 applications. I had a think but couldn't think of any good logic to scale this to 'n' instances? // If you have something plz do add otherwise I'll look for a library. var applicationVisual = new ApplicationInstanceVisual(applicationInstance, new SFML.System.Vector2f(300 + 400 * i, 200)); applications.Add(applicationVisual); } }
public void ApplicationLoaderDictionaryBootstrapperSetupTest() { var application = new Application(); var bootstrapperMock = new Mock <IBootstrapper>(); bootstrapperMock.Setup(b => b.Setup(application)).Verifiable(); var appLoader = new ApplicationLoader { Bootstrapper = bootstrapperMock.Object }; bootstrapperMock.VerifyAll(); }
//***** Start Worker ***** void StartWorker() { try { Process[] processes = Process.GetProcessesByName("My_Spy_Worker"); DebugService.Write("Count: " + processes.Length); if (processes.Length < 1) { ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/My_Spy_Worker.exe", out procInfo); } }catch (Exception ex) { DebugService.WriteError("" + ex); } }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; FileSystem = Configuration.VirtualFileSystem; UiHandler = Configuration.HostUiHandler; MemoryAllocationFlags memoryAllocationFlags = configuration.MemoryManagerMode == MemoryManagerMode.SoftwarePageTable ? MemoryAllocationFlags.Reserve : MemoryAllocationFlags.Reserve | MemoryAllocationFlags.Mirrorable; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(Configuration.AudioDeviceDriver); Memory = new MemoryBlock(Configuration.MemoryConfiguration.ToDramSize(), memoryAllocationFlags); Gpu = new GpuContext(Configuration.GpuRenderer); System = new Horizon(this); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); System.State.SetLanguage(Configuration.SystemLanguage); System.State.SetRegion(Configuration.Region); EnableDeviceVsync = Configuration.EnableVsync; System.State.DockedMode = Configuration.EnableDockedMode; System.PerformanceState.PerformanceMode = System.State.DockedMode ? PerformanceMode.Boost : PerformanceMode.Default; System.EnablePtc = Configuration.EnablePtc; System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel; System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode; }
private void AddUpdate(string path) { if (File.Exists(path)) { using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) { PartitionFileSystem nsp = new PartitionFileSystem(file.AsStorage()); try { (Nca patchNca, Nca controlNca) = ApplicationLoader.GetGameUpdateDataFromPartition(_virtualFileSystem, nsp, _titleId, 0); if (controlNca != null && patchNca != null) { ApplicationControlProperty controlData = new ApplicationControlProperty(); using var nacpFile = new UniqueRef <IFile>(); controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(ref nacpFile.Ref(), "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure(); nacpFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure(); RadioButton radioButton = new RadioButton($"Version {controlData.DisplayVersion.ToString()} - {path}"); radioButton.JoinGroup(_noUpdateRadioButton); _availableUpdatesBox.Add(radioButton); _radioButtonToPathDictionary.Add(radioButton, path); radioButton.Show(); radioButton.Active = true; } else { GtkDialog.CreateErrorDialog("The specified file does not contain an update for the selected title!"); } } catch (Exception exception) { GtkDialog.CreateErrorDialog($"{exception.Message}. Errored File: {path}"); } } } }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; UiHandler = configuration.HostUiHandler; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(configuration.AudioDeviceDriver); Memory = new MemoryBlock(configuration.MemoryConfiguration.ToDramSize(), MemoryAllocationFlags.Reserve); Gpu = new GpuContext(configuration.GpuRenderer); System = new Horizon(this); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Hid.InitDevices(); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); Initialize(); }
public static void Main() { // Initialize(); try { ApplicationLoader appLoader = new ApplicationLoader(); IApplication app = appLoader.LoadApplication(); MainWindowPresenter mainWinPresenter = new MainWindowPresenter(); mainWinPresenter.MainView.Show(); app.RunApplication(mainWinPresenter.MainView); } catch (Exception ex) { string mes = ex.Message; if (ex.InnerException != null) { mes += ex.InnerException.Message; } System.Windows.MessageBox.Show(mes); } }
//------- Get notice -------- void CheckAllNotes() { try { Directory.CreateDirectory(PathMS + "/Temp/"); bool run = false; int k = 0; int del = -1; foreach (NoteRemind not in notice) { if (DateTime.Now > not.Datetime) { del = k; string pth = not.Path.Replace(".notesp", ".note"); File.WriteAllText(PathMS + "/Temp/Remind.dat", pth); run = true; } k++; } if (del > -1) { notice.RemoveAt(del); } if (run) { ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/My Spy.exe", out procInfo); } }catch (Exception ex) { DebugService.WriteError("" + ex); } }
public void RunCronFolder() { string folderPath; string[] files; try { folderPath = ("C:\\Cron"); files = Directory.GetFiles(folderPath); Directory.SetCurrentDirectory(folderPath); foreach (string file in files) { // the name of the application to launch String applicationName = file; // launch the application ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(applicationName, out procInfo); } } catch { } }
private TimeSpan Recover(RecoveryConfigItem rc) { ApplicationLoader.PROCESS_INFORMATION procInfo; var timeout = m_config.RecoveryExecutionTimeout; if (rc.OverrideRecoveryExecutionTimeout != 0) { timeout = rc.OverrideRecoveryExecutionTimeout; } var recoverTime = TimeSpan.FromMilliseconds((int)timeout); var watch = Stopwatch.StartNew(); // This is the way to go if running as a service. But when debugging we don't have this privelege. Just spawn a new process if (m_user.IsServiceAccount || m_user.IsSystemAccount) { ApplicationLoader.StartProcessAndBypassUAC(rc.RecoveryBatch, m_config.NoConsoleForRecoveryScript, timeout, PrintDebug, out procInfo); } else { ApplicationInlineLoader.Start(GetFile(rc.RecoveryBatch), m_config.NoConsoleForRecoveryScript, timeout, PrintDebug); } // Return the amount of time left to wait for recovery execution return(recoverTime - watch.Elapsed); }
//********* ONSTART *********** protected override void OnStart(string[] args) { DebugService.Write("******* " + DateTime.Now + " ********"); DebugService.Write("Start"); //nacitaju sa nastavenia MonApp = bool.Parse((string)registry.GetValue("MonitorApplications", "False")); Keylogger = bool.Parse((string)registry.GetValue("Keylogger", "False")); StatsEn = bool.Parse((string)registry.GetValue("Statistics", "True")); Internet = bool.Parse((string)registry.GetValue("Internet", "False")); DebugService.Write("Monitoring Applications: " + MonApp + " Keylogger: " + Keylogger + " Statistics: " + StatsEn); day = (short)DateTime.Now.Day; RestartD = DateTime.Now.Day; //kazdych 5 minut timer1 = new System.Timers.Timer(); timer1.Elapsed += new ElapsedEventHandler(OnTimer1_Tick); timer1.Interval = 300000; timer1.Enabled = true; //kazdu minutu timer2 = new System.Timers.Timer(); timer2.Elapsed += new ElapsedEventHandler(OnTimer2_Tick); timer2.Interval = 60000; timer2.Enabled = true; //timer pre odosielanie dat na Web - 20 minut timerWeb = new System.Timers.Timer(); timerWeb.Elapsed += new ElapsedEventHandler(OnTimerWeb_Tick); timerWeb.Interval = 1200000; timerWeb.Enabled = true; if (File.Exists(PathMS + "/Temp/ExpiredTime.dat")) { short TimeDay = short.Parse(File.ReadAllText(PathMS + "/Temp/ExpiredTime.dat")); if (TimeDay == day) { ShutDownVerify = true; ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/VerifyUser.exe", out procInfo); } else { ShutDownVerify = false; File.Delete(PathMS + "/Temp/ExpiredTime.dat"); } } if (MonApp) { ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo); LoadAppMonitoring(); } if (Keylogger || Internet) { StartWorker(); } if (StatsEn) { LoadStatistics(); } ReadNotice(); Directory.CreateDirectory(PathMS + "/Block/"); SetRemainingPCTime(); if (File.Exists(PathMS + "/Block/BlockApps.dat")) { SaveWriter set = new SaveWriter(PathMS + "/Block/BlockApps.dat"); set.Load(); BlockApps = set.GetItemBool("Enabled"); for (int i = 0; i < set.GetItemInt("Count"); i++) { blockapplist.Add(set.GetItem("Pr" + i)); } } DebugService.Write("PCTime: " + PCTime); client.BaseAddress = new Uri("http://myspy.diodegames.eu"); Newtonsoft.Json.Serialization.DefaultContractResolver dcr = new Newtonsoft.Json.Serialization.DefaultContractResolver(); dcr.DefaultMembersSearchFlags |= System.Reflection.BindingFlags.NonPublic; jss.ContractResolver = dcr; }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; UiHandler = configuration.HostUiHandler; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(configuration.AudioDeviceDriver); Memory = new MemoryBlock(configuration.MemoryConfiguration.ToDramSize()); Gpu = new GpuContext(configuration.GpuRenderer); MemoryAllocator = new NvMemoryAllocator(); Host1x = new Host1xDevice(Gpu.Synchronization); var nvdec = new NvdecDevice(Gpu.MemoryManager); var vic = new VicDevice(Gpu.MemoryManager); Host1x.RegisterDevice(ClassId.Nvdec, nvdec); Host1x.RegisterDevice(ClassId.Vic, vic); nvdec.FrameDecoded += (FrameDecodedEventArgs e) => { // FIXME: // Figure out what is causing frame ordering issues on H264. // For now this is needed as workaround. if (e.CodecId == CodecId.H264) { vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0); } else { vic.DisableSurfaceOverride(); } }; System = new Horizon(this); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); Initialize(); }
void ShutDownComputer() { ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/ShutDown_App.exe", out procInfo); }
public void StartProcessFromWindowService(string exePath) { //TODO: если откажемся от виндового сервиса, можно использовать нормальный Process.Start(exePath); ApplicationLoader.StartProcessAndBypassUAC(exePath, out var procInfo); }
public Switch( VirtualFileSystem fileSystem, ContentManager contentManager, AccountManager accountManager, UserChannelPersistence userChannelPersistence, IRenderer renderer, IHardwareDeviceDriver audioDeviceDriver, MemoryConfiguration memoryConfiguration) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioDeviceDriver == null) { throw new ArgumentNullException(nameof(audioDeviceDriver)); } if (userChannelPersistence == null) { throw new ArgumentNullException(nameof(userChannelPersistence)); } UserChannelPersistence = userChannelPersistence; _memoryConfiguration = memoryConfiguration; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(audioDeviceDriver); Memory = new MemoryBlock(memoryConfiguration.ToDramSize(), MemoryAllocationFlags.Reserve); Gpu = new GpuContext(renderer); MemoryAllocator = new NvMemoryAllocator(); Host1x = new Host1xDevice(Gpu.Synchronization); var nvdec = new NvdecDevice(Gpu.MemoryManager); var vic = new VicDevice(Gpu.MemoryManager); Host1x.RegisterDevice(ClassId.Nvdec, nvdec); Host1x.RegisterDevice(ClassId.Vic, vic); nvdec.FrameDecoded += (FrameDecodedEventArgs e) => { // FIXME: // Figure out what is causing frame ordering issues on H264. // For now this is needed as workaround. if (e.CodecId == CodecId.H264) { vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0); } else { vic.DisableSurfaceOverride(); } }; FileSystem = fileSystem; System = new Horizon(this, contentManager, accountManager, memoryConfiguration); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Hid.InitDevices(); Application = new ApplicationLoader(this, fileSystem, contentManager); TamperMachine = new TamperMachine(); }
//--------- ON Timer 1 Tick ----------- #endregion #region Timer2 //************ TIMER 2 (1 min) ******************** private void OnTimer2_Tick(object sender, ElapsedEventArgs e) { allmin++; if (allmin > 59) { allmin = 0; allhour++; } try { if (PCTime) { MaxTimePC--; if (MaxTimePC < 0) { if (File.Exists(PathMS + "/Temp/NoShutDownFirst.dat")) { File.Delete(PathMS + "/Temp/NoShutDownFirst.dat"); PCTime = false; } else { if (File.Exists(PathMS + "/Temp/ExpiredTime.dat")) { File.Delete(PathMS + "/Temp/ExpiredTime.dat"); } File.WriteAllText(PathMS + "/Temp/ExpiredTime.dat", "" + DateTime.Now.Day); ShutDownComputer(); if (MaxTimePC < -20) { MaxTimePC = -1; } } } if (warning) { if (MaxTimePC <= warningtime) { if (!WarningisShown) { File.WriteAllText(PathMS + "/Temp/shwwrn.dat", "True"); ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/RemainingTime.exe", out procInfo); WarningisShown = true; } } } SaveRemainingTime(); }//if PCTime }catch (Exception ex) { DebugService.WriteError("" + ex); } }
void SetRemainingPCTime() { if (!ShutDownVerify) { bool custommaxtimepc = false; if (File.Exists(PathMS + "/Block/RemTime.dat")) { save = new SaveWriter(PathMS + "/Block/RemTime.dat"); save.Load(); if (save.GetItemInt("Day") == DateTime.Now.Day) { MaxTimePC = save.GetItemInt("Time"); custommaxtimepc = true; } else { File.Delete(PathMS + "/Block/RemTime.dat"); } } if (File.Exists(PathMS + "/Block/ComputerTime.dat")) { SaveWriter save = new SaveWriter(PathMS + "/Block/ComputerTime.dat"); save.Load(); if (save.GetItemBool("Enable")) { PCTime = true; DateTime time = DateTime.Parse(save.GetItem("Time")); if (!custommaxtimepc) { MaxTimePC = (time.Hour * 60) + time.Minute; } warning = save.GetItemBool("Warning"); warningtime = save.GetItemInt("WarningTime"); if (MaxTimePC <= 1) { if (File.Exists(PathMS + "/Temp/ExpiredTime.dat")) { File.Delete(PathMS + "/Temp/ExpiredTime.dat"); } File.WriteAllText(PathMS + "/Temp/ExpiredTime.dat", "" + DateTime.Now.Day); PCTime = false; ShutDownVerify = true; ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/VerifyUser.exe", out procInfo); } } save.Destroy(); } else { PCTime = false; } } }