Click here to Skip to main content
15,881,173 members
Articles / Programming Languages / C#

C# Script: The Missing Puzzle Piece

Rate me:
Please Sign up or sign in to vote.
4.88/5 (184 votes)
6 Aug 2014MIT24 min read 1.3M   9.4K   531  
An article on a "scripting engine" for the C# language
Demo scripts:
 NKill.cs 		- Kills processes specified as command-line parameters.
 GetUrl.cs 		- Gets URL content and saves it in a file. Capable to go through proxy authentication.
 Debug.cs 		- Opens script with temporary C# project for running it under debugger.
 Install.cs     	- Installs/Uninstalls 'C# Script' shell extensions that will allow to run/debug any script with mouse right-click.
 ImportData.cs  	- Imports data from specified file in SQL Server table.
 ExportData.cs  	- Exports data to specified file from SQL Server table.
 RunScript.cs		- Script that runs another script in background with redirection output to the 'parent script'. 
		  	  Run "cscscript runScript.cs tick.cs" and "cscscript tick.cs" to see it in work.
 ImportTickScript.cs	- Script that imports and execues 'tick.cs' script. 
		  	  Run "cscscript ImportTickScript.cs" and to see it in work.
 Tick.cs	  	- Simple script that counts specified number of seconds (used as demo for runScript). 
 SynTime.cs 		- Gets time from http://tycho.usno.navy.mil/cgi-bin/timer.pl and synchronises PC systemtime.
 sysFindConfig.cs	- Displays configuration console to adjust system 'FindInFile' options on WindowsXP.
			  This is the answer for WindowsXP BUG described in MSDN articles Q309173 and 
			  "Using the 'A Word or Phrase in the File' Search Criterion May Not Work".
 SMTPMailTo.cs		- Sends e-mail to the specified address.		
 Creditentials.cs	- Prompts and collect user login information.
 GetOptusUsage.cs	- Retreives monthly data usage (applicable only for "Optus Australia" customers).
 Reflect.cs		- Prints assembly reflection info.
 Progressbar.cs		- Shows "continuous" progressbar. This is an example how to draw in GDI+ without flickering.
 CutFile.cs 		- Cuts file in pieces and prepares batch file to reassemble the original file.	
 PrintScreen.cs		- Captures screen image and saves it to a file (default file: screen.gif)
 print.cs		- Collection of simple reusable printing routines (the alternative to cmd: notepad.exe /p <file>). 
	

\Extensibility
 HostCSScript.cs	
			- Instantiates and runs the C# script engine (see Extensibility\readme.txt).
 Interop.cs 		- Creates and accesses COM and CLR objects (see Extensibility\readme.txt).
 TeeChartForm.cs	- This is an example that illustrates now to reference an assembly (TeeChart control) from the code. 

 Client.cs,		 
 Script.cs,		
 Common.cs 		- Example of extending any application with CS-Script scripting			  

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 The MIT License


Written By
Program Manager
Australia Australia
I was born in Ukraine. After completing the university degree worked there as a Research Chemist. Last 23 years I live in Australia where I've got my second qualification as a Software Engineer.

"I am the lucky one: I do enjoy what I am doing!"

Comments and Discussions