Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A few minorish updates:

- Closing the wrapper app now actually closes the playdar daemon
- The scanner window stays open on completion, so you can check what it scanned if doing a small set of folders
- I know correctly use the Program Files variable so it can deal with different Windows installation drives (Steve!)
- Update the log colouring stuff to understand the new output the playdar daemon gives us
  • Loading branch information...
commit df1d1a5030f65083dada0975edaecebab915d642 1 parent 3d6f905
@lozzd authored
View
32 PlaydarWin/PlaydarWin/frmMain.cs
@@ -8,6 +8,7 @@
using System.Text.RegularExpressions;
using System.IO;
using System.Security.Principal;
+using System.Diagnostics;
namespace PlaydarWin
{
@@ -54,10 +55,25 @@ private void writeStreamInfo(object sender, DataReceivedEventArgs e)
this.richTextBox1.SelectionColor = Color.Red;
this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
}
+ if (e.Text.Contains("No matches for:"))
+ {
+ this.richTextBox1.SelectionColor = Color.Red;
+ this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
+ }
else if (e.Text.Contains("ACCEPTED")) {
this.richTextBox1.SelectionColor = Color.Green;
this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
}
+ else if (e.Text.Contains("RESOLVER add_results"))
+ {
+ this.richTextBox1.SelectionColor = Color.Green;
+ this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
+ }
+ else if (e.Text.Contains("LAN_UDP responding for "))
+ {
+ this.richTextBox1.SelectionColor = Color.Green;
+ this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
+ }
else if (e.Text.Contains("/api/?method=resolve")) {
this.richTextBox1.SelectionColor = Color.Blue;
this.richTextBox1.SelectedText = e.Text + Environment.NewLine;
@@ -99,18 +115,18 @@ private void processCompletedOrCanceled(object sender, EventArgs e)
private void btnOk_Click_1(object sender, EventArgs e)
{
- if (!File.Exists("C:/program files/playdar/playdar.exe"))
+ if (!File.Exists(Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\playdar.exe"))
{
- MessageBox.Show("The Playdar executable could not be found. "+ Environment.NewLine + "I am currently looking in: "+ Environment.NewLine + @"C:\Program Files\Playdar\playdar.exe"+ Environment.NewLine + Environment.NewLine + "Please ensure the executable is there.","Playdar Critical Error",MessageBoxButtons.OK,MessageBoxIcon.Stop);
+ MessageBox.Show("The Playdar executable could not be found. "+ Environment.NewLine + "I am currently looking in: "+ Environment.NewLine + Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\playdar.exe"+ Environment.NewLine + Environment.NewLine + "Please ensure the executable is there.","Playdar Critical Error",MessageBoxButtons.OK,MessageBoxIcon.Stop);
Close();
}
this.Cursor = Cursors.AppStarting;
this.btnOk.Enabled = false;
processCaller = new ProcessCaller(this);
- processCaller.WorkingDirectory = "C:/program files/playdar/";
- processCaller.FileName = @"C:/program files/playdar/playdar.exe";
- processCaller.Arguments = "-c playdar.ini --app.name \"" + WindowsIdentity.GetCurrent().Name + "\" ";
+ processCaller.WorkingDirectory = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\";
+ processCaller.FileName = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\playdar.exe";
+ processCaller.Arguments = "-c playdar.conf";
processCaller.StdErrReceived += new DataReceivedHandler(writeStreamInfo);
processCaller.StdOutReceived += new DataReceivedHandler(writeStreamInfo);
processCaller.Completed += new EventHandler(processCompletedOrCanceled);
@@ -157,6 +173,10 @@ private void frmMain_Resize(object sender, System.EventArgs e)
private void frmMain_Close(object sender, System.EventArgs e)
{
// TODO: we should probably kill playdar here,
+ // so er, this might work. let's try.
+ Process[] myProcesses;
+ myProcesses = Process.GetProcessesByName("playdar");
+ myProcesses[0].Kill();
}
private void button1_Click(object sender, EventArgs e)
@@ -165,7 +185,7 @@ private void button1_Click(object sender, EventArgs e)
// Eventually we'll do something nice with the GUI again but
// I'm not sure what. So for now, lets just launch notepad. Leet.
- System.Diagnostics.Process.Start(@"notepad.exe", @"C:\Program Files\Playdar\playdar.ini");
+ System.Diagnostics.Process.Start(@"notepad.exe", Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\playdar.conf");
//if (File.Exists(@"C:\Program Files\Playdar\playdarconfig.exe"))
//{
View
6 PlaydarWin/PlaydarWin/frmScan.cs
@@ -30,7 +30,7 @@ private void processCompletedOrCanceled(object sender, EventArgs e)
{
this.Cursor = Cursors.Default;
frmMain.notifyIcon1.ShowBalloonTip(5000, "Playdar Scanner", "File scanning has completed. You may now launch Playdar.", ToolTipIcon.Info);
- this.Close();
+ this.richTextBox1.AppendText(Environment.NewLine + "Playdar scanner completed. Review these results if you wish, then click 'Start Playdar'");
}
private void frmScan_Load(object sender, EventArgs e)
@@ -43,8 +43,8 @@ private void StartScan()
folderBrowserDialog1.ShowDialog();
processCaller = new ProcessCaller(this);
- processCaller.WorkingDirectory = "C:/program files/playdar/";
- processCaller.FileName = @"C:/program files/playdar/scanner.exe";
+ processCaller.WorkingDirectory = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\";
+ processCaller.FileName = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Playdar\playdar-scanner.exe";
processCaller.Arguments = "collection.db \"" + folderBrowserDialog1.SelectedPath + "\"";
processCaller.StdErrReceived += new DataReceivedHandler(writeStreamInfo);
processCaller.StdOutReceived += new DataReceivedHandler(writeStreamInfo);
View
2  PlaydarWin/PlaydarWin/obj/PlaydarWin.csproj.FileList.txt
@@ -10,8 +10,8 @@ bin\Release\PlaydarWin.exe
bin\Release\PlaydarWin.pdb
obj\Release\ResolveAssemblyReference.cache
obj\Release\PlaydarWin.frmMain.resources
+obj\Release\PlaydarWin.frmScan.resources
obj\Release\PlaydarWin.Properties.Resources.resources
obj\Release\PlaydarWin.csproj.GenerateResource.Cache
obj\Release\PlaydarWin.exe
obj\Release\PlaydarWin.pdb
-obj\Release\PlaydarWin.frmScan.resources
View
BIN  PlaydarWin/PlaydarWin/obj/Release/PlaydarWin.csproj.GenerateResource.Cache
Binary file not shown
View
BIN  PlaydarWin/PlaydarWin/obj/Release/PlaydarWin.exe
Binary file not shown
View
BIN  PlaydarWin/PlaydarWin/obj/Release/PlaydarWin.pdb
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.