Beispiel #1
0
        public void CanGetAudioClockClient()
        {
            OSUtils.RequireVista();
            var enumerator = new MMDeviceEnumerator();

            var captureClient = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console).AudioClient;

            var REFTIMES_PER_MILLISEC = 10000;

            captureClient.Initialize(AudioClientShareMode.Shared, AudioClientStreamFlags.None,
                                     REFTIMES_PER_MILLISEC * 100, 0, captureClient.MixFormat, Guid.Empty);

            // get AUDCLNT_E_NOT_INITIALIZED if not init

            var clock = captureClient.AudioClockClient;

            Console.WriteLine("Clock Frequency: {0}", clock.Frequency);
            ulong p;
            ulong qpc;

            clock.GetPosition(out p, out qpc);
            Console.WriteLine("Clock Position: {0}:{1}", p, qpc);
            Console.WriteLine("Adjusted Position: {0}", clock.AdjustedPosition);
            Console.WriteLine("Can Adjust Position: {0}", clock.CanAdjustPosition);
            Console.WriteLine("Characteristics: {0}", clock.Characteristics);
            captureClient.Dispose();
        }
        /// <summary>
        /// Expands any Unix-style environment variables.
        /// </summary>
        /// <param name="commandLine">The command-line to expand.</param>
        private List <string> ExpandCommandLine(IEnumerable <ArgBase> commandLine)
        {
            var result = new List <string>();

            foreach (var part in commandLine)
            {
                switch (part)
                {
                case Arg arg:
                    result.Add(OSUtils.ExpandVariables(arg.Value, _startInfo.EnvironmentVariables));
                    break;

                case ForEachArgs forEach:
                    string valueToSplit = _startInfo.EnvironmentVariables[forEach.ItemFrom];
                    if (!string.IsNullOrEmpty(valueToSplit))
                    {
                        var items = valueToSplit.Split(
                            new[] { forEach.Separator ?? Path.PathSeparator.ToString(CultureInfo.InvariantCulture) }, StringSplitOptions.None);
                        foreach (string item in items)
                        {
                            _startInfo.EnvironmentVariables["item"] = item;
                            result.AddRange(forEach.Arguments.Select(arg => OSUtils.ExpandVariables(arg.Value, _startInfo.EnvironmentVariables)));
                        }
                        _startInfo.EnvironmentVariables.Remove("item");
                    }
                    break;

                default:
                    throw new NotSupportedException($"Unknown command-line part: {part}");
                }
            }

            return(result);
        }
Beispiel #3
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            // Left Panel
            UIHelpers.InitCombox(prevClipboardTypeCombox, 0);
            UIHelpers.InitCombox(preResizeScale, 1);
            UIHelpers.InitCombox(preResizeMode, 0);
            UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0);
            // Right Panel
            UIHelpers.InitCombox(prevOverwriteCombox, 0);
            UIHelpers.InitCombox(prevOutputFormatCombox, 0);
            UIHelpers.FillEnumComboBox(prevOutputFormatCombox, typeof(Upscale.ExportFormats));
            UIHelpers.InitCombox(postResizeScale, 1);
            UIHelpers.InitCombox(postResizeMode, 0);
            UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0);
            // Batch Upscale
            UIHelpers.InitCombox(batchOutMode, 0);
            UIHelpers.InitCombox(preprocessMode, 0);
            await CheckInstallation();

            EmbeddedPython.Init();

            EsrganData.CheckModelDir();
            EsrganData.ReloadModelList();

            NvApi.Init();

            if (OSUtils.IsUserAdministrator())
            {
                Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning");
            }
        }
Beispiel #4
0
        public MainForm()
        {
            InitializeComponent();

            EventfulList <Instance> instList = new EventfulList <Instance>();

            InstanceList = instList;

            instList.Added   += InstAdded;
            instList.Removed += InstRemoved;

            // If on windows, set the theme for our instance list.
            if (OSUtils.OS == OSEnum.Windows)
            {
                OSUtils.SetWindowTheme(instView.Handle, "explorer", null);
            }

            EventfulList <Task> tList = new EventfulList <Task>();

            tList.Added   += TaskAdded;
            tList.Removed += TaskRemoved;
            TaskList       = tList;

            //mainLayoutPanel.

            statusStrips = new Dictionary <int, StatusStrip>();
        }
Beispiel #5
0
        private static Tuple <double, double> GetLinxMemoryInGB()
        {
            try
            {
                var results    = OSUtils.StartProcessWithResults("cat", "/proc/meminfo");
                var resultsArr = results.Split('n');
                var freeKB     = resultsArr
                                 .FirstOrDefault(x => x.StartsWith("FreeMem"))
                                 .Split(" ".ToCharArray(), 2)
                                 .Last() // 9168236 kB
                                 .Trim()
                                 .Split(' ')
                                 .First(); // 9168236

                var totalKB = resultsArr
                              .FirstOrDefault(x => x.StartsWith("MemTotal"))
                              .Split(" ".ToCharArray(), 2)
                              .Last() // 16637468 kB
                              .Trim()
                              .Split(' ')
                              .First(); // 16637468

                var freeGB  = Math.Round((double.Parse(freeKB) / 1024 / 1024), 2);
                var totalGB = Math.Round((double.Parse(totalKB) / 1024 / 1024), 2);

                return(new Tuple <double, double>(freeGB, totalGB));
            }
            catch
            {
                return(new Tuple <double, double>(0, 0));
            }
        }
Beispiel #6
0
        private void StartLinuxScreenCaster(string args)
        {
            var xauthority = OSUtils.StartProcessWithResults("find", $"/ -name Xauthority").Split('\n', StringSplitOptions.RemoveEmptyEntries).First();
            var display    = ":0";
            var whoString  = OSUtils.StartProcessWithResults("who", "")?.Trim();
            var username   = string.Empty;

            if (!string.IsNullOrWhiteSpace(whoString))
            {
                var whoLine  = whoString.Split('\n', StringSplitOptions.RemoveEmptyEntries).First();
                var whoSplit = whoLine.Split(' ', StringSplitOptions.RemoveEmptyEntries);
                username = whoSplit[0];
                display  = whoSplit.Last().Trim('(').Trim(')');
                args     = $"-u {username} {args}";
            }

            var psi = new ProcessStartInfo()
            {
                FileName  = "sudo",
                Arguments = args
            };

            psi.Environment.Add("DISPLAY", display);
            psi.Environment.Add("XAUTHORITY", xauthority);
            Logger.Write($"Attempting to launch screen caster with username {username}, xauthority {xauthority}, and display {display}.");
            Process.Start(psi);
        }
 public static void PathAsciiCheck(string path, string pathTitle)
 {
     if (IOUtils.HasBadChars(path) || OSUtils.HasNonAsciiChars(path))
     {
         ShowMessage($"Warning: Your {pathTitle} includes special characters. This might cause problems.");
     }
 }
        private string getDefaultUserDir()
        {
            string userDir = null;

            switch (OSUtils.determineOS())
            {
            case OS.Windows:
                userDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Paradox Interactive", "Crusader Kings II");
                break;

            case OS.Mac:
                // Environment.SpecialFolder.MyDocuments does not add /Documents/ on Mac
                userDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Documents", "Paradox Interactive", "Crusader Kings II");
                break;

            case OS.Linux:
                userDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".paradoxinteractive", "Crusader Kings II");
                break;

            case OS.Other:
                logger.Error("Unkown operating system, cannot lookup mods mods, platformID:  " + System.Environment.OSVersion.Platform);
                break;
            }
            return(userDir);
        }
 public void CanGetDefaultAudioEndpoint()
 {
     OSUtils.RequireVista();
     MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
     MMDevice defaultAudioEndpoint = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console);
     Assert.IsNotNull(defaultAudioEndpoint);
 }
Beispiel #10
0
 internal static PointF GetScale(this Control control)
 {
     if (control == null)
     {
         throw new ArgumentNullException(nameof(control));
     }
     return(OSUtils.GetScale(control.Handle));
 }
Beispiel #11
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists(Path.Combine(Paths.GetExeDir(), "runtimes")) && Paths.GetExeDir().ToLower().Contains("temp"))
            {
                MessageBox.Show("You seem to be running Flowframes out of an archive.\nPlease extract the whole archive first!", "Error");
                IOUtils.TryDeleteIfExists(Paths.GetDataPath());
                Application.Exit();
            }

            // Left Panel
            UIHelpers.InitCombox(prevClipboardTypeCombox, 0);
            UIHelpers.InitCombox(preResizeScale, 1);
            UIHelpers.InitCombox(preResizeMode, 0);
            UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0);
            // Right Panel
            UIHelpers.InitCombox(prevOverwriteCombox, 0);
            UIHelpers.InitCombox(imageOutputFormat, 0);
            UIHelpers.FillEnumComboBox(imageOutputFormat, typeof(Upscale.ImgExportMode));
            UIHelpers.FillEnumComboBox(videoOutputFormat, typeof(Upscale.VidExportMode));
            UIHelpers.InitCombox(postResizeScale, 1);
            UIHelpers.InitCombox(postResizeMode, 0);
            UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0);
            // Batch Upscale
            UIHelpers.InitCombox(batchOutMode, 0);
            UIHelpers.InitCombox(preprocessMode, 0);
            UIHelpers.InitCombox(batchCacheSplitDepth, 0);
            // Video Upscale
            UIHelpers.InitCombox(videoPreprocessMode, 1);

            await CheckInstallation();

            await EmbeddedPython.Init();

            EsrganData.CheckModelDir();
            EsrganData.ReloadModelList();

            NvApi.Init();

            if (OSUtils.IsUserAdministrator())
            {
                Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning");
            }

            LoadEsrganOptions();

            flowPanelLeft.AutoScroll = false;
            flowPanelLeft.HorizontalScroll.Maximum = 0;
            flowPanelLeft.VerticalScroll.Visible   = false;
            flowPanelLeft.AutoScroll = true;

            flowPanelRight.AutoScroll = false;
            flowPanelRight.HorizontalScroll.Maximum = 0;
            flowPanelRight.VerticalScroll.Visible   = false;
            flowPanelRight.AutoScroll = true;

            initialized = true;
            BusyCheckLoop();
        }
 public void CanEnumerateCaptureDevices()
 {
     OSUtils.RequireVista();
     MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
     foreach (MMDevice device in enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.All))
     {
         Debug.WriteLine(String.Format("{0}, {1}", device.FriendlyName, device.State));
     }
 }
 public void CanEnumerateDevicesInVista()
 {
     OSUtils.RequireVista();
     MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
     foreach (MMDevice devices in enumerator.EnumerateAudioEndPoints(DataFlow.All,DeviceState.All))
     {
         Debug.WriteLine(devices);
     }
 }
Beispiel #14
0
        public ChangeIconForm()
        {
            InitializeComponent();

            if (OSUtils.OS == OSEnum.Windows)
            {
                OSUtils.SetWindowTheme(iconView.Handle, "explorer", null);
            }
        }
        public RestoreBackupDialog()
        {
            InitializeComponent();
            backupView.Items.Clear();

            if (OSUtils.OS == OSEnum.Windows)
            {
                OSUtils.SetWindowTheme(backupView.Handle, "explorer", null);
            }
        }
        public SaveManagerDialog()
        {
            InitializeComponent();

            UpdateButtons();

            if (OSUtils.OS == OSEnum.Windows)
            {
                OSUtils.SetWindowTheme(saveView.Handle, "explorer", null);
            }
        }
        public static async Task InitInput(TextBox outputTbox, TextBox inputTbox, TextBox fpsInTbox)
        {
            Program.mainForm.SetTab("interpolate");
            Program.mainForm.ResetInputInfo();
            string path = inputTbox.Text.Trim();

            InterpolateUtils.PathAsciiCheck(path, "input path");

            if (Config.GetBool("clearLogOnInput"))
            {
                Logger.ClearLogBox();
            }

            outputTbox.Text            = inputTbox.Text.Trim().GetParentDir();
            Program.lastInputPath      = path;
            Program.lastInputPathIsSsd = OSUtils.DriveIsSSD(path);

            if (!Program.lastInputPathIsSsd)
            {
                Logger.Log("Your file seems to be on an HDD or USB device. It is recommended to interpolate videos on an SSD drive for best performance.");
            }

            Logger.Log("Loading metadata...");
            Program.mainForm.currInDuration    = FfmpegCommands.GetDuration(path);
            Program.mainForm.currInDurationCut = Program.mainForm.currInDuration;
            int frameCount = await InterpolateUtils.GetInputFrameCountAsync(path);

            string fpsStr = "Not Found";
            float  fps    = await IOUtils.GetFpsFolderOrVideo(path);

            fpsInTbox.Text = fps.ToString();

            if (fps > 0)
            {
                fpsStr = fps.ToString();
            }

            Logger.Log($"Video FPS: {fpsStr} - Total Number Of Frames: {frameCount}", false, true);
            Program.mainForm.GetInputFpsTextbox().ReadOnly = fps > 0;
            Program.mainForm.currInFps    = fps;
            Program.mainForm.currInFrames = frameCount;
            Program.mainForm.UpdateInputInfo();
            CheckExistingFolder(path, outputTbox.Text.Trim());
            await Task.Delay(10);

            await PrintResolution(path);

            Dedupe.ClearCache();
            await Task.Delay(10);

            InterpolateUtils.SetPreviewImg(await GetThumbnail(path));
        }
        string GetSysPythonOutput()
        {
            Process py = OSUtils.NewProcess(true);

            py.StartInfo.Arguments = "/C python -V";
            Logger.Log("[DepCheck] CMD: " + py.StartInfo.Arguments);
            py.Start();
            py.WaitForExit();
            string output = py.StandardOutput.ReadToEnd();
            string err    = py.StandardError.ReadToEnd();

            return(output + "\n" + err);
        }
Beispiel #19
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            // Left Panel
            UIHelpers.InitCombox(prevClipboardTypeCombox, 0);
            UIHelpers.InitCombox(preResizeScale, 1);
            UIHelpers.InitCombox(preResizeMode, 0);
            UIHelpers.FillEnumComboBox(preResizeFilter, typeof(Upscale.Filter), 0);
            // Right Panel
            UIHelpers.InitCombox(prevOverwriteCombox, 0);
            UIHelpers.InitCombox(imageOutputFormat, 0);
            UIHelpers.FillEnumComboBox(imageOutputFormat, typeof(Upscale.ImgExportMode));
            UIHelpers.FillEnumComboBox(videoOutputFormat, typeof(Upscale.VidExportMode));
            UIHelpers.InitCombox(postResizeScale, 1);
            UIHelpers.InitCombox(postResizeMode, 0);
            UIHelpers.FillEnumComboBox(postResizeFilter, typeof(Upscale.Filter), 0);
            // Batch Upscale
            UIHelpers.InitCombox(batchOutMode, 0);
            UIHelpers.InitCombox(preprocessMode, 0);
            UIHelpers.InitCombox(batchCacheSplitDepth, 0);
            // Video Upscale
            UIHelpers.InitCombox(videoPreprocessMode, 1);

            await CheckInstallation();

            await EmbeddedPython.Init();

            EsrganData.CheckModelDir();
            EsrganData.ReloadModelList();

            NvApi.Init();

            if (OSUtils.IsUserAdministrator())
            {
                Program.ShowMessage("Cupscale is running as administrator.\nThis will break Drag-n-Drop functionality.", "Warning");
            }

            LoadEsrganOptions();

            flowPanelLeft.AutoScroll = false;
            flowPanelLeft.HorizontalScroll.Maximum = 0;
            flowPanelLeft.VerticalScroll.Visible   = false;
            flowPanelLeft.AutoScroll = true;

            flowPanelRight.AutoScroll = false;
            flowPanelRight.HorizontalScroll.Maximum = 0;
            flowPanelRight.VerticalScroll.Visible   = false;
            flowPanelRight.AutoScroll = true;

            initialized = true;
            BusyCheckLoop();
        }
Beispiel #20
0
        private static void RegisterConfig(ContainerBuilder cb)
        {
            cb.Register(c => new ProgramContext(
                            cancellationTokenSource: new CancellationTokenSource(),
                            operationSystem: OSUtils.GetOperationSystem())
                        ).AsSelf().SingleInstance();

            cb.Register(c => new AppConfig(
                            runFrequency: TimeSpan.FromMinutes(1),
                            timeZoneInfo: TimeZoneInfo.Local)
                        ).AsSelf().SingleInstance();

            cb.Register(c => new RunConfig(DateTime.UtcNow)).AsSelf().InstancePerLifetimeScope();
        }
Beispiel #21
0
        private int StartLinuxScreenCaster(string args)
        {
            var xauthority = string.Empty;

            var processes = OSUtils.StartProcessWithResults("ps", "-eaf").Split(Environment.NewLine);
            var xorgLine  = processes.FirstOrDefault(x => x.Contains("xorg"));
            var xorgSplit = xorgLine.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList();
            var auth      = xorgSplit[xorgSplit.IndexOf("-auth") + 1];

            if (!string.IsNullOrWhiteSpace(auth))
            {
                xauthority = auth;
            }

            var display   = ":0";
            var whoString = OSUtils.StartProcessWithResults("w", "-h")?.Trim();
            var username  = string.Empty;

            if (!string.IsNullOrWhiteSpace(whoString))
            {
                try
                {
                    var whoLine = whoString
                                  .Split('\n', StringSplitOptions.RemoveEmptyEntries)
                                  .First();

                    var whoSplit = whoLine.Split(' ', StringSplitOptions.RemoveEmptyEntries);
                    username   = whoSplit[0];
                    display    = whoSplit[2];
                    xauthority = $"/home/{username}/.Xauthority";
                    args       = $"-u {username} {args}";
                }
                catch (Exception ex)
                {
                    Logger.Write(ex);
                }
            }

            var psi = new ProcessStartInfo()
            {
                FileName  = "sudo",
                Arguments = args
            };

            psi.Environment.Add("DISPLAY", display);
            psi.Environment.Add("XAUTHORITY", xauthority);
            Logger.Write($"Attempting to launch screen caster with username {username}, xauthority {xauthority}, display {display}, and args {args}.");
            return(Process.Start(psi).Id);
        }
Beispiel #22
0
 public static void KillEsrgan(bool cleanup = true)
 {
     if (currentEsrganProcess == null || currentEsrganProcess.HasExited)
     {
         return;
     }
     cancelled = true;
     OSUtils.KillProcessTree(currentEsrganProcess.Id);
     if (cleanup)
     {
         IOUtils.ClearDir(Paths.imgInPath);
         IOUtils.ClearDir(Paths.imgOutPath);
         IOUtils.ClearDir(Paths.imgOutNcnnPath);
     }
 }
Beispiel #23
0
        public static string RunAndGetOutput(string args)
        {
            Process ffmpeg = OSUtils.NewProcess(true);

            ffmpeg.StartInfo.Arguments = "/C cd /D " + Paths.esrganPath.Wrap() + " & ffmpeg.exe -hide_banner -y -stats " + args;
            ffmpeg.Start();
            ffmpeg.WaitForExit();
            string output = ffmpeg.StandardOutput.ReadToEnd();
            string err    = ffmpeg.StandardError.ReadToEnd();

            if (!string.IsNullOrWhiteSpace(err))
            {
                output = output + "\n" + err;
            }
            return(output);
        }
Beispiel #24
0
        public static Dictionary <string, string> filenameMap = new Dictionary <string, string>();   // TODO: Store on disk instead for crashes?

        public static void Kill()
        {
            if (lastAiProcess == null)
            {
                return;
            }

            try
            {
                OSUtils.KillProcessTree(lastAiProcess.Id);
            }
            catch (Exception e)
            {
                Logger.Log($"Failed to kill currentAiProcess process tree: {e.Message}", true);
            }
        }
        string GetEmbedPythonOutput()
        {
            Process py = OSUtils.NewProcess(true);

            py.StartInfo.Arguments = "\"/C\" " + EmbeddedPython.GetEmbedPyPath().Wrap() + " -V";
            Logger.Log("[DepCheck] CMD: " + py.StartInfo.Arguments);
            py.Start();
            py.WaitForExit();
            string output = py.StandardOutput.ReadToEnd();
            string err    = py.StandardError.ReadToEnd();

            if (!string.IsNullOrWhiteSpace(err))
            {
                output += "\n" + err;
            }
            return(output);
        }
Beispiel #26
0
        public static string GetFfprobeOutput(string args)
        {
            Process ffprobe = OSUtils.NewProcess(true);

            ffprobe.StartInfo.Arguments = $"{GetCmdArg()} cd /D {GetAvDir().Wrap()} & ffprobe.exe {args}";
            Logger.Log("cmd.exe " + ffprobe.StartInfo.Arguments, true, false, "ffmpeg");
            ffprobe.Start();
            ffprobe.WaitForExit();
            string output = ffprobe.StandardOutput.ReadToEnd();
            string err    = ffprobe.StandardError.ReadToEnd();

            if (!string.IsNullOrWhiteSpace(err))
            {
                output += "\n" + err;
            }
            return(output);
        }
Beispiel #27
0
        public static async Task RunFfmpeg(string args, string workingDir, LogMode logMode, string loglevel, TaskType taskType = TaskType.Other, bool progressBar = false)
        {
            lastOutputFfmpeg = "";
            currentLogMode   = logMode;
            showProgressBar  = progressBar;
            Process ffmpeg = OSUtils.NewProcess(true);

            timeSinceLastOutput.Restart();
            lastAvProcess = ffmpeg;
            lastTask      = taskType;

            if (string.IsNullOrWhiteSpace(loglevel))
            {
                loglevel = defLogLevel;
            }

            if (!string.IsNullOrWhiteSpace(workingDir))
            {
                ffmpeg.StartInfo.Arguments = $"{GetCmdArg()} cd /D {workingDir.Wrap()} & {Path.Combine(GetAvDir(), "ffmpeg.exe").Wrap()} -hide_banner -loglevel {loglevel} -y -stats {args}";
            }
            else
            {
                ffmpeg.StartInfo.Arguments = $"{GetCmdArg()} cd /D {GetAvDir().Wrap()} & ffmpeg.exe -hide_banner -loglevel {loglevel} -y -stats {args}";
            }

            if (logMode != LogMode.Hidden)
            {
                Logger.Log("Running ffmpeg...", false);
            }
            Logger.Log("cmd.exe " + ffmpeg.StartInfo.Arguments, true, false, "ffmpeg");
            ffmpeg.OutputDataReceived += new DataReceivedEventHandler(FfmpegOutputHandler);
            ffmpeg.ErrorDataReceived  += new DataReceivedEventHandler(FfmpegOutputHandler);
            ffmpeg.Start();
            ffmpeg.BeginOutputReadLine();
            ffmpeg.BeginErrorReadLine();

            while (!ffmpeg.HasExited)
            {
                await Task.Delay(1);
            }

            if (progressBar)
            {
                Program.mainForm.SetProgress(0);
            }
        }
Beispiel #28
0
        public EditModsForm(Instance inst)
        {
            InitializeComponent();

            this.inst = inst;

            if (OSUtils.OS == OSEnum.Windows && OSUtils.Runtime != Runtime.Mono)
            {
                OSUtils.SetWindowTheme(modView.Handle, "explorer", null);
                OSUtils.SetWindowTheme(mlModView.Handle, "explorer", null);
                OSUtils.SetWindowTheme(resourceView.Handle, "explorer", null);
            }

            inst.InstMods.ModFileChanged += InstMods_ModFileChanged;

            this.FormClosed += (o, args) =>
                               inst.InstMods.ModFileChanged -= InstMods_ModFileChanged;
        }
Beispiel #29
0
        public static async Task RunGifski(string args)
        {
            Process ffmpeg = OSUtils.NewProcess(true);

            ffmpeg.StartInfo.Arguments = $"/C cd /D {Paths.esrganPath.Wrap()} & gifski.exe {args}";
            Logger.Log("Running gifski...");
            Logger.Log("cmd.exe " + ffmpeg.StartInfo.Arguments);
            ffmpeg.OutputDataReceived += new DataReceivedEventHandler(OutputHandlerGifski);
            ffmpeg.ErrorDataReceived  += new DataReceivedEventHandler(OutputHandlerGifski);
            ffmpeg.Start();
            ffmpeg.BeginOutputReadLine();
            ffmpeg.BeginErrorReadLine();
            while (!ffmpeg.HasExited)
            {
                await Task.Delay(100);
            }
            Logger.Log("Done running gifski.");
        }
Beispiel #30
0
        public void CanEnumerateDevicesInVista()
        {
            OSUtils.RequireVista();
            MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
            var devices = enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All);

            foreach (MMDevice device in devices)
            {
                if (device.State != DeviceState.NotPresent)
                {
                    Debug.WriteLine(String.Format("{0}, {1}", device.FriendlyName, device.State));
                }
                else
                {
                    Debug.WriteLine(String.Format("{0}, {1}", device.ID, device.State));
                }
            }
        }