Esempio n. 1
0
        private static void Run()
        {
            string input = GetInput();

            if (!string.IsNullOrEmpty(input))
            {
                ChromeInput chromeInput = JsonConvert.DeserializeObject <ChromeInput>(input);

                if (chromeInput != null)
                {
                    string argument = null;

                    if (!string.IsNullOrEmpty(chromeInput.URL))
                    {
                        argument = EscapeText(chromeInput.URL);
                    }
                    else if (!string.IsNullOrEmpty(chromeInput.Text))
                    {
                        string filepath = GetTempPath("txt");
                        File.WriteAllText(filepath, chromeInput.Text, Encoding.UTF8);
                        argument = EscapeText(filepath);
                    }

                    if (!string.IsNullOrEmpty(argument))
                    {
                        string path = GetAbsolutePath("ShareX.exe");
                        Process.Start(path, argument);
                    }
                }
            }
        }
Esempio n. 2
0
        private static void Run()
        {
            string input = GetInput();

            if (!string.IsNullOrEmpty(input))
            {
                ChromeInput chromeInput = JsonConvert.DeserializeObject <ChromeInput>(input);

                if (chromeInput != null)
                {
                    string argument = null;

                    if (!string.IsNullOrEmpty(chromeInput.URL))
                    {
                        argument = Helpers.EscapeCLIText(chromeInput.URL);
                    }
                    else if (!string.IsNullOrEmpty(chromeInput.Text))
                    {
                        string filepath = Helpers.GetTempPath("txt");
                        File.WriteAllText(filepath, chromeInput.Text, Encoding.UTF8);
                        argument = $"\"{filepath}\"";
                    }

                    if (!string.IsNullOrEmpty(argument))
                    {
                        string path = Helpers.GetAbsolutePath("ShareX.exe");

                        NativeMethods.CreateProcess(path, argument, CreateProcessFlags.CREATE_BREAKAWAY_FROM_JOB);
                    }
                }
            }
        }