Skip to content

Commit

Permalink
Update source & zip
Browse files Browse the repository at this point in the history
Update source & zip
  • Loading branch information
zzzprojects committed May 13, 2018
1 parent 241cfaa commit 7eb1ea3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
Binary file modified docs/downloads/fnr.zip
Binary file not shown.
9 changes: 5 additions & 4 deletions src/FindAndReplace.App/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ public class CommandLineOptions
[Option("KeepModifiedDate", HelpText = "Keep Modified Date.")]
public bool IsKeepModifiedDate { get; set; }


[Option("consoleByProcessId", HelpText = "If the console should be found by process id")]
public bool IsConsoleByProcessId { get; set; }


#endregion
#endregion

#region Specialized Option Attribute
#region Specialized Option Attribute

[HelpOption("help", HelpText = "Display this help screen.")]
[HelpOption("help", HelpText = "Display this help screen.")]
public string GetUsage()
{
var help = new HelpText("Find And Replace");
Expand Down
1 change: 1 addition & 0 deletions src/FindAndReplace.App/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/FindAndReplace.App/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public partial class MainForm : Form
public MainForm()
{
InitializeComponent();
this.Text = this.Text + " (v" + Application.ProductVersion + ")";
}


Expand Down
27 changes: 23 additions & 4 deletions src/FindAndReplace.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,30 @@ private static int Main(string[] args)
AppDomain.CurrentDomain.AssemblyResolve += ResolveEventHandler;

if (args.Length != 0 && args.Contains("--cl"))
{
//Get a parent procss for see where send the output.
Process process = Process.GetProcessById(Process.GetCurrentProcess().Id).Parent();
{
Process process = null;

if (args.Contains("--consoleByProcessId"))
{
//Get a parent procss for see where send the output.
process = Process.GetProcessById(Process.GetCurrentProcess().Id).Parent();
}
else
{
//Get a pointer to the forground window. The idea here is that
//IF the user is starting our application from an existing console
//shell, that shell will be the uppermost window. We'll get it
//and attach to it
IntPtr ptr = GetForegroundWindow();

int u;

GetWindowThreadProcessId(ptr, out u);

process = Process.GetProcessById(u);
}

if (process.ProcessName == "cmd") //Is the uppermost window a cmd process?
if (process.ProcessName == "cmd") //Is the uppermost window a cmd process?
{
AttachConsole(process.Id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/FindAndReplace.App/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.6")]
[assembly: AssemblyFileVersion("1.7.6")]
[assembly: AssemblyVersion("1.7.8")]
[assembly: AssemblyFileVersion("1.7.8")]

0 comments on commit 7eb1ea3

Please sign in to comment.