Skip to content

Commit

Permalink
NuGenPathWatcher initial import of source
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNystrom committed Nov 1, 2010
1 parent 9391996 commit 08a5293
Show file tree
Hide file tree
Showing 53 changed files with 10,350 additions and 0 deletions.
127 changes: 127 additions & 0 deletions NuGenPathWatcher/2
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Net.Sockets;

namespace ghj
{
/// <summary>
/// Summary description for sosecl.
/// </summary>
///
public delegate void AppCallBack(string RxString);

public class d
{
private Socket SocketListener;
private Socket SocketWorker;
private int iPortNr;
private AsyncCallback pfnWorkerCallBack;

AppCallBack pfServerReceivedData;

public d(int PortNr,AppCallBack RxServer)
{
iPortNr = PortNr;
pfServerReceivedData=RxServer;
}

public void StartServer()
{
try
{
//create the listening socket...
SocketListener = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPEndPoint ipLocal = new IPEndPoint ( IPAddress.Any ,iPortNr);
//bind to local IP Address...
SocketListener.Bind( ipLocal );
//start listening...
SocketListener.Listen (100);
// create the call back for any client connections...
SocketListener.BeginAccept(new AsyncCallback ( OnClientConnect ),null);
}
catch(Exception se)
{
MessageBox.Show ( se.Message );
}
}

private void OnClientConnect(IAsyncResult asyn)
{
if(SocketListener == null )
{
return;
}
try
{
SocketWorker = SocketListener.EndAccept (asyn);
WaitForDataServerRx(SocketWorker);
}
catch(Exception se)
{
MessageBox.Show(se.Message);
}
}

private void WaitForDataServerRx(System.Net.Sockets.Socket soc)
{
try
{
if ( pfnWorkerCallBack == null )
{
pfnWorkerCallBack = new AsyncCallback (OnDataReceivedServer);
}
CSocketPacket theSocPkt = new CSocketPacket ();
theSocPkt.thisSocket = soc;
// now start to listen for any data...
soc .BeginReceive (theSocPkt.dataBuffer ,0,theSocPkt.dataBuffer.Length ,SocketFlags.None,pfnWorkerCallBack,theSocPkt);
}
catch(Exception se)
{
MessageBox.Show(se.Message);
}
}
private void OnDataReceivedServer(IAsyncResult asyn)
{
if(SocketListener == null)
{
return;
}
try
{
CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState ;
//end receive...
int iRx = 0 ;
iRx = theSockId.thisSocket.EndReceive (asyn);
char[] chars = new char[iRx + 1];
System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
System.String szData = new System.String(chars);

if(pfServerReceivedData != null)
{
pfServerReceivedData(szData);
}

WaitForDataServerRx(SocketWorker );
}
catch(Exception se)
{
MessageBox.Show(se.Message);
}
}
public class CSocketPacket
{
public System.Net.Sockets.Socket thisSocket;
public byte[] dataBuffer = new byte[1024];
}
}
}

Binary file added NuGenPathWatcher/App.ico
Binary file not shown.
Binary file added NuGenPathWatcher/App2.ico
Binary file not shown.
62 changes: 62 additions & 0 deletions NuGenPathWatcher/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Resources;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("NuGenPathWatcher")]
[assembly: AssemblyDescription("System IO Watching Application")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Genetibase, Inc.")]
[assembly: AssemblyProduct("NuGenPathWatcher")]
[assembly: AssemblyCopyright("2001-2006 Genetibase, Inc.")]
[assembly: AssemblyTrademark("NuGenPathWatcher")]
[assembly: AssemblyCulture("")]

//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

//[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.2")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("2.1.1.2")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
59 changes: 59 additions & 0 deletions NuGenPathWatcher/Backup/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

//[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
Loading

0 comments on commit 08a5293

Please sign in to comment.