コード例 #1
0
            public bool ExecuteStep()
            {
                try
                {
                    CmdExecuteHelper.ExecuteCommand(ToString(), Path.GetDirectoryName(pathToLatexFile));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(false);
                }

                if (destinationPath.Length > 0)
                {
                    //if any destination file path is given, copy and rename the file to the destination
                    var pdfFile = Path.GetDirectoryName(pathToLatexFile) + @"/" + Path.GetFileNameWithoutExtension(pathToLatexFile) + ".pdf";
                    if (File.Exists(pdfFile))
                    {
                        if (!Directory.Exists(Path.GetDirectoryName(destinationPath)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));
                        }

                        try
                        {
                            File.Copy(pdfFile, destinationPath, true);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            return(false);
                        }
                    }
                }

                return(true);
            }
コード例 #2
0
        private void ResetNetworkButton_OnClick(object sender, RoutedEventArgs e)
        {
            var result = CmdExecuteHelper.Execute("netsh winsock reset");

            MessageBox.Show(Window.GetWindow(this), result, "提示");
        }