SEARCH
TOOLBOX
LANGUAGES
modified on 31 May 2010 at 22:30 ••• 1,464 views

O2 Development/Using an O2 Script to check the O2 Scripts

From

Jump to: navigation, search

Due to the constant API refactoring and the move to have more and more O2 functionality being exposed via the dynamically compiled (& retrieved via SVN) scripts, there is a need to ensure that most scripts compiled ok before the main O2 XRules Database module is pushed to the ClickOnce deployment site.

To do that the following script is now used to make sure that all relevant O2 Scripts modules compile OK:

var panel = O2Gui.open<Panel>("Compiling all local O2 Scripts",500,500);
panel.clear();
panel.insert_Below<ascx_LogViewer>();
var dataGridView = panel.add_DataGridView();
dataGridView.add_Column("File");
dataGridView.add_Column("Compiler Mode #1",100);
dataGridView.add_Column("Compiler Mode #2",100); 
dataGridView.noSelection();
foreach(var file in @"C:\O2\O2Scripts_Database\_Scripts".files("*.cs",true)) 
{				
	var compiler1Result = (file.compile() != null);	
	var compiler2Result = (new O2.DotNetWrappers.DotNet.CompileEngine().compileSourceFile(file) != null);
	var rowId = dataGridView.add_Row(file,compiler1Result, compiler2Result); 
	dataGridView.get_Row(rowId).Cells[0].Style.ForeColor = (compiler1Result && compiler2Result) ? Color.Green : Color.Red;
	dataGridView.get_Row(rowId).Cells[1].Style.ForeColor = (compiler1Result) ? Color.Green : Color.Red;
	dataGridView.get_Row(rowId).Cells[2].Style.ForeColor = (compiler2Result) ? Color.Green : Color.Red;
}
 
//O2Ref:System.Data.dll
//using O2.Views.ASCX.Ascx.MainGUI

here is a result of its execution (as per 31-May-2010)

Image:5_31_2010_11_28_38_PM_tmp1119.jpg

Note: the errors that happen in 'Compilation Mode #1' are caused by circular references in the //O2File: includes

MediaWiki Appliance - Powered by TurnKey Linux