Click here to Skip to main content
15,895,606 members
Articles / Programming Languages / C#

Network Assistant for mobile PCs

Rate me:
Please Sign up or sign in to vote.
4.86/5 (3 votes)
21 Apr 2007Public Domain8 min read 40.9K   366   33  
A small tool that reacts to change in your network environment and changes your settings accordingly.
<?xml version="1.0" encoding="utf-8" ?>

<!--
Testers

	- IsConnected
			Pass if the connection status is what is expected
		
			value parameter : "true" if you want to test if the network
					 is connected, "false" if you want the test to pass
					 when there is no network connections
							
	- DnsServer
			Pass if one of the DNS server for any network connection
					 matches an specific IP
		
			value parameter : the IP address to test (ie : "192.0.0.1")

	- DhcpServer
			Pass if one of the DHCP server for any network connection
					 matches an specific IP
		
			value parameter : the IP address to test (ie : "192.0.0.1")


Netlets
	- DefaultPrinter
			Will change the default printer when connected
					 
			Parameters
						printerName

	- ConnectNetworkDrive
			Creates a new network connected drive linking to a server's
			(or another computer's) share

			Parameters
						localDrive
						remotePath
			
			Remarks
						localDrive should be of the format "X:"
							
	- CopyFiles
			  
			This netlet copies files from a directory to another
			useful for putting rdp shortcuts on your desktop,
			adding/removing software that connects to a local server
			etc.
				
			Parameters
						sourceFolder
						destinationFolder
						searchPattern
			
			Remarks
						You can use the notation those in the source 
						or destination folder : 
						
						- %DESKTOP% : path to the user's desktop folder
						- %PROGRAMSMENU% : path to the user's programs menu
												   (in start menu)
						- every environnement variable can be used
							(ie : %APPDATA%, %LOCALAPPDATA%....)
-->

<Config>
	<NetworkConfiguration name="Disconnected">
		<Tests>
			<IsConnected value="false" />
		</Tests>
		<Netlets>
			<!--<DefaultPrinter printerName="Send to OneNote 2007" />-->
		</Netlets>
	</NetworkConfiguration>

	<NetworkConfiguration name="Connected">
		<Tests>
			<IsConnected value="true" />
		</Tests>
		<Netlets>
			<!--<DefaultPrinter printerName="Send to OneNote 2007" />-->
		</Netlets>
	</NetworkConfiguration>

	<!-- SAMPLE CONFIGURATION
	

	<NetworkConfiguration name="Work">
		<Tests>
			<IsConnected value="true" />
			<DnsServer address="10.0.38.253" />
		</Tests>
		<Netlets>
			<DefaultPrinter printerName="\\SERVER\Printer" />
		</Netlets>
	</NetworkConfiguration>

	<NetworkConfiguration name="Home">
		<Tests>
			<IsConnected value="true" />
			<DnsServer value="192.168.0.1" />
		</Tests>
		<Netlets>
			<DefaultPrinter printerName="MyInkjet" />
			<CopyFiles 
						 sourceFolder="%LOCALAPPDATA%\NetworkAwareAssistant\Home\CopyFiles\"
						 destinationFolder="%DESKTOP%"
						 searchPattern="*.rdp"
						 />
			<ConnectNetworkDrive
						 localDrive="J:"
						 remotePath="\\FamilyServer\Share" />
		</Netlets>
	</NetworkConfiguration>
	-->
</Config>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Web Developer
France France
I'm french, do I need to say more ?

Comments and Discussions