diff --git a/reactos/tools/sysgen/FileSystemTreeView/App.ico b/reactos/tools/sysgen/FileSystemTreeView/App.ico new file mode 100644 index 00000000000..3a5525fd794 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/App.ico differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/AssemblyInfo.cs b/reactos/tools/sysgen/FileSystemTreeView/AssemblyInfo.cs new file mode 100644 index 00000000000..9f89a3282c5 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/AssemblyInfo.cs @@ -0,0 +1,58 @@ +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.*")] + +// +// 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\. 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("")] diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/App.ico b/reactos/tools/sysgen/FileSystemTreeView/Backup/App.ico new file mode 100644 index 00000000000..3a5525fd794 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/Backup/App.ico differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/AssemblyInfo.cs b/reactos/tools/sysgen/FileSystemTreeView/Backup/AssemblyInfo.cs new file mode 100644 index 00000000000..9f89a3282c5 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/AssemblyInfo.cs @@ -0,0 +1,58 @@ +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.*")] + +// +// 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\. 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("")] diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.cs b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.cs new file mode 100644 index 00000000000..e6c055e9b12 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.cs @@ -0,0 +1,201 @@ +using System; +using System.IO; +using System.Windows.Forms; +using System.ComponentModel; +using System.Collections; +using System.Drawing; + +namespace C2C.FileSystem +{ + /// + /// Summary description for DirectoryTreeView. + /// + /// + + public class FileSystemTreeView : TreeView + { + private bool _showFiles = true; + private ImageList _imageList = new ImageList(); + private Hashtable _systemIcons = new Hashtable(); + + public static readonly int Folder = 0; + + public FileSystemTreeView() + { + this.ImageList = _imageList; + this.MouseDown += new MouseEventHandler(FileSystemTreeView_MouseDown); + this.BeforeExpand += new TreeViewCancelEventHandler(FileSystemTreeView_BeforeExpand); + } + + void FileSystemTreeView_MouseDown(object sender, MouseEventArgs e) + { + TreeNode node = this.GetNodeAt(e.X, e.Y); + + if (node == null) + return; + + this.SelectedNode = node; //select the node under the mouse + } + + void FileSystemTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) + { + if( e.Node is FileNode ) return; + + DirectoryNode node = (DirectoryNode)e.Node; + + if (!node.Loaded) + { + node.Nodes[0].Remove(); //remove the fake child node used for virtualization + node.LoadDirectory(); + if( this._showFiles == true ) + node.LoadFiles(); + } + } + + public void Load( string directoryPath ) + { + if( Directory.Exists( directoryPath ) == false ) + throw new DirectoryNotFoundException( "Directory Not Found" ); + + _systemIcons.Clear(); + _imageList.Images.Clear(); + Nodes.Clear(); + + Icon folderIcon = new Icon( typeof( FileSystemTreeView ), "icons.folder.ico"); + + _imageList.Images.Add( folderIcon ); + _systemIcons.Add( FileSystemTreeView.Folder, 0 ); + + DirectoryNode node = new DirectoryNode( this, new DirectoryInfo( directoryPath ) ); + node.Expand(); + } + + public int GetIconImageIndex( string path ) + { + string extension = Path.GetExtension( path ); + + if( _systemIcons.ContainsKey( extension ) == false ) + { + Icon icon = ShellIcon.GetSmallIcon( path ); + _imageList.Images.Add( icon ); + _systemIcons.Add( extension, _imageList.Images.Count-1 ); + } + + return (int)_systemIcons[ Path.GetExtension( path )]; + } + + public bool ShowFiles + { + get{ return this._showFiles; } + set{ this._showFiles = value; } + } + } + + public class DirectoryNode : TreeNode + { + private DirectoryInfo _directoryInfo; + + public DirectoryNode( DirectoryNode parent, DirectoryInfo directoryInfo ) : base( directoryInfo.Name ) + { + this._directoryInfo = directoryInfo; + + this.ImageIndex = FileSystemTreeView.Folder; + this.SelectedImageIndex = this.ImageIndex; + + parent.Nodes.Add( this ); + + Virtualize(); + } + + public DirectoryNode( FileSystemTreeView treeView, DirectoryInfo directoryInfo ) : base( directoryInfo.Name ) + { + this._directoryInfo = directoryInfo; + + this.ImageIndex = FileSystemTreeView.Folder; + this.SelectedImageIndex = this.ImageIndex; + + treeView.Nodes.Add( this ); + + Virtualize(); + + } + + void Virtualize() + { + int fileCount = 0; + + try + { + if( this.TreeView.ShowFiles == true ) + fileCount = this._directoryInfo.GetFiles().Length; + + if( (fileCount + this._directoryInfo.GetDirectories().Length) > 0 ) + new FakeChildNode( this ); + } + catch + { + } + } + + public void LoadDirectory() + { + foreach( DirectoryInfo directoryInfo in _directoryInfo.GetDirectories() ) + { + new DirectoryNode( this, directoryInfo ); + } + } + + public void LoadFiles() + { + foreach( FileInfo file in _directoryInfo.GetFiles() ) + { + new FileNode( this, file ); + } + } + + public bool Loaded + { + get + { + if( this.Nodes.Count != 0 ) + { + if( this.Nodes[0] is FakeChildNode ) + return false; + } + + return true; + } + } + + public new FileSystemTreeView TreeView + { + get{ return (FileSystemTreeView)base.TreeView; } + } + } + + public class FileNode : TreeNode + { + private FileInfo _fileInfo; + private DirectoryNode _directoryNode; + + public FileNode( DirectoryNode directoryNode, FileInfo fileInfo ) : base( fileInfo.Name ) + { + this._directoryNode = directoryNode; + this._fileInfo = fileInfo; + + this.ImageIndex = ((FileSystemTreeView)_directoryNode.TreeView).GetIconImageIndex( _fileInfo.FullName ); + this.SelectedImageIndex = this.ImageIndex; + + _directoryNode.Nodes.Add( this ); + } + } + + public class FakeChildNode : TreeNode + { + public FakeChildNode( TreeNode parent ) : base() + { + parent.Nodes.Add( this ); + } + } + +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj new file mode 100644 index 00000000000..ccafd2eb14c --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj.user b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj.user new file mode 100644 index 00000000000..69ac1936f52 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.resx b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.resx new file mode 100644 index 00000000000..3f337e081da --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/FileSystemTreeView.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.cs b/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.cs new file mode 100644 index 00000000000..b825eb838c0 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.cs @@ -0,0 +1,178 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using C2C.FileSystem; + +namespace DirectoryTreeView +{ + /// + /// Summary description for Form1. + /// + public class Form1 : System.Windows.Forms.Form + { + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TextBox txtDirectory; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnDirectory; + private C2C.FileSystem.FileSystemTreeView tree; + private System.Windows.Forms.Panel treePanel; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.btnDirectory = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.txtDirectory = new System.Windows.Forms.TextBox(); + this.treePanel = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.btnDirectory); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.txtDirectory); + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(721, 57); + this.panel1.TabIndex = 0; + // + // btnDirectory + // + this.btnDirectory.Location = new System.Drawing.Point(615, 27); + this.btnDirectory.Name = "btnDirectory"; + this.btnDirectory.Size = new System.Drawing.Size(30, 21); + this.btnDirectory.TabIndex = 2; + this.btnDirectory.Text = "..."; + this.btnDirectory.Click += new System.EventHandler(this.btnDirectory_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(9, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(102, 18); + this.label1.TabIndex = 1; + this.label1.Text = "Directory:"; + // + // txtDirectory + // + this.txtDirectory.Location = new System.Drawing.Point(9, 27); + this.txtDirectory.Name = "txtDirectory"; + this.txtDirectory.Size = new System.Drawing.Size(603, 20); + this.txtDirectory.TabIndex = 0; + this.txtDirectory.Text = ""; + this.txtDirectory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDirectory_KeyDown); + this.txtDirectory.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDirectory_KeyPress); + // + // treePanel + // + this.treePanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.treePanel.Location = new System.Drawing.Point(0, 57); + this.treePanel.Name = "treePanel"; + this.treePanel.Size = new System.Drawing.Size(721, 530); + this.treePanel.TabIndex = 1; + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(721, 587); + this.Controls.Add(this.treePanel); + this.Controls.Add(this.panel1); + this.Name = "Form1"; + this.Text = "Demo Application"; + this.Load += new System.EventHandler(this.Form1_Load); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + + private void Form1_Load(object sender, System.EventArgs e) + { + tree = new C2C.FileSystem.FileSystemTreeView(); + treePanel.Controls.Add( tree ); + tree.Dock = DockStyle.Fill; + //tree.ShowFiles = false; + } + + + private void btnDirectory_Click(object sender, System.EventArgs e) + { + FolderBrowserDialog dlg = new FolderBrowserDialog(); + + if( dlg.ShowDialog() == DialogResult.OK ) + { + txtDirectory.Text = dlg.SelectedPath; + tree.Load( txtDirectory.Text ); + } + } + + private void txtDirectory_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) + { + + + } + + private void txtDirectory_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + if( e.KeyData == Keys.Enter ) + { + if( System.IO.Directory.Exists( txtDirectory.Text ) == false ) + { + MessageBox.Show( "Directory Does Not Exist", "Invalid Directory", MessageBoxButtons.OK, MessageBoxIcon.Information ); + return; + } + tree.Load( txtDirectory.Text ); + } + } + } +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.resx b/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.resx new file mode 100644 index 00000000000..161c002f2c3 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/Form1.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + True + + + Private + + + 3, 3 + + + True + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + True + + + Private + + + 3, 3 + + + True + + + Private + + + False + + + (Default) + + + False + + + False + + + 3, 3 + + + True + + + 80 + + + Form1 + + + True + + + Private + + \ No newline at end of file diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/ShellIcon.cs b/reactos/tools/sysgen/FileSystemTreeView/Backup/ShellIcon.cs new file mode 100644 index 00000000000..6dd9f867916 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Backup/ShellIcon.cs @@ -0,0 +1,79 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace C2C.FileSystem +{ + /// + /// Summary description for ShellIcon. + /// + /// + /// Summary description for ShellIcon. Get a small or large Icon with an easy C# function call + /// that returns a 32x32 or 16x16 System.Drawing.Icon depending on which function you call + /// either GetSmallIcon(string fileName) or GetLargeIcon(string fileName) + /// + public class ShellIcon + { + [StructLayout(LayoutKind.Sequential)] + public struct SHFILEINFO + { + public IntPtr hIcon; + public IntPtr iIcon; + public uint dwAttributes; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; + }; + + + class Win32 + { + public const uint SHGFI_ICON = 0x100; + public const uint SHGFI_LARGEICON = 0x0; // 'Large icon + public const uint SHGFI_SMALLICON = 0x1; // 'Small icon + + + [DllImport("shell32.dll")] + public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); + } + + + public ShellIcon() + { + // + // TODO: Add constructor logic here + // + } + + + public static Icon GetSmallIcon(string fileName) + { + IntPtr hImgSmall; //the handle to the system image list + SHFILEINFO shinfo = new SHFILEINFO(); + + + //Use this to get the small Icon + hImgSmall = Win32.SHGetFileInfo(fileName, 0, ref shinfo,(uint)Marshal.SizeOf(shinfo),Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON); + + + //The icon is returned in the hIcon member of the shinfo struct + return System.Drawing.Icon.FromHandle(shinfo.hIcon); + } + + + public static Icon GetLargeIcon(string fileName) + { + IntPtr hImgLarge; //the handle to the system image list + SHFILEINFO shinfo = new SHFILEINFO(); + + + //Use this to get the large Icon + hImgLarge = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON); + + + //The icon is returned in the hIcon member of the shinfo struct + return System.Drawing.Icon.FromHandle(shinfo.hIcon); + } + } +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/Backup/icons/folder.ico b/reactos/tools/sysgen/FileSystemTreeView/Backup/icons/folder.ico new file mode 100644 index 00000000000..c9e4b0b4a38 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/Backup/icons/folder.ico differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.cs b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.cs new file mode 100644 index 00000000000..f3da9388b71 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.cs @@ -0,0 +1,202 @@ +using System; +using System.IO; +using System.Windows.Forms; +using System.ComponentModel; +using System.Collections; +using System.Drawing; + +namespace C2C.FileSystem +{ + /// + /// Summary description for DirectoryTreeView. + /// + /// + + public class FileSystemTreeView : TreeView + { + private bool _showFiles = true; + private ImageList _imageList = new ImageList(); + private Hashtable _systemIcons = new Hashtable(); + + public static readonly int Folder = 0; + + public FileSystemTreeView() + { + this.CheckBoxes = true; + this.ImageList = _imageList; + this.MouseDown += new MouseEventHandler(FileSystemTreeView_MouseDown); + this.BeforeExpand += new TreeViewCancelEventHandler(FileSystemTreeView_BeforeExpand); + } + + void FileSystemTreeView_MouseDown(object sender, MouseEventArgs e) + { + TreeNode node = this.GetNodeAt(e.X, e.Y); + + if (node == null) + return; + + this.SelectedNode = node; //select the node under the mouse + } + + void FileSystemTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) + { + if( e.Node is FileNode ) return; + + DirectoryNode node = (DirectoryNode)e.Node; + + if (!node.Loaded) + { + node.Nodes[0].Remove(); //remove the fake child node used for virtualization + node.LoadDirectory(); + if( this._showFiles == true ) + node.LoadFiles(); + } + } + + public void Load( string directoryPath ) + { + if( Directory.Exists( directoryPath ) == false ) + throw new DirectoryNotFoundException( "Directory Not Found" ); + + _systemIcons.Clear(); + _imageList.Images.Clear(); + Nodes.Clear(); + + Icon folderIcon = new Icon( typeof( FileSystemTreeView ), "icons.folder.ico"); + + _imageList.Images.Add( folderIcon ); + _systemIcons.Add( FileSystemTreeView.Folder, 0 ); + + DirectoryNode node = new DirectoryNode( this, new DirectoryInfo( directoryPath ) ); + node.Expand(); + } + + public int GetIconImageIndex( string path ) + { + string extension = Path.GetExtension( path ); + + if( _systemIcons.ContainsKey( extension ) == false ) + { + Icon icon = ShellIcon.GetSmallIcon( path ); + _imageList.Images.Add( icon ); + _systemIcons.Add( extension, _imageList.Images.Count-1 ); + } + + return (int)_systemIcons[ Path.GetExtension( path )]; + } + + public bool ShowFiles + { + get{ return this._showFiles; } + set{ this._showFiles = value; } + } + } + + public class DirectoryNode : TreeNode + { + private DirectoryInfo _directoryInfo; + + public DirectoryNode( DirectoryNode parent, DirectoryInfo directoryInfo ) : base( directoryInfo.Name ) + { + this._directoryInfo = directoryInfo; + + this.ImageIndex = FileSystemTreeView.Folder; + this.SelectedImageIndex = this.ImageIndex; + + parent.Nodes.Add( this ); + + Virtualize(); + } + + public DirectoryNode( FileSystemTreeView treeView, DirectoryInfo directoryInfo ) : base( directoryInfo.Name ) + { + this._directoryInfo = directoryInfo; + + this.ImageIndex = FileSystemTreeView.Folder; + this.SelectedImageIndex = this.ImageIndex; + + treeView.Nodes.Add( this ); + + Virtualize(); + + } + + void Virtualize() + { + int fileCount = 0; + + try + { + if( this.TreeView.ShowFiles == true ) + fileCount = this._directoryInfo.GetFiles().Length; + + if( (fileCount + this._directoryInfo.GetDirectories().Length) > 0 ) + new FakeChildNode( this ); + } + catch + { + } + } + + public void LoadDirectory() + { + foreach( DirectoryInfo directoryInfo in _directoryInfo.GetDirectories() ) + { + new DirectoryNode( this, directoryInfo ); + } + } + + public void LoadFiles() + { + foreach( FileInfo file in _directoryInfo.GetFiles() ) + { + new FileNode( this, file ); + } + } + + public bool Loaded + { + get + { + if( this.Nodes.Count != 0 ) + { + if( this.Nodes[0] is FakeChildNode ) + return false; + } + + return true; + } + } + + public new FileSystemTreeView TreeView + { + get{ return (FileSystemTreeView)base.TreeView; } + } + } + + public class FileNode : TreeNode + { + private FileInfo _fileInfo; + private DirectoryNode _directoryNode; + + public FileNode( DirectoryNode directoryNode, FileInfo fileInfo ) : base( fileInfo.Name ) + { + this._directoryNode = directoryNode; + this._fileInfo = fileInfo; + + this.ImageIndex = ((FileSystemTreeView)_directoryNode.TreeView).GetIconImageIndex( _fileInfo.FullName ); + this.SelectedImageIndex = this.ImageIndex; + + _directoryNode.Nodes.Add( this ); + } + } + + public class FakeChildNode : TreeNode + { + public FakeChildNode( TreeNode parent ) : base() + { + parent.Nodes.Add( this ); + } + } + +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj new file mode 100644 index 00000000000..66d811ad0ab --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj @@ -0,0 +1,124 @@ + + + Local + 8.0.50727 + 2.0 + {83281176-6B39-4EB8-8CDC-82F018DEED68} + Debug + AnyCPU + App.ico + + + DirectoryTreeView + + + JScript + Grid + IE50 + false + WinExe + C2C.FileSystem + OnBuildSuccess + + + + + + + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.DirectoryServices + + + System.Drawing + + + System.Windows.Forms + + + System.XML + + + + + + Code + + + Component + + + Form + + + Code + + + FileSystemTreeView.cs + + + Form1.cs + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj.user b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj.user new file mode 100644 index 00000000000..d9bb8387dbc --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.csproj.user @@ -0,0 +1,58 @@ + + + 7.10.3077 + Debug + AnyCPU + + + + + + + 0 + ProjectFiles + 0 + + + false + false + false + false + false + + + Project + + + + + + + + + + + false + + + false + false + false + false + false + + + Project + + + + + + + + + + + false + + \ No newline at end of file diff --git a/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.resx b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.resx new file mode 100644 index 00000000000..3f337e081da --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.suo b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.suo new file mode 100644 index 00000000000..df5e95f4d88 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/FileSystemTreeView.suo differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/Form1.cs b/reactos/tools/sysgen/FileSystemTreeView/Form1.cs new file mode 100644 index 00000000000..b825eb838c0 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Form1.cs @@ -0,0 +1,178 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using C2C.FileSystem; + +namespace DirectoryTreeView +{ + /// + /// Summary description for Form1. + /// + public class Form1 : System.Windows.Forms.Form + { + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TextBox txtDirectory; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnDirectory; + private C2C.FileSystem.FileSystemTreeView tree; + private System.Windows.Forms.Panel treePanel; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.btnDirectory = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.txtDirectory = new System.Windows.Forms.TextBox(); + this.treePanel = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.btnDirectory); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.txtDirectory); + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(721, 57); + this.panel1.TabIndex = 0; + // + // btnDirectory + // + this.btnDirectory.Location = new System.Drawing.Point(615, 27); + this.btnDirectory.Name = "btnDirectory"; + this.btnDirectory.Size = new System.Drawing.Size(30, 21); + this.btnDirectory.TabIndex = 2; + this.btnDirectory.Text = "..."; + this.btnDirectory.Click += new System.EventHandler(this.btnDirectory_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(9, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(102, 18); + this.label1.TabIndex = 1; + this.label1.Text = "Directory:"; + // + // txtDirectory + // + this.txtDirectory.Location = new System.Drawing.Point(9, 27); + this.txtDirectory.Name = "txtDirectory"; + this.txtDirectory.Size = new System.Drawing.Size(603, 20); + this.txtDirectory.TabIndex = 0; + this.txtDirectory.Text = ""; + this.txtDirectory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDirectory_KeyDown); + this.txtDirectory.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDirectory_KeyPress); + // + // treePanel + // + this.treePanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.treePanel.Location = new System.Drawing.Point(0, 57); + this.treePanel.Name = "treePanel"; + this.treePanel.Size = new System.Drawing.Size(721, 530); + this.treePanel.TabIndex = 1; + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(721, 587); + this.Controls.Add(this.treePanel); + this.Controls.Add(this.panel1); + this.Name = "Form1"; + this.Text = "Demo Application"; + this.Load += new System.EventHandler(this.Form1_Load); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + + private void Form1_Load(object sender, System.EventArgs e) + { + tree = new C2C.FileSystem.FileSystemTreeView(); + treePanel.Controls.Add( tree ); + tree.Dock = DockStyle.Fill; + //tree.ShowFiles = false; + } + + + private void btnDirectory_Click(object sender, System.EventArgs e) + { + FolderBrowserDialog dlg = new FolderBrowserDialog(); + + if( dlg.ShowDialog() == DialogResult.OK ) + { + txtDirectory.Text = dlg.SelectedPath; + tree.Load( txtDirectory.Text ); + } + } + + private void txtDirectory_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) + { + + + } + + private void txtDirectory_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + if( e.KeyData == Keys.Enter ) + { + if( System.IO.Directory.Exists( txtDirectory.Text ) == false ) + { + MessageBox.Show( "Directory Does Not Exist", "Invalid Directory", MessageBoxButtons.OK, MessageBoxIcon.Information ); + return; + } + tree.Load( txtDirectory.Text ); + } + } + } +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/Form1.resx b/reactos/tools/sysgen/FileSystemTreeView/Form1.resx new file mode 100644 index 00000000000..161c002f2c3 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/Form1.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + True + + + Private + + + 3, 3 + + + True + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + True + + + Private + + + 3, 3 + + + True + + + Private + + + False + + + (Default) + + + False + + + False + + + 3, 3 + + + True + + + 80 + + + Form1 + + + True + + + Private + + \ No newline at end of file diff --git a/reactos/tools/sysgen/FileSystemTreeView/ShellIcon.cs b/reactos/tools/sysgen/FileSystemTreeView/ShellIcon.cs new file mode 100644 index 00000000000..6dd9f867916 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/ShellIcon.cs @@ -0,0 +1,79 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace C2C.FileSystem +{ + /// + /// Summary description for ShellIcon. + /// + /// + /// Summary description for ShellIcon. Get a small or large Icon with an easy C# function call + /// that returns a 32x32 or 16x16 System.Drawing.Icon depending on which function you call + /// either GetSmallIcon(string fileName) or GetLargeIcon(string fileName) + /// + public class ShellIcon + { + [StructLayout(LayoutKind.Sequential)] + public struct SHFILEINFO + { + public IntPtr hIcon; + public IntPtr iIcon; + public uint dwAttributes; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; + }; + + + class Win32 + { + public const uint SHGFI_ICON = 0x100; + public const uint SHGFI_LARGEICON = 0x0; // 'Large icon + public const uint SHGFI_SMALLICON = 0x1; // 'Small icon + + + [DllImport("shell32.dll")] + public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); + } + + + public ShellIcon() + { + // + // TODO: Add constructor logic here + // + } + + + public static Icon GetSmallIcon(string fileName) + { + IntPtr hImgSmall; //the handle to the system image list + SHFILEINFO shinfo = new SHFILEINFO(); + + + //Use this to get the small Icon + hImgSmall = Win32.SHGetFileInfo(fileName, 0, ref shinfo,(uint)Marshal.SizeOf(shinfo),Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON); + + + //The icon is returned in the hIcon member of the shinfo struct + return System.Drawing.Icon.FromHandle(shinfo.hIcon); + } + + + public static Icon GetLargeIcon(string fileName) + { + IntPtr hImgLarge; //the handle to the system image list + SHFILEINFO shinfo = new SHFILEINFO(); + + + //Use this to get the large Icon + hImgLarge = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON); + + + //The icon is returned in the hIcon member of the shinfo struct + return System.Drawing.Icon.FromHandle(shinfo.hIcon); + } + } +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/UpgradeLog.XML b/reactos/tools/sysgen/FileSystemTreeView/UpgradeLog.XML new file mode 100644 index 00000000000..e913238577e --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/UpgradeLog.XML @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.css b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.css new file mode 100644 index 00000000000..fae98af0a86 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,207 @@ +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px +} +P +{ + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 70%; + LINE-HEIGHT: 12pt; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 10px +} +.note +{ + BACKGROUND-COLOR: #ffffff; + COLOR: #336699; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px; + PADDING-RIGHT: 10px +} +.infotable +{ + BACKGROUND-COLOR: #f0f0e0; + BORDER-BOTTOM: #ffffff 0px solid; + BORDER-COLLAPSE: collapse; + BORDER-LEFT: #ffffff 0px solid; + BORDER-RIGHT: #ffffff 0px solid; + BORDER-TOP: #ffffff 0px solid; + FONT-SIZE: 70%; + MARGIN-LEFT: 10px +} +.issuetable +{ + BACKGROUND-COLOR: #ffffe8; + BORDER-COLLAPSE: collapse; + COLOR: #000000; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 10px; + MARGIN-LEFT: 13px; + MARGIN-TOP: 0px +} +.issuetitle +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px; + COLOR: #003366; + FONT-WEIGHT: normal +} +.header +{ + BACKGROUND-COLOR: #cecf9c; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + COLOR: #000000; + FONT-WEIGHT: bold +} +.issuehdr +{ + BACKGROUND-COLOR: #E0EBF5; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + COLOR: #000000; + FONT-WEIGHT: normal +} +.issuenone +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: 0px; + BORDER-LEFT: 0px; + BORDER-RIGHT: 0px; + BORDER-TOP: 0px; + COLOR: #000000; + FONT-WEIGHT: normal +} +.content +{ + BACKGROUND-COLOR: #e7e7ce; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + PADDING-LEFT: 3px +} +.issuecontent +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + PADDING-LEFT: 3px +} +A:link +{ + COLOR: #cc6633; + TEXT-DECORATION: underline +} +A:visited +{ + COLOR: #cc6633; +} +A:active +{ + COLOR: #cc6633; +} +A:hover +{ + COLOR: #cc3300; + TEXT-DECORATION: underline +} +H1 +{ + BACKGROUND-COLOR: #003366; + BORDER-BOTTOM: #336699 6px solid; + COLOR: #ffffff; + FONT-SIZE: 130%; + FONT-WEIGHT: normal; + MARGIN: 0em 0em 0em -20px; + PADDING-BOTTOM: 8px; + PADDING-LEFT: 30px; + PADDING-TOP: 16px +} +H2 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 3px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px; + PADDING-LEFT: 0px +} +H3 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: -5px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px +} +H4 +{ + COLOR: #000000; + FONT-SIZE: 70%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 0px; + MARGIN-TOP: 15px; + PADDING-BOTTOM: 0px +} +UL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +OL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +LI +{ + LIST-STYLE: square; + MARGIN-LEFT: 0px +} +.expandable +{ + CURSOR: hand +} +.expanded +{ + color: black +} +.collapsed +{ + DISPLAY: none +} +.foot +{ +BACKGROUND-COLOR: #ffffff; +BORDER-BOTTOM: #cecf9c 1px solid; +BORDER-TOP: #cecf9c 2px solid +} +.settings +{ +MARGIN-LEFT: 25PX; +} +.help +{ +TEXT-ALIGN: right; +margin-right: 10px; +} diff --git a/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.xslt b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100644 index 00000000000..83f4304ab60 --- /dev/null +++ b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Solution: + Project: + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + +
FilenameStatusErrorsWarnings
+ javascript:document.images[''].click()src + + + + Converted + + + + Converted + +
+ + files + + + 1 file + + + Converted:
+ Not converted +
+
+
+ + + + : + + + + + + + + + Conversion Report + <xsl:if test="Properties/Property[@Name='LogNumber']"> + <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> + </xsl:if> + + + + +

Conversion Report -

+ +

+ Time of Conversion:
+

+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ Conversion Settings +

+ + +
+
diff --git a/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Minus.gif b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Minus.gif new file mode 100644 index 00000000000..17751cb2fd5 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Minus.gif differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Plus.gif b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Plus.gif new file mode 100644 index 00000000000..f6009ca3f6b Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/_UpgradeReport_Files/UpgradeReport_Plus.gif differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.exe b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.exe new file mode 100644 index 00000000000..c893a8ea121 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.exe differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.pdb b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.pdb new file mode 100644 index 00000000000..0baced4e8e9 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.pdb differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.vshost.exe b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.vshost.exe new file mode 100644 index 00000000000..ce3f102c36b Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/bin/Debug/DirectoryTreeView.vshost.exe differ diff --git a/reactos/tools/sysgen/FileSystemTreeView/icons/folder.ico b/reactos/tools/sysgen/FileSystemTreeView/icons/folder.ico new file mode 100644 index 00000000000..c9e4b0b4a38 Binary files /dev/null and b/reactos/tools/sysgen/FileSystemTreeView/icons/folder.ico differ diff --git a/reactos/tools/sysgen/RosBuilder/Controls/CatalogTriStateTreeView.cs b/reactos/tools/sysgen/RosBuilder/Controls/CatalogTriStateTreeView.cs new file mode 100644 index 00000000000..c4309b01166 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/CatalogTriStateTreeView.cs @@ -0,0 +1,220 @@ +using System; +using System.Drawing; +using System.Text; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; + +using SIL.FieldWorks.Common.Controls; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public class CatalogTriStateTreeView : TriStateTreeView + { + private ISysGenDesigner m_SysGenDesigner = null; + private TreeNode m_PlatformNode = null; + + public CatalogTriStateTreeView() + { + } + + private void CatalogTriStateTreeView_BeforeCheck(object sender, TreeViewCancelEventArgs e) + { + if (m_SysGenDesigner.SysGenEngine.Project != null) + { + if (e.Node is ModuleTreeNode) + { + //Get the underlying module + ModuleTreeNode moduleNode = e.Node as ModuleTreeNode; + + if (GetChecked(e.Node) == CheckState.Unchecked) + { + //Add the selected node and dependencies + m_SysGenDesigner.PlatformController.Add(moduleNode.Module); + } + else + { + //Remove the module from our platform + m_SysGenDesigner.PlatformController.Remove(moduleNode.Module); + } + + //Update current module status + UpdateCatalogTree(); + } + else if (e.Node is FolderTreeNode) + { + if (m_AutoUpdatingParents == false) + { + //e.Cancel = (AddTreeNodeModules(e.Node) == false); + } + } + } + else + { + MessageBox.Show("Cannot modify a catalog tree without platform associated"); + } + } + + public void SetCatalog(ISysGenDesigner sysGenDesigner) + { + //Set the software catalog + m_SysGenDesigner = sysGenDesigner; + + //Load the platform tree catalog + LoadCatalogTree(); + UpdateCatalogTree(); + + NodeMouseClick += new TreeNodeMouseClickEventHandler(CatalogTriStateTreeView_NodeMouseClick); + } + + void CatalogTriStateTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + ModuleTreeNode moduleNode = e.Node as ModuleTreeNode; + + if (moduleNode != null) + m_SysGenDesigner.InspectedObject = moduleNode.Module; + } + + private void LoadCatalogTree() + { + m_PlatformNode = new TreeNode(); + + LoadPlatformModules(m_PlatformNode, m_SysGenDesigner.SysGenEngine.ProjectTask); + + Nodes.Clear(); + Nodes.Add(m_PlatformNode); + + m_PlatformNode.Text = RootNodeText; + m_PlatformNode.Expand(); + } + + private void UpdateCatalogTree() + { + BeginUpdate(); + BeforeCheck -= new TreeViewCancelEventHandler(CatalogTriStateTreeView_BeforeCheck); + + m_PlatformNode.Text = RootNodeText; + m_PlatformNode.Expand(); + + UpdatePlatformModules(m_PlatformNode); + + EndUpdate(); + BeforeCheck += new TreeViewCancelEventHandler(CatalogTriStateTreeView_BeforeCheck); + } + + private string RootNodeText + { + get + { + return string.Format("Catalog ({0} Modules-{1} Available)", + m_SysGenDesigner.PlatformController.Project.Platform.Modules.Count, + m_SysGenDesigner.PlatformController.Project.Modules.Count); + } + } + + private void UpdatePlatformModules(TreeNode node) + { + if (node is ModuleTreeNode) + { + //Get the underlying module + ModuleTreeNode moduleNode = node as ModuleTreeNode; + + if (moduleNode != null) + { + if (m_SysGenDesigner.PlatformController.Project.Platform.Modules.Contains(moduleNode.Module)) + { + SetChecked(moduleNode, CheckState.Checked); + } + else + { + SetChecked(moduleNode, CheckState.Unchecked); + } + } + } + else + { + foreach (TreeNode subNode in node.Nodes) + { + UpdatePlatformModules(subNode); + } + } + } + + private void LoadPlatformModules(TreeNode node, Task task) + { + if (task is ModuleTask) + { + RBuildModule module = ((ModuleTask)task).Module; + + node.Nodes.Add(new ModuleTreeNode(module)); + } + else if (task is ITaskContainer) + { + if (task is DirectoryTask) + { + FolderTreeNode taskNode = new FolderTreeNode(((DirectoryTask)task).Name); + + node.Nodes.Add(taskNode); + + foreach (Task innerTask in ((ITaskContainer)task).ChildTasks) + { + LoadPlatformModules(taskNode, innerTask); + } + } + else + { + foreach (Task innerTask in ((ITaskContainer)task).ChildTasks) + { + LoadPlatformModules(node, innerTask); + } + } + } + } + + public abstract class CatalogTreeNode : TreeNode + { + public abstract string NodeName { get; } + } + + public class ModuleTreeNode : CatalogTreeNode + { + RBuildModule m_Module = null; + + public ModuleTreeNode(RBuildModule module) + { + m_Module = module; + Text = module.Name; + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public override string NodeName + { + get { return Module.Name; } + } + } + + public class FolderTreeNode : CatalogTreeNode + { + private string m_FolderName = null; + + public FolderTreeNode(string name) + { + m_FolderName = name; + Text = name; + } + + public override string NodeName + { + get { return m_FolderName; } + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Controls/ModuleFiltersListView.cs b/reactos/tools/sysgen/RosBuilder/Controls/ModuleFiltersListView.cs new file mode 100644 index 00000000000..2228f2b729d --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/ModuleFiltersListView.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public class ModuleFiltersListViewItem : ListViewItem + { + private ModuleFilter m_ModuleFilter = null; + + public ModuleFiltersListViewItem(ModuleFilter filter) + { + m_ModuleFilter = filter; + + Text = filter.Name; + SubItems.Add(filter.Modules.Count.ToString()); + } + + public ModuleFilter Filter + { + get { return m_ModuleFilter; } + } + } + + public class ModuleFiltersListView : ListView + { + private ISysGenDesigner m_SysGenDesigner = null; + + public ModuleFiltersListView() + { + View = View.Details; + + FullRowSelect = true; + CheckBoxes = true; + + Columns.Add("Name", 200); + Columns.Add("Modules", 100); + } + + public void SetCatalog(ISysGenDesigner sysGenDesigner) + { + //Set the software catalog + m_SysGenDesigner = sysGenDesigner; + //m_SysGenDesigner.PlatformController.PlatformModulesUpdated += new EventHandler(PlatformController_PlatformModulesUpdated); + + foreach (ModuleFilter filter in sysGenDesigner.ModuleFilterController.ModuleFilters) + { + Items.Add(new ModuleFiltersListViewItem(filter)); + } + } + + //protected override void OnItemCheck(ItemCheckEventArgs ice) + //{ + // base.OnItemCheck(ice); + //} + + //protected override void OnItemChecked(ItemCheckedEventArgs e) + //{ + // base.OnItemChecked(e); + //} + + private void PlatformController_PlatformModulesUpdated(object sender, EventArgs e) + { + BeginUpdate(); + + foreach (ModuleFiltersListViewItem filterItem in Items) + { + foreach (RBuildModule module in m_SysGenDesigner.ProjectController.Project.Platform.Modules) + { + if (!filterItem.Filter.Modules.Contains(module)) + { + filterItem.Checked = false; + break; + } + } + + filterItem.Checked = true; + } + + EndUpdate(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Controls/NewItemListView.cs b/reactos/tools/sysgen/RosBuilder/Controls/NewItemListView.cs new file mode 100644 index 00000000000..e2e28dc11f5 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/NewItemListView.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public abstract class NewItemListViewItem : ListViewItem + { + protected ISysGenDesigner m_SysGenDesigner = null; + + public NewItemListViewItem(ISysGenDesigner designer) + { + m_SysGenDesigner = designer; + } + + public abstract string Description { get; } + public abstract string DefaultFileName { get; } + + public virtual void Apply() + { + } + } + + public class ModuleFiltersNewItemListViewItem : NewItemListViewItem + { + private ModuleFilter m_ModuleFilter = null; + + public ModuleFiltersNewItemListViewItem(ISysGenDesigner designer ,ModuleFilter filter): base(designer) + { + m_ModuleFilter = filter; + + Text = filter.Name; + } + + public override string Description + { + get { return m_ModuleFilter.Name; } + } + + public override string DefaultFileName + { + get { return null; } + } + + public override void Apply() + { + m_SysGenDesigner.ModuleFilterController.Apply(m_ModuleFilter); + } + } + + public class LanguageNewItemListViewItem : NewItemListViewItem + { + private RBuildLanguage m_Language = null; + + public LanguageNewItemListViewItem(ISysGenDesigner designer, RBuildLanguage language) + : base(designer) + { + m_Language = language; + + Text = language.Name; + } + + public override string Description + { + get { return m_Language.Name; } + } + + public override string DefaultFileName + { + get { return null; } + } + + public override void Apply() + { + m_SysGenDesigner.ProjectController.AddLanguage(m_Language); + } + } + + public class DebugChannelNewItemListViewItem : NewItemListViewItem + { + private RBuildDebugChannel m_DebugChannel = null; + + public DebugChannelNewItemListViewItem(ISysGenDesigner designer, RBuildDebugChannel channel) + : base(designer) + { + m_DebugChannel = channel; + + Text = channel.Name; + } + + public override string Description + { + get { return m_DebugChannel.Name; } + } + + public override string DefaultFileName + { + get { return null; } + } + + public override void Apply() + { + m_SysGenDesigner.ProjectController.AddDebugChannel(m_DebugChannel); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Controls/PlatformTreeView.cs b/reactos/tools/sysgen/RosBuilder/Controls/PlatformTreeView.cs new file mode 100644 index 00000000000..1f12d95df50 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/PlatformTreeView.cs @@ -0,0 +1,306 @@ +using System; +using System.Drawing; +using System.Text; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; + +using SIL.FieldWorks.Common.Controls; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public class PlatformTreeView : TriStateTreeView + { + private ISysGenDesigner m_SysGenDesigner = null; + private PlatformTreeNode m_PlatformNode = null; + + public PlatformTreeView() + { + } + + private void CatalogTriStateTreeView_BeforeCheck(object sender, TreeViewCancelEventArgs e) + { + if (m_SysGenDesigner.ProjectController.Project != null) + { + if (e.Node is ModuleTreeNode) + { + //Get the underlying module + ModuleTreeNode moduleNode = e.Node as ModuleTreeNode; + + if (GetChecked(e.Node) == CheckState.Unchecked) + { + //Add the selected node and dependencies + m_SysGenDesigner.ProjectController.Add(moduleNode.Module); + } + else + { + //Remove the module from our platform + m_SysGenDesigner.ProjectController.Remove(moduleNode.Module); + } + + } + else if (e.Node is FolderTreeNode) + { + } + } + else + { + MessageBox.Show("Cannot modify a catalog tree without platform associated"); + } + + /* cancel the paint event*/ + e.Cancel = true; + } + + public void SetCatalog(ISysGenDesigner sysGenDesigner) + { + //Set the software catalog + m_SysGenDesigner = sysGenDesigner; + + m_SysGenDesigner.ProjectController.PlatformModulesUpdated += new EventHandler(PlatformController_PlatformModulesUpdated); + + //Load the platform tree catalog + LoadCatalogTree(); + UpdateCatalogTree(); + + NodeMouseClick += new TreeNodeMouseClickEventHandler(CatalogTriStateTreeView_NodeMouseClick); + } + + void PlatformController_PlatformModulesUpdated(object sender, EventArgs e) + { + //Update current module status + UpdateCatalogTree(); + } + + void CatalogTriStateTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + CatalogTreeNode catalogNode = e.Node as CatalogTreeNode; + + if (catalogNode != null) + m_SysGenDesigner.InspectedObject = catalogNode.NodeObject; + } + + private void LoadCatalogTree() + { + m_PlatformNode = new PlatformTreeNode(m_SysGenDesigner.ProjectController.Project.Platform); + + LoadPlatformModules(m_PlatformNode); + //LoadPlatformModules(m_PlatformNode, m_SysGenDesigner.SysGenEngine.ProjectTask); + + Nodes.Clear(); + Nodes.Add(m_PlatformNode); + + m_PlatformNode.Text = RootNodeText; + m_PlatformNode.Expand(); + } + + private void UpdateCatalogTree() + { + BeginUpdate(); + BeforeCheck -= new TreeViewCancelEventHandler(CatalogTriStateTreeView_BeforeCheck); + + m_PlatformNode.Text = RootNodeText; + m_PlatformNode.Expand(); + + UpdatePlatformModules(m_PlatformNode); + + EndUpdate(); + BeforeCheck += new TreeViewCancelEventHandler(CatalogTriStateTreeView_BeforeCheck); + } + + private string RootNodeText + { + get + { + return string.Format("Catalog ({0} Modules-{1} Available)", + m_SysGenDesigner.ProjectController.Project.Platform.Modules.Count, + m_SysGenDesigner.ProjectController.Project.Modules.Count); + } + } + + private void UpdatePlatformModules(TreeNode node) + { + if (node is ModuleTreeNode) + { + //Get the underlying module + ModuleTreeNode moduleNode = node as ModuleTreeNode; + + if (moduleNode != null) + { + if (m_SysGenDesigner.ProjectController.Project.Platform.Modules.Contains(moduleNode.Module)) + { + SetChecked(moduleNode, CheckState.Checked); + } + else + { + SetChecked(moduleNode, CheckState.Unchecked); + } + } + } + else + { + foreach (TreeNode subNode in node.Nodes) + { + UpdatePlatformModules(subNode); + } + } + } + + private void LoadPlatformModules(TreeNode node) + { + foreach (RBuildModule module in m_SysGenDesigner.ProjectController.AvailableModules) + { + TreeNode parent = node; + + foreach (string part in module.CatalogPath.Split(new char[] { '\\' })) + { + if (part.Length > 0) + { + parent = GetFolderNode(parent, part); + } + } + + parent.Nodes.Add(new ModuleTreeNode(module)); + } + } + + private TreeNode GetFolderNode(TreeNode parent, string name) + { + foreach (TreeNode node in parent.Nodes) + { + CatalogTreeNode folderNode = node as CatalogTreeNode; + + if (folderNode != null) + { + if (folderNode.NodeName == name) + { + return folderNode; + } + } + } + + FolderTreeNode newNode = new FolderTreeNode(name); + + parent.Nodes.Add(newNode); + + return newNode; + } + + //private void LoadPlatformModules(TreeNode node, Task task) + //{ + // foreach (string path in + // /* + // if (task is ModuleTask) + // { + // RBuildModule module = ((ModuleTask)task).Module; + + // node.Nodes.Add(new ModuleTreeNode(module)); + // } + // else if (task is ITaskContainer) + // { + // if (task is DirectoryTask) + // { + // FolderTreeNode taskNode = new FolderTreeNode(((DirectoryTask)task).Name); + + // node.Nodes.Add(taskNode); + + // foreach (Task innerTask in ((ITaskContainer)task).ChildTasks) + // { + // LoadPlatformModules(taskNode, innerTask); + // } + // } + // else + // { + // foreach (Task innerTask in ((ITaskContainer)task).ChildTasks) + // { + // LoadPlatformModules(node, innerTask); + // } + // } + // } + // */ + //} + + public abstract class CatalogTreeNode : TreeNode + { + public abstract string NodeName { get; } + public abstract object NodeObject { get;} + } + + public class PlatformTreeNode : CatalogTreeNode + { + RBuildPlatform m_Platform = null; + + public PlatformTreeNode(RBuildPlatform platform) + { + m_Platform = platform; + Text = platform.Name; + } + + public RBuildPlatform Platform + { + get { return m_Platform; } + } + + public override string NodeName + { + get { return m_Platform.Name; } + } + + public override object NodeObject + { + get { return Platform; } + } + } + + public class ModuleTreeNode : CatalogTreeNode + { + RBuildModule m_Module = null; + + public ModuleTreeNode(RBuildModule module) + { + m_Module = module; + Text = module.Name; + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public override string NodeName + { + get { return Module.Name; } + } + + public override object NodeObject + { + get { return Module; } + } + } + + public class FolderTreeNode : CatalogTreeNode + { + private string m_FolderName = null; + + public FolderTreeNode(string name) + { + m_FolderName = name; + Text = name; + } + + public override string NodeName + { + get { return m_FolderName; } + } + + public override object NodeObject + { + get { return NodeName; } + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Controls/ProjectTreeView.cs b/reactos/tools/sysgen/RosBuilder/Controls/ProjectTreeView.cs new file mode 100644 index 00000000000..35f827319a4 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/ProjectTreeView.cs @@ -0,0 +1,161 @@ +using System; +using System.Windows.Forms; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public class ProjectTreeView : TreeView + { + private ISysGenDesigner m_SysGenDesigner = null; + private TreeNode m_Project = new TreeNode("Project"); + private TreeNode m_Platforms = new TreeNode("Platform"); + private TreeNode m_Languages = new TreeNode("Languages"); + private TreeNode m_DebugChannels = new TreeNode("Debug Channels"); + //private TreeNode m_Filters = new TreeNode("Filters"); + private TreeNode m_Files = new TreeNode("Files"); + private TreeNode m_Registry = new TreeNode("Registry"); + //private TreeNode m_Filters = new TreeNode("Filters"); + + public ProjectTreeView() + { + } + + public void SetCatalog(ISysGenDesigner sysGenDesigner) + { + //Set the software catalog + m_SysGenDesigner = sysGenDesigner; + m_SysGenDesigner.ProjectController.ProjectLoaded += new EventHandler(PlatformController_ProjectLoaded); + m_SysGenDesigner.ProjectController.ProjectUpdated += new EventHandler(PlatformController_ProjectUpdated); + + + LoadProject(); + } + + void PlatformController_ProjectLoaded(object sender, EventArgs e) + { + LoadProject(); + UpdateProject(); + } + + void PlatformController_ProjectUpdated(object sender, EventArgs e) + { + UpdateProject(); + } + + private void LoadProject() + { + Nodes.Clear(); + + m_Project = new ProjectTreeNode(m_SysGenDesigner.ProjectController.SysGenProject); + m_Project.Nodes.Add(m_Platforms); + m_Project.Nodes.Add(m_Languages); + m_Project.Nodes.Add(m_DebugChannels); +// m_Project.Nodes.Add(m_Filters); + m_Project.Nodes.Add(m_Files); + m_Project.Nodes.Add(m_Registry); + m_Project.Expand(); + + Nodes.Add(m_Project); + } + + private void UpdateProject() + { + m_Languages.Nodes.Clear(); + m_DebugChannels.Nodes.Clear(); + + foreach (RBuildLanguage language in m_SysGenDesigner.ProjectController.Project.Platform.Languages) + { + m_Languages.Nodes.Add(language.Name); + } + + foreach (RBuildDebugChannel channel in m_SysGenDesigner.ProjectController.Project.Platform.DebugChannels) + { + m_DebugChannels.Nodes.Add(channel.Name); + } + } + + public abstract class CatalogTreeNode : TreeNode + { + public abstract string NodeName { get; } + public abstract object NodeObject { get;} + } + + public class ProjectTreeNode : CatalogTreeNode + { + Project m_Platform = null; + + public ProjectTreeNode(Project platform) + { + m_Platform = platform; + Text = platform.FileName; + } + + public Project Platform + { + get { return m_Platform; } + } + + public override string NodeName + { + get { return m_Platform.Name; } + } + + public override object NodeObject + { + get { return Platform; } + } + } + + public class ModuleTreeNode : CatalogTreeNode + { + RBuildModule m_Module = null; + + public ModuleTreeNode(RBuildModule module) + { + m_Module = module; + Text = module.Name; + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public override string NodeName + { + get { return Module.Name; } + } + + public override object NodeObject + { + get { return Module; } + } + } + + public class FolderTreeNode : CatalogTreeNode + { + private string m_FolderName = null; + + public FolderTreeNode(string name) + { + m_FolderName = name; + Text = name; + } + + public override string NodeName + { + get { return m_FolderName; } + } + + public override object NodeObject + { + get { return NodeName; } + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.Designer.cs b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.Designer.cs new file mode 100644 index 00000000000..1c20f5713ba --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.Designer.cs @@ -0,0 +1,118 @@ +namespace RosBuilder.Controls +{ + partial class RegistryEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.listView1 = new System.Windows.Forms.ListView(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader3 = new System.Windows.Forms.ColumnHeader(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.treeView1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.listView1); + this.splitContainer1.Size = new System.Drawing.Size(623, 542); + this.splitContainer1.SplitterDistance = 207; + this.splitContainer1.TabIndex = 0; + // + // listView1 + // + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3}); + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.Location = new System.Drawing.Point(0, 0); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(412, 542); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + // + // treeView1 + // + this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeView1.Location = new System.Drawing.Point(0, 0); + this.treeView1.Name = "treeView1"; + this.treeView1.Size = new System.Drawing.Size(207, 542); + this.treeView1.TabIndex = 0; + // + // columnHeader1 + // + this.columnHeader1.Text = "Name"; + this.columnHeader1.Width = 159; + // + // columnHeader2 + // + this.columnHeader2.Text = "Type"; + this.columnHeader2.Width = 130; + // + // columnHeader3 + // + this.columnHeader3.Text = "Data"; + // + // RegistryEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "RegistryEditor"; + this.Size = new System.Drawing.Size(623, 542); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.TreeView treeView1; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader3; + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.cs b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.cs new file mode 100644 index 00000000000..738adfbefc0 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace RosBuilder.Controls +{ + public partial class RegistryEditor : UserControl + { + public RegistryEditor() + { + InitializeComponent(); + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.resx b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.resx new file mode 100644 index 00000000000..19dc0dd8b39 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Controls/RegistryEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Form1.Designer.cs b/reactos/tools/sysgen/RosBuilder/Form1.Designer.cs new file mode 100644 index 00000000000..04418fb8104 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Form1.Designer.cs @@ -0,0 +1,38 @@ +namespace RosBuilder +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "Form1"; + } + + #endregion + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Form1.cs b/reactos/tools/sysgen/RosBuilder/Form1.cs new file mode 100644 index 00000000000..a11fbad5119 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Form1.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace RosBuilder +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Form1.resx b/reactos/tools/sysgen/RosBuilder/Form1.resx new file mode 100644 index 00000000000..19dc0dd8b39 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Inspectors/PlatformInspector.cs b/reactos/tools/sysgen/RosBuilder/Inspectors/PlatformInspector.cs new file mode 100644 index 00000000000..7d798289853 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Inspectors/PlatformInspector.cs @@ -0,0 +1,155 @@ +using System; +using System.Windows.Forms; +using System.ComponentModel; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public class PlatformInspector + { + private RBuildPlatform m_Platform = null; + + public PlatformInspector(RBuildPlatform platform) + { + m_Platform = platform; + } + + [Category("Info")] + public string Name + { + get { return m_Platform.Name; } + set { m_Platform.Name = value; } + } + + [Category("Info")] + public string Description + { + get { return m_Platform.Description; } + set { m_Platform.Description = value; } + } + + [Category("Applications")] + [Description("The module to be used as a shell for the platform")] + public string Shell + { + set + { + if (value != string.Empty) + { + try + { + RBuildModule module = m_Platform.Modules.GetByName(value); + + if (module == null) + throw new ArgumentException("Unknown '" + value + "' shell module"); + + if (module.Type != ModuleType.Win32CUI && + module.Type != ModuleType.Win32GUI) + throw new ArgumentException("Only Win32 GUI and CUI applications can be set as shell"); + + /* set the shell to use */ + m_Platform.Shell = module; + } + catch (ArgumentException e) + { + MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + get + { + if (m_Platform.Shell != null) + return m_Platform.Shell.Name; + + return string.Empty; + } + } + + [Category("Applications")] + [Description("The module to be used as a screensaver for the platform")] + public string Screensaver + { + set + { + if (value != string.Empty) + { + try + { + RBuildModule module = m_Platform.Modules.GetByName(value); + + if (module == null) + throw new ArgumentException("Unknown '" + value + "' screen saver module"); + + if (module.Type != ModuleType.Win32SCR) + throw new ArgumentException("Only Win32 SCR applications can be set as shell"); + + /* set the shell to use */ + m_Platform.Screensaver = module; + } + catch (ArgumentException e) + { + MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + get + { + if (m_Platform.Screensaver != null) + return m_Platform.Screensaver.Name; + + return string.Empty; + } + } + + //public IList DebugChannels + //{ + // get { return m_Platform.DebugChannels; } + //} + + [Category("Appareance")] + [Description("The module to be used as a screensaver for the platform")] + public string Wallpaper + { + set + { + if (value != string.Empty) + { + RBuildWallpaperFile iW = new RBuildWallpaperFile(); + + iW.Name = value; + + m_Platform.Wallpaper = iW; + + //foreach (RBuildModule module in m_Platform.Modules) + //{ + // foreach (RBuildFile file in module.Files) + // { + // RBuildInstallWallpaperFile wallpaper = file as RBuildInstallWallpaperFile; + + // if (wallpaper != null) + // { + // if (wallpaper.ID.ToLower() == value.ToLower()) + // { + // m_Platform.Wallpaper = wallpaper; + // } + // } + // } + //} + + // specified wallpaper not found + //throw new ArgumentException(); + } + } + get + { + if (m_Platform.Wallpaper != null) + return m_Platform.Wallpaper.ID; + + return string.Empty; + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/MainForm.Designer.cs b/reactos/tools/sysgen/RosBuilder/MainForm.Designer.cs new file mode 100644 index 00000000000..9ebe4ebeefd --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/MainForm.Designer.cs @@ -0,0 +1,654 @@ +namespace TriStateTreeViewDemo +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.newToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.openToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.saveToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.cutToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.copyToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); + this.saveConfigToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.cmbArchitecture = new System.Windows.Forms.ToolStripComboBox(); + this.cmbDebug = new System.Windows.Forms.ToolStripComboBox(); + this.cmbOptimization = new System.Windows.Forms.ToolStripComboBox(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.helpToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.platformToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addLanguagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addDebToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pgProperties = new System.Windows.Forms.PropertyGrid(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.tvPlatform = new TriStateTreeViewDemo.PlatformTreeView(); + this.tvProject = new TriStateTreeViewDemo.ProjectTreeView(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.statusStrip1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.SuspendLayout(); + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 601); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(820, 22); + this.statusStrip1.TabIndex = 5; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripButton, + this.openToolStripButton, + this.saveToolStripButton, + this.toolStripSeparator, + this.cutToolStripButton, + this.copyToolStripButton, + this.toolStripSeparator8, + this.saveConfigToolStripButton, + this.cmbArchitecture, + this.cmbDebug, + this.cmbOptimization, + this.toolStripSeparator1, + this.helpToolStripButton}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(820, 25); + this.toolStrip1.TabIndex = 6; + this.toolStrip1.Text = "toolStrip1"; + // + // newToolStripButton + // + this.newToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.newToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripButton.Image"))); + this.newToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newToolStripButton.Name = "newToolStripButton"; + this.newToolStripButton.Size = new System.Drawing.Size(23, 22); + this.newToolStripButton.Text = "&New"; + this.newToolStripButton.Click += new System.EventHandler(this.newToolStripButton_Click); + // + // openToolStripButton + // + this.openToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.openToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripButton.Image"))); + this.openToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openToolStripButton.Name = "openToolStripButton"; + this.openToolStripButton.Size = new System.Drawing.Size(23, 22); + this.openToolStripButton.Text = "&Open"; + this.openToolStripButton.Click += new System.EventHandler(this.openToolStripButton_Click); + // + // saveToolStripButton + // + this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripButton.Image"))); + this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveToolStripButton.Name = "saveToolStripButton"; + this.saveToolStripButton.Size = new System.Drawing.Size(23, 22); + this.saveToolStripButton.Text = "&Save"; + this.saveToolStripButton.Click += new System.EventHandler(this.saveToolStripButton_Click); + // + // toolStripSeparator + // + this.toolStripSeparator.Name = "toolStripSeparator"; + this.toolStripSeparator.Size = new System.Drawing.Size(6, 25); + // + // cutToolStripButton + // + this.cutToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.cutToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripButton.Image"))); + this.cutToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.cutToolStripButton.Name = "cutToolStripButton"; + this.cutToolStripButton.Size = new System.Drawing.Size(23, 22); + this.cutToolStripButton.Text = "C&ut"; + // + // copyToolStripButton + // + this.copyToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.copyToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripButton.Image"))); + this.copyToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.copyToolStripButton.Name = "copyToolStripButton"; + this.copyToolStripButton.Size = new System.Drawing.Size(23, 22); + this.copyToolStripButton.Text = "&Copy"; + // + // toolStripSeparator8 + // + this.toolStripSeparator8.Name = "toolStripSeparator8"; + this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25); + // + // saveConfigToolStripButton + // + this.saveConfigToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.saveConfigToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("saveConfigToolStripButton.Image"))); + this.saveConfigToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveConfigToolStripButton.Name = "saveConfigToolStripButton"; + this.saveConfigToolStripButton.Size = new System.Drawing.Size(69, 22); + this.saveConfigToolStripButton.Text = "&Save Config"; + this.saveConfigToolStripButton.Click += new System.EventHandler(this.saveConfigToolStripButton_Click); + // + // cmbArchitecture + // + this.cmbArchitecture.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbArchitecture.Name = "cmbArchitecture"; + this.cmbArchitecture.Size = new System.Drawing.Size(150, 25); + // + // cmbDebug + // + this.cmbDebug.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbDebug.Name = "cmbDebug"; + this.cmbDebug.Size = new System.Drawing.Size(75, 25); + // + // cmbOptimization + // + this.cmbOptimization.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbOptimization.Name = "cmbOptimization"; + this.cmbOptimization.Size = new System.Drawing.Size(75, 25); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // helpToolStripButton + // + this.helpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.helpToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("helpToolStripButton.Image"))); + this.helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.helpToolStripButton.Name = "helpToolStripButton"; + this.helpToolStripButton.Size = new System.Drawing.Size(23, 22); + this.helpToolStripButton.Text = "He&lp"; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.platformToolStripMenuItem, + this.editToolStripMenuItem, + this.toolsToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(820, 24); + this.menuStrip1.TabIndex = 7; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.toolStripSeparator2, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, + this.toolStripSeparator3, + this.printToolStripMenuItem, + this.printPreviewToolStripMenuItem, + this.toolStripSeparator4, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); + this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.newToolStripMenuItem.Text = "&New"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); + this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.openToolStripMenuItem.Text = "&Open"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(148, 6); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); + this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.saveToolStripMenuItem.Text = "&Save"; + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.saveAsToolStripMenuItem.Text = "Save &As"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(148, 6); + // + // printToolStripMenuItem + // + this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); + this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printToolStripMenuItem.Name = "printToolStripMenuItem"; + this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); + this.printToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.printToolStripMenuItem.Text = "&Print"; + // + // printPreviewToolStripMenuItem + // + this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); + this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; + this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.printPreviewToolStripMenuItem.Text = "Print Pre&view"; + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(148, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + // + // platformToolStripMenuItem + // + this.platformToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addFiltersToolStripMenuItem, + this.addLanguagesToolStripMenuItem, + this.addDebToolStripMenuItem}); + this.platformToolStripMenuItem.Name = "platformToolStripMenuItem"; + this.platformToolStripMenuItem.Size = new System.Drawing.Size(59, 20); + this.platformToolStripMenuItem.Text = "&Platform"; + // + // addFiltersToolStripMenuItem + // + this.addFiltersToolStripMenuItem.Name = "addFiltersToolStripMenuItem"; + this.addFiltersToolStripMenuItem.Size = new System.Drawing.Size(185, 22); + this.addFiltersToolStripMenuItem.Text = "&Add Filters"; + this.addFiltersToolStripMenuItem.Click += new System.EventHandler(this.addFiltersToolStripMenuItem_Click); + // + // addLanguagesToolStripMenuItem + // + this.addLanguagesToolStripMenuItem.Name = "addLanguagesToolStripMenuItem"; + this.addLanguagesToolStripMenuItem.Size = new System.Drawing.Size(185, 22); + this.addLanguagesToolStripMenuItem.Text = "&Add Languages"; + this.addLanguagesToolStripMenuItem.Click += new System.EventHandler(this.addLanguagesToolStripMenuItem_Click); + // + // addDebToolStripMenuItem + // + this.addDebToolStripMenuItem.Name = "addDebToolStripMenuItem"; + this.addDebToolStripMenuItem.Size = new System.Drawing.Size(185, 22); + this.addDebToolStripMenuItem.Text = "&Add Debug Channels"; + this.addDebToolStripMenuItem.Click += new System.EventHandler(this.addDebToolStripMenuItem_Click); + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.undoToolStripMenuItem, + this.redoToolStripMenuItem, + this.toolStripSeparator5, + this.cutToolStripMenuItem, + this.copyToolStripMenuItem, + this.pasteToolStripMenuItem, + this.toolStripSeparator6, + this.selectAllToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // undoToolStripMenuItem + // + this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; + this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.undoToolStripMenuItem.Text = "&Undo"; + // + // redoToolStripMenuItem + // + this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; + this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); + this.redoToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.redoToolStripMenuItem.Text = "&Redo"; + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(147, 6); + // + // cutToolStripMenuItem + // + this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image"))); + this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; + this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); + this.cutToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.cutToolStripMenuItem.Text = "Cu&t"; + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image"))); + this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.copyToolStripMenuItem.Text = "&Copy"; + // + // pasteToolStripMenuItem + // + this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image"))); + this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; + this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.pasteToolStripMenuItem.Text = "&Paste"; + // + // toolStripSeparator6 + // + this.toolStripSeparator6.Name = "toolStripSeparator6"; + this.toolStripSeparator6.Size = new System.Drawing.Size(147, 6); + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.selectAllToolStripMenuItem.Text = "Select &All"; + // + // toolsToolStripMenuItem + // + this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.customizeToolStripMenuItem, + this.optionsToolStripMenuItem}); + this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.toolsToolStripMenuItem.Text = "&Tools"; + // + // customizeToolStripMenuItem + // + this.customizeToolStripMenuItem.Name = "customizeToolStripMenuItem"; + this.customizeToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.customizeToolStripMenuItem.Text = "&Customize"; + // + // optionsToolStripMenuItem + // + this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.optionsToolStripMenuItem.Text = "&Options"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.contentsToolStripMenuItem, + this.indexToolStripMenuItem, + this.searchToolStripMenuItem, + this.toolStripSeparator7, + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(40, 20); + this.helpToolStripMenuItem.Text = "&Help"; + // + // contentsToolStripMenuItem + // + this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; + this.contentsToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.contentsToolStripMenuItem.Text = "&Contents"; + // + // indexToolStripMenuItem + // + this.indexToolStripMenuItem.Name = "indexToolStripMenuItem"; + this.indexToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.indexToolStripMenuItem.Text = "&Index"; + // + // searchToolStripMenuItem + // + this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; + this.searchToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.searchToolStripMenuItem.Text = "&Search"; + // + // toolStripSeparator7 + // + this.toolStripSeparator7.Name = "toolStripSeparator7"; + this.toolStripSeparator7.Size = new System.Drawing.Size(126, 6); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.aboutToolStripMenuItem.Text = "&About..."; + // + // pgProperties + // + this.pgProperties.Dock = System.Windows.Forms.DockStyle.Fill; + this.pgProperties.Location = new System.Drawing.Point(0, 0); + this.pgProperties.Name = "pgProperties"; + this.pgProperties.Size = new System.Drawing.Size(348, 304); + this.pgProperties.TabIndex = 9; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 49); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.tvPlatform); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(820, 552); + this.splitContainer1.SplitterDistance = 468; + this.splitContainer1.TabIndex = 11; + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.tvProject); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.pgProperties); + this.splitContainer2.Size = new System.Drawing.Size(348, 552); + this.splitContainer2.SplitterDistance = 244; + this.splitContainer2.TabIndex = 0; + // + // tvPlatform + // + this.tvPlatform.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvPlatform.ImageIndex = 1; + this.tvPlatform.Location = new System.Drawing.Point(0, 0); + this.tvPlatform.Name = "tvPlatform"; + this.tvPlatform.SelectedImageIndex = 1; + this.tvPlatform.Size = new System.Drawing.Size(468, 552); + this.tvPlatform.TabIndex = 1; + // + // tvProject + // + this.tvProject.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvProject.Location = new System.Drawing.Point(0, 0); + this.tvProject.Name = "tvProject"; + this.tvProject.Size = new System.Drawing.Size(348, 244); + this.tvProject.TabIndex = 10; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); + this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(820, 623); + this.Controls.Add(this.splitContainer1); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "MainForm"; + this.Text = "SysGen Platform Designer"; + this.Load += new System.EventHandler(this.MainForm_Load); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + this.splitContainer2.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private TriStateTreeViewDemo.PlatformTreeView tvPlatform; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton newToolStripButton; + private System.Windows.Forms.ToolStripButton openToolStripButton; + private System.Windows.Forms.ToolStripButton saveToolStripButton; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator; + private System.Windows.Forms.ToolStripButton cutToolStripButton; + private System.Windows.Forms.ToolStripButton copyToolStripButton; + private System.Windows.Forms.ToolStripButton saveConfigToolStripButton; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton helpToolStripButton; + private System.Windows.Forms.ToolStripComboBox cmbArchitecture; + private System.Windows.Forms.ToolStripComboBox cmbDebug; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.PropertyGrid pgProperties; + private System.Windows.Forms.ToolStripComboBox cmbOptimization; + private ProjectTreeView tvProject; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.ToolStripMenuItem platformToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addFiltersToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addLanguagesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addDebToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + } +} + diff --git a/reactos/tools/sysgen/RosBuilder/MainForm.cs b/reactos/tools/sysgen/RosBuilder/MainForm.cs new file mode 100644 index 00000000000..c001ba7d016 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/MainForm.cs @@ -0,0 +1,362 @@ +using System; +using System.Xml; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using TriStateTreeViewDemo; + +using SysGen.Framework.Catalog; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Log; +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public interface ISysGenDesigner + { + ModuleFilterController ModuleFilterController { get; } + ProjectController ProjectController { get; } + object InspectedObject { set; } + } + + public partial class MainForm : Form, ISysGenDesigner + { + ProjectController m_ProjectController = null; + ModuleFilterController m_FilterController = null; + + public MainForm() + { + InitializeComponent(); + + m_ProjectController = new ProjectController(this); + m_FilterController = new ModuleFilterController(this); + + tvPlatform.SetCatalog(this); + tvProject.SetCatalog(this); + tvProject.DoubleClick += new EventHandler(tvProject_DoubleClick); + //lvModuleFilters.SetCatalog(this); + } + + private void button1_Click(object sender, EventArgs e) + { + //m_project = new RBuildProject(); + + m_ProjectController = new ProjectController(this); + m_FilterController = new ModuleFilterController(this); + + tvPlatform.SetCatalog(this); + tvProject.SetCatalog(this); + //lvModuleFilters.SetCatalog(this); + + //PlatformCatalogReader m_Reader = new PlatformCatalogReader(@"C:\Ros\trunk\reactos\rbuilddb.xml"); + + /* + BuildLog.Listeners.Clear(); + + m_SysGenEngine.SetDefaults = false; + m_SysGenEngine.RunBackends = false; + m_SysGenEngine.CleanCustomConfigs(); + m_SysGenEngine.ReadBuildFiles(); + + m_PlatformController = new PlatformController(this); + m_FilterController = new ModuleFilterController(this); + + catalogTriStateTreeView1.SetCatalog(this); + lvModuleFilters.SetCatalog(this); + */ + + } + + void tvProject_DoubleClick(object sender, EventArgs e) + { + } + + private void button2_Click(object sender, EventArgs e) + { + using (XmlTextWriter writer = new XmlTextWriter(@"c:\pkg.rbuild", Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteStartElement("module"); + writer.WriteAttributeString("name", ""); + writer.WriteAttributeString("type", "modulegroup"); + + foreach (RBuildModule module in m_ProjectController.Project.Platform.Modules) + { + writer.WriteElementString("requires", module.Name); + } + + writer.WriteEndElement(); + writer.WriteEndDocument(); + } + + } + + private void button3_Click(object sender, EventArgs e) + { + } + + public ModuleFilterController ModuleFilterController + { + get { return m_FilterController; } + } + + public ProjectController ProjectController + { + get { return m_ProjectController; } + } + + private void lvModuleFilters_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + //private void lvModuleFilters_ItemCheck(object sender, ItemCheckEventArgs e) + //{ + // ModuleFiltersListViewItem filerListViewItem = lvModuleFilters.FocusedItem as ModuleFiltersListViewItem; + + // if (filerListViewItem != null) + // { + // if (e.NewValue == CheckState.Checked) + // { + // m_FilterController.Apply(filerListViewItem.Filter); + // } + // } + //} + + private void MainForm_Load(object sender, EventArgs e) + { + cmbArchitecture.Items.Add("x86 - (i486)"); + cmbArchitecture.Items.Add("x86 - (i586)"); + cmbArchitecture.Items.Add("x86 - (Pentium)"); + cmbArchitecture.Items.Add("x86 - (Pentium2)"); + cmbArchitecture.Items.Add("x86 - (Pentium3)"); + cmbArchitecture.Items.Add("x86 - (Pentium4)"); + cmbArchitecture.Items.Add("x86 - (athlon-xp)"); + cmbArchitecture.Items.Add("x86 - (athlon-mp)"); + cmbArchitecture.Items.Add("x86 - (k6-2)"); + cmbArchitecture.Items.Add("x86 - Xbox"); + cmbArchitecture.Items.Add("Power PC"); + cmbArchitecture.Items.Add("ARM"); + cmbArchitecture.SelectedIndex = 2; + + cmbDebug.Items.Add("Debug"); + cmbDebug.Items.Add("Release"); + cmbDebug.SelectedIndex = 0; + + cmbOptimization.Items.Add("Level 0"); + cmbOptimization.Items.Add("Level 1"); + cmbOptimization.Items.Add("Level 2"); + cmbOptimization.Items.Add("Level 3"); + cmbOptimization.Items.Add("Level 4"); + cmbOptimization.Items.Add("Level 5"); + cmbOptimization.SelectedIndex = 1; + } + + public object InspectedObject + { + set + { + if (value is RBuildPlatform) + { + pgProperties.SelectedObject = new PlatformInspector(m_ProjectController.Project.Platform); + } + else + pgProperties.SelectedObject = value; + } + } + + private void openToolStripButton_Click(object sender, EventArgs e) + { + m_ProjectController.Open(); + } + + private void saveToolStripButton_Click(object sender, EventArgs e) + { + m_ProjectController.Save(); + } + + private void saveConfigToolStripButton_Click(object sender, EventArgs e) + { + //if (MessageBox.Show("Your platform does not have a default shell selected ¿are you sure you want to continue?", + // "Question", + // MessageBoxButtons.YesNo, + // MessageBoxIcon.Question) == DialogResult.OK) + //{ + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(m_ProjectController.SysGenProject.Source + @"\config.rbuild", Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteStartElement("group"); + + writer.WriteComment("Platform information"); + writer.WriteElementString("platformname", m_ProjectController.Project.Platform.Name); + writer.WriteElementString("platformdescription", m_ProjectController.Project.Platform.Description); + + writer.WriteComment("Default applications"); + + if (m_ProjectController.Project.Platform.Shell != null) + { + writer.WriteElementString("platformshell", m_ProjectController.Project.Platform.Shell.Name); + } + + if (m_ProjectController.Project.Platform.Screensaver != null) + { + writer.WriteElementString("platformscreensaver", m_ProjectController.Project.Platform.Screensaver.Name); + } + + if (m_ProjectController.Project.Platform.Wallpaper != null) + { + writer.WriteElementString("platformwallpaper", m_ProjectController.Project.Platform.Wallpaper.ID); + } + + writer.WriteComment("Modules incuded in the platform"); + foreach (RBuildModule module in m_ProjectController.Project.Platform.Modules) + { + writer.WriteElementString("platformmodule", module.Name); + } + + writer.WriteComment("Languages incuded in the platform"); + foreach (RBuildLanguage language in m_ProjectController.Project.Platform.Languages) + { + writer.WriteElementString("platformlanguage", language.Name); + } + + writer.WriteComment("Debug Channels incuded in the platform"); + foreach (RBuildDebugChannel debugChannel in m_ProjectController.Project.Platform.DebugChannels) + { + writer.WriteElementString("platformdebugchhanel", debugChannel.Name); + } + + writer.WriteComment("Platform RBuild Properties"); + writer.WriteComment("Properties"); + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "SARCH"); + writer.WriteAttributeString("value", ""); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "OARCH"); + writer.WriteAttributeString("value", "pentium"); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "OPTIMIZE"); + writer.WriteAttributeString("value", ((int)m_ProjectController.SysGenProject.OptimizeLevel).ToString()); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "KDBG"); + writer.WriteAttributeString("value", m_ProjectController.SysGenProject.KDebug ? "1" : "0"); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "DBG"); + writer.WriteAttributeString("value", m_ProjectController.SysGenProject.Debug ? "1" : "0"); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "GDB"); + writer.WriteAttributeString("value", m_ProjectController.SysGenProject.GDB ? "1" : "0"); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "NSWPAT"); + writer.WriteAttributeString("value", m_ProjectController.SysGenProject.NSWPAT ? "1" : "0"); + writer.WriteEndElement(); + + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", "_WINKD_"); + writer.WriteAttributeString("value", m_ProjectController.SysGenProject.WINKD ? "1" : "0"); + writer.WriteEndElement(); + + writer.WriteEndElement(); + writer.WriteEndDocument(); + // } + } + } + + private void newToolStripButton_Click(object sender, EventArgs e) + { + m_ProjectController.New(); + } + + private void addFiltersToolStripMenuItem_Click(object sender, EventArgs e) + { + using (NewItemForm newItem = new NewItemForm()) + { + foreach (ModuleFilter filter in ModuleFilterController.ModuleFilters) + { + newItem.ListView.Items.Add(new ModuleFiltersNewItemListViewItem(this, filter)); + } + + if (newItem.ShowDialog() == DialogResult.OK) + { + foreach (ListViewItem lvItem in newItem.ListView.SelectedItems) + { + NewItemListViewItem item = lvItem as NewItemListViewItem; + + if (item != null) + item.Apply(); + } + } + } + } + + private void addLanguagesToolStripMenuItem_Click(object sender, EventArgs e) + { + using (NewItemForm newItem = new NewItemForm()) + { + foreach (RBuildLanguage language in m_ProjectController.Project.Languages) + { + newItem.ListView.Items.Add(new LanguageNewItemListViewItem(this, language)); + } + + if (newItem.ShowDialog() == DialogResult.OK) + { + foreach (ListViewItem lvItem in newItem.ListView.SelectedItems) + { + NewItemListViewItem item = lvItem as NewItemListViewItem; + + if (item != null) + item.Apply(); + } + } + } + } + + private void addDebToolStripMenuItem_Click(object sender, EventArgs e) + { + using (NewItemForm newItem = new NewItemForm()) + { + foreach (RBuildDebugChannel channel in m_ProjectController.Project.DebugChannels) + { + newItem.ListView.Items.Add(new DebugChannelNewItemListViewItem(this, channel)); + } + + if (newItem.ShowDialog() == DialogResult.OK) + { + foreach (ListViewItem lvItem in newItem.ListView.SelectedItems) + { + NewItemListViewItem item = lvItem as NewItemListViewItem; + + if (item != null) + item.Apply(); + } + } + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/MainForm.resx b/reactos/tools/sysgen/RosBuilder/MainForm.resx new file mode 100644 index 00000000000..222877d4dd7 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/MainForm.resx @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 127, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAQ9JREFUOE+t09lq + wkAUBmBfyr5DfY32jaReSOmFCyKCgkKLFrVUBZeKiEbshqRuaNw1xiXmLxMJBJ0Zc+GBw9zMfDPnHMZm + u1ZE35s4zXCqjmC8Al+sgHLjD9y7yGFWPIbecOO45yORtMAEHnxxJHL1IyKI9JeEXqtMwOl50Q8bSS0l + 8PzBBPbqAQQxICrgjeapgKZpkJUdBmNZB+y3d/QSnsIZKrDdqZjMFYj9OR9wB1NngHrQsJC36EkrfIkT + PuDyJ84AZbOHNF2j1Z2h9i3xAVKfOUjjZssN2oMFmq0xSkLfOmBu3E97iurnENlKxzpgbpzwO0Kh1kOy + KFoDjHmzVuYYjRmTDZfyWh9Yd/4B2Mz2w1z7EGUAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlpJREFUOE+tk21I + k1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC + TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p + AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0 + BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr + UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG + CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5 + F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS + rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt + NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp + 59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAixJREFUOE+tk91L + k3EUx/cvdN9N0EW3NTWGa7EaPOUcyqphWBG9PZEv5dJlmqhYmUYtXyBb4dJJy+kknFT4BqZIjaFMJUsz + V7TEoabYRDD49ju/6Pm1Mi+iH5zLz+c855zvo1L9j/fsaRRUvvZltHmX8Ni9gMaGCO47ZlBb8wn22yHc + KJ9CackECgteIy93FBfOB6H0JrC3B6ipXsVGb2V1Dca0XhxOe8JLEXhbF7mgsuLLX3mCIwsr2G1+DrVa + huWQRwjcj+a5oLTk87qCn/D78CLiTD4UXJ7GAXOTEDjrZ7ngku3dH4Jf4ZHJCLZJXlhzxpGa4hSCurth + LsjOGo0R/A4PBsPYrHdDlgMwmRxCUF31kQvkMwFFsB7c4/+ATYkNOHL0BZKSaoXgZuU0urvATgkcP/kK + lmMDfNu0MJqZPps6/4D7cNDSCUmyC8HVskl0+MAyADS5vrG7f0X59Tm+VFoYzZyZEVTg5NR2GAwVQnCl + cByeZuChc40FJwpjek5MmU/YkH6uiHdOTmHwfg/0+jIhsOWNMRiouhPlnUnAQoI4rYSht7MYm5qDnHsN + e41tHNbucUGnKxICiqXjHpTPJgHBZ/Nv4U1oHqGZJVwstiNe72JwI+J3PYA2MV8IMjOG2dzLfOatBg+2 + 7JDQ0tEPX9cguvv8GHg5hH0mC9S6eiQweLumDhqNVQgo06dP9fN4UsIoJHRnOhVtmxZGM1NXKoJ3JmTH + Cv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAYdJREFUOE+t001L + QlEQBuB+TdCmRVEJRRIWtRAUlKsQhFmkpZQtIiWyAlMwP5KkXS0shLqGFkgoFqWQmaRR2qIvU7FMwWhd + 8JZXkFx0uVGzOcNh5jkDw6mr+++4SN7B6fbju/uQecYm6a25+/Hdl2IJptWNmmJyL4DwWZwZUJbtayT8 + RxGqIV8oQaaaRfrxkTmw4z2G+WuKbC6PYDgOkUSJp6ccc+AgdI4luwPbHh/UCxb0S0aZN5fHTmefMTVv + wfDEHIiBMegMpt8BZUShNoGQTIKQGxA8TTIHMoUPGF1vEOvTWHTcgqeJQahNwLqVQiRRpIdS+XcM2l4h + 1t2DI3WAP7oGoSYE3kwSPQofljcqm/kxjK4SCH0OXSMetItsUC26wZuOVptYhI0eEOuz1YI2gZnKBdpr + 6iR9V2jkKOkBQpeiCryhFFr4eioft16iU7qNho4h1Dc00QOqlRuwpSSa+UawuZXdByIZsPoUaOmWwrUf + owcOozlwZeto7ZXDuXvCfHV/+dGfqqrf44qgu28AAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAeJJREFUOE+lk9FP + klEYxv1TSsecde0f0FpZrTbbal7URVvZuuJCr7pq2WzLNWy0iSHNwtIB9qG0ltLSYRJpBomUgZPMGSyU + 8SmJIOiv7zssCdrAzXd77s77e5/nnPdUVR20HBPfUCWNB4QsI176HB8IL/9iX2y1ubTMwx6utz0nuLhc + GWIfCxT153Z26ep/g9Md4FJLZ2WIZdQnAM4QSJ/BH5Z5aH6NNCljm0hgdSV4MppAPxQXCq5kil31OTx7 + DjLbOeSNNJFYUgBKq31glfpmN76F9QLEZHOJc73ubXQjMreln7Q+DdP/du0/QIsxhmNK5mjTMJ/m43mI + Qcmr5t5MZVlNpFiKrPM1vIbpVVQAOqSckF+ZekUX5UjTS+ouDFLb+CwPUPNupbN7k7WmEDcMX3hgXSpy + IP/OsrCyhXtuA6M0g+bc4wJATqaZ/x7DF4zg8f9g/OMibb355701kERriHL5fojzd2aFjNI0mjPdBUD9 + 6auUqlU/KwBZJV4skWUuvMmYV8b+Ls6jQQ81DfryO3KtfUoA/p3810G37T3VJ3TlARdvukhldjANeemx + z2B8MS0mq80GyySHj98rD2jQOpXbtgrVNprRnO2h5lQX1Sc7leYODh27W3nN9/WZDnroDx0A5wwhdtmt + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlBJREFUOE+1k1lI + lGEUhn/owm6KFuqqq4LoJooIqouMwixMM4zEjKyJGJUSlcnSITU1RSe3SdPGyGVQc6tEUSkSIXFo13CM + FonUyGmy5p9xz+Lp/z8ZbGjzpgMv5+a8z1n4Pkn6H9HZnEH7zVQayxKYF7+hMg+3ynKO4LBVMWa7xmBf + Nme1vuSl67hi0GNMj/sVqBon5XqmnXVMOqoxF+sYH6kgJyWKF13xnD/tT7xmM7bOY4y0riY6bL8nRAWo + 5mlnDUUZR+m2ZCO/L2C4T89bywmaSgIJD/WmKnEVT/MkIg/v8wTUVeTMAuQbGBLDSNaFoI8K5lxkEDpt + IDEafyJCfciPXiMAIX7enoDqUgNTci1TdhPjQ5nYn0dhrVgu1Fu+jO7iRTwyegmzKp9tGz0BZlMGE/Yy + JgbSGH95irFnB5GbF5Nb3kqmqZELl2uJN5iJSS0hPMFIWGyWJ6C0MJXRQSNjfVpGH/vjur+Jj7dXCLM7 + pme+4XBOMjDsIDgihYDj+jlISW4S8qs0XA99cXWsx9m2ksFySXRWo/RWp5Cppp3efpsw3+2ysidIMwsp + zErgc88ZnO3rkFuWYq/3ov+6JMb+OvOdLy6l8wcHvW9sWHre4Rcag69i3rX3AN7bdyDlX4zD/iBCMS/h + U8NChioXYC2SiFZ2Vsd2T3BVmaDA3EZTh1VkVVs3rEW6lBwrHoj7yu6sVQ72c+d7ltfCXH+nm5rWJ3MA + dY3cpJPKCwtEE7SbgJ1bBFm9trqzu9vvspjgT3FIubZa8C/N67P9regHTvjvLQ3rR38AAAAASUVORK5C + YII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAhhJREFUOE+1U09r + E0EU70fIR9iPUBQ8eMrR46IN5JhCDz2oBA8SBHEpCMFgG5GiwdJdq2Ijqe6ldo3Wrmhri0gXazW2YbMt + UdNmm45ulf7R/HwzU1hLIzn54LFvhvn9eW9nOjr+R0wvBLhTXEf6bgV9w0sYLJQx/uoz2mq9c7eRn2pA + L67Bq+/i29YeWLBL9Q6u5ktI6w6Kr1dbE3HwA3sT/o8mbAfQRgE1LZPXtsPgbjZxaXAG4y/Kh0m48sbP + JgwbiKYAwwLYNkR4DEje5HsMFSI5l3l2kGD6/RYezzeEMgfzwzzMWSCRlV9OFk0xqhl06wNy+Tchyb2n + dXxhv4TVaFLazppAJ9VKL0MySxYoVI0hkXaw5AbovjAWEmTur4qBqZoEdfbKVCgTBObqdolBUW0ocRs1 + P8Cx2PWQ4PJtl6a9J+xLIB1OMHIilU2b1gSMqCZ9TdTq33FEHQgJcg8rWPF3qHcJVOKeyOyoJIioDqUk + UFM2SuUqus4YIcHEzFdYji8GxIGROAc41JJHc6E1B58wRRqWhzFrEVduTR78E5mRBSz7v0l1H0AgXgsH + +2DNcPBp3cep0/rhezA5V0Vfbg5ug+4CqaiaI/rmyWu+t1zdQIysDxdmW9/GiZcVnO+fgvHkI+YXV7BG + 067VA9Ezt91Fyvq/wH8/lKHCW/RcfITj8Rs4evIaYmdHkBl63v4xtX1tLQ78AZ3a8qxOv4hDAAAAAElF + TkSuQmCC + + + + 226, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAQ9JREFUOE+t09lq + wkAUBmBfyr5DfY32jaReSOmFCyKCgkKLFrVUBZeKiEbshqRuaNw1xiXmLxMJBJ0Zc+GBw9zMfDPnHMZm + u1ZE35s4zXCqjmC8Al+sgHLjD9y7yGFWPIbecOO45yORtMAEHnxxJHL1IyKI9JeEXqtMwOl50Q8bSS0l + 8PzBBPbqAQQxICrgjeapgKZpkJUdBmNZB+y3d/QSnsIZKrDdqZjMFYj9OR9wB1NngHrQsJC36EkrfIkT + PuDyJ84AZbOHNF2j1Z2h9i3xAVKfOUjjZssN2oMFmq0xSkLfOmBu3E97iurnENlKxzpgbpzwO0Kh1kOy + KFoDjHmzVuYYjRmTDZfyWh9Yd/4B2Mz2w1z7EGUAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlpJREFUOE+tk21I + k1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC + TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p + AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0 + BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr + UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG + CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5 + F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS + rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt + NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp + 59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAixJREFUOE+tk91L + k3EUx/cvdN9N0EW3NTWGa7EaPOUcyqphWBG9PZEv5dJlmqhYmUYtXyBb4dJJy+kknFT4BqZIjaFMJUsz + V7TEoabYRDD49ju/6Pm1Mi+iH5zLz+c855zvo1L9j/fsaRRUvvZltHmX8Ni9gMaGCO47ZlBb8wn22yHc + KJ9CackECgteIy93FBfOB6H0JrC3B6ipXsVGb2V1Dca0XhxOe8JLEXhbF7mgsuLLX3mCIwsr2G1+DrVa + huWQRwjcj+a5oLTk87qCn/D78CLiTD4UXJ7GAXOTEDjrZ7ngku3dH4Jf4ZHJCLZJXlhzxpGa4hSCurth + LsjOGo0R/A4PBsPYrHdDlgMwmRxCUF31kQvkMwFFsB7c4/+ATYkNOHL0BZKSaoXgZuU0urvATgkcP/kK + lmMDfNu0MJqZPps6/4D7cNDSCUmyC8HVskl0+MAyADS5vrG7f0X59Tm+VFoYzZyZEVTg5NR2GAwVQnCl + cByeZuChc40FJwpjek5MmU/YkH6uiHdOTmHwfg/0+jIhsOWNMRiouhPlnUnAQoI4rYSht7MYm5qDnHsN + e41tHNbucUGnKxICiqXjHpTPJgHBZ/Nv4U1oHqGZJVwstiNe72JwI+J3PYA2MV8IMjOG2dzLfOatBg+2 + 7JDQ0tEPX9cguvv8GHg5hH0mC9S6eiQweLumDhqNVQgo06dP9fN4UsIoJHRnOhVtmxZGM1NXKoJ3JmTH + Cv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAi1JREFUOE+1k/9P + UlEYxv2nWK2tVlttGmpltrCcEQ1XUjSMaUHJNLIpNcnCragplBvUoC/okJhZLG92ySUpU8RNICdIhAio + EF+e7r1UZMDW1jrb+8t7z/N83vucc8rK/sdyeYIwvpopWYbRaZTk0uIx0o0/V/JbGt7lVTwxT6CKKylt + oLd8xGYihS/hKGz2WaaeWUnoTATsMz7UCztx9Ex7cYN3jkUQU4tb4DR5LZaAcyEAg4VE5YlLMFmJQoNQ + JA61gUA6k4XPH9pCN9s+gZz2oq5Jjlq+DDfUz3Fba86bOGY9jHiUdDF0mvqT7A/F4fKEcE9nZf5d1jOI + B4ZxVJ2U5gyc8z70akegMX3AXb0ND1+8R6/GgvZbeog61OA2K3CA2lxR34JjZ69B2T8EsVyN/Q0XcwY3 + B14iGk8UpE43UukMNqhA6QyC4Q0srcQg7dagsbWHmuDHScj7jDC9nsJTqx0a4xjuaIfRqXoMSXc/hG0q + 8C4owGnqwEGeFOXHxThH9eoEV7G7VpiboE2pK0qnm9H1JLz+NUzOBfHWEcAQsQSuqAuVDa1gVZzKGUgU + jwoMqAzxNZbC3Od1jDvDYPdth+7NCpP8Yf4V7KoR5A1arg8gmQIoGMLxLJYjWSwEMphwb2J4MoZB2yqU + LBZUIxHGYB9HlBfTE4jl9+GmBPTHv6lfo//+GGoaZajmXQabumXl1HHt5TRjz5Hz2HlIgB3Vp7GNzWeo + RcX/+pq/AwHYL0leVl8fAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAY5JREFUOE+d081L + AkEUAPD1T+hYhzoERV77OHUo8JBBt+4RRkSQ4U0SunaJOkSRKQWZWCiF5kdroa0WRAoRFXXoEEkWCUFY + Wbvrvnqz7NK6OxANPIZh5v1m3uyOKZK5AaamiaLICILACDzPtDXXM+3mRlPtGnWMAK15g4fQabVBYDej + 20QFdtJXVGBxg4Xk8aWMRDhjJLh/TgUW1hPQ1T+ihmEZgXieCghiFRBRIEPAFzkxBO4fSsByOfBsRkkE + 4xkoFEv6Mla3szoAF2Jy+E2A0KMc/nyRINe3BS2yspXSAf4YR5Kfq/LUE1QJopxEU8qSP6kD5nwxFUAE + A0E8hdM1rz0BXtDvhheHwMEnwKkkJ2OPAJMuw+TUDB2QJAneKzxgCRNnHwTBUJJd3ijYx8fowBcvwstr + BXIXdxBOZAmCu2JgssMxBGvOOmNA+d5KP+sJw17qiJRjn3bDwOAocF4LQMWtRTABf9W/hLWjFcpsA0Fc + tm76+6C+vJ+J4b4WgmAp/0bMTXVg6ekFNrQM3y3xMcC3lb+tAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAYdJREFUOE+t001L + QlEQBuB+TdCmRVEJRRIWtRAUlKsQhFmkpZQtIiWyAlMwP5KkXS0shLqGFkgoFqWQmaRR2qIvU7FMwWhd + 8JZXkFx0uVGzOcNh5jkDw6mr+++4SN7B6fbju/uQecYm6a25+/Hdl2IJptWNmmJyL4DwWZwZUJbtayT8 + RxGqIV8oQaaaRfrxkTmw4z2G+WuKbC6PYDgOkUSJp6ccc+AgdI4luwPbHh/UCxb0S0aZN5fHTmefMTVv + wfDEHIiBMegMpt8BZUShNoGQTIKQGxA8TTIHMoUPGF1vEOvTWHTcgqeJQahNwLqVQiRRpIdS+XcM2l4h + 1t2DI3WAP7oGoSYE3kwSPQofljcqm/kxjK4SCH0OXSMetItsUC26wZuOVptYhI0eEOuz1YI2gZnKBdpr + 6iR9V2jkKOkBQpeiCryhFFr4eioft16iU7qNho4h1Dc00QOqlRuwpSSa+UawuZXdByIZsPoUaOmWwrUf + owcOozlwZeto7ZXDuXvCfHV/+dGfqqrf44qgu28AAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAeJJREFUOE+lk9FP + klEYxv1TSsecde0f0FpZrTbbal7URVvZuuJCr7pq2WzLNWy0iSHNwtIB9qG0ltLSYRJpBomUgZPMGSyU + 8SmJIOiv7zssCdrAzXd77s77e5/nnPdUVR20HBPfUCWNB4QsI176HB8IL/9iX2y1ubTMwx6utz0nuLhc + GWIfCxT153Z26ep/g9Md4FJLZ2WIZdQnAM4QSJ/BH5Z5aH6NNCljm0hgdSV4MppAPxQXCq5kil31OTx7 + DjLbOeSNNJFYUgBKq31glfpmN76F9QLEZHOJc73ubXQjMreln7Q+DdP/du0/QIsxhmNK5mjTMJ/m43mI + Qcmr5t5MZVlNpFiKrPM1vIbpVVQAOqSckF+ZekUX5UjTS+ouDFLb+CwPUPNupbN7k7WmEDcMX3hgXSpy + IP/OsrCyhXtuA6M0g+bc4wJATqaZ/x7DF4zg8f9g/OMibb355701kERriHL5fojzd2aFjNI0mjPdBUD9 + 6auUqlU/KwBZJV4skWUuvMmYV8b+Ls6jQQ81DfryO3KtfUoA/p3810G37T3VJ3TlARdvukhldjANeemx + z2B8MS0mq80GyySHj98rD2jQOpXbtgrVNprRnO2h5lQX1Sc7leYODh27W3nN9/WZDnroDx0A5wwhdtmt + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlBJREFUOE+1k1lI + lGEUhn/owm6KFuqqq4LoJooIqouMwixMM4zEjKyJGJUSlcnSITU1RSe3SdPGyGVQc6tEUSkSIXFo13CM + FonUyGmy5p9xz+Lp/z8ZbGjzpgMv5+a8z1n4Pkn6H9HZnEH7zVQayxKYF7+hMg+3ynKO4LBVMWa7xmBf + Nme1vuSl67hi0GNMj/sVqBon5XqmnXVMOqoxF+sYH6kgJyWKF13xnD/tT7xmM7bOY4y0riY6bL8nRAWo + 5mlnDUUZR+m2ZCO/L2C4T89bywmaSgIJD/WmKnEVT/MkIg/v8wTUVeTMAuQbGBLDSNaFoI8K5lxkEDpt + IDEafyJCfciPXiMAIX7enoDqUgNTci1TdhPjQ5nYn0dhrVgu1Fu+jO7iRTwyegmzKp9tGz0BZlMGE/Yy + JgbSGH95irFnB5GbF5Nb3kqmqZELl2uJN5iJSS0hPMFIWGyWJ6C0MJXRQSNjfVpGH/vjur+Jj7dXCLM7 + pme+4XBOMjDsIDgihYDj+jlISW4S8qs0XA99cXWsx9m2ksFySXRWo/RWp5Cppp3efpsw3+2ysidIMwsp + zErgc88ZnO3rkFuWYq/3ov+6JMb+OvOdLy6l8wcHvW9sWHre4Rcag69i3rX3AN7bdyDlX4zD/iBCMS/h + U8NChioXYC2SiFZ2Vsd2T3BVmaDA3EZTh1VkVVs3rEW6lBwrHoj7yu6sVQ72c+d7ltfCXH+nm5rWJ3MA + dY3cpJPKCwtEE7SbgJ1bBFm9trqzu9vvspjgT3FIubZa8C/N67P9regHTvjvLQ3rR38AAAAASUVORK5C + YII= + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/ModuleFilter.cs b/reactos/tools/sysgen/RosBuilder/ModuleFilter.cs new file mode 100644 index 00000000000..0853aeec8a1 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/ModuleFilter.cs @@ -0,0 +1,295 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine; +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public class ModuleFilterController + { + private List m_ModuleFilters = new List(); + private ISysGenDesigner m_SysGenDesigner = null; + + public ModuleFilterController(ISysGenDesigner engine) + { + //The engine... + m_SysGenDesigner = engine; + + RegisterDinamicFilters(); + RegisterModuleGroups(); + InitializeFilters(); + } + + private void RegisterDinamicFilters() + { + m_ModuleFilters.Add(new AllModuleFilter()); + m_ModuleFilters.Add(new AllWin32CUIModuleFilter()); + m_ModuleFilters.Add(new AllWin32GUIModuleFilter()); + m_ModuleFilters.Add(new AllScreenSaversModuleFilter()); + m_ModuleFilters.Add(new AllKeyboardLayoutsModuleFilter()); + m_ModuleFilters.Add(new AllDriversModuleFilter()); + m_ModuleFilters.Add(new AllDllsModuleFilter()); + } + + private void RegisterModuleGroups() + { + foreach (RBuildModule module in m_SysGenDesigner.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.ModuleGroup) + { + m_ModuleFilters.Add(new PackageModuleFilter(module)); + } + } + } + + private void InitializeFilters() + { + foreach (ModuleFilter filter in m_ModuleFilters) + { + filter.Designer = m_SysGenDesigner; + filter.Initialize(); + } + } + + public List ModuleFilters + { + get { return m_ModuleFilters; } + } + + public void Apply(ModuleFilter filter) + { + m_SysGenDesigner.ProjectController.Add(filter.Modules); + } + + public void Remove(ModuleFilter filter) + { + //m_SysGenDesigner.PlatformController.Remove(filter.Modules); + } + } + + public abstract class ModuleFilter + { + protected ISysGenDesigner m_Project = null; + protected RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + + public ModuleFilter() + { + } + + public virtual void Initialize() + { + ExecuteRule(); + } + + public abstract void ExecuteRule(); + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + + public ISysGenDesigner Designer + { + get { return m_Project; } + set { m_Project = value; } + } + + public abstract string Name { get; } + + public override string ToString() + { + return string.Format("{0} - ({1} modules)", + Name, + Modules.Count); + } + } + + public class PackageModuleFilter : ModuleFilter + { + RBuildModule m_Module = null; + + public PackageModuleFilter(RBuildModule module) + { + //Save the underlaying module... + m_Module = module; + } + + public override string Name + { + get { return (m_Module.Description != null) ? m_Module.Description : m_Module.Name; } + } + + public override void ExecuteRule() + { + Modules.Add(m_Module.Needs); + } + } + + public class AllModuleFilter : ModuleFilter + { + public AllModuleFilter() + { + } + + public override string Name + { + get { return "All"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + + public class AllWin32CUIModuleFilter : ModuleFilter + { + public AllWin32CUIModuleFilter() + { + } + + public override string Name + { + get { return "All Console Applications"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.Win32CUI) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } + + public class AllWin32GUIModuleFilter : ModuleFilter + { + public AllWin32GUIModuleFilter() + { + } + + public override string Name + { + get { return "All Graphical Applications"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.Win32GUI) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } + + public class AllScreenSaversModuleFilter : ModuleFilter + { + public AllScreenSaversModuleFilter() + { + } + + public override string Name + { + get { return "All ScreenSavers"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.Win32SCR) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } + + public class AllKeyboardLayoutsModuleFilter : ModuleFilter + { + public AllKeyboardLayoutsModuleFilter() + { + } + + public override string Name + { + get { return "All Keyboard Layouts"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.KeyboardLayout) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } + + public class AllDriversModuleFilter : ModuleFilter + { + public AllDriversModuleFilter() + { + } + + public override string Name + { + get { return "All Drivers"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.KernelModeDriver) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } + + public class AllDllsModuleFilter : ModuleFilter + { + public AllDllsModuleFilter() + { + } + + public override string Name + { + get { return "All Dlls"; } + } + + public override void ExecuteRule() + { + foreach (RBuildModule module in Designer.ProjectController.AvailableModules) + { + if (module.Type == ModuleType.Win32DLL) + { + if (Modules.Contains(module) == false) + Modules.Add(module); + } + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/NewItemForm.Designer.cs b/reactos/tools/sysgen/RosBuilder/NewItemForm.Designer.cs new file mode 100644 index 00000000000..81bcb58e30d --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/NewItemForm.Designer.cs @@ -0,0 +1,135 @@ +namespace TriStateTreeViewDemo +{ + partial class NewItemForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbItems = new System.Windows.Forms.Label(); + this.lvAddItem = new System.Windows.Forms.ListView(); + this.btnAdd = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.lbDescription = new System.Windows.Forms.Label(); + this.lbName = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // lbItems + // + this.lbItems.AutoSize = true; + this.lbItems.Location = new System.Drawing.Point(12, 24); + this.lbItems.Name = "lbItems"; + this.lbItems.Size = new System.Drawing.Size(78, 13); + this.lbItems.TabIndex = 0; + this.lbItems.Text = "Available Items"; + // + // lvAddItem + // + this.lvAddItem.Location = new System.Drawing.Point(12, 40); + this.lvAddItem.Name = "lvAddItem"; + this.lvAddItem.Size = new System.Drawing.Size(583, 236); + this.lvAddItem.TabIndex = 1; + this.lvAddItem.UseCompatibleStateImageBehavior = false; + this.lvAddItem.View = System.Windows.Forms.View.List; + this.lvAddItem.DoubleClick += new System.EventHandler(this.lvAddItem_DoubleClick); + // + // btnAdd + // + this.btnAdd.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnAdd.Location = new System.Drawing.Point(439, 348); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(75, 23); + this.btnAdd.TabIndex = 2; + this.btnAdd.Text = "Add"; + this.btnAdd.UseVisualStyleBackColor = true; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(520, 348); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 3; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // lbDescription + // + this.lbDescription.AutoSize = true; + this.lbDescription.Location = new System.Drawing.Point(12, 279); + this.lbDescription.Name = "lbDescription"; + this.lbDescription.Size = new System.Drawing.Size(79, 13); + this.lbDescription.TabIndex = 4; + this.lbDescription.Text = "Select any item"; + // + // lbName + // + this.lbName.AutoSize = true; + this.lbName.Location = new System.Drawing.Point(9, 308); + this.lbName.Name = "lbName"; + this.lbName.Size = new System.Drawing.Size(35, 13); + this.lbName.TabIndex = 5; + this.lbName.Text = "&Name"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(53, 305); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(542, 20); + this.textBox1.TabIndex = 6; + // + // NewItemForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(607, 383); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.lbName); + this.Controls.Add(this.lbDescription); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnAdd); + this.Controls.Add(this.lvAddItem); + this.Controls.Add(this.lbItems); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "NewItemForm"; + this.Text = "Add Item"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbItems; + private System.Windows.Forms.ListView lvAddItem; + private System.Windows.Forms.Button btnAdd; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lbDescription; + private System.Windows.Forms.Label lbName; + private System.Windows.Forms.TextBox textBox1; + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/NewItemForm.cs b/reactos/tools/sysgen/RosBuilder/NewItemForm.cs new file mode 100644 index 00000000000..4101b0c988c --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/NewItemForm.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace TriStateTreeViewDemo +{ + public partial class NewItemForm : Form + { + public NewItemForm() + { + InitializeComponent(); + } + + public ListView ListView + { + get { return lvAddItem; } + } + + private void lvAddItem_DoubleClick(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/NewItemForm.resx b/reactos/tools/sysgen/RosBuilder/NewItemForm.resx new file mode 100644 index 00000000000..19dc0dd8b39 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/NewItemForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/PlatformCatalogReader.cs b/reactos/tools/sysgen/RosBuilder/PlatformCatalogReader.cs new file mode 100644 index 00000000000..7a847340622 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/PlatformCatalogReader.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Collections.Generic; + +using SysGen.RBuild.Framework; + +namespace SysGen.Framework.Catalog +{ + public class PlatformCatalogReader + { + XmlDocument doc = new XmlDocument(); + + RBuildProject m_Project = new RBuildProject(); + + public PlatformCatalogReader(string filename) + { + doc.Load(filename); + } + + public RBuildProject Project + { + get { return m_Project; } + } + + public void Read() + { + + foreach (XmlNode node in doc.SelectSingleNode("/catalog/modules").ChildNodes) + { + RBuildModule module = new RBuildModule(); + + module.Type = (ModuleType)Enum.Parse(typeof(ModuleType), node.Attributes["type"].Value.ToString()); + module.Name = node.Attributes["name"].Value.ToString(); + module.Folder.Base = node.Attributes["base"].Value.ToString(); + module.CatalogPath = node.Attributes["path"].Value.ToString(); + module.Description = node.Attributes["desc"].Value.ToString(); + + m_Project.Modules.Add(module); + } + + foreach (XmlNode node in doc.SelectSingleNode("/catalog/modules").ChildNodes) + { + RBuildModule module = m_Project.Modules.GetByName(node.Attributes["name"].Value.ToString()); + + foreach (XmlNode snode in node.SelectSingleNode("libraries").ChildNodes) + { + module.Libraries.Add(m_Project.Modules.GetByName(snode.InnerText)); + } + + foreach (XmlNode snode in node.SelectSingleNode("dependencies").ChildNodes) + { + module.Dependencies.Add(m_Project.Modules.GetByName(snode.InnerText)); + } + + foreach (XmlNode snode in node.SelectSingleNode("requeriments").ChildNodes) + { + module.Requeriments.Add(m_Project.Modules.GetByName(snode.InnerText)); + } + } + + foreach (XmlNode node in doc.SelectSingleNode("/catalog/languages").ChildNodes) + { + RBuildLanguage language = new RBuildLanguage(); + + language.Name = node.Attributes["name"].Value.ToString(); + + m_Project.Languages.Add(language); + } + + foreach (XmlNode node in doc.SelectSingleNode("/catalog/debugchannels").ChildNodes) + { + RBuildDebugChannel language = new RBuildDebugChannel(); + + language.Name = node.Attributes["name"].Value.ToString(); + + m_Project.DebugChannels.Add(language); + } + + /* + RBuildModuleInfoCollection modules = new RBuildModuleInfoCollection(); + + + WhitespaceHandling = WhitespaceHandling.None; + + ReadStartElement("modules"); + while (Name == "module") + { + RBuildModuleInfo module = new RBuildModuleInfo(); + + MoveToFirstAttribute(); + do + { + switch (Name) + { + case "name": + module.Name = Value; + break; + case "type": + module.Type = (ModuleType)Enum.Parse(typeof(ModuleType), Value); + break; + case "base": + module.Base = Value; + break; + case "desc": + module.CatalogPath = Value; + break; + case "path": + module.CatalogPath = Value; + break; + } + + } + while (MoveToNextAttribute()); + + MoveToElement(); + + //Read(); + //Read(); + + if (Name == "libraries") + { + if (!IsEmptyElement) + { + ReadStartElement("libraries"); + while (Name == "library") + { + ReadStartElement("library"); + module.Libraries.Add(ReadContentAsString()); + ReadEndElement(); + } + ReadEndElement(); + } + else + ReadStartElement("libraries"); + } + + if (Name == "dependencies") + { + if (!IsEmptyElement) + { + ReadStartElement("dependencies"); + while (Name == "dependency") + { + ReadStartElement("dependency"); + module.Dependencies.Add(ReadContentAsString()); + ReadEndElement(); + } + ReadEndElement(); + } + else + ReadStartElement("dependencies"); + } + + if (Name == "requeriments") + { + if (!IsEmptyElement) + { + ReadStartElement("requeriments"); + while (Name == "requires") + { + ReadStartElement("requires"); + module.Requirements.Add(ReadContentAsString()); + ReadEndElement(); + } + ReadEndElement(); + } + else + ReadStartElement("requeriments"); + } + + modules.Add(module); + + Read(); + } + + ReadEndElement(); + + foreach (RBuildModuleInfo moduleInfo in modules) + { + RBuildModule module = new RBuildModule(); + + module.Type = moduleInfo.Type; + module.Name = moduleInfo.Name; + + m_Modules.Add(module); + } + + foreach (RBuildModuleInfo moduleInfo in modules) + { + RBuildModule module = m_Modules.GetByName(moduleInfo.Name); + + foreach (string library in moduleInfo.Libraries) + module.Libraries.Add(m_Modules.GetByName(library)); + + foreach (string library in moduleInfo.Dependencies) + module.Dependencies.Add(m_Modules.GetByName(library)); + + foreach (string library in moduleInfo.Requirements) + module.Requeriments.Add(m_Modules.GetByName(library)); + }*/ + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/PlatformController.cs b/reactos/tools/sysgen/RosBuilder/PlatformController.cs new file mode 100644 index 00000000000..1d710cb372f --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/PlatformController.cs @@ -0,0 +1,86 @@ +using System; +using System.Windows.Forms; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; + +namespace TriStateTreeViewDemo +{ + public class PlatformController + { + private ISysGenDesigner m_SysGenDesigner = null; + + public PlatformController(ISysGenDesigner engine) + { + m_SysGenDesigner = engine; + } + + public ProjectTask ProjectTask + { + get { return m_SysGenDesigner.SysGenEngine.ProjectTask; } + } + + public RBuildProject Project + { + get { return m_SysGenDesigner.SysGenEngine.Project; } + } + + public void Remove(RBuildModule module) + { + } + + public void Add(RBuildModule module) + { + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(module , Project.Platform.Modules); + + if (AskAddModulesToPlatform(dependencyTracker.Missing)) + { + Project.Platform.Modules.Add(dependencyTracker.Dependencies); + } + } + + public void Add(RBuildModuleCollection modules) + { + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(modules, Project.Platform.Modules); + + if (AskAddModulesToPlatform(dependencyTracker.Missing)) + { + Project.Platform.Modules.Add(dependencyTracker.Dependencies); + } + } + + public bool AskAddModulesToPlatform(RBuildModuleCollection missingDependencies) + { + if (missingDependencies.Count > 0) + { + StringBuilder str = new StringBuilder(); + + str.AppendFormat("This action requieres adding {0} dependecies no present in your platform :", missingDependencies.Count); + str.AppendLine(); + str.AppendLine(); + + foreach (RBuildModule dependency in missingDependencies) + { + str.AppendFormat("{0} on '{1}' \n", + dependency.Name, + dependency.Base); + } + + str.AppendLine(); + str.AppendLine("¿Do you want to add this dependencies?"); + + if (MessageBox.Show(str.ToString(), "RosBuilder", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + { + return true; + } + } + else + return true; + + return false; + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Program.cs b/reactos/tools/sysgen/RosBuilder/Program.cs new file mode 100644 index 00000000000..6d9cbcb5b1f --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Program.cs @@ -0,0 +1,109 @@ +using System; +using System.Reflection; +using System.Collections.Generic; +using System.Windows.Forms; + +using TriStateTreeViewDemo; + +namespace TriStateTreeViewDemo +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + MainForm mainForm = new MainForm(); + + if (args.Length == 0) + { + //Create file associations from .dnml files to the script engine + CreateFileAssociation(); + } + else if (args[0].ToLower() == "remove") + { + //Remove file associations for .dnml files to the script engine + RemoveFileAssociation(); + } + else + { + mainForm.ProjectController.Open(args[0]); + + if (args.Length > 1) + { + if (args[1].ToLower() == "x86") + { + MessageBox.Show("86"); + } + else if (args[1].ToLower() == "ppc") + { + MessageBox.Show("ppc"); + } + else if (args[1].ToLower() == "arm") + { + MessageBox.Show("arm"); + } + else + { + MessageBox.Show("Unknown Architecture"); + } + + if (args.Length > 2) + { + if (args[2].ToLower() == "debug") + { + mainForm.ProjectController.SysGenProject.Debug = true; + } + else if (args[2].ToLower() == "release") + { + mainForm.ProjectController.SysGenProject.Debug = false; + } + else + { + MessageBox.Show("Unknown Target Mode"); + } + } + } + } + + //Run the application + Application.Run(mainForm); + } + + internal static void CreateFileAssociation() + { + FileAssociation FA = new FileAssociation(); + FA.Extension = "sgpd"; + FA.ContentType = "application/sysgenproject"; + FA.FullName = "SysGenProject"; + FA.ProperName = "SysGenProject"; + FA.AddCommand("open", "\"" + Assembly.GetExecutingAssembly().Location + "\" \" %1\""); + FA.AddCommand("edit", "notepad.exe %1"); + FA.AddCommand("Generate x86", "\"" + Assembly.GetExecutingAssembly().Location + "\" \" %1\" X86 RELEASE"); + FA.AddCommand("Generate x86 [DEBUG]", "\"" + Assembly.GetExecutingAssembly().Location + "\" \" %1\" X86 DEBUG"); + FA.IconPath = Assembly.GetExecutingAssembly().Location; + FA.IconIndex = 0; + FA.Create(); + } + + internal static void RemoveFileAssociation() + { + FileAssociation FA = new FileAssociation(); + FA.Extension = "sgpd"; + FA.ContentType = "application/sysgenproject"; + FA.FullName = "SysGenProject"; + FA.ProperName = "SysGenProject"; + FA.AddCommand("open", Assembly.GetExecutingAssembly().Location + " %1"); + FA.AddCommand("edit", "notepad.exe %1"); + FA.AddCommand("edit123", "notepad.exe %1"); + FA.IconPath = Assembly.GetExecutingAssembly().Location; + FA.IconIndex = 0; + FA.Remove(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Project/Project.cs b/reactos/tools/sysgen/RosBuilder/Project/Project.cs new file mode 100644 index 00000000000..f024dc385a5 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Project/Project.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Specialized; +using System.Collections.Generic; +using System.Xml; +using System.Collections; +using System.IO; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public enum TargetArchitectureType + { + X86, + X86_i486, + X86_i586, + X86_Pentium, + X86_Pentium2, + X86_Pentium3, + X86_Pentium4, + X86_AthlonXP, + X86_AthlonMP, + X86_Xbox, + PPC, + ARM + } + + public enum OptimizeLevelType : int + { + Level_0 = 0, + Level_1 = 1, + Level_2 = 2, + Level_3 = 3, + Level_4 = 4, + Level_5 = 5 + } + + public class Project : RBuildPlatform + { + RBuildProject m_Project = null; + + string m_FilePath; // full path to this project, including filename + string m_FileName = "Unnamed"; + + //MovieOptions movieOptions; + //CompilerOptions compilerOptions; + //PathCollection classpaths; + //PathCollection compileTargets; + //HiddenPathCollection hiddenPaths; + //AssetCollection libraryAssets; + bool traceEnabled; // selected configuration + + public bool NoOutput; // Disable file building + public string InputPath; // For code injection + public string OutputPath; + public string PreBuildEvent; + public string PostBuildEvent; + public string TestMovieCommand; + public bool AlwaysRunPostBuild; + public bool ShowHiddenPaths; + + public string Source; + + public Project(RBuildProject project,string path) + { + m_FilePath = path; + m_FileName = Path.GetFileName(path); + m_Project = project; + m_Project.Platform = this; + } + + public Project(RBuildProject project) + { + m_Project = project; + m_Project.Platform = this; + } + + public RBuildProject RBuildProject + { + get { return m_Project; } + } + + public virtual bool UsesInjection { get { return false; } } + public virtual bool HasLibraries { get { return false; } } + public virtual void ValidateBuild(out string error) { error = null; } + + #region Simple Properties + + public string ProjectPath { get { return m_FilePath; } set { m_FilePath = value; } } + //public string Name { get { return Path.GetFileNameWithoutExtension(path).Replace(' ', '-'); } } + public string Directory { get { return Path.GetDirectoryName(m_FilePath); } } + public Boolean TraceEnabled { set { traceEnabled = value; } get { return traceEnabled; } } + + public string FileName + { + get { return m_FileName; } + } + + //// we only provide getters for these to preserve the original pointer + //public MovieOptions MovieOptions { get { return movieOptions; } } + //public PathCollection Classpaths { get { return classpaths; } } + //public PathCollection CompileTargets { get { return compileTargets; } } + //public HiddenPathCollection HiddenPaths { get { return hiddenPaths; } } + //public AssetCollection LibraryAssets { get { return libraryAssets; } } + + //public CompilerOptions CompilerOptions + //{ + // get { return compilerOptions; } + // set { compilerOptions = value; } + //} + + //public PathCollection AbsoluteClasspaths + //{ + // get + // { + // PathCollection absolute = new PathCollection(); + // foreach (string cp in classpaths) + // absolute.Add(GetAbsolutePath(cp)); + // return absolute; + // } + //} + + //public string OutputPathAbsolute { get { return GetAbsolutePath(OutputPath); } } + + public bool CanBuild + { + get { return OutputPath != null && OutputPath.Length > 0; } + } + + #endregion + + #region Methods + + // all the Set/Is methods expect absolute paths (as opposed to the way they're + // actually stored) + + //public void SetPathHidden(string path, bool isHidden) + //{ + // path = GetRelativePath(path); + + // if (isHidden) + // { + // hiddenPaths.Add(path); + // compileTargets.RemoveAtOrBelow(path); // can't compile hidden files + // libraryAssets.RemoveAtOrBelow(path); // can't embed hidden resources + // } + // else hiddenPaths.Remove(path); + //} + + //public bool IsPathHidden(string path) + //{ + // return hiddenPaths.IsHidden(GetRelativePath(path)); + //} + + public void SetCompileTarget(string path, bool isCompileTarget) + { + //if (isCompileTarget) + // compileTargets.Add(GetRelativePath(path)); + //else + // compileTargets.Remove(GetRelativePath(path)); + } + + //public bool IsCompileTarget(string path) { return compileTargets.Contains(GetRelativePath(path)); } + + public void SetLibraryAsset(string path, bool isLibraryAsset) + { + //if (isLibraryAsset) + // libraryAssets.Add(GetRelativePath(path)); + //else + // libraryAssets.Remove(GetRelativePath(path)); + } + + //public bool IsLibraryAsset(string path) { return libraryAssets.Contains(GetRelativePath(path)); } +// public LibraryAsset GetAsset(string path) { return libraryAssets[GetRelativePath(path)]; } + + public void ChangeAssetPath(string fromPath, string toPath) + { + //if (IsLibraryAsset(fromPath)) + //{ + // //LibraryAsset asset = libraryAssets[GetRelativePath(fromPath)]; + // //libraryAssets.Remove(asset); + // //asset.Path = GetRelativePath(toPath); + // //libraryAssets.Add(asset); + //} + } + + //public bool IsInput(string path) { return GetRelativePath(path) == InputPath; } + //public bool IsOutput(string path) { return GetRelativePath(path) == OutputPath; } + + /// + /// Call this when you delete a path so we can remove all our references to it + /// + public void NotifyPathsDeleted(string path) + { + //path = GetRelativePath(path); + //hiddenPaths.Remove(path); + //compileTargets.RemoveAtOrBelow(path); + //libraryAssets.RemoveAtOrBelow(path); + } + + /// + /// Returns the path to the "obj\" subdirectory, creating it if necessary. + /// + public string GetObjDirectory() + { + string objPath = Path.Combine(this.Directory, "obj"); + if (!System.IO.Directory.Exists(objPath)) + System.IO.Directory.CreateDirectory(objPath); + return objPath; + } + + #endregion + + #region Relative Path Helpers + + //public string GetRelativePath(string path) + //{ + // return ProjectPaths.GetRelativePath(this.Directory,path); + //} + + //public string GetAbsolutePath(string path) + //{ + // return ProjectPaths.GetAbsolutePath(this.Directory,path); + //} + + #endregion + + public Project Load() + { + ProjectReader reader = new ProjectReader(this, ProjectPath); + + try + { + return reader.ReadProject(); + } + catch (XmlException exception) + { + string format = string.Format("Error in Project '{0}' line {1}, position {2}.", + ProjectPath, + exception.LineNumber, + exception.LinePosition); + + throw new Exception(format, exception); + } + finally + { + reader.Close(); + } + } + + public void Save() + { + ProjectWriter writer = new ProjectWriter(this, ProjectPath); + + try + { + writer.WriteProject(); + writer.Flush(); + } + finally + { + writer.Close(); + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Project/ProjectReader.cs b/reactos/tools/sysgen/RosBuilder/Project/ProjectReader.cs new file mode 100644 index 00000000000..4fec3546bc6 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Project/ProjectReader.cs @@ -0,0 +1,319 @@ +using System; +using System.Windows.Forms; +using System.Collections; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Collections.Generic; + +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public class ProjectReader : XmlTextReader + { + Project project; + + public ProjectReader(Project project, string filename) + : base(filename) + { + this.project = project; + WhitespaceHandling = WhitespaceHandling.None; + } + + protected Project Project { get { return project; } } + + public virtual Project ReadProject() + { + MoveToContent(); + + while (Read()) + ProcessNode(Name); + + return project; + } + + private void ReadModules() + { + RBuildModule module = null; + + ReadStartElement("modules"); + while (Name == "module") + { + try + { + module = project.RBuildProject.Modules.GetByName(GetAttribute("name")); + + if (module == null) + throw new Exception("Unkown module '" + Value + "'"); + + project.Modules.Add(module); + + //project.SysGenDesinger.PlatformController.Project.Platform.Modules.Add(module); + } + catch (Exception e) + { + MessageBox.Show( + e.Message, + "Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + + //project.Modules.Add(GetAttribute("name")); + + // continue reading + Read(); + } + + ReadEndElement(); + } + + private void ReadLanguages() + { + RBuildLanguage language = null; + + ReadStartElement("languages"); + while (Name == "language") + { + try + { + language = project.RBuildProject.Languages.GetByName(GetAttribute("name")); + + if (language == null) + throw new Exception("Unkown language '" + Value + "'"); + + project.Languages.Add(language); + } + catch (Exception e) + { + MessageBox.Show(e.Message, + "Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + + // continue reading + Read(); + } + + ReadEndElement(); + } + + //private void ReadRSLPaths() + //{ + // //project.CompilerOptions.RSLPaths = ReadLibrary("rslPaths"); + //} + + //private void ReadExternalLibraryPaths() + //{ + // //project.CompilerOptions.ExternalLibraryPaths = ReadLibrary("externalLibraryPaths"); + //} + + //private void ReadLibrayPath() + //{ + // //project.CompilerOptions.LibraryPaths = ReadLibrary("libraryPaths"); + //} + + //private void ReadIncludeLibraries() + //{ + // //project.CompilerOptions.IncludeLibraries = ReadLibrary("includeLibraries"); + //} + + //private string[] ReadLibrary(string name) + //{ + // ReadStartElement(name); + // List elements = new List(); + // while (Name == "element") + // { + // elements.Add(GetAttribute("path")); + // Read(); + // } + // ReadEndElement(); + // string[] result = new string[elements.Count]; + // elements.CopyTo(result); + // return result; + //} + + public void ReadApplications() + { + ReadStartElement("applications"); + while (Name == "option") + { + MoveToFirstAttribute(); + switch (Name) + { + case "shell": + project.Shell = Project.RBuildProject.Modules.GetByName(Value); + break; + case "screensaver": + project.Screensaver = Project.RBuildProject.Modules.GetByName(Value); + break; + case "wallpaper": + //project.Wallpaper = Value; + break; + } + Read(); + } + ReadEndElement(); + } + + //protected virtual void ProcessNode(string name) + //{ + // switch (name) + // { + // case "output": ReadOutputOptions(); break; + // // case "classpaths": ReadClasspaths(); break; + // // case "compileTargets": ReadCompileTargets(); break; + // // case "hiddenPaths": ReadHiddenPaths(); break; + // // case "preBuildCommand": ReadPreBuildCommand(); break; + // // case "postBuildCommand": ReadPostBuildCommand(); break; + // // case "options": ReadProjectOptions(); break; + // } + //} + + // process AS3-specific stuff + protected virtual void ProcessNode(string name) + { + if (NodeType == XmlNodeType.Element) + { + switch (name) + { + //case "build": ReadBuildOptions(); break; + //case "includeLibraries": ReadIncludeLibraries(); break; + //case "libraryPaths": ReadLibrayPath(); break; + //case "externalLibraryPaths": ReadExternalLibraryPaths(); break; + case "modules": + ReadModules(); + break; + case "languages": + ReadLanguages(); + break; + case "applications": + ReadApplications(); + break; + case "output": + ReadOutputOptions(); + break; + case "options": + ReadProjectOptions(); + break; + //default: + // base.ProcessNode(name); break; + } + } + } + + public void ReadOutputOptions() + { + ReadStartElement("output"); + while (Name == "movie") + { + MoveToFirstAttribute(); + switch (Name) + { + case "name": + project.Name = Value; + break; + case "desc": + project.Description = Value; + break; + //case "path": project.OutputPath = OSPath(Value); break; + //case "fps": project.MovieOptions.Fps = IntValue; break; + //case "width": project.MovieOptions.Width = IntValue; break; + //case "height": project.MovieOptions.Height = IntValue; break; + //case "version": project.MovieOptions.Version = IntValue; break; + //case "background": project.MovieOptions.Background = Value; break; + } + Read(); + } + ReadEndElement(); + } + + //public void ReadClasspaths() + //{ + // ReadStartElement("classpaths"); + // //ReadPaths("class",project.Classpaths); + // ReadEndElement(); + //} + + //public void ReadCompileTargets() + //{ + // ReadStartElement("compileTargets"); + // //ReadPaths("compile",project.CompileTargets); + // ReadEndElement(); + //} + + //public void ReadHiddenPaths() + //{ + // ReadStartElement("hiddenPaths"); + // //ReadPaths("hidden",project.HiddenPaths); + // ReadEndElement(); + //} + + //public void ReadPreBuildCommand() + //{ + // if (!IsEmptyElement) + // { + // ReadStartElement("preBuildCommand"); + // project.PreBuildEvent = OSPath(ReadString().Trim()); + // ReadEndElement(); + // } + //} + + public void ReadPostBuildCommand() + { + //project.AlwaysRunPostBuild = Convert.ToBoolean(GetAttribute("alwaysRun")); + + //if (!IsEmptyElement) + //{ + // ReadStartElement("postBuildCommand"); + // project.PostBuildEvent = OSPath(ReadString().Trim()); + // ReadEndElement(); + //} + } + + public void ReadProjectOptions() + { + ReadStartElement("options"); + while (Name == "option") + { + MoveToFirstAttribute(); + switch (Name) + { + case "debug": + project.Debug = BoolValue; + break; + case "kdebug": + project.KDebug = BoolValue; + break; + case "source": + project.Source = Value; + break; + } + Read(); + } + ReadEndElement(); + } + + public bool BoolValue { get { return Convert.ToBoolean(Value); } } + public int IntValue { get { return Convert.ToInt32(Value); } } + + //public void ReadPaths(string pathNodeName, IAddPaths paths) + //{ + // while (Name == pathNodeName) + // { + // paths.Add(OSPath(GetAttribute("path"))); + // Read(); + // } + //} + + //protected string OSPath(string path) + //{ + // if (path != null) + // return path.Replace('\\',System.IO.Path.DirectorySeparatorChar); + // else + // return null; + //} + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Project/ProjectWriter.cs b/reactos/tools/sysgen/RosBuilder/Project/ProjectWriter.cs new file mode 100644 index 00000000000..1061c326395 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Project/ProjectWriter.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections; +using System.IO; +using System.Diagnostics; +using System.Text; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Framework; + +namespace TriStateTreeViewDemo +{ + public class ProjectWriter : XmlTextWriter + { + Project m_Project; + + public ProjectWriter(Project project, string filename) : base(filename,Encoding.UTF8) + { + m_Project = project; + Formatting = Formatting.Indented; + } + + protected Project Project { get { return m_Project; } } + + public void WriteProject() + { + WriteStartDocument(); + WriteStartElement("project"); + WriteOutputOptions(); + WriteBuildOptions(); + WriteProjectOptions(); + WriteEndElement(); + WriteEndDocument(); + } + + public void WriteOutputOptions() + { + WriteComment(" Output SWF options "); + WriteStartElement("output"); + WriteOption("movie", "name", m_Project.Name); + WriteOption("movie", "desc", m_Project.Description); + WriteEndElement(); + } + + public void WriteBuildOptions() + { + WriteComment(" Build options "); + WriteStartElement("build"); + + if (Project.Modules.Count > 0) + { + WriteStartElement("modules"); + foreach (RBuildModule module in Project.Modules) + { + WriteStartElement("module"); + WriteAttributeString("name", module.Name); + WriteEndElement(); + } + WriteEndElement(); + } + + WriteEndElement(); + + if (Project.Languages.Count > 0) + { + WriteComment(" Build options "); + WriteStartElement("languages"); + foreach (RBuildLanguage language in Project.Languages) + { + WriteStartElement("language"); + WriteAttributeString("name", language.Name); + WriteEndElement(); + } + WriteEndElement(); + } + + if (Project.DebugChannels.Count > 0) + { + WriteStartElement("debugchhanels"); + foreach (RBuildDebugChannel channel in Project.DebugChannels) + { + WriteStartElement("debugchannel"); + WriteAttributeString("name", channel.Name); + WriteEndElement(); + } + WriteEndElement(); + } + + WriteStartElement("applications"); + + if (m_Project.Shell != null) + WriteOption("Shell", m_Project.Shell.Name); + + if (m_Project.Screensaver != null) + WriteOption("Screensaver", m_Project.Screensaver.Name); + + if (m_Project.Wallpaper != null) + WriteOption("Wallpaper", m_Project.Wallpaper.Name); + + WriteEndElement(); + } + + public void WriteClasspaths() + { + WriteComment(" Other classes to be compiled into your SWF "); + WriteStartElement("classpaths"); + //WritePaths(project.Classpaths,"class"); + WriteEndElement(); + } + + public void WriteCompileTargets() + { + WriteComment(" Class files to compile (other referenced classes will automatically be included) "); + WriteStartElement("compileTargets"); + //WritePaths(project.CompileTargets,"compile"); + WriteEndElement(); + } + + public void WriteHiddenPaths() + { + WriteComment(" Paths to exclude from the Project Explorer tree "); + WriteStartElement("hiddenPaths"); + //WritePaths(project.HiddenPaths,"hidden"); + WriteEndElement(); + } + + public void WritePreBuildCommand() + { + WriteComment(" Executed before build "); + WriteStartElement("preBuildCommand"); + if (m_Project.PreBuildEvent.Length > 0) + WriteString(m_Project.PreBuildEvent); + WriteEndElement(); + } + + public void WritePostBuildCommand() + { + WriteComment(" Executed after build "); + WriteStartElement("postBuildCommand"); + WriteAttributeString("alwaysRun",m_Project.AlwaysRunPostBuild.ToString()); + if (m_Project.PostBuildEvent.Length > 0) + WriteString(m_Project.PostBuildEvent); + WriteEndElement(); + + } + + public void WriteProjectOptions() + { + WriteComment(" Other project options "); + WriteStartElement("options"); + WriteOption("debug",m_Project.Debug); + WriteOption("kdebug",m_Project.KDebug); + WriteOption("source", @"c:\ros\trunk\reactos" /*project.Source*/); + WriteEndElement(); + } + + public void WriteOption(string optionName, object optionValue) + { + WriteOption("option", optionName, optionValue); + } + + public void WriteOption(string nodeName, string optionName, object optionValue) + { + WriteStartElement(nodeName); + WriteAttributeString(optionName, optionValue.ToString()); + WriteEndElement(); + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/ProjectController.cs b/reactos/tools/sysgen/RosBuilder/ProjectController.cs new file mode 100644 index 00000000000..c77491d236f --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/ProjectController.cs @@ -0,0 +1,222 @@ +using System; +using System.Windows.Forms; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; +using SysGen.Framework.Catalog; + +namespace TriStateTreeViewDemo +{ + public class ProjectController + { + private ISysGenDesigner m_SysGenDesigner = null; + private RBuildProject m_Project = null; + + public event EventHandler PlatformModulesUpdated; + public event EventHandler ProjectLoaded; + public event EventHandler ProjectSaved; + public event EventHandler ProjectUpdated; + + public ProjectController(ISysGenDesigner engine) + { + m_SysGenDesigner = engine; + + PlatformCatalogReader m_Catalog = new PlatformCatalogReader(@"C:\Ros\trunk\reactos\rbuilddb.xml"); + m_Catalog.Read(); + + m_Project = m_Catalog.Project; + + New(); + } + + public void New() + { + m_Project.Platform = new Project(m_Project); + + if (ProjectLoaded != null) + ProjectLoaded(this, EventArgs.Empty); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + + public void Open(string file) + { + SysGenProject = new Project(m_Project, file); + SysGenProject.Load(); + + if (ProjectLoaded != null) + ProjectLoaded(this, EventArgs.Empty); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + + public void Open() + { + using (OpenFileDialog openFile = new OpenFileDialog()) + { + openFile.Title = "Open SysGen Designer Project File"; + //openFile.InitialDirectory = m_SysGenEngine.BaseDirectory; + openFile.Filter = "SysGen Project File|*.sgpd"; + + if (openFile.ShowDialog() == DialogResult.OK) + { + SysGenProject = new Project(m_Project, openFile.FileName); + SysGenProject.Load(); + + if (ProjectLoaded != null) + ProjectLoaded(this, EventArgs.Empty); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + } + } + + public void Save() + { + using (SaveFileDialog saveFile = new SaveFileDialog()) + { + saveFile.Title = "Save SysGen Designer Project File"; + //saveFile.InitialDirectory = m_SysGenEngine.BaseDirectory; + saveFile.Filter = "SysGen Project File|*.sgpd"; + + if (saveFile.ShowDialog() == DialogResult.OK) + { + SysGenProject.ProjectPath = saveFile.FileName; + SysGenProject.Save(); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + + if (ProjectSaved != null) + ProjectSaved(this, EventArgs.Empty); + } + } + } + + public RBuildModuleCollection AvailableModules + { + get { return m_Project.Modules; } + } + + public RBuildProject Project + { + get { return m_Project; } + } + + public Project SysGenProject + { + get { return Project.Platform as Project; } + set { Project.Platform = value; } + } + + public void Remove(RBuildModule module) + { + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(Project, module); + + if (dependencyTracker.Using.Count > 0) + { + string s = string.Format("Cannot remove module '{0}' because '{1}' modules depends on it", + module.Name, + dependencyTracker.Using.Count); + + MessageBox.Show(s, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + Project.Platform.Modules.Remove(module); + } + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + + public void Add(RBuildModule module) + { + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(Project , module); + + if (AskAddModulesToPlatform(dependencyTracker.Missing)) + { + Project.Platform.Modules.Add(dependencyTracker.DependsOn); + Project.Platform.Modules.Add(module); + } + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + + public void Add(RBuildModuleCollection modules) + { + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(Project, modules); + + if (AskAddModulesToPlatform(dependencyTracker.Missing)) + { + Project.Platform.Modules.Add(dependencyTracker.DependsOn); + Project.Platform.Modules.Add(modules); + } + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + } + + public void AddLanguage(RBuildLanguage language) + { + if (Project.Platform.Languages.Contains(language) == false) + Project.Platform.Languages.Add(language); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + + if (ProjectUpdated != null) + ProjectUpdated(this, EventArgs.Empty); + } + + public void AddDebugChannel(RBuildDebugChannel channel) + { + if (Project.Platform.DebugChannels.Contains(channel) == false) + Project.Platform.DebugChannels.Add(channel); + + if (PlatformModulesUpdated != null) + PlatformModulesUpdated(this, EventArgs.Empty); + + if (ProjectUpdated != null) + ProjectUpdated(this, EventArgs.Empty); + } + + public bool AskAddModulesToPlatform(RBuildModuleCollection missingDependencies) + { + if (missingDependencies.Count > 0) + { + StringBuilder str = new StringBuilder(); + + str.AppendFormat("This action requieres adding {0} dependecies no present in your platform :", missingDependencies.Count); + str.AppendLine(); + str.AppendLine(); + + foreach (RBuildModule dependency in missingDependencies) + { + str.AppendFormat("{0} on '{1}' \n", + dependency.Name, + dependency.Base); + } + + str.AppendLine(); + str.AppendLine("¿Do you want to add this dependencies?"); + + if (MessageBox.Show(str.ToString(), "RosBuilder", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + { + return true; + } + } + else + return true; + + return false; + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/RosBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..0b59df60ad1 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("RosBuilder")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("RosBuilder")] +[assembly: AssemblyCopyright("Copyright © Sand 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8f4d0b84-8882-4b89-8e3c-8ce5238d603f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/RosBuilder/Properties/Resources.Designer.cs b/reactos/tools/sysgen/RosBuilder/Properties/Resources.Designer.cs new file mode 100644 index 00000000000..268c5602106 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RosBuilder.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RosBuilder.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Properties/Resources.resx b/reactos/tools/sysgen/RosBuilder/Properties/Resources.resx new file mode 100644 index 00000000000..af7dbebbace --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Properties/Settings.Designer.cs b/reactos/tools/sysgen/RosBuilder/Properties/Settings.Designer.cs new file mode 100644 index 00000000000..71b700b5e99 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RosBuilder.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/reactos/tools/sysgen/RosBuilder/Properties/Settings.settings b/reactos/tools/sysgen/RosBuilder/Properties/Settings.settings new file mode 100644 index 00000000000..39645652af6 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj b/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj new file mode 100644 index 00000000000..3e94b2c1469 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj @@ -0,0 +1,148 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {78A0F196-A5BD-469A-B901-B269671AFB0A} + WinExe + Properties + RosBuilder + RosBuilder + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + Component + + + Component + + + Component + + + UserControl + + + RegistryEditor.cs + + + Form + + + Form1.cs + + + Form + + + MainForm.cs + + + + Form + + + NewItemForm.cs + + + Code + + + + + + + + + + Designer + RegistryEditor.cs + + + Designer + Form1.cs + + + Designer + MainForm.cs + + + Designer + NewItemForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + SysGen.RBuild.Framework + + + {8F5F8375-4097-4952-B860-784EB9961ABE} + SysGen.Framework + + + {99CEE41D-B76D-4102-B0AD-C81069509D17} + TriStateTreeView + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj.user b/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj.user new file mode 100644 index 00000000000..6a34e7dcdf5 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/SysGen.Designer.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosBuilder/Util/FileAssociation.cs b/reactos/tools/sysgen/RosBuilder/Util/FileAssociation.cs new file mode 100644 index 00000000000..f60b10d4603 --- /dev/null +++ b/reactos/tools/sysgen/RosBuilder/Util/FileAssociation.cs @@ -0,0 +1,244 @@ +using System; +using System.Security; +using System.Collections; +using Microsoft.Win32; + +namespace TriStateTreeViewDemo +{ + /// List of commands. + internal struct CommandList + { + /// + /// Holds the names of the commands. + /// + public ArrayList Captions; + /// + /// Holds the commands. + /// + public ArrayList Commands; + } + /// Properties of the file association. + internal struct FileType + { + /// + /// Holds the command names and the commands. + /// + public CommandList Commands; + /// + /// Holds the extension of the file type. + /// + public string Extension; + /// + /// Holds the proper name of the file type. + /// + public string ProperName; + /// + /// Holds the full name of the file type. + /// + public string FullName; + /// + /// Holds the name of the content type of the file type. + /// + public string ContentType; + /// + /// Holds the path to the resource with the icon of this file type. + /// + public string IconPath; + /// + /// Holds the icon index in the resource file. + /// + public short IconIndex; + } + /// Creates file associations for your programs. + /// The following example creates a file association for the type XYZ with a non-existent program. + ///


VB.NET code
+ /// + /// Dim FA as New FileAssociation + /// FA.Extension = "xyz" + /// FA.ContentType = "application/myprogram" + /// FA.FullName = "My XYZ Files!" + /// FA.ProperName = "XYZ File" + /// FA.AddCommand("open", "C:\mydir\myprog.exe %1") + /// FA.Create + /// + ///
C# code
+ /// + /// FileAssociation FA = new FileAssociation(); + /// FA.Extension = "xyz"; + /// FA.ContentType = "application/myprogram"; + /// FA.FullName = "My XYZ Files!"; + /// FA.ProperName = "XYZ File"; + /// FA.AddCommand("open", "C:\\mydir\\myprog.exe %1"); + /// FA.Create(); + /// + ///
+ public class FileAssociation + { + /// Initializes an instance of the FileAssociation class. + public FileAssociation() + { + FileInfo = new FileType(); + FileInfo.Commands.Captions = new ArrayList(); + FileInfo.Commands.Commands = new ArrayList(); + } + /// Gets or sets the proper name of the file type. + /// A String representing the proper name of the file type. + public string ProperName + { + get + { + return FileInfo.ProperName; + } + set + { + FileInfo.ProperName = value; + } + } + /// Gets or sets the full name of the file type. + /// A String representing the full name of the file type. + public string FullName + { + get + { + return FileInfo.FullName; + } + set + { + FileInfo.FullName = value; + } + } + /// Gets or sets the content type of the file type. + /// A String representing the content type of the file type. + public string ContentType + { + get + { + return FileInfo.ContentType; + } + set + { + FileInfo.ContentType = value; + } + } + /// Gets or sets the extension of the file type. + /// A String representing the extension of the file type. + /// If the extension doesn't start with a dot ("."), a dot is automatically added. + public string Extension + { + get + { + return FileInfo.Extension; + } + set + { + if (value.Substring(0, 1) != ".") + value = "." + value; + FileInfo.Extension = value; + } + } + /// Gets or sets the index of the icon of the file type. + /// A short representing the index of the icon of the file type. + public short IconIndex + { + get + { + return FileInfo.IconIndex; + } + set + { + FileInfo.IconIndex = value; + } + } + /// Gets or sets the path of the resource that contains the icon for the file type. + /// A String representing the path of the resource that contains the icon for the file type. + /// This resource can be an executable or a DLL. + public string IconPath + { + get + { + return FileInfo.IconPath; + } + set + { + FileInfo.IconPath = value; + } + } + /// Adds a new command to the command list. + /// The name of the command. + /// The command to execute. + /// Caption -or- Command is null (VB.NET: Nothing). + public void AddCommand(string Caption, string Command) + { + if (Caption == null || Command == null) + throw new ArgumentNullException(); + FileInfo.Commands.Captions.Add(Caption); + FileInfo.Commands.Commands.Add(Command); + } + /// Creates the file association. + /// Extension -or- ProperName is null (VB.NET: Nothing). + /// Extension -or- ProperName is empty. + /// The user does not have registry write access. + public void Create() + { + // remove the extension to avoid incompatibilities [such as DDE links] + try + { + Remove(); + } + catch (ArgumentException) {} // the extension doesn't exist + + // create the exception + if (Extension == "" || ProperName == "") + throw new ArgumentException(); + int cnt; + + try + { + RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey(Extension); + RegKey.SetValue("", ProperName); + + if (ContentType != null && ContentType != "") + RegKey.SetValue("Content Type", ContentType); + + RegKey.Close(); + RegKey = Registry.ClassesRoot.CreateSubKey(ProperName); + RegKey.SetValue("", FullName); + RegKey.Close(); + + if (IconPath != "") + { + RegKey = Registry.ClassesRoot.CreateSubKey(ProperName + "\\" + "DefaultIcon"); + RegKey.SetValue("", IconPath + "," + IconIndex.ToString()); + RegKey.Close(); + } + + for (cnt = 0; cnt < FileInfo.Commands.Captions.Count; cnt++) + { + RegKey = Registry.ClassesRoot.CreateSubKey(ProperName + "\\" + "Shell" + "\\" + (String)FileInfo.Commands.Captions[cnt]); + RegKey = RegKey.CreateSubKey("Command"); + RegKey.SetValue("", FileInfo.Commands.Commands[cnt]); + RegKey.Close(); + } + } + catch + { + throw new SecurityException(); + } + } + /// Removes the file association. + /// Extension -or- ProperName is null (VB.NET: Nothing). + /// Extension -or- ProperName is empty -or- the specified extension doesn't exist. + /// The user does not have registry delete access. + public void Remove() + { + if (Extension == null || ProperName == null) + throw new ArgumentNullException(); + if (Extension == "" || ProperName == "") + throw new ArgumentException(); + Registry.ClassesRoot.DeleteSubKeyTree(Extension); + Registry.ClassesRoot.DeleteSubKeyTree(ProperName); + } + /// Holds the properties of the file type. + private FileType FileInfo; + } +} diff --git a/reactos/tools/sysgen/RosFramework/Base/RBuildElement.cs b/reactos/tools/sysgen/RosFramework/Base/RBuildElement.cs new file mode 100644 index 00000000000..3376bd00ed7 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Base/RBuildElement.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public abstract class RBuildElement : IRBuildNamed + { + protected string m_RBuild = null; + protected string m_Name = null; + protected string m_Base = null; + protected string m_Path = null; + protected string m_XmlFile = null; + + protected List m_AssemblyFlags = new List(); + protected List m_CompilerFlags = new List(); + protected List m_LinkerFlags = new List(); + protected RBuildIncludeFolderCollection m_Includes = new RBuildIncludeFolderCollection(); + protected RBuildPlatformFileCollection m_Files = new RBuildPlatformFileCollection(); + protected RBuildDefineCollection m_Defines = new RBuildDefineCollection(); + protected RBuildPropertyCollection m_Properties = new RBuildPropertyCollection(); + protected RBuildFolderCollection m_Folders = new RBuildFolderCollection(); + protected RBuildFolder m_Folder = new RBuildFolder(); + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public virtual RBuildFolder Folder + { + get { return m_Folder; } + set { m_Folder = value; } + } + + public string XmlFile + { + get { return m_XmlFile; } + set { m_XmlFile = value; } + } + + public string Path + { + get { return m_Path; } + set { m_Path = value; } + } + + public string Base + { + get { return Folder.FullPath; } + } + + public string RBuildPath + { + get { return System.IO.Path.Combine(Base, RBuildFile); } + } + + public string RBuildFile + { + get { return m_RBuild; } + set { m_RBuild = value; } + } + + public Uri BaseURI + { + get { return new Uri(Base, UriKind.Relative); } + } + + public string BaseParent + { + get { return Base.Replace(System.IO.Path.DirectorySeparatorChar + Name , string.Empty); } + } + + public string FolderFullPath + { + get { return System.IO.Path.Combine(Path, Base); } + } + + public RBuildFolderCollection Folders + { + get { return m_Folders; } + } + + public RBuildPlatformFileCollection Files + { + get { return m_Files; } + } + + public RBuildPropertyCollection Properties + { + get { return m_Properties; } + } + + public List CompilerFlags + { + get { return m_CompilerFlags; } + } + + public List LinkerFlags + { + get { return m_LinkerFlags; } + } + + public List AssemblyFlags + { + get { return m_AssemblyFlags; } + } + + public RBuildDefineCollection Defines + { + get { return m_Defines; } + } + + public RBuildIncludeFolderCollection IncludeFolders + { + get { return m_Includes; } + set { m_Includes = value; } + } + + public string MakeFilePreCondition + { + get { return string.Format("{0}_PRECONDITION", Name); } + } + + public string MakeFileRCFlags + { + get { return string.Format("{0}_RCFLAGS", Name); } + } + + public string MakeFileWIDLFlags + { + get { return string.Format("{0}_WIDLFLAGS", Name); } + } + + public string MakeFileLFlags + { + get { return string.Format("{0}_LFLAGS", Name); } + } + + public string MakeFileNASMFlags + { + get { return string.Format("{0}_NASMFLAGS", Name); } + } + + public string MakeFileFoldersMacro + { + get { return string.Format("$({0}_FOLDERS)", Name); } + } + + public string MakeFileFolders + { + get { return string.Format("{0}_FOLDERS", Name); } + } + + public string MakeFileCFlags + { + get { return string.Format("{0}_CFLAGS", Name); } + } + + public string MakeFileObjs + { + get { return string.Format("{0}_OBJS", Name); } + } + + public string MakeFileSources + { + get { return string.Format("{0}_SOURCES", Name); } + } + + public string MakeFileHeaders + { + get { return string.Format("{0}_HEADERS", Name); } + } + + public string MakeFileMakeTarget + { + get { return string.Format("{0}", Name); } + } + + public string MakeFileFlagDebugTarget + { + get { return string.Format("{0}_flagdebug", Name); } + } + + public string MakeFileInfoTarget + { + get { return string.Format("{0}_info", Name); } + } + + public string MakeFileCleanTarget + { + get { return string.Format("{0}_clean", Name); } + } + + public string MakeFileDependsTarget + { + get { return string.Format("{0}_depends", Name); } + } + + public string MakeFileInstallTarger + { + get { return string.Format("{0}_install", Name); } + } + + public string MakeFileHeadersMacro + { + get { return string.Format("$({0}_HEADERS)", Name); } + } + + public string MakeFileMCHeadersMacro + { + get { return string.Format("$({0}_MCHEADERS)", Name); } + } + + public string MakeFileMCHeaders + { + get { return string.Format("{0}_MCHEADERS", Name); } + } + + public string MakeFileRPCHeadersMacro + { + get { return string.Format("$({0}_RPCHEADERS)", Name); } + } + + public string MakeFileRPCHeaders + { + get { return string.Format("{0}_RPCHEADERS", Name); } + } + + public string MakeFileRPCSourcesMacro + { + get { return string.Format("$({0}_RPCSOURCES)", Name); } + } + + public string MakeFileRPCSources + { + get { return string.Format("{0}_RPCSOURCES", Name); } + } + + public string MakeFilePCHMacro + { + get { return string.Format("$({0}_PCH)", Name); } + } + + public string MakeFilePCHHeaders + { + get { return string.Format("{0}_PCH", Name); } + } + + public string MakeFileNASMMacro + { + get { return string.Format("$({0}_NASMFLAGS)", Name); } + } + + public string MakeFileCFlagsMacro + { + get { return string.Format("$({0}_CFLAGS)", Name); } + } + + public string MakeFileLFlagsMacro + { + get { return string.Format("$({0}_LFLAGS)", Name); } + } + + public string MakeFileWIDLFlagsMacro + { + get { return string.Format("$({0}_WIDLFLAGS)", Name); } + } + + public string MakeFileObjsMacro + { + get { return string.Format("$({0}_OBJS)", Name); } + } + + public string MakeFileSourcesMacro + { + get { return string.Format("$({0}_SOURCES)", Name); } + } + + public string MakeFilePreConditionMacro + { + get { return string.Format("$({0}_PRECONDITION)", Name); } + } + + public string MakeFileRCFlagsMacro + { + get { return string.Format("$({0}_RCFLAGS)", Name); } + } + + public abstract void SaveAs(string file); + + public override bool Equals(object obj) + { + if (obj is RBuildElement) + { + RBuildElement element = obj as RBuildElement; + + if (element.Name == Name) + return true; + } + + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildAPIStatusCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildAPIStatusCollection.cs new file mode 100644 index 00000000000..e877521ee0c --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildAPIStatusCollection.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildAPIStatusCollection : List + { + public int Percentage + { + get + { + if (TotalFunctions == 0) + return 100; + + return ((100 * ImplementedFunctionsCount) / TotalFunctions); + } + } + + public int TotalFunctions + { + get { return (ImplementedFunctionsCount + UnImplementedFunctionsCount); } + } + + public int ImplementedFunctionsCount + { + get + { + int count = 0; + + foreach (RBuildAPIInfo info in this) + if (info.Implemented == true) + count++; + + return count; + } + } + + public int UnImplementedFunctionsCount + { + get + { + int count = 0; + + foreach (RBuildAPIInfo info in this) + if (info.Implemented == false) + count++; + + return count; + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildAuthorCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildAuthorCollection.cs new file mode 100644 index 00000000000..e9f588ae119 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildAuthorCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildAuthorCollection : List + { + public RBuildAuthor GetByName(string alias) + { + foreach (RBuildAuthor author in this) + { + if (author.Contributor.Alias == alias) + return author; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildBuildFamilyCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildBuildFamilyCollection.cs new file mode 100644 index 00000000000..c2f0b416a42 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildBuildFamilyCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildBuildFamilyCollection : List + { + public RBuildBuildFamily GetByName(string name) + { + foreach (RBuildBuildFamily family in this) + { + if (family.Name == name) + return family; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildContributorCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildContributorCollection.cs new file mode 100644 index 00000000000..ee8e5530b7e --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildContributorCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildContributorCollection : List + { + public RBuildContributor GetByName(string alias) + { + foreach (RBuildContributor contributor in this) + { + if (contributor.Alias == alias) + return contributor; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildDebugChannelCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildDebugChannelCollection.cs new file mode 100644 index 00000000000..8f45b25cfb1 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildDebugChannelCollection.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildDebugChannelCollection : List + { + public RBuildDebugChannel GetByName(string name) + { + foreach (RBuildDebugChannel channel in this) + { + if (channel.Name == name) + return channel; + } + + return null; + } + + public string Text + { + get + { + StringBuilder sBuilder = new StringBuilder(); + + foreach (RBuildDebugChannel channel in this) + { + sBuilder.Append(channel.Text); + } + + return sBuilder.ToString(); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildDefineCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildDefineCollection.cs new file mode 100644 index 00000000000..7281ab8a556 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildDefineCollection.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + public class RBuildDefineCollection : List + { + public bool IsDefined(string name) + { + foreach (RBuildDefine define in this) + { + if (define.Name == name) + return true; + } + + return false; + } + + public void Add(string name) + { + Add(new RBuildDefine(name)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildExportedFunctionsCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildExportedFunctionsCollection.cs new file mode 100644 index 00000000000..c3d17463fad --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildExportedFunctionsCollection.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildExportedFunctionsCollection : List + { + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildFamilyCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildFamilyCollection.cs new file mode 100644 index 00000000000..66ea4355fd4 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildFamilyCollection.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildFamilyCollection : List + { + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildFileCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildFileCollection.cs new file mode 100644 index 00000000000..08e47dd24be --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildFileCollection.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildFileCollection : List + { + public void Add(RBuildFileCollection files) + { + foreach (RBuildFile file in files) + { + Add(file); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildFolderCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildFolderCollection.cs new file mode 100644 index 00000000000..09faabaa28f --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildFolderCollection.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildFolderCollection : List + { + public void Add(RBuildFolderCollection folders) + { + foreach (RBuildFolder folder in folders) + { + Add(folder); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildIncludeFolderCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildIncludeFolderCollection.cs new file mode 100644 index 00000000000..96b63771fe8 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildIncludeFolderCollection.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildIncludeFolderCollection : List + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildInstallFolderCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildInstallFolderCollection.cs new file mode 100644 index 00000000000..e9620346126 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildInstallFolderCollection.cs @@ -0,0 +1,28 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildInstallFolderCollection : List + { + public RBuildInstallFolder GetByName(string name) + { + foreach (RBuildInstallFolder folder in this) + { + if (NormalizeFolderName(folder.Name) == NormalizeFolderName(name)) + return folder; + } + + return null; + } + + private string NormalizeFolderName(string path) + { + return path.Replace( + Path.AltDirectorySeparatorChar, + Path.DirectorySeparatorChar); + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildLanguageCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildLanguageCollection.cs new file mode 100644 index 00000000000..d81f0506a49 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildLanguageCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildLanguageCollection : List + { + public RBuildLanguage GetByName(string culture) + { + foreach (RBuildLanguage language in this) + { + if (language.Name == culture) + return language; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildLocalizationFileCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildLocalizationFileCollection.cs new file mode 100644 index 00000000000..7e005d00616 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildLocalizationFileCollection.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildLocalizationFileCollection : List + { + public bool ContainsLocalization(string culture) + { + return GetByName(culture) != null; + } + + public RBuildLocalizationFile GetByName(string culture) + { + foreach (RBuildLocalizationFile file in this) + { + if (file.IsoName == culture) + return file; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleCollection.cs new file mode 100644 index 00000000000..2c472e74f07 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleCollection.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class ModulePreferenceComparer : IComparer + { + public int Compare(RBuildModule x, RBuildModule y) + { + if (x.Type == y.Type) + return 0; + + if (x.Type == ModuleType.BuildTool) + return -1; + + return 1; + } + } + + public class RBuildModuleCollection : List + { + public event EventHandler OnModuleAdded; + + public void Add(RBuildModuleCollection modules) + { + foreach (RBuildModule module in modules) + { + Add(module); + } + } + + public new void Add(RBuildModule module) + { + if (module == null) + throw new Exception("Could not add a null instance"); + + if (GetByName(module.Name) == null) + { + base.Add(module); + } + + if (OnModuleAdded != null) + OnModuleAdded(this, EventArgs.Empty); + } + + public void Add(string moduleName) + { + RBuildModule module = GetByName(moduleName); + + if (module == null) + throw new Exception(string.Format("Unknown '{0}' module", moduleName)); + + Add(module); + } + + public void Add(int index, RBuildModule moduleName) + { + base.Insert(index, moduleName); + } + + public void DisableAll() + { + foreach (RBuildModule module in this) + { + // Disable module + module.Enabled = false; + } + } + + public RBuildModule GetByName(string name) + { + foreach (RBuildModule module in this) + { + if (module.Name == name) + return module; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleInfoCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleInfoCollection.cs new file mode 100644 index 00000000000..4670f093936 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildModuleInfoCollection.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildModuleInfoCollection : List + { + public RBuildModuleInfo GetByName(string name) + { + foreach (RBuildModuleInfo module in this) + { + if (module.Name == name) + return module; + } + + return null; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildPlatformFileCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildPlatformFileCollection.cs new file mode 100644 index 00000000000..7ccf135cefc --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildPlatformFileCollection.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildPlatformFileCollection : List + { + public void Add(RBuildPlatformFileCollection files) + { + foreach (RBuildPlatformFile file in files) + { + Add(file); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildPropertyCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildPropertyCollection.cs new file mode 100644 index 00000000000..f3a4769258f --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildPropertyCollection.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text.RegularExpressions; + +namespace SysGen.RBuild.Framework +{ + public class RBuildPropertyCollection : List + { + /// + /// Adds a property that cannot be changed. + /// + /// + /// Properties added with this method can never be changed. Note that + /// they are removed if the Clear method is called. + /// + /// Name of property + /// Value of property + public virtual void AddReadOnly(string name, string value) + { + Add(name, value, true); + } + + /// + /// Adds a property to the collection. + /// + /// Name of property + /// Value of property + public virtual void Add(string name, string value) + { + Add(name, value, false); + } + + /// + /// Adds a property to the collection. + /// + /// Name of property + /// Value of property + public virtual void Add(string name, bool value) + { + Add(name, value.ToString()); + } + + /// + /// Adds a property to the collection. + /// + /// Name of property + /// Value of property + public virtual void Add(string name, string value, bool readOnly) + { + if (!PropertyExists(name)) + { + Add(new RBuildProperty(name, value , readOnly)); + } + } + + /// + /// Adds a property to the collection. + /// + /// Name of property + /// Value of property + public virtual void Add(string name, string value, bool readOnly, bool isInternal) + { + if (!PropertyExists(name)) + { + Add(new RBuildProperty(name, value, readOnly,isInternal)); + } + } + + /// + /// Returns true if a property is listed as read only + /// + /// Property to check + /// true if readonly, false otherwise + public virtual bool IsReadOnlyProperty(string name) + { + if (PropertyExists(name)) + return this[name].ReadOnly; + return false; + } + + /// + /// Returns true if a property exists + /// + /// Property to check + /// true if exists, false otherwise + public bool PropertyExists(string name) + { + return (this[name] != null); + } + + /// + /// Indexer property. + /// + public virtual RBuildProperty this[string name] + { + get + { + foreach (RBuildProperty property in this) + if (property.Name == name) + return property; + + return null; + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Collections/RBuildSourceFileCollection.cs b/reactos/tools/sysgen/RosFramework/Collections/RBuildSourceFileCollection.cs new file mode 100644 index 00000000000..7175bac8e8a --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Collections/RBuildSourceFileCollection.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class SourceCodePreferenceComparer : IComparer + { + public int Compare(RBuildSourceFile x, RBuildSourceFile y) + { + if (x.First != y.First) + { + if (x.First) + return -1; + else + return 1; + } + + if (x.Extension == y.Extension) + return 0; + + if (x.IsWidl) + return -1; + else if (y.IsWidl) + return 1; + + if (x.IsAssembler) + return 1; + else if (y.IsAssembler) + return -1; + + if (x.IsNASM) + return 1; + else if (y.IsNASM) + return -1; + + return 0; + } + } + + public class RBuildSourceFileCollection : List + { + public bool ContainsASM + { + get + { + foreach (RBuildSourceFile file in this) + { + if ((file.IsAssembler) || (file.IsNASM)) + { + return true; + } + } + + // This module does not contain C++ code + return false; + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildInstallable.cs b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildInstallable.cs new file mode 100644 index 00000000000..4e5a8467d0b --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildInstallable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public interface IRBuildInstallable + { + string InstallBase { get; set; } + + RBuildInstallFolder InstallFolder { get; set; } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildModulesContainer.cs b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildModulesContainer.cs new file mode 100644 index 00000000000..9bc5f9902f3 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildModulesContainer.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + public interface IRBuildModulesContainer + { + RBuildSourceFileCollection Modules { get; } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildNamed.cs b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildNamed.cs new file mode 100644 index 00000000000..34252cab108 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildNamed.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + public interface IRBuildNamed + { + string Name { get; } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildSourceFilesContainer.cs b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildSourceFilesContainer.cs new file mode 100644 index 00000000000..78eccd72cdb --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Interfaces/IRBuildSourceFilesContainer.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + public interface IRBuildSourceFilesContainer + { + RBuildSourceFileCollection SourceFiles { get; } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Misc/Utility.cs b/reactos/tools/sysgen/RosFramework/Misc/Utility.cs new file mode 100644 index 00000000000..da5200b907d --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Misc/Utility.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + class Utility + { + public static string GetSafeString (string str) + { + str = str.Replace(" ", string.Empty); + str = str.Replace(".", string.Empty); + + return str; + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildModuleGroup.cs b/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildModuleGroup.cs new file mode 100644 index 00000000000..6cc00b2fe2a --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildModuleGroup.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework.NotImplementedYet +{ + public class RBuildModuleGroup + { + private RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + private string m_Name = null; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildPatch.cs b/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildPatch.cs new file mode 100644 index 00000000000..0b8b9c22b82 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/NotImplementedYet/RBuildPatch.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework.NotImplementedYet +{ + public class RBuildPatch + { + private string m_Filename = null; + private string m_Name = null; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string FileName + { + get { return m_Filename; } + set { m_Filename = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Obsolete/PlatformCatalog.cs b/reactos/tools/sysgen/RosFramework/Obsolete/PlatformCatalog.cs new file mode 100644 index 00000000000..4d8fcfbaf41 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Obsolete/PlatformCatalog.cs @@ -0,0 +1,92 @@ +using System; +using System.Xml; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class PlatformCatalog + { + public List m_Platform = new List(); + public SoftwareCatalog m_SoftwareCatalog = new SoftwareCatalog(); + + public PlatformCatalog() + { + } + + public List Platforms + { + get { return m_Platform; } + } + + public SoftwareCatalog SoftwareCatalog + { + get { return m_SoftwareCatalog; } + set { m_SoftwareCatalog = value; } + } + + public RosPlatform GetPlatformByName(string name) + { + foreach (RosPlatform platform in Platforms) + { + if (platform.Name == name) + { + return platform; + } + } + + throw new Exception("Platform not found in catalog"); + } + + public void LoadFromFile(string file) + { + XmlDocument doc = new XmlDocument(); + + //Load the file in to memory + doc.Load(file); + + //Load modules ... + foreach (XmlNode node in doc.SelectNodes("/platforms/platform")) + { + RosPlatform platform = new RosPlatform(); + + platform.Name = node.Attributes["name"].InnerText; + + if (node.Attributes["base"] != null) + { + platform.Base = node.Attributes["base"].InnerText; + } + + m_Platform.Add(platform); + } + + foreach (XmlNode comp in doc.SelectNodes("/platforms/platform")) + { + // Get the component name.... + string name = comp.Attributes["name"].InnerText; + + RosPlatform platform = GetPlatformByName(name); + + if (platform.Base != null) + { + platform.ParentPlatform = GetPlatformByName(platform.Base); + + foreach (RBuildModule module in platform.ParentModules) + { + platform.Modules.Add(module); + } + } + + foreach (XmlNode dep in comp.SelectNodes("modules/module")) + { + // Gets the dependency name + name = dep.Attributes["name"].InnerText; + + RBuildModule module = SoftwareCatalog.Modules.GetByName(name); + + platform.Modules.Add(module); + } + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Obsolete/RosArchitecture.cs b/reactos/tools/sysgen/RosFramework/Obsolete/RosArchitecture.cs new file mode 100644 index 00000000000..593a0373a1a --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Obsolete/RosArchitecture.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RosArchitecture + { + private string m_Name = null; + private string m_Sub = null; + private string m_Optimization = null; + + public RosArchitecture () + { + m_Name = "i386"; + m_Sub = string.Empty; + m_Optimization = "pentium"; + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string SubArchitecture + { + get { return m_Sub; } + set { m_Sub = value; } + } + + public string Optimization + { + get { return m_Optimization; } + set { m_Optimization = value; } + } + + public string SafeName + { + get { return Utility.GetSafeString(m_Name).ToUpper(); } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/Obsolete/RosOSImage.cs b/reactos/tools/sysgen/RosFramework/Obsolete/RosOSImage.cs new file mode 100644 index 00000000000..7890b26cf26 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Obsolete/RosOSImage.cs @@ -0,0 +1,209 @@ +using System; +using System.Xml; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildOSImage + { + private RosPlatform m_Platform = null; + private RBuildLanguage m_Language = null; + private RosArchitecture m_Architecture = null; + + private Dictionary m_Properties = new Dictionary(); + private List m_Defines = new List(); + private List m_Includes = new List(); + + private bool m_Debug = false; + //private bool m_KernelDebugger = false; + //private bool m_GDBDebugger = false; + + private bool m_MakeBootCD = false; + private bool m_MakeLiveCD = false; + + public RBuildOSImage() + { + Properties.Add("SARCH", ""); + Properties.Add("OARCH", "pentium"); + Properties.Add("OPTIMIZE", "1"); + Properties.Add("MP", "0"); + Properties.Add("KDBG", "0"); + Properties.Add("DBG", "0"); + Properties.Add("GDB", "0"); + Properties.Add("NSWPAT", "0"); + Properties.Add("NTLPC", "1"); + Properties.Add("_WINKD_", "0"); + + Defines.Add ("_M_IX86"); + Defines.Add ("_X86_"); + Defines.Add ("__i386__"); + Defines.Add ("_REACTOS_"); + + Includes.Add("."); + Includes.Add("include"); + Includes.Add("include/psdk"); + Includes.Add("include/dxsdk"); + Includes.Add("include/crt"); + Includes.Add("include/ddk"); + Includes.Add("include/GL"); + Includes.Add("include/ndk"); + Includes.Add("include/reactos"); + Includes.Add("include/reactos/libs"); + } + + public bool MakeLiveCD + { + get { return m_MakeLiveCD; } + set { m_MakeLiveCD = value; } + } + + public bool MakeBootCD + { + get { return m_MakeBootCD; } + set { m_MakeBootCD = value; } + } + + public RBuildLanguage Language + { + get { return m_Language; } + set { m_Language = value; } + } + + public RosPlatform Platform + { + get { return m_Platform; } + set { m_Platform = value; } + } + + public RosArchitecture Architecture + { + get { return m_Architecture; } + set { m_Architecture = value; } + } + + public Dictionary Properties + { + get { return m_Properties; } + } + + public List Defines + { + get { return m_Defines; } + } + + public List Includes + { + get { return m_Includes; } + } + + public string ReleaseType + { + get + { + if (m_Debug) + return "DBG"; + + return "RELEASE"; + } + } + + public string ImageType + { + get + { + if (m_MakeBootCD) + return "BootCD"; + + return "LiveCD"; + } + } + + public void SaveAs(string file) + { + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(file, Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteStartElement("project"); + writer.WriteAttributeString("name", "ReactOS"); + writer.WriteAttributeString("makefile", "makefile.auto"); + writer.WriteAttributeString("xmlns", "xi", null, "http://www.w3.org/2001/XInclude"); + + writer.WriteComment("Generic Properties"); + foreach (KeyValuePair property in Properties) + { + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", property.Key); + writer.WriteAttributeString("value", property.Value); + writer.WriteEndElement(); + } + + foreach (string define in Defines) + { + writer.WriteStartElement("define"); + writer.WriteAttributeString("name", define); + writer.WriteEndElement(); + } + + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", "baseaddress.rbuild"); + writer.WriteEndElement(); + + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", "boot/bootdata/bootdata.rbuild"); + writer.WriteEndElement(); + + writer.WriteElementString("compilerflag", "-Os"); + writer.WriteElementString("compilerflag", "-ftracer"); + writer.WriteElementString("compilerflag", "-momit-leaf-frame-pointer"); + writer.WriteElementString("compilerflag", "-mpreferred-stack-boundary=2"); + + writer.WriteElementString("compilerflag", "-Wno-strict-aliasing"); + writer.WriteElementString("compilerflag", "-Wpointer-arith"); + writer.WriteElementString("linkerflag", "-enable-stdcall-fixup"); + + foreach (string include in Includes) + { + writer.WriteStartElement("include"); + writer.WriteAttributeString("root", "intermediate"); + writer.WriteString(include); + writer.WriteEndElement(); + + writer.WriteStartElement("include"); + writer.WriteString(include); + writer.WriteEndElement(); + } + + foreach (RBuildModule module in Platform.Modules) + { + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", module.RBuildFile); + writer.WriteEndElement(); + } + + writer.WriteEndElement(); //Project + writer.WriteEndDocument(); + } + + string a = Name; + } + + public string Name + { + get { + return ""; + //return string.Format("{0}_{1}{2}_{3}_{4}.iso", + // Platform.SafeName, + // Architecture.SafeName , + // Language.CultureInfo.ThreeLetterISOLanguageName, + // ImageType, + // ReleaseType); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/Obsolete/RosPlatform.cs b/reactos/tools/sysgen/RosFramework/Obsolete/RosPlatform.cs new file mode 100644 index 00000000000..2864a425bbf --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Obsolete/RosPlatform.cs @@ -0,0 +1,78 @@ +using System; +using System.Xml; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RosPlatform + { + private List m_Modules = new List(); + + private string m_Name = null; + private string m_Base = null; + + private RosPlatform m_ParentPlatform = null; + + public RosPlatform() + { + m_Name = "ReactOS Core"; + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string Base + { + get { return m_Base; } + set { m_Base = value; } + } + + public RosPlatform ParentPlatform + { + get { return m_ParentPlatform; } + set { m_ParentPlatform = value; } + } + + public string SafeName + { + get { return Utility.GetSafeString(m_Name); } + } + + public void SaveAs(string file) + { + + } + + public List Modules + { + get { return m_Modules; } + } + + public List ParentModules + { + get + { + List modules = new List(); + + if (ParentPlatform != null) + { + foreach (RBuildModule module in ParentPlatform.Modules) + { + modules.Add(module); + } + + foreach (RBuildModule module in ParentPlatform.ParentModules) + { + modules.Add(module); + } + } + + return modules; + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Obsolete/SoftwareCatalog.cs b/reactos/tools/sysgen/RosFramework/Obsolete/SoftwareCatalog.cs new file mode 100644 index 00000000000..5169cf21a55 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Obsolete/SoftwareCatalog.cs @@ -0,0 +1,80 @@ +using System; +using System.Xml; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class SoftwareCatalog + { + public RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + + public SoftwareCatalog() + { + } + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + + public void LoadFromFile(string file) + { + XmlDocument doc = new XmlDocument(); + + //Load the file in to memory + doc.Load(file); + + //Load modules ... + foreach (XmlNode node in doc.SelectNodes("/modules/module")) + { + RBuildModule module; + + module = new RBuildModule(); + module.Metadata = new RBuildMetadata(); + + module.Name = node.Attributes["name"].Value; + //module.Base = node.Attributes["base"].Value; + module.Metadata.Description = node.Attributes["desc"].Value; + //module.Rbuild = node.Attributes["rbuild"].Value; + + /* + foreach (XmlNode dep in node.SelectNodes("provides/provide")) + { + string value = dep.SelectSingleNode("value").InnerText; + string type = dep.SelectSingleNode("type").InnerText; + + module.Provides.Add(value, type); + }*/ + + m_Modules.Add(module); + } + + foreach (XmlNode comp in doc.SelectNodes("/modules/module")) + { + // Get the component name.... + string componentName = comp.Attributes["name"].Value; + + foreach (XmlNode dep in comp.SelectNodes("dependencies/dependency")) + { + // Gets the dependency name + string dependencyName = dep.Attributes["name"].Value; + + foreach (RBuildModule dependency in m_Modules) + { + if (dependency.Name == dependencyName) + { + foreach (RBuildModule module in m_Modules) + { + if (module.Name == componentName) + { + module.Libraries.Add(dependency); + } + } + } + } + } + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/RosFramework/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..c9902b14d7b --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("RosFramework")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("RosFramework")] +[assembly: AssemblyCopyright("Copyright © Sand 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bc0dfcae-52a0-41f1-83b6-df64128d52b7")] + +// 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.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/RosFramework/RBuildAPIInfo.cs b/reactos/tools/sysgen/RosFramework/RBuildAPIInfo.cs new file mode 100644 index 00000000000..dc175f72398 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildAPIInfo.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildAPIInfo + { + private string m_Name; + private string m_File; + private bool m_Implemented; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string File + { + get { return m_File; } + set { m_File = value; } + } + + public bool Implemented + { + get { return m_Implemented; } + set { m_Implemented = value; } + } + + public string HtmlDocFileName + { + get { return string.Format("{0}.htm", Name); } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildAuthor.cs b/reactos/tools/sysgen/RosFramework/RBuildAuthor.cs new file mode 100644 index 00000000000..eb504b687d6 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildAuthor.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum AuthorRole + { + Developer, + Mantainer, + Translator + } + + public class RBuildAuthor + { + private AuthorRole m_AuthorRole = AuthorRole.Developer; + private RBuildContributor m_Contributor = null; + + /// + /// The underlying contributor. + /// + public RBuildContributor Contributor + { + get { return m_Contributor; } + set { m_Contributor = value; } + } + + /// + /// The author role. + /// + public AuthorRole Role + { + get { return m_AuthorRole; } + set { m_AuthorRole = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildAutoRegister.cs b/reactos/tools/sysgen/RosFramework/RBuildAutoRegister.cs new file mode 100644 index 00000000000..8bc526a5f01 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildAutoRegister.cs @@ -0,0 +1,106 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + /// + /// Type of registration + /// + public enum AutoRegisterType : int + { + DllRegisterServer = 1, + DllInstall = 2, + Both = 3 + } + + public enum SetupApiFolder : int + { + SourceDrive = 1, //(the directory from which the INF file was installed) + OS = 10, //(%SystemRoot%) + System = 11, //(%SystemRoot%\system32) + Drivers = 12, //(%SystemRoot%\system32\drivers) + Inf = 17, //(%SystemRoot%\inf) + Help = 18, //(%SystemRoot%\Help) + Fonts = 20, //(%SystemRoot%\Fonts) + Root = 24, //(%SystemDrive%) + Shared = 25, //(%ALLUSERSPROFILE%\Shared Documents) + UserProfile = 53 //(%USERPROFILE%) + } + + public enum SetupApiShellFolder : int + { + AllUsersApplicationData, // 16419 %ALLUSERSPROFILE%\Application Data + AllUsersDesktop, // 16409 %ALLUSERSPROFILE%\Desktop + AllUsersMyDocuments, // 16430 %ALLUSERSPROFILE%\Documents + AllUsersMyMusic, // 16437 %ALLUSERSPROFILE%\Documents\My Music + AllUsersMyPictures, // 16438 %ALLUSERSPROFILE%\Documents\My Pictures + AllUsersMyVideos, // 16439 %ALLUSERSPROFILE%\Documents\My Videos + AllUsersFavourites, // 16415 %ALLUSERSPROFILE%\Favorites + AllUsersStartMenu, // 16406 %ALLUSERSPROFILE%\Start Menu + AllUsersStartMenuPrograms, // 16407 %ALLUSERSPROFILE%\Start Menu\Programs + AllUsersStartMenuAdministrativeTools, // 16431 %ALLUSERSPROFILE%\Start Menu\Programs\Administrative Tools + AllUsersStartMenuStartup, // 16408 %ALLUSERSPROFILE%\Start Menu\Programs\Startup + AllUsersTemplates, // 16429 %ALLUSERSPROFILE%\Templates + UserApplicationData, // 16410 %USERPROFILE%\Application Data + UserCookies, // 16417 %USERPROFILE%\Cookies + UserDesktop, // 16384 %USERPROFILE%\Desktop + UserDesktop2, // 16400 %USERPROFILE%\Desktop + UserFavourites, // 16390 %USERPROFILE%\Favorites + UserLocalSettingsApplicationData, // 16412 %USERPROFILE%\Local Settings\Application Data + UserLocalSettingsMSCDBruning, // 16443 %USERPROFILE%\Local Settings\Application Data\Microsoft\CD Burning + UserHistory, // 16418 %USERPROFILE%\Local Settings\History + UserTemporaryInternetFiles, // 16416 %USERPROFILE%\Local Settings\Temporary Internet Files + UserMyDocuments, // 16389 %USERPROFILE%\My Documents + UserMyMusic, // 16397 %USERPROFILE%\My Documents\My Music + UserMyPictures, // 16423 %USERPROFILE%\My Documents\My Pictures + UserMyVideos, // 16398 %USERPROFILE%\My Documents\My Videos + UserNetHood, // 16403 %USERPROFILE%\NetHood + UserPrintHood, // 16411 %USERPROFILE%\PrintHood + UserRecent, // 16392 %USERPROFILE%\Recent + UserSendTo, // 16393 %USERPROFILE%\SendTo + UserStartMenu, // 16395 %USERPROFILE%\Start Menu + UserStartMenuPrograms, // 16386 %USERPROFILE%\Start Menu\Programs + UserStartMenuAdministrativeTools, // 16432 %USERPROFILE%\Start Menu\Programs\Administrative Tools + UserStartMenuStartup, // 16391 %USERPROFILE%\Start Menu\Programs\Startup + UserTemplates, // 16405 %USERPROFILE%\Templates + ProgramFiles, // 16422 %ProgramFiles% + ProgramFilesCommonFiles, // 16427 %ProgramFiles%\Common Files + SystenResources, // 16440 %SystemRoot%\Resources + SystemEnglishResources // 16441 %SystemRoot%\Resources\0409 + } + + /// + /// An autoregister element specifies that the generated executable should be + /// registered in the registry during second stage setup. + /// + public class RBuildAutoRegister + { + private AutoRegisterType m_AutoRegisterType = AutoRegisterType.Both; + private string m_InfSection = null; + + /// + /// Name of section in syssetup.inf. + /// + public string InfSection + { + get { return m_InfSection; } + set { m_InfSection = value; } + } + + /// + /// Type of registration. + /// + public AutoRegisterType Type + { + get { return m_AutoRegisterType; } + set { m_AutoRegisterType = value; } + } + + public int RegistrationType + { + get { return (int)Type; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildBootstrapFile.cs b/reactos/tools/sysgen/RosFramework/RBuildBootstrapFile.cs new file mode 100644 index 00000000000..07771b10d46 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildBootstrapFile.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + /// + /// A bootstrap element specifies that the generated file should + /// be put on the bootable CD as a bootstrap file. + /// + public class RBuildBootstrapFile : RBuildCDFileBase + { + public RBuildBootstrapFile() + { + } + + public RBuildBootstrapFile(string basePath , string name) + { + Base = basePath; + Name = name; + } + + //public override RBuildFile CDNewFile + //{ + // get + // { + // RBuildFile file = (RBuildFile)Clone(); + + // file.Name = NewName; + // file.Base = InstallBase; + // file.Root = PathRoot.CDOutput; + + // return file; + // } + //} + + //public virtual RBuildFile CDNewFile + //{ + // get + // { + // RBuildFile file = (RBuildFile)Clone(); + + // file.Name = NewName; + // file.Base = InstallBase; + // file.Root = PathRoot.CDOutput; + + // return file; + // } + //} + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildBuildFamily.cs b/reactos/tools/sysgen/RosFramework/RBuildBuildFamily.cs new file mode 100644 index 00000000000..24014e0e2c7 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildBuildFamily.cs @@ -0,0 +1,25 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildBuildFamily + { + private string m_Name = null; + private string m_Description = null; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string Description + { + get { return m_Description; } + set { m_Description = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildCDFile.cs b/reactos/tools/sysgen/RosFramework/RBuildCDFile.cs new file mode 100644 index 00000000000..e8b34f00252 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildCDFile.cs @@ -0,0 +1,14 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + /// + /// A cdfile element specifies the name of a file that is to be put on the bootable CD. + /// + public class RBuildCDFile : RBuildCDFileBase + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildCDFileBase.cs b/reactos/tools/sysgen/RosFramework/RBuildCDFileBase.cs new file mode 100644 index 00000000000..5f07e283027 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildCDFileBase.cs @@ -0,0 +1,11 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildCDFileBase : RBuildOutputFile /*RBuildPlatformFile*/ + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildCompilationUnit.cs b/reactos/tools/sysgen/RosFramework/RBuildCompilationUnit.cs new file mode 100644 index 00000000000..2b1348b8c7b --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildCompilationUnit.cs @@ -0,0 +1,24 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + /// + /// A compilationunit element specifies that one or more source code + /// files are to be compiled as a single compilation unit. + /// + public class RBuildCompilationUnitFile : RBuildSourceFile , IRBuildSourceFilesContainer + { + private RBuildSourceFileCollection m_SourceFiles = new RBuildSourceFileCollection(); + + /// + /// Gets the collection of . + /// + public RBuildSourceFileCollection SourceFiles + { + get { return m_SourceFiles; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildContributor.cs b/reactos/tools/sysgen/RosFramework/RBuildContributor.cs new file mode 100644 index 00000000000..a881176f071 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildContributor.cs @@ -0,0 +1,93 @@ +using System; +using System.Text.RegularExpressions; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildContributor + { + private string m_FirstName = null; + private string m_LastName = null; + private string m_Alias = null; + private string m_City = null; + private string m_Country = null; + private string m_Mail = null; + private string m_Website = null; + private bool m_Active = true; + + public string FirstName + { + get { return m_FirstName; } + set { m_FirstName = value; } + } + + public string Website + { + get { return m_Website; } + set { m_Website = value; } + } + + public string LastName + { + get { return m_LastName; } + set { m_LastName = value; } + } + + public string Alias + { + get { return m_Mail; } + set { m_Mail = value; } + } + + public string Mail + { + get { return m_Alias; } + set { m_Alias = value; } + } + + public string City + { + get { return m_City; } + set { m_City = value; } + } + + public string Country + { + get { return m_Country; } + set { m_Country = value; } + } + + public bool Active + { + get { return m_Active; } + set { m_Active = value; } + } + + public string FullName + { + get { return string.Format("{0} {1}", FirstName, LastName); } + } + + public string HtmlDocFileName + { + get { return string.Format("{0}.htm", Alias); } + } + + public bool HasAlias + { + get { return ((Alias != null) && (Alias.Length > 0)); } + } + + public bool HasMail + { + get { return ((Mail != null) && (Mail.Length > 0)); } + } + + public bool HasLocation + { + get { return ((City != null) && (City.Length > 0) && (Country != null) && (Country.Length > 0)); } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildDebugChannel.cs b/reactos/tools/sysgen/RosFramework/RBuildDebugChannel.cs new file mode 100644 index 00000000000..6125c49bd48 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildDebugChannel.cs @@ -0,0 +1,74 @@ +using System; +using System.Text; +using System.IO; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + public class RBuildDebugChannel + { + private string m_Name = null; + private bool m_Warn = true; + private bool m_Error = true; + private bool m_Trace = false; + private bool m_Fixme = true; + + public RBuildDebugChannel() + { + } + + public RBuildDebugChannel(string name) + { + m_Name = name; + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public bool Warn + { + get { return m_Warn; } + set { m_Warn = value; } + } + + public bool Error + { + get { return m_Error; } + set { m_Error = value; } + } + + public bool Trace + { + get { return m_Trace; } + set { m_Trace = value; } + } + + public bool Fixme + { + get { return m_Fixme; } + set { m_Fixme = value; } + } + + public string Text + { + get + { + StringBuilder sBuilder = new StringBuilder(); + + if (Warn) + sBuilder.AppendFormat("warn+{0},", Name); + if (Error) + sBuilder.AppendFormat("err+{0},", Name); + if (Trace) + sBuilder.AppendFormat("trace+{0},", Name); + if (Fixme) + sBuilder.AppendFormat("fix+{0},", Name); + + return sBuilder.ToString(); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildExportFunction.cs b/reactos/tools/sysgen/RosFramework/RBuildExportFunction.cs new file mode 100644 index 00000000000..9e1868a01f5 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildExportFunction.cs @@ -0,0 +1,47 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum CallingConventionType + { + None, + StdCall, + Pascal, + VarArgs + } + + public class RBuildExportFunction + { + private string m_Ordinal; + private string m_FunctionName; + private CallingConventionType m_CallingConvention = CallingConventionType.None; + private bool m_Stub; + + public string Ordinal + { + get { return m_Ordinal; } + set { m_Ordinal = value; } + } + + public string FunctionName + { + get { return m_FunctionName; } + set { m_FunctionName = value; } + } + + public CallingConventionType CallingConvention + { + get { return m_CallingConvention; } + set { m_CallingConvention = value; } + } + + public bool IsStub + { + get { return m_Stub; } + set { m_Stub = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildFamily.cs b/reactos/tools/sysgen/RosFramework/RBuildFamily.cs new file mode 100644 index 00000000000..067453a19df --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildFamily.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildFamily + { + private string m_FamilyName = null; + + public string Name + { + get { return m_FamilyName; } + set { m_FamilyName = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildFile.cs b/reactos/tools/sysgen/RosFramework/RBuildFile.cs new file mode 100644 index 00000000000..ed070b95ecf --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildFile.cs @@ -0,0 +1,441 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum PathRoot + { + Default, + SourceCode, + Output, + Intermediate, + CDOutput, + Temporary, + Install, + BootCD, + LiveCD, + Platform + } + + public enum SourceType + { + Unknown, + C, + CPP, + IDL, + Assembler, + NASM, + WineBuild, + WindResource, + MessageTable, + Header + } + + public class RBuildFolder : RBuildFileSystemInfo + { + private List m_Contents = new List(); + + public RBuildFolder() + { + } + + public RBuildFolder(RBuildFolder parentFolder , string name) + { + Root = parentFolder.Root; + Base = parentFolder.Base; + Name = name; + } + + public RBuildFolder(PathRoot rootPath) + { + Root = rootPath; + //Base = "."; + } + + public RBuildFolder (PathRoot rootPath, string basePath) + { + Root = rootPath; + Base = basePath; + } + + public RBuildFolder Parent + { + get + { + RBuildFolder folder = null; + + folder = new RBuildFolder(); + folder.Base = Path.GetDirectoryName(FullPath); + folder.Name = ""; + folder.Root = Root; + + return folder; + // return new RBuildFolder(Root, Path.GetDirectoryName(Base), Name); + } + } + + public List Contents + { + get { return m_Contents; } + } + + public override string ToString() + { + return string.Format("{0} - {1}", Root, FullPath); + } + } + + public class RBuildSourceFile : RBuildFile, IComparable + { + private bool m_First = false; + private string m_Switches = string.Empty; + + public string Switches + { + get { return m_Switches; } + set { m_Switches = value; } + } + + public bool First + { + get { return m_First; } + set { m_First = value; } + } + + public SourceType Type + { + get + { + if (IsC) + return SourceType.C; + if (IsCPP) + return SourceType.CPP; + if (IsAssembler) + return SourceType.Assembler; + if (IsNASM) + return SourceType.NASM; + if (IsWidl) + return SourceType.IDL; + if (IsWindResource) + return SourceType.WindResource; + if (IsWineBuild) + return SourceType.WineBuild; + if (IsMessageTable) + return SourceType.MessageTable; + if (IsHeader) + return SourceType.Header; + + return SourceType.Unknown; + } + } + + public bool CompilableObject + { + get + { + if (IsWidl) + return false; + if (IsMessageTable) + return false; + + return true; + } + } + + public bool IsCPP + { + get + { + switch (Extension) + { + case ".cc": + case ".cpp": + case ".cxx": + return true; + default: + return false; + } + } + } + + public bool IsWidl + { + get + { + if (Extension == ".idl") + return true; + + return false; + } + } + + public bool IsMessageTable + { + get + { + if (Extension == ".mc") + return true; + + return false; + } + } + + public bool IsHeader + { + get + { + if (Extension == ".h") + return true; + + return false; + } + } + + public bool IsWineBuild + { + get + { + if (Extension == ".spec") + return true; + + return false; + } + } + + public bool IsWindResource + { + get + { + if (Extension == ".rc") + return true; + + return false; + } + } + + public bool IsNASM + { + get + { + if (Extension == ".asm") + return true; + + return false; + } + } + + public bool IsAssembler + { + get + { + if (Extension == ".s") + return true; + + return false; + } + } + + public bool IsC + { + get + { + if (Extension == ".c") + return true; + + return false; + } + } + + public bool IsCompilable + { + get { return (IsC || IsCPP || IsAssembler || IsNASM || IsWidl || IsWindResource || IsWineBuild || IsHeader); } + } + + public override string ToString() + { + return string.Format("{0} {1}" , Name , Type); + } + + #region IComparable Members + + public int CompareTo(object obj) + { + RBuildSourceFile source = (RBuildSourceFile)obj; + + if (First != source.First) + { + if (source.First) + return 1; + else + return -1; + } + + return 0; + } + + #endregion + } + + public class RBuildFile : RBuildFileSystemInfo + { + public RBuildFile() + { + } + + public RBuildFile(RBuildElement element) + : base (element) + { + } + + public string Extension + { + get { return Path.GetExtension(Name).Trim().ToLower(); } + } + + public override object Clone() + { + RBuildFile file = new RBuildFile(); + + file.Base = Base; + file.Name = Name; + file.Root = Root; + file.Enabled = Enabled; + + return file; + } + + public RBuildFolder Folder + { + get { return new RBuildFolder(Root, Base); } + } + } + + /// + /// Represents the base class for source-code , installable file , folder , include folder , cdfile taks ... from a build. + /// + public abstract class RBuildFileSystemInfo : ICloneable + { + protected RBuildElement m_Element = null; + protected PathRoot m_Root = PathRoot.Default; + protected string m_Name = string.Empty; //"."; + protected string m_Base = string.Empty; //null; + protected bool m_Enabled = true; + + public RBuildFileSystemInfo(RBuildElement element) + { + m_Element = element; + } + + public RBuildFileSystemInfo() + { + } + + private string NormalizePath(string path) + { + return path.Replace( + Path.AltDirectorySeparatorChar, + Path.DirectorySeparatorChar); + } + + public string FullPath + { + get { + + if (Base == null || Name == null) + { + int i = 10; + } + + return NormalizePath(Path.Combine(Base, Name)); + } + } + + public string Name + { + get { return m_Name; } + set + { + if (value == null) + { + int i = 10; + } + m_Name = value; } + } + + public string Base + { + get { return m_Base; } + set + { + if (value == null) + { + int i = 10; + } + m_Base = value; + } + } + + public bool Enabled + { + get { return m_Enabled; } + set { m_Enabled = value; } + } + + //TODO : ELIMINAR + public RBuildElement Element + { + get { return m_Element; } + set { m_Element = value; } + } + + public virtual PathRoot Root + { + get { return m_Root; } + set { m_Root = value; } + } + + public string[] BasePathParts + { + get { return Base.Split(new char[] { '\\' }); } + } + + public override bool Equals(object obj) + { + if (obj is RBuildFileSystemInfo) + { + RBuildFileSystemInfo rfsInfo = obj as RBuildFileSystemInfo; + + if ((rfsInfo.Base == Base) && + (rfsInfo.Root == Root) && + (rfsInfo.Name == Name)) + { + return true; + } + + if ((rfsInfo.FullPath == FullPath) && (rfsInfo.Root == Root)) + { + return true; + } + } + + // The instances are not equal + return false; + } + + public override int GetHashCode() + { + return Base.GetHashCode() ^ Name.GetHashCode() ^ Root.GetHashCode (); + } + + #region ICloneable Members + + public virtual object Clone() + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildImportLibrary.cs b/reactos/tools/sysgen/RosFramework/RBuildImportLibrary.cs new file mode 100644 index 00000000000..04d9508d25f --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildImportLibrary.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + /// + /// An importlibrary element specifies that an import library should be + /// generated which other modules can use to link with the current module. + /// + public sealed class RBuildImportLibrary : RBuildFile + { + private string m_DllName = null; + + /// + /// Creates a new instance of the . + /// + public RBuildImportLibrary() + { + } + + public string DllName + { + get { return m_DllName; } + set { m_DllName = value; } + } + + public bool IsSpecFile + { + get { return Name.EndsWith(".spec.def"); } + } + + public string Definition + { + get { return Name; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildInfInstallerFile.cs b/reactos/tools/sysgen/RosFramework/RBuildInfInstallerFile.cs new file mode 100644 index 00000000000..0eec49b37ae --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildInfInstallerFile.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildInfInstallerFile : RBuildFile + { + private string m_InstallSection = "DefaultInstall"; + + public string InstallSection + { + get { return m_InstallSection; } + set { m_InstallSection = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildInstallFile.cs b/reactos/tools/sysgen/RosFramework/RBuildInstallFile.cs new file mode 100644 index 00000000000..a401e126969 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildInstallFile.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildInstallFile : RBuildPlatformFile + { + } + + public class RBuildWallpaperFile : RBuildInstallFile + { + private string m_ID = null; + + public RBuildWallpaperFile() + { + } + + public RBuildWallpaperFile(string file) + { + Name = file; + } + + public string ID + { + get + { + if (m_ID == null || + m_ID == string.Empty) + return base.Name; + + return m_ID; + } + set { m_ID = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildInstallFolder.cs b/reactos/tools/sysgen/RosFramework/RBuildInstallFolder.cs new file mode 100644 index 00000000000..acc7918b249 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildInstallFolder.cs @@ -0,0 +1,30 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildInstallFolder : RBuildFolder + { + private string m_ID = null; + + public RBuildInstallFolder() + { + Root = PathRoot.Install; + } + + public RBuildInstallFolder(string id, string name) + { + ID = id; + Name = name; + Root = PathRoot.Install; + } + + public string ID + { + get { return m_ID; } + set { m_ID = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildLanguage.cs b/reactos/tools/sysgen/RosFramework/RBuildLanguage.cs new file mode 100644 index 00000000000..0e0be1389f2 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildLanguage.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildLanguage + { + private string m_Name = null; + private string m_LCID = null; + + private CultureInfo m_CultureInfo = null; + + public RBuildLanguage() + { + } + + public RBuildLanguage(string name) + { + //IsoName = name; + Name = name; + } + + public string LCID + { + get { return m_LCID; } + set { m_LCID = value; } + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public CultureInfo CultureInfo + { + get { return m_CultureInfo; } + } + + //public string IsoName + //{ + // get { return m_CultureInfo.Name; } + // set { m_CultureInfo = CultureInfo.GetCultureInfo(value); } + //} + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildLocalizationFile.cs b/reactos/tools/sysgen/RosFramework/RBuildLocalizationFile.cs new file mode 100644 index 00000000000..cbc46aa5c99 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildLocalizationFile.cs @@ -0,0 +1,34 @@ +using System; +using System.Globalization; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildLocalizationFile : RBuildFile + { + private bool m_Dirty = false; + private CultureInfo m_CultureInfo = null; + + public RBuildLocalizationFile() + { + } + + public CultureInfo CultureInfo + { + get { return m_CultureInfo; } + } + + public bool Dirty + { + get { return m_Dirty; } + set { m_Dirty = value; } + } + + public string IsoName + { + get { return m_CultureInfo.Name; } + set { m_CultureInfo = CultureInfo.GetCultureInfo(value); } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildMetadata.cs b/reactos/tools/sysgen/RosFramework/RBuildMetadata.cs new file mode 100644 index 00000000000..e828dbdc725 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildMetadata.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildMetadata + { + private string m_Description = null; + + public string Description + { + get { return m_Description; } + set { m_Description = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildModule.cs b/reactos/tools/sysgen/RosFramework/RBuildModule.cs new file mode 100644 index 00000000000..f7fcb2f504d --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildModule.cs @@ -0,0 +1,1210 @@ +using System; +using System.Xml; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.ComponentModel; + +namespace SysGen.RBuild.Framework +{ + public enum ModuleType + { + BuildTool = 0, + StaticLibrary = 1, + ObjectLibrary = 2, + Kernel = 3, + KernelModeDLL = 4, + KernelModeDriver = 5, + NativeDLL = 6, + NativeCUI = 7, + Win32DLL = 8, + Win32OCX = 9, + Win32CUI = 10, + Win32GUI = 11, + BootLoader = 12, + BootSector = 13, + Iso = 14, + LiveIso = 15, + Test = 16, + RpcServer = 17, + RpcClient = 18, + Alias = 19, + BootProgram = 20, + Win32SCR = 21, + IdlHeader = 23, + IsoRegTest = 24, + LiveIsoRegTest = 25, + EmbeddedTypeLib = 26, + ElfExecutable = 27, + RpcProxy = 28, + HostStaticLibrary = 29, + Cabinet = 30, + Package = 50, + ModuleGroup = 51, + PlatformProfile = 52, + KeyboardLayout, + MessageHeader, + IdlInterface + } + + [DefaultPropertyAttribute("Name")] + public class RBuildModule : RBuildElement, IRBuildSourceFilesContainer//, IRBuildInstallable + { + private string m_InstallBase = "."; + private string m_InstallName = null; + private string m_BaseAddress = null; + private string m_EntryPoint = null; + private string m_AliasOf = null; + private string m_Extension = null; + private string m_BuildType = null; + private string m_Description = null; + private string m_LCID = null; + private string m_CDLabel = null; + private string m_OutputName = null; + private string m_CatalogPath = null; + + private ModuleType m_Type = ModuleType.Win32CUI; + + protected bool m_Enabled = true; + protected bool m_Unicode = false; + protected bool m_AllowWarnings = false; + protected bool m_IsStartupLib = false; + protected bool m_UnderscoreSymbols = false; + protected bool m_MangledSymbols = false; + protected bool m_HostBuild = false; + + //protected RBuildInfInstallerFile m_InfInstallComponent = null; + protected RBuildFile m_LinkerScript = null; + protected RBuildSourceFile m_PrecompiledHeader = null; + protected RBuildAutoRegister m_AutoRegister = null; + protected RBuildSetupFile m_RBuildSetup = null; + protected RBuildImportLibrary m_ImportLibrary = null; + protected RBuildMetadata m_Metadata = null; + //protected RBuildInstallFolder m_InstallFolder = null; + protected RBuildBootstrapFile m_Bootstrap = null; + protected RBuildModule m_BootSectorModule = null; + + private RBuildFamilyCollection m_Families = new RBuildFamilyCollection(); + private RBuildAPIStatusCollection m_ApiInfo = new RBuildAPIStatusCollection(); + private RBuildModuleCollection m_Dependencies = new RBuildModuleCollection(); + private RBuildModuleCollection m_Libraries = new RBuildModuleCollection(); + private RBuildModuleCollection m_Requeriments = new RBuildModuleCollection(); + private RBuildSourceFileCollection m_SourceFiles = new RBuildSourceFileCollection(); + private RBuildLocalizationFileCollection m_LocalizationFiles = new RBuildLocalizationFileCollection(); + private RBuildExportedFunctionsCollection m_ExportedFunctions = new RBuildExportedFunctionsCollection(); + private RBuildAuthorCollection m_Authors = new RBuildAuthorCollection(); + private List m_RegistryKeys = new List(); + private List m_CompilationUnits = new List(); + + //public void GenerateFromPath(string path) + //{ + // m_Base = path; + + // m_Path = System.IO.Path.GetFileName(path); + // m_Name = System.IO.Path.GetFileName(path); + //} + + public RBuildSourceFile PreCompiledHeader + { + get + { + foreach (RBuildSourceFile file in SourceFiles) + { + if (file.Type == SourceType.Header) + return file; + } + + return null; + } + } + + public RBuildFile LinkerScript + { + get { return m_LinkerScript; } + set { m_LinkerScript = value; } + } + + public RBuildBootstrapFile Bootstrap + { + get { return m_Bootstrap; } + set { m_Bootstrap = value; } + } + + public bool IsBootstrap + { + get { return Bootstrap != null; } + } + + //Hack: + public bool IsSpecialIncludedBootStrap + { + get { return (Name == "ntdll"); } + } + + //Hack:: + public bool IsSpecialExcludedBootStrap + { + get { return (Name == "hal"); } + } + + public RBuildModule BootSector + { + get { return m_BootSectorModule; } + set { m_BootSectorModule = value; } + } + + //public RBuildInstallFolder InstallFolder + //{ + // get { return m_InstallFolder; } + // set { m_InstallFolder = value; } + //} + + public RBuildMetadata Metadata + { + get { return m_Metadata; } + set { m_Metadata = value; } + } + + public string Extension + { + get + { + if ((m_Extension == null) || (m_Extension == string.Empty)) + return DefaultExtension; + + return m_Extension; + } + set { m_Extension = value; } + } + + public string DefaultExtension + { + get + { + switch (Type) + { + case ModuleType.StaticLibrary: + case ModuleType.HostStaticLibrary: + return ".a"; + case ModuleType.ObjectLibrary: + return ".o"; + case ModuleType.Kernel: + case ModuleType.NativeCUI: + case ModuleType.Win32CUI: + case ModuleType.Win32GUI: + return ".exe"; + case ModuleType.Win32SCR: + return ".scr"; + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + case ModuleType.NativeDLL: + case ModuleType.Win32DLL: + return ".dll"; + case ModuleType.Win32OCX: + return ".ocx"; + case ModuleType.KernelModeDriver: + case ModuleType.BootLoader: + return ".sys"; + case ModuleType.BootSector: + return ".o"; + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + return ".iso"; + case ModuleType.Test: + return ".exe"; + case ModuleType.RpcServer: + case ModuleType.RpcClient: + case ModuleType.RpcProxy: + return ".o"; + case ModuleType.BuildTool: + return ".exe"; + case ModuleType.Alias: + case ModuleType.BootProgram: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.Package: + case ModuleType.ModuleGroup: + case ModuleType.PlatformProfile: + return string.Empty; + case ModuleType.EmbeddedTypeLib: + return ".tlb"; + case ModuleType.Cabinet: + return ".cab"; + default: + throw new Exception("Unknown module type"); + } + } + } + + public string CatalogPath + { + get + { + if (m_CatalogPath == null) + return Folder.Parent.FullPath; + + return m_CatalogPath; + } + set { m_CatalogPath = value; } + } + + public RBuildImportLibrary ImportLibrary + { + get { return m_ImportLibrary; } + set { m_ImportLibrary = value; } + } + + public string AliasOf + { + get { return m_AliasOf; } + set { m_AliasOf = value; } + } + + public string BuildType + { + get + { + if (m_BuildType == null) + m_BuildType = "BOOTPROG"; + + return m_BuildType; + } + set { m_BuildType = value; } + } + + public string BaseAddress + { + get + { + if ((m_BaseAddress == null) || (m_BaseAddress == string.Empty)) + return DefaultBaseAdress; + + return m_BaseAddress; + } + set { m_BaseAddress = value; } + } + + public string EntryPoint + { + get + { + if (string.IsNullOrEmpty(m_EntryPoint)) + return DefaultEntrypoint; + + return m_EntryPoint; + } + set { m_EntryPoint = value; } + } + + public bool NoEntryPoint + { + get { return (EntryPoint == "0") || (EntryPoint == "0x0"); } + } + + public string LinkerEntryPoint + { + get + { + if (NoEntryPoint) + return EntryPoint; + + return string.Format("_{0}", EntryPoint); + } + } + + public string HtmlDocFileName + { + get { return string.Format("{0}.htm", Name); } + } + + public bool IsDefaultBaseAdress + { + get { return (BaseAddress == DefaultBaseAdress); } + } + + public bool IsDefaultEntryPoint + { + get { return (EntryPoint == DefaultEntrypoint); } + } + + public bool PCH + { + get { return (PreCompiledHeader != null); } + } + + public bool CPlusPlus + { + get + { + foreach (RBuildSourceFile file in SourceFiles) + { + if ((file.Extension == ".cpp") || + (file.Extension == ".cc") || + (file.Extension == ".cxx")) + { + return true; + } + } + + // This module does not contain C++ code + return false; + } + } + + public bool IsRPC + { + get + { + switch (Type) + { + case ModuleType.RpcClient: + case ModuleType.RpcServer: + case ModuleType.RpcProxy: + return true; + default: + return false; + } + } + } + + public bool IsLibrary + { + get + { + switch (Type) + { + case ModuleType.StaticLibrary: + case ModuleType.ObjectLibrary: + case ModuleType.HostStaticLibrary: //HACK + return true; + default: + return false; + } + } + } + + public bool HasInstallBase + { + get { return InstallBase != null; } + } + + public bool IsInstallable + { + get { return (IsDLL) || (IsApplication); } + } + + public bool IsApplication + { + get + { + switch (Type) + { + case ModuleType.NativeCUI: + case ModuleType.Win32CUI: + case ModuleType.Win32SCR: + case ModuleType.Win32GUI: + return true; + case ModuleType.KeyboardLayout: + case ModuleType.Kernel: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + case ModuleType.NativeDLL: + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + case ModuleType.Test: + case ModuleType.BuildTool: + case ModuleType.HostStaticLibrary: + case ModuleType.StaticLibrary: + case ModuleType.ObjectLibrary: + case ModuleType.BootLoader: + case ModuleType.BootSector: + case ModuleType.BootProgram: + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + case ModuleType.RpcServer: + case ModuleType.RpcClient: + case ModuleType.RpcProxy: + case ModuleType.Alias: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.EmbeddedTypeLib: + case ModuleType.Cabinet: + case ModuleType.Package: + case ModuleType.ModuleGroup: + case ModuleType.PlatformProfile: + return false; + default: + throw new Exception("Unknown Module Type"); + } + } + } + + public bool IsDLL + { + get + { + switch (Type) + { + case ModuleType.Kernel: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + case ModuleType.NativeDLL: + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + case ModuleType.KeyboardLayout: + return true; + case ModuleType.NativeCUI: + case ModuleType.Win32CUI: + case ModuleType.Test: + case ModuleType.Win32SCR: + case ModuleType.Win32GUI: + case ModuleType.BuildTool: + case ModuleType.HostStaticLibrary: + case ModuleType.StaticLibrary: + case ModuleType.ObjectLibrary: + case ModuleType.BootLoader: + case ModuleType.BootSector: + case ModuleType.BootProgram: + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + case ModuleType.RpcServer: + case ModuleType.RpcClient: + case ModuleType.RpcProxy: + case ModuleType.Alias: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.EmbeddedTypeLib: + case ModuleType.Cabinet: + case ModuleType.Package: + case ModuleType.ModuleGroup: + case ModuleType.PlatformProfile: + return false; + default: + throw new Exception("Unknown Module Type"); + } + } + } + + public string DefaultBaseAdress + { + get + { + switch (Type) + { + case ModuleType.Kernel: + return "0x80800000"; + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + return "0x10000000"; + case ModuleType.NativeDLL: + case ModuleType.NativeCUI: + case ModuleType.Win32CUI: + case ModuleType.Test: + return "0x00400000"; + case ModuleType.Win32SCR: + case ModuleType.Win32GUI: + return "0x00400000"; + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + return "0x00010000"; + case ModuleType.BuildTool: + case ModuleType.HostStaticLibrary: + case ModuleType.StaticLibrary: + case ModuleType.ObjectLibrary: + case ModuleType.BootLoader: + case ModuleType.BootSector: + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + case ModuleType.RpcServer: + case ModuleType.RpcClient: + case ModuleType.RpcProxy: + case ModuleType.Alias: + case ModuleType.BootProgram: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.EmbeddedTypeLib: + case ModuleType.Cabinet: + case ModuleType.Package: + case ModuleType.ModuleGroup: + case ModuleType.PlatformProfile: + return string.Empty; + default: + throw new Exception("Unknown Module Type"); + } + } + } + + public string DefaultEntrypoint + { + get + { + switch (Type) + { + case ModuleType.Kernel: + return "KiSystemStartup"; + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + return "DriverEntry@8"; + case ModuleType.NativeDLL: + return "DllMainCRTStartup@12"; + case ModuleType.NativeCUI: + return "NtProcessStartup@4"; + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + return "DllMain@12"; + case ModuleType.Win32CUI: + case ModuleType.Test: + { + if (Unicode) + return "wmainCRTStartup"; + return "mainCRTStartup"; + } + case ModuleType.Win32SCR: + case ModuleType.Win32GUI: + { + if (Unicode) + return "wWinMainCRTStartup"; + return "WinMainCRTStartup"; + } + case ModuleType.HostStaticLibrary: + case ModuleType.BuildTool: + case ModuleType.StaticLibrary: + case ModuleType.ObjectLibrary: + case ModuleType.BootLoader: + case ModuleType.BootSector: + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + case ModuleType.RpcServer: + case ModuleType.RpcClient: + case ModuleType.RpcProxy: + case ModuleType.Alias: + case ModuleType.BootProgram: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.EmbeddedTypeLib: + case ModuleType.Cabinet: + case ModuleType.Package: + case ModuleType.ModuleGroup: + case ModuleType.PlatformProfile: + return string.Empty; + default: + throw new Exception("Unknown Module Type"); + } + } + } + + public bool IsBuildable + { + get { return Type != ModuleType.Package && Type != ModuleType.ModuleGroup && Type != ModuleType.PlatformProfile; } + } + + public bool IncludeInAllTarget + { + get + { + if (Type == ModuleType.BootSector || + Type == ModuleType.Iso || + Type == ModuleType.LiveIso || + Type == ModuleType.IsoRegTest || + Type == ModuleType.LiveIsoRegTest || + Type == ModuleType.Test || + Type == ModuleType.Alias) + { + return false; + } + + return true; + } + } + + public bool LinksToCRuntimeLibrary + { + get + { + foreach (RBuildModule module in Libraries) + { + if ((module.Name == "libcntpr") || + (module.Name == "crt")) + { + return true; + } + } + + return false; + } + } + + /// + /// Default root to use when someone references + /// this module by using include + /// + public PathRoot IncludeDefaultRoot + { + get + { + switch (Type) + { + case ModuleType.RpcClient: + case ModuleType.RpcServer: + case ModuleType.RpcProxy: + return PathRoot.Intermediate; + default: + return PathRoot.SourceCode; + } + } + } + + /// + /// Gets the folder to be used when another object + /// references this module + /// + public PathRoot ReferenceDefaultRoot + { + get + { + switch (Type) + { + case ModuleType.RpcClient: + case ModuleType.RpcServer: + case ModuleType.RpcProxy: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.BootSector: + case ModuleType.StaticLibrary: + case ModuleType.HostStaticLibrary: + return PathRoot.Intermediate; + default: + return PathRoot.Output; + } + } + } + + /// + /// Gets the folder to be used when another objects + /// references the target file generated by this module + /// + public PathRoot TargetDefaultRoot + { + get + { + switch (Type) + { + case ModuleType.Iso: + case ModuleType.LiveIso: + case ModuleType.IsoRegTest: + case ModuleType.LiveIsoRegTest: + return PathRoot.Default; + case ModuleType.RpcClient: + case ModuleType.RpcServer: + case ModuleType.RpcProxy: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.BootSector: + case ModuleType.StaticLibrary: + case ModuleType.EmbeddedTypeLib: + case ModuleType.HostStaticLibrary: + return PathRoot.Intermediate; + default: + return PathRoot.Output; + } + } + } + + public bool Enabled + { + get { return m_Enabled; } + set { m_Enabled = value; } + } + + public bool MangledSymbols + { + get { return m_MangledSymbols; } + set { m_MangledSymbols = value; } + } + + public bool IsStartupLib + { + get { return m_IsStartupLib; } + set { m_IsStartupLib = value; } + } + + public bool UnderscoreSymbols + { + get { return m_UnderscoreSymbols; } + set { m_UnderscoreSymbols = value; } + } + + public bool Unicode + { + get { return m_Unicode; } + set { m_Unicode = value; } + } + + public bool AllowWarnings + { + get { return m_AllowWarnings; } + set { m_AllowWarnings = value; } + } + + /* + public RBuildFolder Folder + { + get { return new RBuildFolder(PathRoot.SourceCode, Base); } + } + */ + + /// + /// Gets the collection of . + /// + public RBuildSourceFileCollection SourceFiles + { + get { return m_SourceFiles; } + set { m_SourceFiles = value; } + } + + public RBuildLocalizationFileCollection LocalizationFiles + { + get { return m_LocalizationFiles; } + set { m_LocalizationFiles = value; } + } + + public List RegistryKeys + { + get { return m_RegistryKeys; } + set { m_RegistryKeys = value; } + } + + public RBuildAuthorCollection Authors + { + get { return m_Authors; } + set { m_Authors = value; } + } + + public List CompilationUnits + { + get { return m_CompilationUnits; } + } + + public RBuildExportedFunctionsCollection ExportedFunctions + { + get { return m_ExportedFunctions; } + } + + public RBuildAPIStatusCollection ApiInfo + { + get { return m_ApiInfo; } + } + + public RBuildFamilyCollection Families + { + get { return m_Families; } + } + + public string ModulePath + { + get { return m_Path + @"\"; } + } + + public RBuildFolder TargetFolder + { + get + { + RBuildFolder folder = null; + + folder = new RBuildFolder(); + folder.Root = TargetDefaultRoot; + + //Las ISO son excepciones a la regla , generan su resultado en el raiz y no en la carpeta + //del módulo donde se encuentran + if (Type != ModuleType.Iso && + Type != ModuleType.LiveIso && + Type != ModuleType.IsoRegTest && + Type != ModuleType.LiveIsoRegTest) + { + folder.Name = Folder.Name; + folder.Base = Folder.Base; + } + + return folder; + } + } + + public RBuildFile TargetFile + { + get + { + RBuildFile file = null; + + file = new RBuildFile(); + file.Name = TargetName; + file.Base = TargetFolder.FullPath; + file.Root = TargetFolder.Root; + + return file; + } + } + + public RBuildFile Install + { + get + { + RBuildFile file = null; + + file = new RBuildFile(); + file.Base = InstallBase; + file.Name = InstallName; + file.Root = PathRoot.Install; + + return file; + } + } + + public RBuildFile PlatformInstall + { + get + { + RBuildFile file = null; + + file = new RBuildFile(); + file.Base = "%SystemRoot%\\" + InstallBase; + file.Name = InstallName; + file.Root = PathRoot.Platform; + + return file; + } + } + + public RBuildFile Dependency + { + get + { + RBuildFile file = null; + + file = new RBuildFile(); + file.Base = Folder.FullPath; + file.Name = DependencyName; + file.Root = PathRoot.Intermediate; // ReferenceDefaultRoot; + + return file; + } + } + + public string CDLabel + { + get { return "ReactOS"; } + set { m_CDLabel = value; } + } + + public string TargetName + { + get + { + if (OutputName != null) + return OutputName; + + if (InstallName != null) + return InstallName; + + return string.Format("{0}{1}", Name, Extension); + } + } + + public string DependencyName + { + get + { + if (HasImportLibrary) + return string.Format("lib{0}.a" , Name); + + //Get the regular name + return string.Format("{0}.a" , Name); + } + } + + public string InstallBase + { + get { return m_InstallBase; } + set { m_InstallBase = value; } + } + + public string InstallName + { + get { return m_InstallName; } + set { m_InstallName = value; } + } + + public string OutputName + { + get { return m_OutputName; } + set { m_OutputName = value; } + } + + public bool Host + { + get { return m_HostBuild; } + set { m_HostBuild = value; } + } + + public bool HasImportLibrary + { + get { return (ImportLibrary != null) && (Type != ModuleType.StaticLibrary); } + } + + public bool HasMessageTables + { + get + { + foreach (RBuildSourceFile source in SourceFiles) + if (source.Type == SourceType.MessageTable) + return true; + + return false; + } + } + + public bool HasIDLs + { + get + { + foreach (RBuildSourceFile source in SourceFiles) + if (source.Type == SourceType.IDL) + return true; + + return false; + } + } + + ///* + //public string[] BaseLocation + //{ + // get { return Base.Split(new char[] { '\\' }); } + //} + + //public string[] PathLocation + //{ + // get + // { + // Uri uri = new Uri(Base , UriKind.Relative); + + // return Base.Split(new char[] { '\\' }); + + // /* + // DirectoryInfo info = new DirectoryInfo(Base); + // return info.Parent.FullName.Split(new char[] { '\\' }); + // */ + // } + //} + //*/ + + public bool IsModuleInRoot + { + get { return Path == string.Empty; } + } + + public string Description + { + get { return m_Description; } + set { m_Description = value; } + } + + public string LCID + { + get { return m_LCID; } + set { m_LCID = value; } + } + + public RBuildModuleCollection Dependencies + { + get { return m_Dependencies; } + } + + public RBuildModuleCollection Requeriments + { + get { return m_Requeriments; } + } + + public RBuildModuleCollection Libraries + { + get { return m_Libraries; } + } + + public RBuildModuleCollection Needs + { + get + { + RBuildModuleCollection modules = new RBuildModuleCollection(); + + modules.Add(Dependencies); + modules.Add(Libraries); + modules.Add(Requeriments); + + return modules; + } + } + + public ModuleType Type + { + get { return m_Type; } + set { m_Type = value; } + } + + public RBuildSetupFile Setup + { + get { return m_RBuildSetup; } + set { m_RBuildSetup = value; } + } + + public RBuildAutoRegister AutoRegister + { + get { return m_AutoRegister; } + set { m_AutoRegister = value; } + } + + public string MakeFileTargetMacro + { + get { return string.Format("$({0}_TARGET)", Name); } + } + + public string MakeFileTarget + { + get { return string.Format("{0}_TARGET", Name); } + } + + public string MakeFileLibs + { + get { return string.Format("{0}_LIBS", Name); } + } + + public string MakeFileLinkDeps + { + get { return string.Format("{0}_LINKDEPS", Name); } + } + + public string MakeFileLinkDepsMacro + { + get { return string.Format("$({0}_LINKDEPS)", Name); } + } + + public string MakeFileLibsMacro + { + get { return string.Format("$({0}_LIBS)", Name); } + } + + public override void SaveAs(string moduleFile) + { + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(moduleFile, Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + + writer.WriteComment("File autogenerated by RosBuilder 0.1"); + writer.WriteStartElement("module"); + + writer.WriteAttributeString("name", Name); + writer.WriteAttributeString("type", Type.ToString()); + writer.WriteAttributeString("installbase", InstallBase); + writer.WriteAttributeString("installname", InstallName); + writer.WriteAttributeString("unicode", Unicode.ToString()); + writer.WriteAttributeString("allowwarnings", AllowWarnings.ToString()); + writer.WriteAttributeString("underscoresymbols", UnderscoreSymbols.ToString()); + writer.WriteAttributeString("baseadress", BaseAddress); + writer.WriteAttributeString("entrypoint", EntryPoint); + writer.WriteAttributeString("extension", Extension); + writer.WriteAttributeString("isstartuplib", IsStartupLib.ToString()); + writer.WriteAttributeString("mangledsymbols", MangledSymbols.ToString()); + + writer.WriteStartElement("include"); + writer.WriteAttributeString("base", Name); + writer.WriteString("."); + writer.WriteEndElement(); + + foreach (RBuildFolder include in IncludeFolders) + { + writer.WriteStartElement("include"); + writer.WriteAttributeString("base", include.Base); + writer.WriteString(include.Name); + writer.WriteEndElement(); + } + + foreach (RBuildDefine define in Defines) + { + writer.WriteStartElement("define"); + writer.WriteAttributeString("name", define.Name); + + if (define.Name != string.Empty) + { + writer.WriteString(define.Value); + } + + writer.WriteEndElement(); + } + + foreach (RBuildModule dependency in Dependencies) + { + writer.WriteStartElement("dependency"); + writer.WriteString(dependency.Name); + writer.WriteEndElement(); + } + + foreach (RBuildModule library in Libraries) + { + writer.WriteStartElement("library"); + writer.WriteString(library.Name); + writer.WriteEndElement(); + } + + foreach (RBuildSourceFile sourceFile in SourceFiles) + { + if (sourceFile.IsCompilable) + { + if (sourceFile.Switches != string.Empty) + { + writer.WriteAttributeString("switches", sourceFile.Switches); + } + + writer.WriteStartElement("file"); + writer.WriteString(sourceFile.Name); + writer.WriteEndElement(); + } + } + + if (PreCompiledHeader != null) + { + writer.WriteStartElement("pch"); + writer.WriteString(PreCompiledHeader.Name); + writer.WriteEndElement(); + } + + writer.WriteEndDocument(); + } + } + + public override string ToString() + { + return string.Format("Module : '{0}' Type : {1} Base : '{2}' Libraries : '{3}' Dependencies : '{4}' Requeriments : '{5}'", + Name, + Type, + Base, + Libraries.Count, + Dependencies.Count, + Requeriments.Count); + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildModuleGroup.cs b/reactos/tools/sysgen/RosFramework/RBuildModuleGroup.cs new file mode 100644 index 00000000000..a3c57c26c8a --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildModuleGroup.cs @@ -0,0 +1,24 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildModuleGroup + { + private string m_Name = null; + private RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildModuleInfo.cs b/reactos/tools/sysgen/RosFramework/RBuildModuleInfo.cs new file mode 100644 index 00000000000..c4c944e87fc --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildModuleInfo.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildModuleInfo + { + private string m_Name = string.Empty; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + private string m_Base = string.Empty; + + public string Base + { + get { return m_Base; } + set { m_Base = value; } + } + private string m_CatalogPath = string.Empty; + + public string CatalogPath + { + get { return m_CatalogPath; } + set { m_CatalogPath = value; } + } + private ModuleType m_Type = ModuleType.BuildTool; + + public ModuleType Type + { + get { return m_Type; } + set { m_Type = value; } + } + + List m_Libraries = new List(); + List m_Dependencies = new List(); + List m_Requirements = new List(); + + public List Libraries + { + get { return m_Libraries; } + set { m_Libraries = value; } + } + + public List Dependencies + { + get { return m_Dependencies; } + set { m_Dependencies = value; } + } + + public List Requirements + { + get { return m_Requirements; } + set { m_Requirements = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildPlatform.cs b/reactos/tools/sysgen/RosFramework/RBuildPlatform.cs new file mode 100644 index 00000000000..8940398da6e --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildPlatform.cs @@ -0,0 +1,133 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum OptimizeLevelType : int + { + Level_0 = 0, + Level_1 = 1, + Level_2 = 2, + Level_3 = 3, + Level_4 = 4, + Level_5 = 5 + } + + public class RBuildPlatform + { + private string m_Name = "Unamed Platform"; + private string m_Description = "This Platform has not yet a description"; + private bool m_Debug = true; + private bool m_KDebug = true; + private bool m_GDB = false; + private bool m_NSWPAT = false; + private bool m_WINKD = false; + private OptimizeLevelType m_OptimizeLevelType = OptimizeLevelType.Level_1; + private RBuildModule m_ShellModule = null; + private RBuildModule m_ScreenSaverModule = null; + private RBuildLanguage m_Language = null; + private RBuildWallpaperFile m_Wallpaper = null; + private RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + private RBuildModuleCollection m_Autorun = new RBuildModuleCollection(); + private RBuildLanguageCollection m_Languages = new RBuildLanguageCollection(); + private RBuildDebugChannelCollection m_DebugChannels = new RBuildDebugChannelCollection(); + + public RBuildPlatform() + { + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string Description + { + get { return m_Description; } + set { m_Description = value; } + } + + public RBuildDebugChannelCollection DebugChannels + { + get { return m_DebugChannels; } + } + + public RBuildModule Shell + { + get { return m_ShellModule; } + set { m_ShellModule = value; } + } + + public RBuildModule Screensaver + { + get { return m_ScreenSaverModule; } + set { m_ScreenSaverModule = value; } + } + + public RBuildLanguage Language + { + get { return m_Language; } + set { m_Language = value; } + } + + public RBuildWallpaperFile Wallpaper + { + get { return m_Wallpaper; } + set { m_Wallpaper = value; } + } + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + + public RBuildModuleCollection AutorunModules + { + get { return m_Autorun; } + } + + public RBuildLanguageCollection Languages + { + get { return m_Languages; } + } + + public bool Debug + { + get { return m_Debug; } + set { m_Debug = value; } + } + + public bool KDebug + { + get { return m_KDebug; } + set { m_KDebug = value; } + } + + public bool GDB + { + get { return m_GDB; } + set { m_GDB = value; } + } + + public bool NSWPAT + { + get { return m_NSWPAT; } + set { m_NSWPAT = value; } + } + + public bool WINKD + { + get { return m_WINKD; } + set { m_WINKD = value; } + } + + public OptimizeLevelType OptimizeLevel + { + get { return m_OptimizeLevelType; } + set { m_OptimizeLevelType = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/RBuildPlatformFile.cs b/reactos/tools/sysgen/RosFramework/RBuildPlatformFile.cs new file mode 100644 index 00000000000..2e300fd4f30 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildPlatformFile.cs @@ -0,0 +1,84 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildOutputFile : RBuildFile //, IRBuildInstallable + { + private string m_InstallBase = "."; //"."; + private string m_NewName = null; + + public string NewName + { + get + { + if (m_NewName == null) + return m_Name; + return m_NewName; + } + set { m_NewName = value; } + } + + public string InstallBase + { + get { return m_InstallBase; } + set { m_InstallBase = value; } + } + + public virtual RBuildFile CDNewFile + { + get + { + RBuildFile file = (RBuildFile)Clone(); + + file.Name = NewName; + file.Base = InstallBase; + file.Root = PathRoot.CDOutput; + + return file; + } + } + + public virtual RBuildFile NewFile + { + get + { + RBuildFile file = (RBuildFile)Clone(); + + file.Name = NewName; + file.Base = InstallBase; + file.Root = Root; + + return file; + } + } + } + + public class RBuildPlatformFile : RBuildOutputFile + { + //protected RBuildInstallFolder m_InstallFolder = null; + + //public RBuildInstallFolder InstallFolder + //{ + // get { return m_InstallFolder; } + // set { m_InstallFolder = value; } + //} + + public RBuildFile PlatformInstall + { + get + { + RBuildFile file = null; + + file = new RBuildFile(); + file.Base = "%SystemRoot%\\" + InstallBase; + file.Name = Name; + file.Root = PathRoot.Platform; + + return file; + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildProject.cs b/reactos/tools/sysgen/RosFramework/RBuildProject.cs new file mode 100644 index 00000000000..c771b923d95 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildProject.cs @@ -0,0 +1,163 @@ +using System; +using System.Text; +using System.Xml; +using System.Collections.Generic; + +namespace SysGen.RBuild.Framework +{ + /// + /// There can be one project per top-level XML build file. + /// A project can only be defined in a top-level xml build file. + /// + public class RBuildProject : RBuildElement + { + private RBuildContributorCollection m_Contributors = new RBuildContributorCollection(); + private RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + private RBuildLanguageCollection m_Languages = new RBuildLanguageCollection(); + private RBuildInstallFolderCollection m_InstallFolders = new RBuildInstallFolderCollection(); + private RBuildBuildFamilyCollection m_BuildFamilies = new RBuildBuildFamilyCollection(); + private RBuildPlatform m_Platform = new RBuildPlatform(); + private RBuildDebugChannelCollection m_DebugChannels = new RBuildDebugChannelCollection(); + + private string m_PackagesFile = "obj-i386/reactos.dff"; + private string m_MakeFile = "makefile.auto"; + + public RBuildProject() + { + Folder = new RBuildFolder(PathRoot.SourceCode); + } + + /// + /// Filename of the GNU makefile that is to be created. + /// + public string MakeFile + { + get { return m_MakeFile; } + set { m_MakeFile = value; } + } + + public string PackagesFile + { + get { return m_PackagesFile; } + set { m_PackagesFile = value; } + } + + public RBuildDebugChannelCollection DebugChannels + { + get { return m_DebugChannels; } + } + + public RBuildPlatform Platform + { + get { return m_Platform; } + set { m_Platform = value; } + } + + public RBuildBuildFamilyCollection BuildFamilies + { + get { return m_BuildFamilies; } + set { m_BuildFamilies = value; } + } + + public RBuildInstallFolderCollection InstallFolders + { + get { return m_InstallFolders; } + set { m_InstallFolders = value; } + } + + public RBuildContributorCollection Contributors + { + get { return m_Contributors; } + set { m_Contributors = value; } + } + + public RBuildModuleCollection Modules + { + get { return m_Modules; } + } + + public RBuildLanguageCollection Languages + { + get { return m_Languages; } + } + + public string MakeFileGCCOptions + { + get { return string.Format("{0}_GCCOPTIONS", Name); } + } + + public string MakeFileGCCOptionsMacro + { + get { return string.Format("$({0}_GCCOPTIONS)", Name); } + } + + public override void SaveAs(string projectFile) + { + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(projectFile, Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteStartElement("project"); + writer.WriteAttributeString("name", Name); + writer.WriteAttributeString("makefile", MakeFile); + writer.WriteAttributeString("xmlns", "xi", null, "http://www.w3.org/2001/XInclude"); + + /* + writer.WriteComment("Generic Properties"); + foreach (KeyValuePair property in Properties) + { + writer.WriteStartElement("property"); + writer.WriteAttributeString("name", property.Key); + writer.WriteAttributeString("value", property.Value); + writer.WriteEndElement(); + } + + foreach (string define in Defines) + { + writer.WriteStartElement("define"); + writer.WriteAttributeString("name", define); + writer.WriteEndElement(); + }*/ + + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", "baseaddress.rbuild"); + writer.WriteEndElement(); + + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", "boot/bootdata/bootdata.rbuild"); + writer.WriteEndElement(); + + writer.WriteElementString("compilerflag", "-Os"); + writer.WriteElementString("compilerflag", "-ftracer"); + writer.WriteElementString("compilerflag", "-momit-leaf-frame-pointer"); + writer.WriteElementString("compilerflag", "-mpreferred-stack-boundary=2"); + + writer.WriteElementString("compilerflag", "-Wno-strict-aliasing"); + writer.WriteElementString("compilerflag", "-Wpointer-arith"); + writer.WriteElementString("linkerflag", "-enable-stdcall-fixup"); + + foreach (RBuildFolder folder in IncludeFolders) + { + writer.WriteStartElement("include"); + writer.WriteAttributeString("root", folder.Root.ToString()); + writer.WriteString(folder.Name); + writer.WriteEndElement(); + } + + foreach (RBuildModule module in Modules) + { + writer.WriteStartElement("xi:include"); + writer.WriteAttributeString("href", module.RBuildFile); + writer.WriteEndElement(); + } + + writer.WriteEndElement(); //Project + writer.WriteEndDocument(); + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildProperty.cs b/reactos/tools/sysgen/RosFramework/RBuildProperty.cs new file mode 100644 index 00000000000..bbc996f00e0 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildProperty.cs @@ -0,0 +1,104 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildProperty : RBuildValueKey + { + public RBuildProperty(string name, string value) + : base(name, value) + { + } + + public RBuildProperty(string name, string value, bool readOnly) + : base(name, value, readOnly) + { + } + + public RBuildProperty(string name, string value, bool readOnly, bool isInternal) + : base(name, value, readOnly, isInternal) + { + } + } + + public class RBuildBaseAdress : RBuildProperty + { + public RBuildBaseAdress(string name, string value) + : base(name, value, true) + { + } + } + + public class RBuildDefine : RBuildValueKey + { + public RBuildDefine(string name) + : base(name, string.Empty, true) + { + } + + public RBuildDefine(string name, string value) + : base(name, value, true) + { + } + } + + public abstract class RBuildValueKey + { + protected string m_Name = null; + protected string m_Value = null; + protected bool m_ReadOnly = false; + protected bool m_IsInternal = false; + + public RBuildValueKey(string name, string value) + { + m_Name = name; + m_Value = value; + } + + public RBuildValueKey(string name, string value, bool readOnly) + { + m_Name = name; + m_Value = value; + m_ReadOnly = readOnly; + } + + public RBuildValueKey(string name, string value, bool readOnly, bool isInternal) + { + m_Name = name; + m_Value = value; + m_ReadOnly = readOnly; + m_IsInternal = isInternal; + } + + public bool IsEmpty + { + get { return string.IsNullOrEmpty(Value); } + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string Value + { + get { return m_Value; } + set { m_Value = value; } + } + + public bool ReadOnly + { + get { return m_ReadOnly; } + set { m_ReadOnly = value; } + } + + public bool Internal + { + get { return m_IsInternal; } + set { m_IsInternal = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildRegistryKey.cs b/reactos/tools/sysgen/RosFramework/RBuildRegistryKey.cs new file mode 100644 index 00000000000..2f573be5409 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildRegistryKey.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using Microsoft.Win32; + +namespace SysGen.RBuild.Framework +{ + public class RBuildRegistryKey + { + private bool m_Enabled = true; + private bool m_LiveCD = true; + private bool m_BootCD = true; + + private string m_KeyName = null; + private string m_KeyValue = null; + + private RegistryHive m_RegistryHive = RegistryHive.ClassesRoot; + private RegistryValueKind m_RegistryValueKind = RegistryValueKind.Unknown; + + public RBuildRegistryKey() + { + } + + public bool LiveCD + { + get { return m_LiveCD; } + set { m_LiveCD = value; } + } + + public bool BootCD + { + get { return m_BootCD; } + set { m_BootCD = value; } + } + + public bool Enabled + { + get { return m_Enabled; } + set { m_Enabled = value; } + } + + public string KeyName + { + get { return m_KeyName; } + set { m_KeyName = value; } + } + + public string KeyValue + { + get { return m_KeyValue; } + set { m_KeyValue = value; } + } + + public RegistryHive RegistryHive + { + get { return m_RegistryHive; } + set { m_RegistryHive = value; } + } + + public RegistryValueKind RegistryValueKind + { + get { return m_RegistryValueKind; } + set { m_RegistryValueKind = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildSetup.cs b/reactos/tools/sysgen/RosFramework/RBuildSetup.cs new file mode 100644 index 00000000000..42dc5c18ed7 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildSetup.cs @@ -0,0 +1,52 @@ +//using System; +//using System.IO; +//using System.Collections.Generic; +//using System.Text; + +//namespace SysGen.RBuild.Framework +//{ +// public enum SetupType +// { +// Device, +// Component +// } + +// public class RBuildSetup : RBuildPlatformFile +// { +// private SetupType m_SetupType = SetupType.Component; +// private bool m_InstallAlways = true; +// private string m_InstallSection = "DefaultInstall"; + +// public SetupType SetupType +// { +// get { return m_SetupType; } +// set { m_SetupType = value; } +// } + +// public string InstallSection +// { +// get { return m_InstallSection; } +// set { m_InstallSection = value; } +// } + +// public string DefaultInstallSection +// { +// get +// { +// switch (SetupType) +// { +// case SetupType.Device: +// return "DefaultInstall"; +// default: +// return "DefaultInstall"; +// } +// } +// } + +// public bool InstallAlways +// { +// get { return m_InstallAlways; } +// set { m_InstallAlways = value; } +// } +// } +//} diff --git a/reactos/tools/sysgen/RosFramework/RBuildSetupFile.cs b/reactos/tools/sysgen/RosFramework/RBuildSetupFile.cs new file mode 100644 index 00000000000..6bd9aee38c9 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildSetupFile.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum SetupType + { + Device, + Component + } + + public class RBuildSetupFile : RBuildPlatformFile + { + private SetupType m_SetupType = SetupType.Component; + private bool m_InstallAlways = true; + private string m_InstallSection = "DefaultInstall"; + + public SetupType SetupType + { + get { return m_SetupType; } + set { m_SetupType = value; } + } + + public string InstallSection + { + get { return m_InstallSection; } + set { m_InstallSection = value; } + } + + public string DefaultInstallSection + { + get + { + switch (SetupType) + { + case SetupType.Device: + return "DefaultInstall"; + default: + return "DefaultInstall"; + } + } + } + + public bool InstallAlways + { + get { return m_InstallAlways; } + set { m_InstallAlways = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildSolution.cs b/reactos/tools/sysgen/RosFramework/RBuildSolution.cs new file mode 100644 index 00000000000..32d10134769 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildSolution.cs @@ -0,0 +1,21 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class RBuildSolution + { + private List m_Projects = null; + + /// + /// The projects this solution contains. + /// + public List Projects + { + get { return m_Projects; } + set { m_Projects = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildTarget.cs b/reactos/tools/sysgen/RosFramework/RBuildTarget.cs new file mode 100644 index 00000000000..adf726165e3 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildTarget.cs @@ -0,0 +1,274 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum TargetType + { + LiveCD, + BootCD + } + + public enum TargetDebugOutputType + { + COM1, + COM2, + Screen, + Bochs + } + + public enum TargetDebugType + { + None, + Debug, + KernelDebug + } + + public enum TargetWindowsPlatformType + { + WindowsNT4 = 0x400, + Windows2000 = 0x500, + WindowsXP = 0x501, + Windows2003 = 0x0502, + WindowsVista = 0x600 + } + + public enum TargetWindowsSPType + { + NoServicePack, + ServicePack1 = 0x100, + ServicePack2 = 0x200, + ServicePack3 = 0x300, + ServicePack4 = 0x400, + ServicePack5 = 0x500, + ServicePack6 = 0x600, + ServicePack7 = 0x700, + ServicePack8 = 0x800, + ServicePack9 = 0x900 + } + + public enum TargetPlatformType + { + NT4, /* Windows NT 4.0 */ + NT4_SP1, + NT4_SP2, + NT4_SP3, + NT4_SP4, + NT4_SP5, + NT4_SP6, + NT5, /* Windows 2000 */ + NT5_SP1, + NT5_SP2, + NT5_SP3, + NT5_SP4, + NT51, /* Windows XP */ + NT51_SP1, + NT51_SP2, + NT52, /* Windows 2003 */ + NT52_SP1, + NT52_SP2, + NT6 /* Windows Vista */ + } + + public enum TargetArchitectureType + { + X86, + X86_i486, + X86_i586, + X86_Pentium, + X86_Pentium2, + X86_Pentium3, + X86_Pentium4, + X86_AthlonXP, + X86_AthlonMP, + X86_Xbox, + PPC + } + + public enum TargetOptimizeLevelType + { + Level_0, + Level_1, + Level_2, + Level_3, + Level_4, + Level_5 + } + + public class RBuildTarget + { + private string m_Name = null; + + private bool m_RegTest = false; + private bool m_Multiprocessor = false; + + private TargetType m_Type = TargetType.BootCD; + private TargetDebugType m_DebugType = TargetDebugType.None; + private TargetPlatformType m_PlatformType = TargetPlatformType.NT5_SP4; + private TargetDebugOutputType m_DebugOutputType = TargetDebugOutputType.COM1; + private TargetArchitectureType m_ArchitectureType = TargetArchitectureType.X86_Pentium; + private TargetOptimizeLevelType m_OptimizeLevelType = TargetOptimizeLevelType.Level_1; + + public RBuildTarget() + { + } + + public RBuildTarget(string name) + { + m_Name = name; + } + + public RBuildTarget(string name, TargetType type) + { + m_Name = name; + m_Type = type; + } + + public RBuildTarget(string name, TargetType type, TargetDebugType debugType) + { + m_Name = name; + m_Type = type; + m_DebugType = debugType; + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public bool MultiProcessor + { + get { return m_Multiprocessor; } + set { m_Multiprocessor = value; } + } + + public bool RegressionTest + { + get { return m_RegTest; } + set { m_RegTest = value; } + } + + public bool Debug + { + get { return ((DebugType == TargetDebugType.Debug) || (DebugType == TargetDebugType.KernelDebug)); } + } + + public bool KernelDebug + { + get { return (DebugType == TargetDebugType.KernelDebug); } + } + + public TargetType Type + { + get { return m_Type; } + set { m_Type = value; } + } + + public TargetDebugType DebugType + { + get { return m_DebugType; } + set { m_DebugType = value; } + } + + public TargetDebugOutputType DebugOutputType + { + get { return m_DebugOutputType; } + set { m_DebugOutputType = value; } + } + + public TargetPlatformType PlatformType + { + get { return m_PlatformType; } + set { m_PlatformType = value; } + } + + public TargetArchitectureType ArchitectureType + { + get { return m_ArchitectureType; } + set { m_ArchitectureType = value; } + } + + public TargetOptimizeLevelType OptimizeType + { + get { return m_OptimizeLevelType; } + set { m_OptimizeLevelType = value; } + } + + public TargetWindowsSPType WindowsServicePack + { + get + { + switch (PlatformType) + { + case TargetPlatformType.NT4: + case TargetPlatformType.NT5: + case TargetPlatformType.NT51: + case TargetPlatformType.NT52: + case TargetPlatformType.NT6: + return TargetWindowsSPType.NoServicePack; + case TargetPlatformType.NT4_SP1: + case TargetPlatformType.NT5_SP1: + case TargetPlatformType.NT51_SP1: + case TargetPlatformType.NT52_SP1: + return TargetWindowsSPType.ServicePack1; + case TargetPlatformType.NT4_SP2: + case TargetPlatformType.NT5_SP2: + case TargetPlatformType.NT51_SP2: + case TargetPlatformType.NT52_SP2: + return TargetWindowsSPType.ServicePack2; + case TargetPlatformType.NT4_SP3: + case TargetPlatformType.NT5_SP3: + return TargetWindowsSPType.ServicePack3; + case TargetPlatformType.NT4_SP4: + case TargetPlatformType.NT5_SP4: + return TargetWindowsSPType.ServicePack4; + case TargetPlatformType.NT4_SP5: + return TargetWindowsSPType.ServicePack5; + case TargetPlatformType.NT4_SP6: + return TargetWindowsSPType.ServicePack6; + default: + throw new Exception(""); + } + } + } + + public TargetWindowsPlatformType WindowsPlatfom + { + get + { + switch (PlatformType) + { + case TargetPlatformType.NT4: + case TargetPlatformType.NT4_SP1: + case TargetPlatformType.NT4_SP2: + case TargetPlatformType.NT4_SP3: + case TargetPlatformType.NT4_SP4: + case TargetPlatformType.NT4_SP5: + case TargetPlatformType.NT4_SP6: + return TargetWindowsPlatformType.WindowsNT4; + case TargetPlatformType.NT5: + case TargetPlatformType.NT5_SP1: + case TargetPlatformType.NT5_SP2: + case TargetPlatformType.NT5_SP3: + case TargetPlatformType.NT5_SP4: + return TargetWindowsPlatformType.Windows2000; + case TargetPlatformType.NT51: + case TargetPlatformType.NT51_SP1: + case TargetPlatformType.NT51_SP2: + return TargetWindowsPlatformType.WindowsXP; + case TargetPlatformType.NT52: + case TargetPlatformType.NT52_SP1: + case TargetPlatformType.NT52_SP2: + return TargetWindowsPlatformType.Windows2003; + case TargetPlatformType.NT6: + return TargetWindowsPlatformType.WindowsVista; + default: + throw new Exception(""); + } + } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/RBuildUnAttendSetup.cs b/reactos/tools/sysgen/RosFramework/RBuildUnAttendSetup.cs new file mode 100644 index 00000000000..a240dbda757 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/RBuildUnAttendSetup.cs @@ -0,0 +1,102 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public enum InstallType : int + { + SkipMBRInstall = 0, + FloppyMBRInstall = 1, + HDDMBRInstall = 2 + } + + public class RBuildUnAttendSetup + { + private InstallType m_InstallType = InstallType.HDDMBRInstall; + private int m_DestinationDiskNumber = 0; + private int m_DestinationPartitionNumber = 1; + private bool m_FormatPartition; + private bool m_AutoPartition; + private bool m_DisableVmwDriverInstall; + private bool m_Enabled = false; + private string m_InstallDirectory; + private string m_FullName; + private string m_OrgName; + private string m_ComputerName; + private string m_AdminPassword; + + public InstallType InstallType + { + get { return m_InstallType; } + set { m_InstallType = value; } + } + + public int DestinationDiskNumber + { + get { return m_DestinationDiskNumber; } + set { m_DestinationDiskNumber = value; } + } + + public int DestinationPartitionNumber + { + get { return m_DestinationPartitionNumber; } + set { m_DestinationPartitionNumber = value; } + } + + public string InstallDirectory + { + get { return m_InstallDirectory; } + set { m_InstallDirectory = value; } + } + + public string FullName + { + get { return m_FullName; } + set { m_FullName = value; } + } + + public string OrgName + { + get { return m_OrgName; } + set { m_OrgName = value; } + } + + public string ComputerName + { + get { return m_ComputerName; } + set { m_ComputerName = value; } + } + + public string AdminPassword + { + get { return m_AdminPassword; } + set { m_AdminPassword = value; } + } + + public bool FormatPartition + { + get { return m_FormatPartition; } + set { m_FormatPartition = value; } + } + + public bool AutoPartition + { + get { return m_AutoPartition; } + set { m_AutoPartition = value; } + } + + public bool DisableVmwDriverInstall + { + get { return m_DisableVmwDriverInstall; } + set { m_DisableVmwDriverInstall = value; } + } + + public bool Enabled + { + get { return m_Enabled; } + set { m_Enabled = value; } + } + } +} diff --git a/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj b/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj new file mode 100644 index 00000000000..6ccaf2fe069 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj @@ -0,0 +1,117 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + Library + Properties + SysGen.RBuild.Framework + SysGen.RBuild.Framework + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj.user b/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj.user new file mode 100644 index 00000000000..6a34e7dcdf5 --- /dev/null +++ b/reactos/tools/sysgen/RosFramework/SysGen.RBuild.Framework.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SYSGen/Backends/Backend.cs b/reactos/tools/sysgen/SYSGen/Backends/Backend.cs new file mode 100644 index 00000000000..849137aa76d --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/Backends/Backend.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SYSGen.Backends +{ + public abstract class Backend + { + } +} diff --git a/reactos/tools/sysgen/SYSGen/Backends/Catalog/CatalogBackend.cs b/reactos/tools/sysgen/SYSGen/Backends/Catalog/CatalogBackend.cs new file mode 100644 index 00000000000..52bd011dd41 --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/Backends/Catalog/CatalogBackend.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SYSGen.Backends; + +namespace SYSGen.Backends.Catalog +{ + class CatalogBackend : Backend + { + } +} diff --git a/reactos/tools/sysgen/SYSGen/Backends/Mingw/MingwBackend.cs b/reactos/tools/sysgen/SYSGen/Backends/Mingw/MingwBackend.cs new file mode 100644 index 00000000000..73c2ae3a7bd --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/Backends/Mingw/MingwBackend.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SYSGen.Backends; + +namespace SYSGen.Backends.Mingw +{ + class MingwBackend : Backend + { + } +} diff --git a/reactos/tools/sysgen/SYSGen/Program.cs b/reactos/tools/sysgen/SYSGen/Program.cs new file mode 100644 index 00000000000..c49fc075055 --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/Program.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SYSGen +{ + class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/reactos/tools/sysgen/SYSGen/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/SYSGen/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..04c75a90f62 --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("SYSGen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("SYSGen")] +[assembly: AssemblyCopyright("Copyright © Sand 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("eb4b0be6-5b08-4933-b932-61bf335383db")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/SYSGen/SYSGen.csproj b/reactos/tools/sysgen/SYSGen/SYSGen.csproj new file mode 100644 index 00000000000..93452a30484 --- /dev/null +++ b/reactos/tools/sysgen/SYSGen/SYSGen.csproj @@ -0,0 +1,56 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {5AEA291F-D79C-4FC1-AA60-96C591658B85} + Exe + Properties + SYSGen + sysgen + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + RosFramework + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementArrayAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementArrayAttribute.cs new file mode 100644 index 00000000000..3e2e2155fe8 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementArrayAttribute.cs @@ -0,0 +1,33 @@ +// NAnt - A .NET build tool +// Copyright (C) 2001 Gerry Shaw +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Ian MacLean ( ian@maclean.ms ) + +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// Indicates that property should be treated as a xml arrayList for the task. + [AttributeUsage(AttributeTargets.Property, Inherited=true)] + public class BuildElementArrayAttribute : BuildElementAttribute { + + public BuildElementArrayAttribute(string name) : base(name) { + + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementAttribute.cs new file mode 100644 index 00000000000..5b453a063f2 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/BuildElementAttribute.cs @@ -0,0 +1,50 @@ +// NAnt - A .NET build tool +// Copyright (C) 2001 Gerry Shaw +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Ian MacLean ( ian@maclean.ms ) + +namespace SysGen.BuildEngine.Attributes +{ + + using System; + using System.Reflection; + + /// Indicates that field should be treated as a xml file set for the task. + [AttributeUsage(AttributeTargets.Property, Inherited=true)] + public class BuildElementAttribute : Attribute + { + + string _name; + bool _required; + + public BuildElementAttribute(string name) + { + Name = name; + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + public bool Required + { + get { return _required; } + set { _required = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/ElementNameAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/ElementNameAttribute.cs new file mode 100644 index 00000000000..a52f72ef520 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/ElementNameAttribute.cs @@ -0,0 +1,45 @@ +// NAnt - A .NET build tool +// Copyright (C) 2001 Gerry Shaw +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Ian MacLean (ian_maclean@another.com) + +namespace SysGen.BuildEngine.Attributes { + + using System; + using System.Reflection; + + /// Indicates that class should be treated as a NAnt element. + /// + /// Attach this attribute to a subclass of Element to have NAnt be able + /// to recognize it. The name should be short but must not confict + /// with any other element already in use. + /// + [AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)] + public class ElementNameAttribute : Attribute { + + string _name; + + public ElementNameAttribute(string name) { + _name = name; + } + + public string Name { + get { return _name; } + set { _name = value; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionAttribute.cs new file mode 100644 index 00000000000..506cab8a400 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionAttribute.cs @@ -0,0 +1,60 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// + /// Indicates that the method should be exposed as a function in NAnt build + /// files. + /// + /// + /// Attach this attribute to a method of a class that derives from + /// to have NAnt be able to recognize it. + /// + [AttributeUsage(AttributeTargets.Method, Inherited=false, AllowMultiple=false)] + public sealed class FunctionAttribute : Attribute { + #region Public Instance Constructors + + /// + /// Initializes a new instance of the + /// class with the specified name. + /// + /// The name of the function. + /// is . + /// is a zero-length . + public FunctionAttribute(string name) { + if (name == null) { + throw new ArgumentNullException("name"); + } + + if (name.Trim().Length == 0) { + throw new ArgumentOutOfRangeException("name", name, "A zero-length string is not an allowed value."); + } + + _name = name; + } + + #endregion Public Instance Constructors + + #region Public Instance Properties + + /// + /// Gets or sets the name of the function. + /// + /// + /// The name of the function. + /// + public string Name { + get { return _name; } + set { _name = value; } + } + + #endregion Public Instance Properties + + #region Private Instance Fields + + private string _name; + + #endregion Private Instance Fields + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionSetAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionSetAttribute.cs new file mode 100644 index 00000000000..0ac033f07e0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/FunctionSetAttribute.cs @@ -0,0 +1,90 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// + /// Indicates that class should be treated as a set of functions. + /// + /// + /// Attach this attribute to a class that derives from + /// to have NAnt be able to recognize it as containing custom functions. + /// + [AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)] + public sealed class FunctionSetAttribute : Attribute { + #region Public Instance Constructors + + /// + /// Initializes a new instance of the + /// class with the specified name. + /// + /// The prefix used to distinguish the functions. + /// The category of the functions. + /// + /// is . + /// -or- + /// is . + /// + /// + /// is a zero-length . + /// -or- + /// is a zero-length . + /// + public FunctionSetAttribute(string prefix, string category) { + if (prefix == null) { + throw new ArgumentNullException("prefix"); + } + if (category == null) { + throw new ArgumentNullException("category"); + } + + if (prefix.Trim().Length == 0) { + throw new ArgumentOutOfRangeException("prefix", prefix, "A zero-length string is not an allowed value."); + } + if (category.Trim().Length == 0) { + throw new ArgumentOutOfRangeException("category", category, "A zero-length string is not an allowed value."); + } + + _prefix = prefix; + _category = category; + } + + #endregion Public Instance Constructors + + #region Public Instance Properties + + /// + /// Gets or sets the category of the function set. + /// + /// + /// The name of the category of the function set. + /// + /// + /// This will be displayed in the user docs. + /// + public string Category { + get { return _category; } + set { _category = value; } + } + + /// + /// Gets or sets the prefix of all functions in this function set. + /// + /// + /// The prefix of the functions in this function set. + /// + public string Prefix { + get { return _prefix; } + set { _prefix = value; } + } + + #endregion Public Instance Properties + + #region Private Instance Fields + + private string _prefix; + private string _category; + + #endregion Private Instance Fields + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskAttributeAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskAttributeAttribute.cs new file mode 100644 index 00000000000..3242801bf09 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskAttributeAttribute.cs @@ -0,0 +1,43 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// Indicates that field should be treated as a xml attribute for the task. + /// + /// Examples of how to specify task attributes + /// + /// // task XmlType default is string + /// [TaskAttribute("out", Required=true)] + /// string _out = null; // assign default value here + /// + /// [TaskAttribute("optimize")] + /// [BooleanValidator()] + /// // during ExecuteTask you can safely use Convert.ToBoolean(_optimize) + /// string _optimize = Boolean.FalseString; + /// + /// [TaskAttribute("warnlevel")] + /// [Int32Validator(0,4)] // limit values to 0-4 + /// // during ExecuteTask you can safely use Convert.ToInt32(_optimize) + /// string _warnlevel = "0"; + /// + /// [FileSet("sources")] + /// FileSet _sources = new FileSet(); + /// + /// NOTE: Attribute values must be of type of string if you want + /// to be able to have macros. The field stores the exact value during + /// InitializeTask. Just before ExecuteTask is called NAnt will expand + /// all the macros with the current values. + /// + [AttributeUsage( AttributeTargets.Property, Inherited=true)] + public class TaskAttributeAttribute : TaskPropertyAttribute { + + public TaskAttributeAttribute(string name) : base(name){ + } + + public override TaskPropertyLocation Location + { + get { return TaskPropertyLocation.Attribute; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskFileSetAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskFileSetAttribute.cs new file mode 100644 index 00000000000..fd9ad0cad05 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskFileSetAttribute.cs @@ -0,0 +1,33 @@ +// NAnt - A .NET build tool +// Copyright (C) 2001 Gerry Shaw +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Gerry Shaw (gerry_shaw@yahoo.com) +// Ian MacLean ( ian@maclean.ms ) + +namespace SysGen.BuildEngine.Attributes { + + using System; + using System.Reflection; + + /// Indicates that field should be treated as a xml file set for the task. + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited=true)] + public class FileSetAttribute : BuildElementAttribute { + + public FileSetAttribute(string name) : base(name) { + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskNameAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskNameAttribute.cs new file mode 100644 index 00000000000..d46357f6892 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskNameAttribute.cs @@ -0,0 +1,46 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// Indicates that class should be treated as a task. + /// + /// Attach this attribute to a subclass of Task to have NAnt be able + /// to recognize it. The name should be short but must not confict + /// with any other task already in use. + /// + [AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)] + public class TaskNameAttribute : Attribute + { + private string m_Namespace = null; + private string m_Name = null; + + public TaskNameAttribute(string name) + { + m_Name = name; + } + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string Namespace + { + get { return m_Namespace; } + set { m_Namespace = value; } + } + + public string FullTaskName + { + get + { + if (Namespace != null) + return string.Format("{0}:{1}", Namespace, Name); + + return Name; + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskOptionSetAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskOptionSetAttribute.cs new file mode 100644 index 00000000000..c62c48f3312 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskOptionSetAttribute.cs @@ -0,0 +1,32 @@ +// NAnt - A .NET build tool +// Copyright (C) 2001 Gerry Shaw +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Tomas Restrepo (tomasr@mvps.org) + +namespace SysGen.BuildEngine.Attributes { + + using System; + using System.Reflection; + + /// Indicates that field should be treated as a xml option set for the task. + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited=true)] + public class OptionSetAttribute : BuildElementAttribute { + + public OptionSetAttribute(string name) : base(name) { + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskPropertyAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskPropertyAttribute.cs new file mode 100644 index 00000000000..6ee83ec2058 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskPropertyAttribute.cs @@ -0,0 +1,66 @@ +using System; +using System.Reflection; + +namespace SysGen.BuildEngine.Attributes +{ + public enum TaskPropertyLocation + { + Attribute, + Node + } + + /// Indicates that field should be treated as a xml attribute for the task. + /// + /// Examples of how to specify task attributes + /// + /// // task XmlType default is string + /// [BuildAttribute("out", Required=true)] + /// string _out = null; // assign default value here + /// + /// [BuildAttribute("optimize")] + /// [BooleanValidator()] + /// // during ExecuteTask you can safely use Convert.ToBoolean(_optimize) + /// string _optimize = Boolean.FalseString; + /// + /// [BuildAttribute("warnlevel")] + /// [Int32Validator(0,4)] // limit values to 0-4 + /// // during ExecuteTask you can safely use Convert.ToInt32(_optimize) + /// string _warnlevel = "0"; + /// + /// [FileSet("sources")] + /// FileSet _sources = new FileSet(); + /// + /// NOTE: Attribute values must be of type of string if you want + /// to be able to have macros. The field stores the exact value during + /// InitializeTask. Just before ExecuteTask is called NAnt will expand + /// all the macros with the current values. + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field , Inherited=true)] + public abstract class TaskPropertyAttribute : Attribute + { + string _name; + bool _required = false; + bool _expandProperties = true; + + public TaskPropertyAttribute(string name) { + _name = name; + } + + public string Name { + get { return _name; } + set { _name = value; } + } + + public bool Required { + get { return _required; } + set { _required = value; } + } + + public bool ExpandProperties { + get { return _expandProperties; } + set { _expandProperties = value; } + } + + public abstract TaskPropertyLocation Location { get; } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskValueAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskValueAttribute.cs new file mode 100644 index 00000000000..9a00b764e17 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/TaskValueAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Reflection; + +namespace SysGen.BuildEngine.Attributes +{ + [AttributeUsage(AttributeTargets.Property, Inherited = true)] + public class TaskValueAttribute : TaskPropertyAttribute + { + public TaskValueAttribute() + : base(null) + { + } + + public override TaskPropertyLocation Location + { + get { return TaskPropertyLocation.Node; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Base/ValidatorAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Base/ValidatorAttribute.cs new file mode 100644 index 00000000000..21592caa508 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Base/ValidatorAttribute.cs @@ -0,0 +1,16 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + public abstract class ValidatorAttribute : Attribute + { + /// + /// Validates the object. + /// + /// The object to be validated + /// Throws a ValidationException when validation fails. + /// Returns an indication of the result. + public abstract bool Validate(object value); + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/BooleanValidatorAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/BooleanValidatorAttribute.cs new file mode 100644 index 00000000000..a77c4044db3 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/BooleanValidatorAttribute.cs @@ -0,0 +1,21 @@ +namespace SysGen.BuildEngine.Attributes +{ + using System; + using System.Reflection; + + /// + /// Indicates that field should be able to be converted into a Boolean. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property , Inherited=true)] + public class BooleanValidatorAttribute : ValidatorAttribute + { + public BooleanValidatorAttribute() + { + } + + public override bool Validate(object value) + { + return SysGenConversion.ToBolean(value); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Int32ValidatorAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Int32ValidatorAttribute.cs new file mode 100644 index 00000000000..0336016ff3d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/Int32ValidatorAttribute.cs @@ -0,0 +1,54 @@ +using System; +using System.Reflection; + +namespace SysGen.BuildEngine.Attributes +{ + /// + /// Indicates that field should be able to be converted into a Int32 within the given range. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)] + public class Int32ValidatorAttribute : ValidatorAttribute + { + int _minValue = Int32.MinValue; + int _maxValue = Int32.MaxValue; + + public Int32ValidatorAttribute() + { + } + + public Int32ValidatorAttribute(int minValue, int maxValue) + { + MinValue = minValue; + MaxValue = maxValue; + } + + public int MinValue + { + get { return _minValue; } + set { _minValue = value; } + } + + public int MaxValue + { + get { return _maxValue; } + set { _maxValue = value; } + } + + public override bool Validate(object value) + { + try + { + Int32 intValue = Convert.ToInt32(value); + if (intValue < MinValue || intValue > MaxValue) + { + throw new ValidationException(String.Format("Cannot resolve '{0}' to integer between '{1}' and '{2}'.", value.ToString(), MinValue, MaxValue)); + } + } + catch (Exception) + { + throw new ValidationException(String.Format("Cannot resolve '{0}' to integer value.", value.ToString())); + } + return true; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/StringValidatorAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/StringValidatorAttribute.cs new file mode 100644 index 00000000000..be617dee875 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/StringValidatorAttribute.cs @@ -0,0 +1,35 @@ +using System; +using System.Reflection; + +namespace SysGen.BuildEngine.Attributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)] + public class StringValidatorAttribute : ValidatorAttribute + { + private bool m_AllowEmpty = true; + private bool m_AllowSpaces = true; + + public override bool Validate(object value) + { + if (!AllowSpaces && string.Equals(value, " ")) + throw new ValidationException("No spaces allowed"); + + if (!AllowEmpty && value.ToString().Length == 0) + throw new ValidationException("No empty string allowed"); + + return true; + } + + public bool AllowEmpty + { + get { return m_AllowEmpty; } + set { m_AllowEmpty = value; } + } + + public bool AllowSpaces + { + get { return m_AllowSpaces; } + set { m_AllowSpaces = value; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/UriValidatorAttribute.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/UriValidatorAttribute.cs new file mode 100644 index 00000000000..54da6e52690 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Attributes/Validators/UriValidatorAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Reflection; + +namespace SysGen.BuildEngine.Attributes +{ + /// + /// Indicates that field should be able to be converted into a Uri. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)] + public class UriValidatorAttribute : ValidatorAttribute + { + public override bool Validate(object value) + { + try + { + Uri uriValue = new Uri(value.ToString(), UriKind.Relative); + } + catch (Exception) + { + throw new ValidationException(String.Format("Cannot resolve '{0}' to Uri.", value.ToString())); + } + + return true; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/APIDocumentation/APIDocumentation.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/APIDocumentation/APIDocumentation.cs new file mode 100644 index 00000000000..330f3d65ef6 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/APIDocumentation/APIDocumentation.cs @@ -0,0 +1,395 @@ +using System; +using System.Text.RegularExpressions; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine.Backends +{ + public class APIDocumentation : HtmlDocumenterBaseBacked + { + public APIDocumentation(SysGenEngine sysgen) + : base(sysgen) + { + if (Directory.Exists(@"C:\rosLib")) + Directory.Delete(@"C:\rosLib", true); + + Directory.CreateDirectory(@"C:\rosLib"); + + File.Copy(@"c:\style.css", @"c:\rosLib\style.css"); + } + + protected override string FriendlyName + { + get { return "APIDocumentation Report"; } + } + + private void WriteModuleFunctions() + { + foreach (RBuildModule module in Project.Modules) + { + if (module.IsDLL || module.IsLibrary) + { + foreach (RBuildAPIInfo apiInfo in module.ApiInfo) + { + using (StreamWriter sw = new StreamWriter(@"C:\roslib\" + apiInfo.HtmlDocFileName)) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Module"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("{0} Function", apiInfo.Name); + writer.RenderEndTag(); + + if (apiInfo.Implemented) + { + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Function '{0}' on '{1}' is currently implemented.", + apiInfo.Name, + apiInfo.File); + writer.RenderEndTag(); + } + else + { + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Function '{0}' on '{1}' is currently un-implemented.", + apiInfo.Name, + apiInfo.File); + writer.RenderEndTag(); + } + } + } + } + } + } + } + + private void WriteModules() + { + foreach (RBuildModule module in Project.Modules) + { + if (module.IsDLL || module.IsLibrary) + { + using (StreamWriter sw = new StreamWriter(@"C:\roslib\" + module.HtmlDocFileName)) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Module"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("{0}", module.Name); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Module {0} has a total of {1} functions , {2} implemented and {3} un-implemented ({4}%)", + module.Name, + module.ApiInfo.TotalFunctions, + module.ApiInfo.ImplementedFunctionsCount, + module.ApiInfo.UnImplementedFunctionsCount, + module.ApiInfo.Percentage); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("{0} Functions", module.Name); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildAPIInfo apiInfo in module.ApiInfo) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute("href", apiInfo.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(apiInfo.Name); + writer.RenderEndTag(); + + if (!apiInfo.Implemented) + { + writer.RenderBeginTag(HtmlTextWriterTag.B); + writer.Write("(UnImplemented)"); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + } + } + + private void WriteWelcome() + { + using (StreamWriter sw = new StreamWriter(@"C:\roslib\welcome.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Warnings"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("ReactOS API Documentation"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Welcome to the ReactOS API documentation website."); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H1); + writer.Write("Implementation status Color Key"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "5"); + writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + for (int i = 0; i <= 100; i = i + 5) + { + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct" + i); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("{0}%" , i); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Native DLLs"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Modules) + { + if (module.Type == ModuleType.NativeDLL) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute("href", module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Win32 DLLs"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Modules) + { + if (module.Type == ModuleType.Win32DLL) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute("href", module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void WriteHeader() + { + using (StreamWriter sw = new StreamWriter(@"C:\roslib\header.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + writer.WriteLine("

ReactOS API Documentation

"); + } + } + } + + private void WriteFrameSet() + { + using (StreamWriter sw = new StreamWriter(@"C:\roslib\default.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + writer.WriteLine(""); + writer.WriteLine(""); + writer.WriteLine(""); + writer.WriteLine(""); + writer.WriteLine(""); + writer.WriteLine(""); + writer.WriteLine(""); + } + } + } + + private void ReadApiStatusFile() + { + XmlDocument doc = new XmlDocument(); + + //Load the file in to memory + doc.Load(@"C:\Ros\clean\reactos\apistatus.xml"); + + foreach (XmlNode comp in doc.SelectNodes("/components/component")) + { + // Get the component name.... + string modulename = comp.Attributes["name"].InnerText; + + RBuildModule module = Project.Modules.GetByName(modulename); + + if (module != null) + { + foreach (XmlNode dep in comp.SelectNodes("functions/f")) + { + // Gets the dependency name + string name = dep.Attributes["n"].InnerText; + string file = dep.Attributes["f"].InnerText; + bool imp = Boolean.Parse(dep.Attributes["i"].InnerText); + + RBuildAPIInfo apiInfo = new RBuildAPIInfo(); + + apiInfo.Name = name; + apiInfo.File = file; + apiInfo.Implemented = imp; + + module.ApiInfo.Add(apiInfo); + } + } + } + } + + protected override void Generate() + { + ReadApiStatusFile(); + WriteFrameSet(); + WriteHeader(); + WriteWelcome(); + WriteModules(); + WriteModuleFunctions(); + + using (StreamWriter sw = new StreamWriter(@"C:\roslib\tree.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Warnings"); + + writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2"); + writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "2"); + writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); + //writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + foreach (RBuildModule module in Project.Modules) + { + if ((module.IsDLL) || (module.IsLibrary)) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + + if ((module.ApiInfo.Percentage >= 0) && (module.ApiInfo.Percentage <= 5)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct0"); + if ((module.ApiInfo.Percentage >= 5) && (module.ApiInfo.Percentage <= 10)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct5"); + if ((module.ApiInfo.Percentage >= 10) && (module.ApiInfo.Percentage <= 15)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct10"); + if ((module.ApiInfo.Percentage >= 15) && (module.ApiInfo.Percentage <= 20)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct15"); + if ((module.ApiInfo.Percentage >= 20) && (module.ApiInfo.Percentage <= 25)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct20"); + if ((module.ApiInfo.Percentage >= 25) && (module.ApiInfo.Percentage <= 30)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct25"); + if ((module.ApiInfo.Percentage >= 30) && (module.ApiInfo.Percentage <= 35)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct30"); + if ((module.ApiInfo.Percentage >= 35) && (module.ApiInfo.Percentage <= 40)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct35"); + if ((module.ApiInfo.Percentage >= 40) && (module.ApiInfo.Percentage <= 45)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct40"); + if ((module.ApiInfo.Percentage >= 45) && (module.ApiInfo.Percentage <= 50)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct45"); + if ((module.ApiInfo.Percentage >= 50) && (module.ApiInfo.Percentage <= 55)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct50"); + if ((module.ApiInfo.Percentage >= 55) && (module.ApiInfo.Percentage <= 60)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct55"); + if ((module.ApiInfo.Percentage >= 60) && (module.ApiInfo.Percentage <= 65)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct60"); + if ((module.ApiInfo.Percentage >= 65) && (module.ApiInfo.Percentage <= 70)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct65"); + if ((module.ApiInfo.Percentage >= 70) && (module.ApiInfo.Percentage <= 75)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct70"); + if ((module.ApiInfo.Percentage >= 75) && (module.ApiInfo.Percentage <= 80)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct75"); + if ((module.ApiInfo.Percentage >= 80) && (module.ApiInfo.Percentage <= 85)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct80"); + if ((module.ApiInfo.Percentage >= 85) && (module.ApiInfo.Percentage <= 90)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct85"); + if ((module.ApiInfo.Percentage >= 90) && (module.ApiInfo.Percentage <= 95)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct90"); + if ((module.ApiInfo.Percentage >= 95) && (module.ApiInfo.Percentage <= 100)) + writer.AddAttribute(HtmlTextWriterAttribute.Class, "pct100"); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + + if (module.ApiInfo.Count > 0) + { + writer.AddAttribute("href", module.HtmlDocFileName); + writer.AddAttribute("target", "content"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + + writer.Write(" (I:{0} U:{1} P:{2}%)", + module.ApiInfo.ImplementedFunctionsCount, + module.ApiInfo.UnImplementedFunctionsCount, + module.ApiInfo.Percentage); + } + else + { + writer.Write(module.Name); + } + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + if (module.ApiInfo.Count > 0) + { + foreach (RBuildAPIInfo apiInfo in module.ApiInfo) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute("href", apiInfo.HtmlDocFileName); + writer.AddAttribute("target", "content"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(apiInfo.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + else + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write("No documentation available yet"); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + + + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/Backend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/Backend.cs new file mode 100644 index 00000000000..5811c6fc253 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/Backend.cs @@ -0,0 +1,81 @@ +using System; +using System.Reflection; +using System.Diagnostics; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Log; + +namespace SysGen.BuildEngine.Backends +{ + public abstract class Backend + { + private SysGenEngine m_SysGenEngine = null; + + public Backend(SysGenEngine sysgen) + { + m_SysGenEngine = sysgen; + } + + public SysGenEngine SysGen + { + get { return m_SysGenEngine; } + } + + public RBuildProject Project + { + get { return m_SysGenEngine.Project; } + } + + public string AppInfo + { + get { return string.Format("{0} {1}", AppName, AppVersion); } + } + + public string AppName + { + get { return "SysGen"; } + } + + public string AppVersion + { + get + { + FileVersionInfo info = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); + + return string.Format("{0}.{1}.{2}", + info.FileMajorPart, + info.FileMinorPart, + info.FileBuildPart); + } + } + + protected abstract string FriendlyName { get;} + //protected abstract string Name { get;} + + public void Run() + { + BuildLog.WriteLine(); + BuildLog.Write("[Backend] {0} running ...", FriendlyName); + + try + { + //Run current Backend + Generate(); + + //Report OK + BuildLog.Write("{0,30}", "[OK]"); + } + catch (Exception e) + { + //Report OK + BuildLog.Write("{0,30}", "[FAIL]"); + throw; + } + } + + protected abstract void Generate(); + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/CompilerBaseBacked.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/CompilerBaseBacked.cs new file mode 100644 index 00000000000..9c1d05417e9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/CompilerBaseBacked.cs @@ -0,0 +1,160 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public abstract class CompilerBaseBacked : Backend + { + public CompilerBaseBacked(SysGenEngine sysgen) + : base(sysgen) + { + //Initialize(); + } + + protected override void Generate() + { + CheckCompiler(); + GenerateRosCfg(); + GenerateFolders(); + //GenerateBuildNumber(); + //GenerateCompilationUnits(); + GenerateTxtSetupCustomHive(); + GenerateSysSetup(); + GenerateTxtSetup(); + GenerateDffSetup(); + } + + protected virtual void GenerateCompilationUnits() + { + foreach (RBuildModule module in SysGen.Project.Modules) + { + foreach (RBuildCompilationUnitFile unit in module.CompilationUnits) + { + using (CompilationUnitFileWriter writer = new CompilationUnitFileWriter(module , unit , SysGen.ResolveRBuildFilePath(unit))) + { + writer.WriteFile(); + } + } + } + } + + protected virtual void GenerateRosCfg() + { + Directory.CreateDirectory (Project.Path + "\\obj-i386\\include\\reactos"); + + using (HeaderRosCfgFileWriter writer = new HeaderRosCfgFileWriter(SysGen.Project, Project.Path + "\\obj-i386\\include\\reactos\\roscfg.h")) + { + writer.WriteFile(); + } + } + + protected virtual void GenerateDffSetup() + { + using (DffFileWriter writer = new DffFileWriter(Project, Project.Path + "\\obj-i386\\reactos.dff")) + { + writer.WriteFile(); + } + } + + protected virtual void GenerateBuildNumber() + { + using (DffFileWriter writer = new DffFileWriter(SysGen.Project, "c:\\buildno.h")) + { + writer.WriteFile(); + } + } + + protected virtual void GenerateTxtSetup() + { + using (TxtSetupFileWriter writer = new TxtSetupFileWriter(SysGen.Project, "c:\\txtsetup.sif")) + { + writer.WriteFile(); + } + } + + protected virtual void GenerateTxtSetupCustomHive() + { + //using (DesktopComponentSetupFileWriter writer = new DesktopComponentSetupFileWriter(SysGen.Project, Project.Path + "\\output-i386\\wallpaper.inf")) + //{ + // writer.WriteFile(); + + // RBuildSetup s = new RBuildSetup(); + + // s.InstallBase = "inf"; + // s.Name = "wallpaper.inf"; + // s.Root = PathRoot.Output; + + // Project.Files.Add(s); + //} + + //using (ShellComponentSetupFileWriter writer = new ShellComponentSetupFileWriter(SysGen.Project, Project.Path + "\\output-i386\\shell.inf")) + //{ + // writer.WriteFile(); + + // RBuildSetup s1 = new RBuildSetup(); + + // s1.InstallBase = "inf"; + // s1.Name = "shell.inf"; + // s1.Root = PathRoot.Output; + + // Project.Files.Add(s1); + //} + + using (TxtSetupHiveFileWriter writer = new TxtSetupHiveFileWriter(SysGen.Project, Project.Path + "\\output-i386\\hivecst.inf")) + { + writer.WriteFile(); + } + + RBuildBootstrapFile bs = new RBuildBootstrapFile(); + + bs.InstallBase = "reactos"; + bs.Name = "hivecst.inf"; + bs.Root = PathRoot.Output; + + Project.Files.Add(bs); + } + + protected virtual void GenerateSysSetup() + { + Directory.CreateDirectory(Project.Path + "\\output-i386\\media\\inf"); + + using (SysSetupFileWriter writer = new SysSetupFileWriter(SysGen.Project, Project.Path + "\\output-i386\\media\\inf\\syssetup.inf")) + { + writer.WriteFile(); + } + } + + private void GenerateFolders() + { + //foreach (RBuildModule module in Project.Modules) + //{ + // foreach (RBuildFolder folder in module.Folders) + // { + // if (folders.Contains(folder) == false) + // folders.Add(folder); + // } + //} + + //foreach (RBuildFolder folder in Project.Folders) + //{ + // if (folders.Contains(folder) == false) + // folders.Add(folder); + //} + + //foreach (RBuildFolder folder in folders) + //{ + // GenerateFolder(makefile, folder); + //} + } + + protected virtual void CheckCompiler() + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/HtmlDocumenterBaseBacked.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/HtmlDocumenterBaseBacked.cs new file mode 100644 index 00000000000..aac5117de0d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Base/HtmlDocumenterBaseBacked.cs @@ -0,0 +1,97 @@ +using System; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine; +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public abstract class HtmlDocumenterBaseBacked : Backend + { + public HtmlDocumenterBaseBacked(SysGenEngine sysgen) + : base(sysgen) + { + } + + public string ReportFileExtension + { + get { return "htm"; } + } + + protected string GetHtmlFileName(IRBuildNamed namedObject) + { + return string.Format("{0}.{1}", + namedObject.Name, + ReportFileExtension); + } + + protected void WriteDocumentStart(HtmlTextWriter writer, string title) + { + writer.RenderBeginTag(HtmlTextWriterTag.Html);// + writer.RenderBeginTag(HtmlTextWriterTag.Head);// + writer.RenderBeginTag(HtmlTextWriterTag.Title); // + writer.Write(title); + writer.RenderEndTag(); // + writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet"); + writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css"); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "style.css"); + writer.RenderBeginTag(HtmlTextWriterTag.Link); + writer.RenderEndTag(); + + writer.RenderEndTag(); // + writer.RenderBeginTag(HtmlTextWriterTag.Body);// + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "header"); + writer.RenderBeginTag(HtmlTextWriterTag.Div); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "default.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("ReactOS RBuild Documentation"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.P); + + if (!Project.Properties["ARCH"].IsEmpty) + { + if (!Project.Properties["SARCH"].IsEmpty) + { + writer.Write("RBuild Documentation for the '{0}' architecture, sub-architecture '{1}'. Project used '{2}'", + Project.Properties["ARCH"].Value, + Project.Properties["SARCH"].Value, + Project.RBuildFile); + } + else + { + writer.Write("RBuild Documentation for the '{0}' architecture. Project used '{1}'", + Project.Properties["ARCH"].Value, + Project.RBuildFile); + } + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + protected void WriteDocumentEnd(HtmlTextWriter writer) + { + writer.WriteBreak(); + writer.AddAttribute(HtmlTextWriterAttribute.Class, "footer"); + writer.RenderBeginTag(HtmlTextWriterTag.Div); + WriteDocumentLastUpdate(writer); + writer.RenderEndTag(); + + writer.RenderEndTag(); // + writer.RenderEndTag(); // + } + + protected void WriteDocumentLastUpdate(HtmlTextWriter writer) + { + //writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Document last updated on {0}", DateTime.Now); + //writer.RenderEndTag(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BaseAddress/BaseAddressReportBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BaseAddress/BaseAddressReportBackend.cs new file mode 100644 index 00000000000..df0cf9ebc2d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BaseAddress/BaseAddressReportBackend.cs @@ -0,0 +1,127 @@ +using System; +using System.Globalization; +using System.Text.RegularExpressions; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine.Backends +{ + public class BaseAddressReportBackend : Backend + { + private List m_Modules = new List (); + + public class BaseAddressModule + { + private FileInfo m_FileInfo = null; + private RBuildModule m_Module = null; + + public BaseAddressModule(RBuildModule module , string file) + { + m_Module = module; + m_FileInfo = new FileInfo(file); + } + + public string Name + { + get { return m_Module.Name; } + } + + public string BaseAddress + { + get { return m_Module.BaseAddress; } + } + + public long Size + { + get { return m_FileInfo.Length; } + } + + public string HexBaseAddressStart + { + get { return m_Module.BaseAddress.Replace("0x", string.Empty); } + } + + public long BaseAddressStart + { + get { return Int64.Parse(HexBaseAddressStart, NumberStyles.AllowHexSpecifier); } + } + + public long BaseAddressEnd + { + get { return m_FileInfo.Length + BaseAddressStart; } + } + } + + public BaseAddressReportBackend(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Base Address Report"; } + } + + protected override void Generate() + { + foreach (RBuildModule module in Project.Modules) + { + if (module.Type == ModuleType.Win32DLL || + module.Type == ModuleType.Win32OCX) + { + if (module.BaseAddress != module.DefaultBaseAdress) + { + BaseAddressModule baseAddressModule = new BaseAddressModule(module , SysGen.ResolveRBuildFilePath (module.TargetFile)); + + Console.WriteLine(baseAddressModule.Name); + + Console.WriteLine(" {0} {1}", + baseAddressModule.BaseAddressStart, + baseAddressModule.BaseAddressEnd); + + m_Modules.Add (baseAddressModule); + } + } + + + } + + using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "\\overlapping.txt")) + { + foreach (BaseAddressModule module in m_Modules) + { + foreach (BaseAddressModule testModule in m_Modules) + { + if (module.Name != testModule.Name) + { + if ((testModule.BaseAddressStart >= module.BaseAddressStart && testModule.BaseAddressStart <= module.BaseAddressEnd) || + (testModule.BaseAddressEnd >= module.BaseAddressStart && testModule.BaseAddressEnd <= module.BaseAddressEnd) || + (testModule.BaseAddressStart <= module.BaseAddressStart && testModule.BaseAddressEnd >= module.BaseAddressEnd)) + { + sw.WriteLine("- Module '{0}' [size '{1} and base address '{2}' [start:{3} end:{4}] is provably being overlapped by module '{5}' [size '{6} and base address '{7}' [start:{3} end:{8}]", + module.Name, + module.Size, + module.BaseAddress, + module.BaseAddressStart, + module.BaseAddressEnd, + testModule.Name, + testModule.Size, + testModule.BaseAddress, + testModule.BaseAddressStart, + testModule.BaseAddressEnd); + } + } + } + } + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BuildLogReport/BuildLogReport.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BuildLogReport/BuildLogReport.cs new file mode 100644 index 00000000000..af1fb660479 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/BuildLogReport/BuildLogReport.cs @@ -0,0 +1,109 @@ +using System; +using System.Text.RegularExpressions; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class BuildLogReportEntry + { + public string File; + public string Message; + public string Position; + public string Type; + } + + public class BuildLogReport : Backend + { + private List m_Errors = new List(); + + public BuildLogReport(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Build Log analizer"; } + } + + private List Errors + { + get { return m_Errors; } + } + + protected override void Generate() + { + using (StreamReader sr = new StreamReader(@"C:\Ros\Trunk\reactos\RosBE-Logs\BuildLog-4.1.3-20070210-0630.txt")) + { + Regex regex = new Regex(@"(.*?):(.*?): (.*?): (.*?)$", + RegexOptions.IgnoreCase | + RegexOptions.Multiline | + RegexOptions.Compiled); + + MatchCollection matches = regex.Matches(sr.ReadToEnd()); + foreach (Match match in matches) + { + BuildLogReportEntry error = new BuildLogReportEntry(); + + error.File = match.Groups[1].ToString(); + error.Position = match.Groups[2].ToString(); + error.Type = match.Groups[3].ToString(); + error.Message = match.Groups[4].ToString(); + + Errors.Add(error); + } + } + + using (StreamWriter sw = new StreamWriter(@"C:\rosbuildwarnings.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + writer.WriteLine("{0} Warnings" , Errors.Count); + + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("File"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Line/Column"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Error"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (BuildLogReportEntry report in m_Errors) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(report.File); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(report.Position); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(report.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(report.Message); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Catalog/CatalogBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Catalog/CatalogBackend.cs new file mode 100644 index 00000000000..9e2a499d2b0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Catalog/CatalogBackend.cs @@ -0,0 +1,69 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class CatalogBackend : Backend + { + public CatalogBackend(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Component catalog"; } + } + + private string CatalogFile + { + get { return Path.Combine(SysGen.BaseDirectory, "catalog.xml"); } + } + + protected override void Generate() + { + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(CatalogFile, Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteComment("File autogenerated by " + AppInfo); + writer.WriteStartElement("modules"); + + foreach (RBuildModule module in Project.Modules) + { + writer.WriteStartElement("module"); + writer.WriteAttributeString("name", module.Name); + writer.WriteAttributeString("type", module.Type.ToString()); + writer.WriteAttributeString("base", module.Base); + writer.WriteAttributeString("path", module.Path); + writer.WriteAttributeString("desc", module.Description); + + writer.WriteStartElement("dependencies"); + foreach (RBuildModule library in module.Libraries) + { + writer.WriteStartElement("dependency"); + writer.WriteAttributeString("name", library.Name); + writer.WriteEndElement(); + } + writer.WriteEndElement(); + + writer.WriteEndElement(); + } + + writer.WriteEndElement(); + writer.WriteEndDocument(); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Html/HtmlBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Html/HtmlBackend.cs new file mode 100644 index 00000000000..02f40a102f9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Html/HtmlBackend.cs @@ -0,0 +1,2743 @@ +using System; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Drawing; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class HtmlBackend : HtmlDocumenterBaseBacked + { + public HtmlBackend(SysGenEngine sysgen) + : base(sysgen) + { + try + { + if (Directory.Exists(@"C:\rosDoc")) + Directory.Delete(@"C:\rosDoc", true); + + Directory.CreateDirectory(@"C:\rosDoc"); + + File.Copy(@"c:\style.css", @"c:\rosDoc\style.css"); + } + catch (Exception) + { + } + } + + protected override string FriendlyName + { + get { return "HTML Report"; } + } + + private void GenerateFrontPage() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\default.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "RBuild Auto Documentation"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Modules"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "platform.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Platform"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Quick platform overview."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "modules.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Modules"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("ReactOS is a modular operating system, made of components that collaborate with each other."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "baseaddresses.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Base Addresses"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Memory address serving as a reference point for other addresses."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "dllbaseaddresses.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("DLL Base Addresses"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Base addresses used in ReactOS dlls."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "properties.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Properties"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Properties used during the build process."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "defines.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Project Defines"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Global defines."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "depmap.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Dependency map"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Graphically represents interdependencies between modules."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "files.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Files"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Files included for current platform."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "installfolders.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Install Folders"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Install folders created during ReactOS setup."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "installfiles.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Install Files"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Install files created during ReactOS setup."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "authors.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Authors"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Individuals who have contributed time and energy to supporting the ReactOS Project."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "unicodemodules.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Unicode"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Modules supporting UNICODE builds"); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "localizations.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Localizations"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Languages and cultures currently supported by ReactOS"); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "codestats.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Stats"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Basic ReactOS code base statistics"); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "warnings.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("RBuild Warnings"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Warnings and inconsistencies detected by rbuild."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "buildsummary.htm"); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("Build Summary"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write("Options and build settings per module."); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateDependencyMap() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\depmap.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Module Dependency Map"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Module Dependency Map"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.B); + writer.Write("Direct Dependencies :"); + writer.RenderEndTag(); + writer.Write("Dependencies and libraries this module is using"); + + writer.RenderBeginTag(HtmlTextWriterTag.Br); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.B); + writer.Write("Full Dependencies :"); + writer.RenderEndTag(); + writer.Write("Dependencies and libraries this module and it's dependencies are using"); + + SysGenDependencyTracker dependencyTracker = null; + + foreach (RBuildModule module in Project.Platform.Modules) + { + dependencyTracker = new SysGenDependencyTracker(Project, module); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("{0}", module.Name); + writer.RenderEndTag(); + + writer.AddAttribute("name", module.Name); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Blockquote); + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Direct Dependencies"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule dependency in module.Needs) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "#" + dependency.Name); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("{0} - ({1} Dependencies , {2} Libraries , {3} Requeriments)", + dependency.Name, + dependency.Dependencies.Count, + dependency.Libraries.Count, + dependency.Requeriments.Count); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Full Dependencies"); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule dependency in dependencyTracker.DependsOn) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, "#" + dependency.Name); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write("{0} - ({1} Dependencies , {2} Libraries , {3} Requeriments)", + dependency.Name, + dependency.Dependencies.Count, + dependency.Libraries.Count, + dependency.Requeriments.Count); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + } + } + + private void GenerateModulesBuildSummary() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\buildsummary.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Modules"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Modules"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Libraries"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Dependencies"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("CFLAGS"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("LFLAGS"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + + foreach (RBuildModule library in module.Libraries) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, library.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(library.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + + foreach (RBuildModule dependency in module.Dependencies) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + + foreach (string flag in module.CompilerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(flag); + writer.RenderEndTag(); + } + + foreach (string flag in Project.CompilerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(flag); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + + foreach (string flag in module.LinkerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(flag); + writer.RenderEndTag(); + } + + foreach (string flag in Project.LinkerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(flag); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateModules() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\modules.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Modules"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Modules"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Unicode"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("C++"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("PCH"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Target"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Install Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Install Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("RBuild"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Unicode); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.CPlusPlus); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PCH); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.InstallName); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.RBuildPath); + writer.RenderEndTag(); + + writer.RenderEndTag(); + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateStats() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\codestats.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Stats"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Stats"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Modules"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(Project.Modules.Count); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateWarnings() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\warnings.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Warnings"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Warnings"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Unicode == false) + { + if ((module.Defines.IsDefined("UNICODE")) || + (module.Defines.IsDefined("_UNICODE")) || + (module.Defines.IsDefined("_UNICODE_"))) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' has unicode defines but 'Unicode' property set to 'False'", module.Name); + writer.RenderEndTag(); + } + } + + foreach (RBuildDefine define in Project.Defines) + { + if (module.Defines.IsDefined(define.Name)) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' defines '{1}' already inherited from project ", module.Name, define.Name); + writer.RenderEndTag(); + } + } + + foreach (string flag in Project.CompilerFlags) + { + if (module.CompilerFlags.Contains(flag)) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' has compiler flag '{1}' already inherited from project ", module.Name, flag); + writer.RenderEndTag(); + } + } + + foreach (string flag in Project.LinkerFlags) + { + if (module.LinkerFlags.Contains(flag)) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' has linker flag '{1}' already inherited from project ", module.Name, flag); + writer.RenderEndTag(); + } + } + + foreach (RBuildFolder include in module.IncludeFolders) + { + if (Project.IncludeFolders.Contains(include)) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' includes folder '({1}){2}' already inherited from project ", module.Name, include.Root, include.FullPath); + writer.RenderEndTag(); + } + + if (include.Root == PathRoot.Default || + include.Root == PathRoot.SourceCode) + { + if (SysGen.RBuildFolderExists(include) == false) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.WriteLine("Module '{0}' includes folder '({1}){2}' which could not be found ", module.Name, include.Root, include.FullPath); + writer.RenderEndTag(); + } + } + } + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateFiles() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\files.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Modules"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Path"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Install Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("New Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildOutputFile file in Project.Files) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.NewFile.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.GetType().Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateBaseAddresses() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\baseaddresses.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "BaseAdress"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Base Adress"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Value"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildProperty property in SysGen.Project.Properties) + { + if (property is RBuildBaseAdress) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.Value); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateDllBaseAddresses() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\dllbaseaddresses.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Dll's base addresses"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Dll's base addresses"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base Adress"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Is Default"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.IsDLL) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.BaseAddress); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.IsDefaultBaseAdress); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + } + } + } + + private void GenerateDefines() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\defines.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Project Defines"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Project Defines"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Value"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildDefine define in Project.Defines) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Value); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateProperties() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\properties.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Properties"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Properties"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Value"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Read-Only"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Internal"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildProperty property in SysGen.Project.Properties) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.Value); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.ReadOnly); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.Internal); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(property.GetType().Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateInstallFiles() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\installfiles.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Install Files"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Install Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("ID"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Enabled) + { + if (module.IsInstallable) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetFile.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + foreach (RBuildOutputFile file in module.Files) + { + RBuildPlatformFile platformFile = file as RBuildPlatformFile; + + if (platformFile != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(platformFile.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(platformFile.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + } + + foreach (RBuildOutputFile file in Project.Files) + { + RBuildPlatformFile platformFile = file as RBuildPlatformFile; + + if (platformFile != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(platformFile.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(platformFile.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateInstallFolders() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\installfolders.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Folders"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Install Folders"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("ID"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildInstallFolder folder in Project.InstallFolders) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.ID); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateAuthors() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\authors.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Authors"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("ReactOS Authors"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Alias"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Mail"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("City"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Country"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Active"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildContributor contributor in Project.Contributors) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + + if (contributor.Alias != null) + { + writer.AddAttribute(HtmlTextWriterAttribute.Href, contributor.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(contributor.Alias); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(contributor.FullName); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(contributor.Mail); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(contributor.City); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(contributor.Country); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(contributor.Active); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateContributors() + { + foreach (RBuildContributor contributor in Project.Contributors) + { + if (contributor.Alias != null) + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\" + contributor.HtmlDocFileName)) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Authors"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("ReactOS Authors"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Roles"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Authors.GetByName(contributor.Alias) != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildAuthor author in module.Authors) + { + if (author.Contributor == contributor) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(author.Role); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + } + } + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + } + } + + private void GenerateLocalizations() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\localizations.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Translations"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Available Languages"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("ID"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("ThreeLetter ISO"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildLanguage language in Project.Languages) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(language.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(language.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(language.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Localization by Module"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + + foreach (RBuildLanguage language in Project.Languages) + { + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write(language.Name); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildLanguage language in Project.Languages) + { + RBuildLocalizationFile localization = module.LocalizationFiles.GetByName(language.Name); + + if (localization != null) + { + if (localization.Dirty) + { + writer.AddAttribute(HtmlTextWriterAttribute.Class, "Red"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("Yes"); + writer.RenderEndTag(); + } + else + { + writer.AddAttribute(HtmlTextWriterAttribute.Class, "Green"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("Yes"); + writer.RenderEndTag(); + } + } + else + { + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("No"); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + } + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + private void GenerateModulePages() + { + foreach (RBuildModule module in Project.Platform.Modules) + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\" + module.HtmlDocFileName)) + { + // Creates an XML file is not exist + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, module.Name); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Module : {0}", module.Name); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Entry Point"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.EntryPoint); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("C++"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.CPlusPlus); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base Adress"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.BaseAddress); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Unicode"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Unicode); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Target Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type.ToString()); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + + if (module.Families.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Families this module belong"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildFamily family in module.Families) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, ""); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(family.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Folders.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Folders"); + writer.RenderEndTag(); + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildFolder folder in module.Folders) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.FullPath); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.IsBuildable) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Output Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("File"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + if (module.TargetFile != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetFile.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetFile.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.TargetFile.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.Install != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Install.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Install.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Install.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.PlatformInstall != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PlatformInstall.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PlatformInstall.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PlatformInstall.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Authors.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Authors"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Alias"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Full Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Mail"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Role"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildAuthor author in module.Authors) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, author.Contributor.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(author.Contributor.Alias); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(author.Contributor.FullName); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(author.Contributor.Mail); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(author.Role); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Metadata != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Metadata"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Description"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Metadata.Description); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.AutoRegister != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("COM Auto register"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Register Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.AutoRegister.Type.ToString()); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("SysSetup INF Section"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.AutoRegister.InfSection); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.ImportLibrary != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("DLL Import"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.ImportLibrary.Root); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.ImportLibrary.Base); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Definition"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.ImportLibrary.Definition); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Import Dll Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.ImportLibrary.DllName); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.Bootstrap != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("CD Bootstrap"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Install Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Bootstrap.InstallBase); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Path"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Bootstrap.FullPath); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("New name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Bootstrap.NewName); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (module.Dependencies.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Dependencies"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule dependency in module.Dependencies) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Libraries.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Libraries"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule dependency in module.Libraries) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Requeriments.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Requeriments"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule dependency in module.Requeriments) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + SysGenDependencyTracker dependencyTracker = new SysGenDependencyTracker(Project,module); + + if (dependencyTracker.DependsOn.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Depdends On"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule dependency in dependencyTracker.DependsOn) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (dependencyTracker.DependencyOf.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Dependency Of"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildModule dependency in dependencyTracker.DependencyOf) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, dependency.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(dependency.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(dependency.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Include Folders"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildFolder folder in module.IncludeFolders) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + foreach (RBuildFolder folder in Project.IncludeFolders) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(folder.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.TrueString); + writer.RenderEndTag(); + + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + if (module.LocalizationFiles.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Localizations"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("ISO Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Resource"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Outdated"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildLocalizationFile localization in module.LocalizationFiles) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(localization.CultureInfo.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(localization.CultureInfo.EnglishName); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(localization.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(localization.Dirty); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.Defines.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Defines"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Value"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildDefine define in module.Defines) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Value); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + foreach (RBuildDefine define in Project.Defines) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Name); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(define.Value); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.TrueString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + } + + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Linker Flags"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Flag"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (string flag in module.LinkerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(flag); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + foreach (string flag in Project.LinkerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(flag); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.TrueString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + if (module.LinkerScript != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Linker Script"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.LinkerScript.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.LinkerScript.FullPath); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + } + + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("CompilerFlags Flags"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Flag"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Inherited"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (string flag in module.CompilerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(flag); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + foreach (string flag in Project.CompilerFlags) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(flag); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.TrueString); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + if (module.Files.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Path"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Install Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("New Name"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildOutputFile file in module.Files) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.InstallBase); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.NewFile.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.GetType().Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + } + + if (module.SourceFiles.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Source Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Source Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Switches"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + foreach (RBuildSourceFile file in module.SourceFiles) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.FullPath); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(file.Switches); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderEndTag(); + + if (module.PreCompiledHeader != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Precompiled Header"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Root"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Source Type"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PreCompiledHeader.Root); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PreCompiledHeader.Type); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.PreCompiledHeader.FullPath); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + } + } + + WriteDocumentEnd(writer); + } + } + } + } + + private void GenerateUnicodeModules() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\unicodemodules.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Unicode"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Unicode Modules"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Unicode) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write("Non-Unicode Modules"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Module"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Base"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Type"); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (!module.Unicode) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.Name); + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Base); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(module.Type); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + + writer.RenderEndTag(); + + + WriteDocumentEnd(writer); + } + } + } + + private void GeneratePlatformFrontPage() + { + using (StreamWriter sw = new StreamWriter(@"C:\rosDoc\platform.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteDocumentStart(writer, "Platform"); + + writer.RenderBeginTag(HtmlTextWriterTag.H2); + writer.Write(Project.Platform.Name); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.P); + writer.Write(Project.Platform.Description); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Modules"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.WriteLine("{0} out of {1}", Project.Platform.Modules.Count, Project.Modules.Count); + writer.RenderEndTag(); + writer.RenderEndTag(); + + if (Project.Platform.Shell != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Shell"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(Project.Platform.Shell.InstallName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (Project.Platform.Screensaver != null) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Screen Saver"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(Project.Platform.Screensaver.InstallName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (Project.Platform.Languages.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Languages"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildLanguage language in Project.Platform.Languages) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(language.Name); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + if (Project.Platform.DebugChannels.Count > 0) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Debug Channels"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildDebugChannel channel in Project.Platform.DebugChannels) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(channel.Name); + writer.RenderEndTag(); + } + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Platform Profiles"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.ModuleGroup) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.Write(module.Description); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Debug Build"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.TrueString); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Kernel Debug"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(bool.FalseString); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.H3); + writer.Write("Files"); + writer.RenderEndTag(); + + writer.AddAttribute(HtmlTextWriterAttribute.Class, "table"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("GUI Applications"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Console Applications"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Dlls"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Drivers"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("Keyboard Layouts"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("KernelMode DLLs"); + writer.RenderEndTag(); + writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.Write("OCX & TypeLibs"); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.Win32GUI) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.Win32CUI) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.Win32DLL) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.KernelModeDriver) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.KeyboardLayout) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.KernelModeDLL) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.RenderBeginTag(HtmlTextWriterTag.Ul); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.Win32OCX || module.Type == ModuleType.EmbeddedTypeLib) + { + writer.RenderBeginTag(HtmlTextWriterTag.Li); + writer.AddAttribute(HtmlTextWriterAttribute.Href, module.HtmlDocFileName); + writer.RenderBeginTag(HtmlTextWriterTag.A); + writer.Write(module.TargetName); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + + writer.RenderEndTag(); + + WriteDocumentEnd(writer); + } + } + } + + protected override void Generate() + { + GenerateFrontPage(); + GeneratePlatformFrontPage(); + GenerateModules(); + GenerateProperties(); + GenerateModulesBuildSummary(); + GenerateStats(); + //GenerateDependencyMap(); + GenerateWarnings(); + GenerateFiles(); + GenerateBaseAddresses(); + GenerateDllBaseAddresses(); + GenerateDefines(); + GenerateInstallFolders(); + GenerateInstallFiles(); + GenerateAuthors(); + GenerateContributors(); + GenerateLocalizations(); + GenerateModulePages(); + GenerateUnicodeModules(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/MSVisualStudio.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/MSVisualStudio.cs new file mode 100644 index 00000000000..c1744aad138 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/MSVisualStudio.cs @@ -0,0 +1,45 @@ +using System; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Framework.VisualStudio; +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class MSVisualStudio : Backend + { + public MSVisualStudio(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Visual Studio 6.0-2005"; } + } + + protected override void Generate() + { + VSSolution solution = new VSSolution(); + + solution.Name = "ReactOS"; + solution.FileName = "reactos.sln"; + + foreach (RBuildModule module in SysGen.Project.Modules) + { + VSProject project = new VSProject(); + + //project.Name = module.Name; + project.FileName = module.Name + ".vcproj"; + + solution.Projects.Add(project); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/VisualStudio/Solution.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/VisualStudio/Solution.cs new file mode 100644 index 00000000000..00ececbee87 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/MSVisualStudio/VisualStudio/Solution.cs @@ -0,0 +1,703 @@ +using System; +using System.IO; +using System.Xml; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.BuildEngine.Framework.VisualStudio +{ + public enum VisualStudioVersion + { + VS6, + VS2002, + VS2003, + VS2005 + } + + #region ProjectFile + public class ProjectFile + { + private string relPath = ""; + private string basePath = ""; + private string buildAction = ""; + private string subType = ""; + + public string AbsolutePath + { + get + { + return Path.Combine(basePath, relPath); + } + } + public string AbsoluteDirectory + { + get + { + return Path.GetDirectoryName(Path.Combine(basePath, relPath)); + } + } + + public string RelativePath + { + get + { + return relPath; + } + } + + public string BasePath + { + get + { + return basePath; + } + } + public string BuildAction + { + get + { + return buildAction; + } + } + public string SubType + { + get + { + return subType; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder("\nProject File:"); + buff.Append("\n\tRelativePath:"); + buff.Append(relPath); + buff.Append("\n\tBuildAction:"); + buff.Append(buildAction); + buff.Append("\n\tSubType:"); + buff.Append(subType); + buff.Append("\n\tBasePath:"); + buff.Append(basePath); + return buff.ToString(); + } + + public ProjectFile( + string relPath, + string buildAction, + string subType, + string basePath) + { + this.relPath = relPath; + this.buildAction = buildAction; + this.subType = subType; + this.basePath = basePath; + } + } + #endregion + + #region ProjectFileCollection + public class ProjectFileCollection : ReadOnlyCollectionBase + { + public ProjectFile this[int index] + { + get + { + return (ProjectFile)this.InnerList[index]; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProjectFileCollection"); + foreach (ProjectFile pf in this.InnerList) + { + buff.Append(pf.ToString()); + } + return buff.ToString(); + } + + public ProjectFileCollection(ProjectFile[] projectFileArray) + { + foreach (ProjectFile projectFile in projectFileArray) + { + this.InnerList.Add(projectFile); + } + } + + + } + #endregion + + #region ProjectReference + public class ProjectReference + { + private string name = ""; + private string assemblyName = ""; + private string hintPath = ""; + private string basePath = ""; + + public string Name + { + get + { + return this.name; + + } + } + public string AssemblyName + { + get + { + return this.assemblyName; + } + } + public string HintPath + { + get + { + return this.hintPath; + } + } + public string AbsolutePath + { + get + { + return Path.Combine(this.basePath, this.hintPath); + } + } + + public string BasePath + { + get + { + return this.basePath; + } + } + public override string ToString() + { + StringBuilder buff = new StringBuilder("\nReference:"); + buff.Append("\n\tName"); + buff.Append(name); + buff.Append("\n\tAssemblyName"); + buff.Append(assemblyName); + buff.Append("\n\tHintPath:"); + buff.Append(hintPath); + buff.Append("\n\tBasePath:"); + buff.Append(basePath); + return buff.ToString(); + } + + public ProjectReference(string name, + string assemblyName, + string hintPath, + string basePath) + { + this.name = name; + this.assemblyName = assemblyName; + this.hintPath = hintPath; + this.basePath = basePath; + } + + } + #endregion + + #region ProjectReferenceCollection + public class ProjectReferenceCollection : ReadOnlyCollectionBase + { + public ProjectReference this[int index] + { + get + { + return (ProjectReference)this.InnerList[index]; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProjectReferenceCollection"); + foreach (ProjectReference pr in this.InnerList) + { + buff.Append(pr.ToString()); + } + return buff.ToString(); + } + + public ProjectReferenceCollection(ProjectReference[] + projectReferenceArray) + { + foreach (ProjectReference projectReference in projectReferenceArray) + { + this.InnerList.Add(projectReference); + } + } + + } + #endregion + + #region ProjectConfigItem + public class ProjectConfigItem + { + private string key = ""; + private string keyValue = ""; + + public string Key + { + get + { + return key; + } + } + public string Value + { + get + { + return keyValue; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProjectConfigItem:"); + buff.Append("\n\tKey:"); + buff.Append(key); + buff.Append("\n\tValue:"); + buff.Append(keyValue); + return buff.ToString(); + } + + public ProjectConfigItem(string key, string keyValue) + { + this.key = key; + this.keyValue = keyValue; + + } + } + #endregion + + #region ProjectConfigItemCollection + public class ProjectConfigItemCollection : ReadOnlyCollectionBase + { + private string basePath = ""; + + public string Name + { + get + { + string name = ""; + foreach (ProjectConfigItem pc in this.InnerList) + { + if (pc.Key.Equals("Name")) + { + name = pc.Value; + break; + } + } + return name; + } + } + + public string OutputRelPath + { + get + { + string relPath = ""; + foreach (ProjectConfigItem pc in this.InnerList) + { + if (pc.Key.Equals("OutputPath")) + { + relPath = pc.Value; + break; + } + } + return relPath; + } + } + + public string OutputAbsolutePath + { + get + { + string absPath = OutputRelPath; + absPath = Path.Combine(this.basePath, absPath); + return absPath.Replace("\\.\\", ""); + } + } + + public ProjectConfigItem this[int index] + { + get + { + return (ProjectConfigItem)this.InnerList[index]; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProjectConfigItemCollection:"); + foreach (ProjectConfigItem pc in this.InnerList) + { + buff.Append(pc.ToString()); + } + return buff.ToString(); + } + + public ProjectConfigItemCollection(ProjectConfigItem[] + projectConfigItemArray, string basePath) + { + this.basePath = basePath; + foreach (ProjectConfigItem pc in projectConfigItemArray) + { + this.InnerList.Add(pc); + } + + } + } + #endregion + + #region ProjectConfigCollection + public class ProjectConfigCollection : ReadOnlyCollectionBase + { + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProjectConfigCollection:"); + foreach (ProjectConfigItemCollection pc in this.InnerList) + { + buff.Append(pc.ToString()); + } + return buff.ToString(); + } + + public ProjectConfigItemCollection this[int index] + { + get + { + return (ProjectConfigItemCollection)this.InnerList[index]; + } + } + + public ProjectConfigCollection(XmlNodeList configItems, string basePath) + { + if (configItems.Count > 0) + { + foreach (XmlNode configItem in configItems) + { + // create an array of items: + ProjectConfigItem[] projectConfigItemArray = new + ProjectConfigItem[configItem.Attributes.Count]; + int i = 0; + foreach (XmlAttribute attrib in configItem.Attributes) + { + projectConfigItemArray[i] = new + ProjectConfigItem(attrib.Name, attrib.Value); + i++; + } + // create a ProjectConfigItemCollection: + ProjectConfigItemCollection projectConfigItemCollection = new + ProjectConfigItemCollection(projectConfigItemArray, basePath); + this.InnerList.Add(projectConfigItemCollection); + } + } + } + } + #endregion + + #region Project + public class VSProject : VSItem + { + private string basePath = ""; + private string projectBasePath = ""; + private string projectFileName = ""; + private string projectGuid = ""; + private string projectConfigurationGuid = ""; + private string projectName = ""; + private string projectType = ""; + private ProjectConfigCollection configCollection = null; + private ProjectReferenceCollection referenceCollection = null; + private ProjectFileCollection fileCollection = null; + + public string AbsolutePath + { + get + { + return Path.Combine(basePath, projectFileName); + } + } + + public string AbsoluteDirectory + { + get + { + return basePath; + } + } + + public ProjectConfigCollection Configurations + { + get + { + return configCollection; + } + } + public ProjectReferenceCollection ReferenceCollection + { + get + { + return referenceCollection; + } + } + public ProjectFileCollection FileCollection + { + get + { + return fileCollection; + } + } + + public string RelPath + { + get + { + return projectFileName; + } + } + + public string Guid + { + get + { + return projectGuid; + } + } + + public string ConfigurationGuid + { + get + { + return projectConfigurationGuid; + } + } + + public string Name + { + get + { + return projectName; + } + } + + public string ProjectType + { + get + { + return projectType; + } + } + + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProject:"); + buff.Append("\n\tName:"); + buff.Append(projectName); + buff.Append("\n\tFileName:"); + buff.Append(projectFileName); + buff.Append("\n\tBasePath:"); + buff.Append(basePath); + buff.Append("\n\tGuid:"); + buff.Append(projectGuid); + buff.Append("\nConfiguration:"); + buff.Append(configCollection.ToString()); + buff.Append("\nReferences:"); + buff.Append(referenceCollection.ToString()); + buff.Append("\nFiles:"); + buff.Append(fileCollection.ToString()); + return buff.ToString(); + } + } + #endregion + + #region ProjectCollection + public class ProjectCollection : List + { + public override string ToString() + { + StringBuilder buff = new StringBuilder(); + buff.Append("\nProject Collection:"); + foreach (VSProject p in this) + { + buff.Append(p.ToString()); + } + return buff.ToString(); + } + } + #endregion + + #region Solution + public class VSSolution : VSItem + { + private string solutionFileName = ""; + private string solutionDirectory = ""; + private string solutionFileVersion = ""; + private ProjectCollection projectCollection = null; + + public string LongestSharedPath + { + get + { + // find the longest path which is shared by all of the + // objects in the project (if any) + string longestSharedPath = solutionDirectory; + foreach (VSProject p in projectCollection) + { + string projectDir = p.AbsoluteDirectory; + longestSharedPath = getMinimumSharedPath(longestSharedPath, + projectDir); + foreach (ProjectFile pf in p.FileCollection) + { + string fileDir = pf.AbsoluteDirectory; + longestSharedPath = getMinimumSharedPath(longestSharedPath, + fileDir); + } + } + return longestSharedPath; + } + } + + private string getMinimumSharedPath( + string sharedPath, + string newPath + ) + { + string retSharedPath = ""; + if (sharedPath.Length > 0) + { + string[] sharedPathParts = sharedPath.Split( + (new char[] {Path.DirectorySeparatorChar, + Path.AltDirectorySeparatorChar })); + string[] newPathParts = newPath.Split( + (new char[] {Path.DirectorySeparatorChar, + Path.AltDirectorySeparatorChar})); + int max = Math.Min(sharedPathParts.Length, newPathParts.Length); + int sharedCount = 0; + for (int i = 0; i < max; i++) + { + if + (!sharedPathParts[i].ToUpper().Equals(newPathParts[i].ToUpper()) + ) + { + break; + } + else + { + sharedCount = i + 1; + } + } + if (sharedCount == 0) + { + return ""; + } + else + { + for (int i = 0; i < sharedCount; i++) + { + if (retSharedPath.Length > 0) + { + retSharedPath += Path.DirectorySeparatorChar; + } + retSharedPath += sharedPathParts[i]; + } + } + } + return retSharedPath; + } + + public string FileVersion + { + get + { + return solutionFileVersion; + } + } + + public ProjectCollection Projects + { + get + { + return projectCollection; + } + } + + public string FileName + { + get + { + return solutionFileName; + } + set + { + solutionFileName = value; + } + } + + public string BasePath + { + get + { + return solutionDirectory; + } + } + + public override string ToString() + { + StringBuilder s = new StringBuilder(); + s.Append("\nSolution:"); + s.Append("\nFileName:"); + s.Append(solutionFileName); + s.Append("\nVersion:"); + s.Append(solutionFileVersion); + if (projectCollection != null) + { + s.Append(projectCollection.ToString()); + } + return s.ToString(); + } + + public VSSolution() + { + } + + public VSSolution(string fileName) + { + solutionFileName = fileName; + } + } + #endregion + + public class VSItem + { + private string m_Name = null; + private string m_FileName = null; + + public string Name + { + get { return m_Name; } + set { m_Name = value; } + } + + public string FileName + { + get { return m_FileName; } + set { m_FileName = value; } + } + + public void SaveAs(VisualStudioVersion version) + { + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/CompilableFile.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/CompilableFile.cs new file mode 100644 index 00000000000..c4451fceeab --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/CompilableFile.cs @@ -0,0 +1,621 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Tasks; + +namespace SysGen.BuildEngine.Backends +{ + public class BackedBuildIncludeFolder : BackedBuildFolder + { + public BackedBuildIncludeFolder(RBuildFolder folder, SysGenEngine sysgen) + : base(sysgen) + { + m_RBuildFile = folder; + } + } + + public class BackendBuildFile : BackendBuildFileSystemInfo + { + public BackendBuildFile(SysGenEngine sysgen) + : base(sysgen) + { + m_RBuildFile = new RBuildFile(); + } + + public string GetPathWithNewExtension(PathRoot root, string newExtension) + { + return GetPath(root, BuildFile.Name, newExtension); + } + + public string GetPathWithNewName(PathRoot root, string newName) + { + return GetPath(root, newName, Path.GetExtension(BuildFile.Name)); + } + + public string GetPath(PathRoot root, string newName, string newExtension) + { + return Path.Combine(SysGen.GetPathRoot(root), Path.ChangeExtension(newName, newExtension)); + } + + public string IntermediateFolderFullPath + { + get { return Path.Combine(SysGen.GetPathRoot(PathRoot.Intermediate), BuildFile.Base) /*+ @"\."*/; } + } + + public string BaseFolderFullPath + { + get { return Path.Combine(SysGen.GetPathRoot(PathRoot.SourceCode), BuildFile.Base) /*+ @"\."*/; } + } + + public RBuildFile BuildFile + { + get { return m_RBuildFile as RBuildFile; } + } + } + + public class BackedBuildFolder : BackendBuildFileSystemInfo + { + public BackedBuildFolder(RBuildFolder folder, SysGenEngine sysgen) + : base(sysgen) + { + m_RBuildFile = folder; + } + + public BackedBuildFolder(SysGenEngine sysgen) + : base(sysgen) + { + m_RBuildFile = new RBuildFolder(); + } + + public RBuildFolder BuildFolder + { + get { return m_RBuildFile as RBuildFolder; } + } + } + + public abstract class BackendBuildFileSystemInfo + { + protected RBuildFileSystemInfo m_RBuildFile = null; + protected SysGenEngine m_SysGenEngine = null; + + public BackendBuildFileSystemInfo(SysGenEngine sysgen) + { + m_SysGenEngine = sysgen; + } + + public SysGenEngine SysGen + { + get { return m_SysGenEngine; } + } + + public string RelativePath + { + get { return SysGen.NormalizePath(m_RBuildFile.FullPath); } + } + + public string GetPath(PathRoot root) + { + return Path.Combine(SysGen.GetPathRoot(root), RelativePath); + } + + public string OriginalFullPath + { + get { return Path.Combine(SysGen.GetPathRoot(m_RBuildFile.Root), RelativePath); } + } + + public string BaseFullPath + { + get { return Path.Combine(SysGen.BaseDirectory, RelativePath); } + } + + public string IntermediateFullPath + { + get { return Path.Combine(SysGen.IntermediateDirectory, RelativePath); } + } + + public string OutputFullPath + { + get { return Path.Combine(SysGen.OutputDirectory, RelativePath); } + } + + public string BootCDOutputDirectory + { + get { return Path.Combine(SysGen.BootCDOutputDirectory, RelativePath); } + } + + public string TemporaryFullPath + { + get { return Path.Combine(SysGen.TemporaryDirectory, RelativePath); } + } + + public string InstallFullPath + { + get { return Path.Combine(SysGen.InstallDirectory, RelativePath); } + } + + public RBuildModule Module + { + get { return m_RBuildFile.Element as RBuildModule; } + } + } + + public class SourceFile : BackendBuildModule + { + RBuildSourceFile m_File = null; + BackendBuildFile m_SourceCodeFile = null; + BackendBuildFile m_SourceCodeObjectFile = null; + BackendBuildFile m_SourceCodeActualFile = null; + BackendBuildFile m_SourceCodeHeaderFile = null; + BackendBuildFile m_SourceCodePCHeaderFile = null; + BackendBuildFile m_SourceRpcClientHeaderFile = null; + BackendBuildFile m_SourceRpcServerHeaderFile = null; + BackendBuildFile m_SourceMessageTableHeaderFile = null; + BackendBuildFile m_SourceMessageTableResourceFile = null; + BackendBuildFile m_PCH = null; + BackendBuildFile m_PCHTemp = null; + + public SourceFile(RBuildSourceFile file, RBuildModule module, SysGenEngine sysgen) + : base(module, sysgen) + { + m_File = file; + + m_SourceCodeFile = new BackendBuildFile(sysgen); + m_SourceCodeFile.BuildFile.Name = file.Name; + m_SourceCodeFile.BuildFile.Element = module; + m_SourceCodeFile.BuildFile.Base = file.Base; + m_SourceCodeFile.BuildFile.Root = file.Root; + + m_SourceCodeObjectFile = new BackendBuildFile(sysgen); + m_SourceCodeObjectFile.BuildFile.Name = GetObjectFileName(file); + m_SourceCodeObjectFile.BuildFile.Element = module; + m_SourceCodeObjectFile.BuildFile.Base = file.Base; + + m_SourceCodeActualFile = new BackendBuildFile(sysgen); + m_SourceCodeActualFile.BuildFile.Name = GetActualSourceFile(file); + m_SourceCodeActualFile.BuildFile.Element = module; + m_SourceCodeActualFile.BuildFile.Base = file.Base; + + m_SourceCodeHeaderFile = new BackendBuildFile(sysgen); + m_SourceCodeHeaderFile.BuildFile.Name = GetHeaderFile(file); + m_SourceCodeHeaderFile.BuildFile.Element = module; + m_SourceCodeHeaderFile.BuildFile.Base = file.Base; + + m_SourceRpcClientHeaderFile = new BackendBuildFile(sysgen); + m_SourceRpcClientHeaderFile.BuildFile.Name = GetRpcClientHeaderFile(file); + m_SourceRpcClientHeaderFile.BuildFile.Element = module; + m_SourceRpcClientHeaderFile.BuildFile.Base = file.Base; + + m_SourceRpcServerHeaderFile = new BackendBuildFile(sysgen); + m_SourceRpcServerHeaderFile.BuildFile.Name = GetRpcServerHeaderFile(file); + m_SourceRpcServerHeaderFile.BuildFile.Element = module; + m_SourceRpcServerHeaderFile.BuildFile.Base = file.Base; + + m_SourceMessageTableHeaderFile = new BackendBuildFile(sysgen); + m_SourceMessageTableHeaderFile.BuildFile.Name = GetMessageTableHeaderFile(file); + m_SourceMessageTableHeaderFile.BuildFile.Element = module; + m_SourceMessageTableHeaderFile.BuildFile.Base = /*file.Base; //*/ "include/reactos"; + + m_SourceMessageTableResourceFile = new BackendBuildFile(sysgen); + m_SourceMessageTableResourceFile.BuildFile.Name = GetMessageTableResourceFile(file); + m_SourceMessageTableResourceFile.BuildFile.Element = module; + m_SourceMessageTableResourceFile.BuildFile.Base = file.Base; + } + + public string GetMessageTableResourceFile(RBuildFile file) + { + return Path.GetFileNameWithoutExtension(file.Name) + ".rc"; + } + + public string GetMessageTableHeaderFile(RBuildFile file) + { + return Path.GetFileNameWithoutExtension(file.Name) + ".h"; + } + + public string GetRpcServerHeaderFile(RBuildFile file) + { + return Path.GetFileNameWithoutExtension(file.Name) + "_s.h"; + } + + public string GetRpcClientHeaderFile(RBuildFile file) + { + return Path.GetFileNameWithoutExtension(file.Name) + "_c.h"; + } + + public string GetRpcProxyHeaderFile(RBuildFile file) + { + return Path.GetFileNameWithoutExtension(file.Name) + "_p.h"; + } + + private string GetHeaderFile(RBuildFile file) + { + switch (file.Extension) + { + case ".idl": + { + if (Module.Type == ModuleType.RpcServer) + return GetRpcServerHeaderFile(file); + + if (Module.Type == ModuleType.RpcClient) + return GetRpcClientHeaderFile(file); + + if (Module.Type == ModuleType.RpcProxy) + return GetRpcProxyHeaderFile(file); + + return Path.ChangeExtension(file.Name, ".h"); + } + break; + default: + return file.Name; + } + } + + private string GetActualSourceFile(RBuildFile file) + { + switch (file.Extension) + { + case ".spec": + return Path.ChangeExtension(file.Name, ".stubs.c"); + break; + case ".idl": + { + if (Module.Type == ModuleType.RpcServer) + return Path.GetFileNameWithoutExtension(file.Name) + "_s.c"; + + if (Module.Type == ModuleType.RpcClient) + return Path.GetFileNameWithoutExtension(file.Name) + "_c.c"; + + if (Module.Type == ModuleType.RpcProxy) + return Path.GetFileNameWithoutExtension(file.Name) + "_p.c"; + + return Path.ChangeExtension(file.Name, ".h"); + } + break; + default: + return file.Name; + } + } + + private string GetObjectFileName(RBuildFile file) + { + string filename = null; + switch (file.Extension) + { + case ".h": + filename = Path.ChangeExtension(file.Name, ".h.gch"); + break; + case ".mc": + filename = Path.ChangeExtension(file.Name, ".rc"); + break; + case ".rc": + filename = Path.ChangeExtension(file.Name, ".coff"); + break; + case ".spec": + filename = Path.ChangeExtension(file.Name, ".stubs.o"); + break; + case ".idl": + { + if (Module.Type == ModuleType.RpcServer) + return Path.GetFileNameWithoutExtension(file.Name) + "_s.o"; + + if (Module.Type == ModuleType.RpcClient) + return Path.GetFileNameWithoutExtension(file.Name) + "_c.o"; + + if (Module.Type == ModuleType.RpcProxy) + return Path.GetFileNameWithoutExtension(file.Name) + "_p.o"; + + /* + if (Module.Type == ModuleType.EmbeddedTypeLib) + return Path.GetFileNameWithoutExtension(file.Name) + ".tlb"; + */ + + filename = Path.ChangeExtension(file.Name, ".h"); + } + break; + //case ".c": + //case ".cpp": + //case ".cxx": + // { + // filename = Path.ChangeExtension(file.Name, ".o"); + // } + // break; + default: + filename = Path.ChangeExtension(file.Name, ".o"); + + //HACK: + if (Module.Type == ModuleType.BootSector) + return filename; + + //filename = string.Format("{1}_{0}{2}", + // Module.Name, + // Path.GetFileNameWithoutExtension(filename), + // Path.GetExtension(filename)); + break; + } + + if (file.Extension == ".mc" || + file.Extension == ".rc" || + file.Extension == ".c" || + file.Extension == ".cpp" || + file.Extension == ".cxx" || + file.Extension == ".asm" || + file.Extension == ".s") + { + filename = string.Format("{0}_{1}{2}", + Path.GetFileNameWithoutExtension(filename), + Module.Name, + Path.GetExtension(filename)); + } + else if (file.Extension == ".h") + { + return filename; + } + + return filename; + } + + public BackendBuildFile SourceCodeFile + { + get { return m_SourceCodeFile; } + } + + public BackendBuildFile SourceCodeHeaderFile + { + get { return m_SourceCodeHeaderFile; } + } + + public BackendBuildFile SourceCodeObjectFile + { + get { return m_SourceCodeObjectFile; } + } + + public BackendBuildFile SourceCodeActualFile + { + get { return m_SourceCodeActualFile; } + } + + public BackendBuildFile SourceRpcClientHeaderFile + { + get { return m_SourceRpcClientHeaderFile; } + } + + public BackendBuildFile SourceRpcServerHeaderFile + { + get { return m_SourceRpcServerHeaderFile; } + } + + public BackendBuildFile SourceCodePCHeaderFile + { + get { return m_SourceCodePCHeaderFile; } + } + + public RBuildSourceFile File + { + get { return m_File; } + } + + public BackendBuildFile MessageTableHeaderFile + { + get { return m_SourceMessageTableHeaderFile; } + } + + public BackendBuildFile MessageTableResourceFile + { + get { return m_SourceMessageTableResourceFile; } + } + } + + public class LibraryModule : BackendBuildModule + { + BackendBuildFile m_Dependency = null; + + public LibraryModule(RBuildModule module, SysGenEngine sysgen) : base (module , sysgen) + { + m_Dependency = new BackendBuildFile(sysgen); + m_Dependency.BuildFile.Name = module.DependencyName; + m_Dependency.BuildFile.Element = module; + m_Dependency.BuildFile.Base = module.Base; + } + + public BackendBuildFile Dependency + { + get { return m_Dependency; } + } + } + + public class BackendBuildModule + { + SysGenEngine m_SysGenEngine = null; + RBuildModule m_Module = null; + BackendBuildFile m_Target = null; + BackendBuildFile m_TargetNoStrip = null; + BackendBuildFile m_Dependency = null; + BackendBuildFile m_Definition = null; + + public BackendBuildModule(RBuildModule module, SysGenEngine sysgen) + { + m_Module = module; + m_SysGenEngine = sysgen; + + m_Target = new BackendBuildFile(sysgen); + m_Target.BuildFile.Name = module.TargetFile.Name; //module.TargetName; + m_Target.BuildFile.Element = module; + m_Target.BuildFile.Base = module.TargetFile.Base; //module.Base; + + m_TargetNoStrip = new BackendBuildFile(sysgen); + m_TargetNoStrip.BuildFile.Name = GetNoStripTargetName(module); + m_TargetNoStrip.BuildFile.Element = module; + m_TargetNoStrip.BuildFile.Base = module.Base; + + m_Dependency = new BackendBuildFile(sysgen); + m_Dependency.BuildFile.Name = module.DependencyName; + m_Dependency.BuildFile.Element = module; + m_Dependency.BuildFile.Base = module.Base; + + + m_Definition = new BackendBuildFile(sysgen); + m_Definition.BuildFile.Element = module; + + if (module.ImportLibrary == null) + { + m_Definition.BuildFile.Name = "tools/rbuild/empty.def"; + m_Definition.BuildFile.Base = sysgen.BaseDirectory; + } + else + { + if (IsWineModule) + m_Definition.BuildFile.Root = PathRoot.Intermediate; + + m_Definition.BuildFile.Name = module.ImportLibrary.Definition; + m_Definition.BuildFile.Base = module.ImportLibrary.Base; + } + } + + public bool IsWineModule + { + get + { + if (Module.ImportLibrary == null) + return false; + + return ((Module.ImportLibrary.Definition != null) && + (Module.ImportLibrary.Definition != string.Empty) && + (Module.ImportLibrary.Definition.Contains(".spec.def"))); + } + } + + public string GetNoStripTargetName(RBuildModule module) + { + return string.Format("{0}.nostrip{1}", + Path.GetFileNameWithoutExtension(module.TargetName), + Path.GetExtension(module.TargetName)); + } + + public string LibTempFileName + { + get + { + if (m_Module.Type == ModuleType.StaticLibrary) + return m_Module.TargetName; + + return Path.ChangeExtension(m_Module.TargetName, ".temp.a"); + } + } + + public string ExpTempFileName + { + get + { + if (m_Module.Type == ModuleType.StaticLibrary) + return m_Module.TargetName; + + return Path.ChangeExtension(m_Module.TargetName, ".temp.exp"); + } + } + + public string JunkTempFileName + { + get + { + if (m_Module.Type == ModuleType.StaticLibrary) + return m_Module.TargetName; + + return Path.ChangeExtension(m_Module.TargetName, ".junk.tmp"); + } + } + + public string RcTempFileName + { + get + { + if (m_Module.Type == ModuleType.StaticLibrary) + return m_Module.TargetName; + + return Path.ChangeExtension(m_Module.TargetName, ".rci.tmp"); + } + } + + public string ResTempFileName + { + get + { + if (m_Module.Type == ModuleType.StaticLibrary) + return m_Module.TargetName; + + return Path.ChangeExtension(m_Module.TargetName, ".res.tmp"); + } + } + + public string JunkTempFileNameFullPath + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.SourceCode), JunkTempFileName); } + } + + public string RcTempFileNameFullPath + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Temporary), RcTempFileName); } + } + + public string ResTempFileNameFullPath + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Intermediate), ResTempFileName); } + } + + public string ExpTempFileNameFullPath + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.SourceCode), ExpTempFileName); } + } + + public string LibTempFileNameFullPath + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Intermediate), LibTempFileName); } + } + + public string ModuleIntermediateLocation + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Intermediate), Module.Base); } + } + + public string ModuleOutputLocation + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Output), Module.Base); } + } + + public string ModuleBaseIntermediateLocation + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Intermediate), Module.Base); } + } + + public string ModuleBaseOutputLocation + { + get { return Path.Combine(m_SysGenEngine.GetPathRoot(PathRoot.Output), Module.Base); } + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public BackendBuildFile Target + { + get { return m_Target; } + } + + public BackendBuildFile Dependency + { + get { return m_Dependency; } + } + + public BackendBuildFile Definition + { + get { return m_Definition; } + } + + public BackendBuildFile TargetNoStrip + { + get { return m_TargetNoStrip; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwBackend.cs new file mode 100644 index 00000000000..356dde7aa9a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwBackend.cs @@ -0,0 +1,504 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine; +using SysGen.BuildEngine.Backends; +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwBackend : CompilerBaseBacked + { + public const string ECHO_AR_MACRO = "$(ECHO_AR)"; + public const string ECHO_CC_MACRO = "$(ECHO_CC)"; + public const string ECHO_LD_MACRO = "$(ECHO_LD)"; + public const string ECHO_WRC_MACRO = "$(ECHO_WRC)"; + + public const string EMPTY_DEF_FILE = "tools\\rbuild\\empty.def"; + + protected bool m_UsePipe = false; + protected bool m_UsePch = false; + protected bool m_ManualBinUtilsSetting = false; + + protected List m_ModuleHandlers = new List(); + + public MingwBackend(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "MINGW32 Backend"; } + } + + private void WriteXmlRBuildFiles(MakefileWriter makefile, RBuildProject project) + { + foreach (string xmlBuildFile in SysGen.BuildFiles) + { + makefile.WriteIndentedLine(xmlBuildFile); + } + } + + protected List ModuleHandlers + { + get { return m_ModuleHandlers; } + } + + protected override void Generate() + { + base.Generate(); + + using (MakefileWriter makefile = new MakefileWriter(Directory.GetCurrentDirectory() + "\\" + Project.MakeFile)) + { + makefile.WriteComplexComment("THIS FILE IS AUTOMATICALLY GENERATED, EDIT " + Project.XmlFile + " INSTEAD"); + makefile.WriteLine(); + + makefile.WriteProperty("nasm", "nasm"); + makefile.WriteProperty("ARCH", "i386"); + + foreach (RBuildProperty property in SysGen.Project.Properties) + { + if (property.Internal == false) + { + if (property.Value != null) + { + makefile.WriteProperty( + property.Name.ToString(), + property.Value.ToString()); + } + } + } + + makefile.WriteComplexComment("XML rbuild files"); + + makefile.WritePropertyListStart("XMLBUILDFILES"); + WriteXmlRBuildFiles(makefile, Project); + makefile.WritePropertyListEnd(); + + MingwRBuildElementHandler projectHandler = new MingwRBuildProjectHandler(Project); + + projectHandler.Makefile = makefile; + projectHandler.SysGen = SysGen; + projectHandler.GenerateMakeFile(); + + //BackendBuildModule cModule; + SourceFile cFile; + MingwRBuildModuleHandler moduleHandler = null; + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + makefile.WritePropertyListStart(module.MakeFileSources); + foreach (RBuildSourceFile file in module.SourceFiles) + { + makefile.WriteIndentedLine(file.FullPath); + } + makefile.WritePropertyListEnd(); + } + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + if (module.Type == ModuleType.RpcClient) + { + makefile.WritePropertyListStart(module.MakeFileRPCHeaders); + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (cFile.File.IsWidl) + { + makefile.WriteIndentedLine(cFile.SourceRpcClientHeaderFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + makefile.WritePropertyListStart(module.MakeFileRPCSources); + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (cFile.File.IsWidl) + { + makefile.WriteIndentedLine(cFile.SourceCodeActualFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + } + + if (module.Type == ModuleType.RpcClient || + module.Type == ModuleType.RpcServer || + module.Type == ModuleType.RpcProxy) + { + makefile.WritePropertyListStart(module.MakeFileObjs); + + // Procesamos primero los .idl que generan .h que pueden + // ser luego requeridos para compilar el resto del módulo. + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (cFile.File.IsWidl) + { + makefile.WriteIndentedLine(cFile.SourceCodeObjectFile.IntermediateFullPath); + } + } + + // Luego compilamos el resto de fuentes + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (!cFile.File.IsWidl && !cFile.File.IsMessageTable) + { + makefile.WriteIndentedLine(cFile.SourceCodeObjectFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + } + else + { + makefile.WritePropertyListStart(module.MakeFileHeaders); + + // Procesamos primero los .idl que generan .h que pueden + // ser luego requeridos para compilar el resto del módulo. + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (module.Type == ModuleType.EmbeddedTypeLib) + { + /* idl files in EmbeddedTypeLib modules do not generate header files */ + } + else + { + if (cFile.File.IsWidl) + { + makefile.WriteIndentedLine(cFile.SourceCodeObjectFile.IntermediateFullPath); + } + } + } + + makefile.WritePropertyListEnd(); + makefile.WritePropertyListStart(module.MakeFilePCHHeaders); + + // Procesamos primero los .idl que generan .h que pueden + // ser luego requeridos para compilar el resto del módulo. + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (cFile.File.IsHeader) + { + makefile.WriteIndentedLine(cFile.SourceCodeObjectFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + makefile.WritePropertyListStart(module.MakeFileMCHeaders); + + // Procesamos primero los .idl que generan .h que pueden + // ser luego requeridos para compilar el resto del módulo. + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + + if (cFile.File.IsMessageTable) + { + makefile.WriteIndentedLine(cFile.MessageTableHeaderFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + makefile.WritePropertyListStart(module.MakeFileObjs); + + foreach (RBuildSourceFile file in module.SourceFiles) + { + cFile = new SourceFile(file, module, SysGen); + //if (cFile.File.IsCompilable) + if (!cFile.File.IsWidl && !cFile.File.IsMessageTable &&!cFile.File.IsHeader) + { + makefile.WriteIndentedLine(cFile.SourceCodeObjectFile.IntermediateFullPath); + } + } + + makefile.WritePropertyListEnd(); + } + } + + makefile.WriteLine(); + + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + moduleHandler = null; + + switch (module.Type) + { + case ModuleType.RpcClient: + moduleHandler = new MingwRpcClientHeaderModuleHandler(module); + break; + case ModuleType.RpcServer: + moduleHandler = new MingwRpcServerHeaderModuleHandler(module); + break; + case ModuleType.RpcProxy: + moduleHandler = new MingwRpcProxyModuleHandler(module); + break; + case ModuleType.BootLoader: + moduleHandler = new MingwBootLoaderModuleHandler(module); + break; + case ModuleType.BootSector: + moduleHandler = new MingwBootSectorModuleHandler(module); + break; + case ModuleType.IdlHeader: + moduleHandler = new MingwIdlHeaderModuleHandler(module); + break; + case ModuleType.Win32CUI: + moduleHandler = new MingwWin32CUIModuleHandler(module); + break; + case ModuleType.Win32SCR: + case ModuleType.Win32GUI: + moduleHandler = new MingwWin32GUIModuleHandler(module); + break; + case ModuleType.Win32DLL: + moduleHandler = new MingwWin32DLLModuleHandler(module); + break; + case ModuleType.Win32OCX: + moduleHandler = new MingwWin32OCXModuleHandler(module); + break; + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + moduleHandler = new MingwKernelModeDLLModuleHandler(module); + break; + case ModuleType.KernelModeDriver: + moduleHandler = new MingwKernelModeDriverModuleHandler(module); + break; + case ModuleType.Kernel: + moduleHandler = new MingwKernelModuleHandler(module); + break; + case ModuleType.NativeCUI: + moduleHandler = new MingwNativeCUIModuleHandler(module); + break; + case ModuleType.NativeDLL: + moduleHandler = new MingwNativeDLLModuleHandler(module); + break; + case ModuleType.ObjectLibrary: + moduleHandler = new MingwObjectLibraryModuleHandler(module); + break; + case ModuleType.StaticLibrary: + moduleHandler = new MingwStaticLibraryModuleHandler(module); + break; + case ModuleType.EmbeddedTypeLib: + moduleHandler = new MingwEmbeddedTypeLibModuleHandler(module); + break; + case ModuleType.HostStaticLibrary: + moduleHandler = new MingwHostStaticLibraryModuleHandler(module); + break; + case ModuleType.BuildTool: + moduleHandler = new MingwBuildToolModuleHandler(module); + break; + case ModuleType.Cabinet: + moduleHandler = new MingwCabinetModuleHandler(module); + break; + case ModuleType.Iso: + moduleHandler = new MingwBootCDTargetHandler(module); + break; + case ModuleType.LiveIso: + moduleHandler = new MingwLiveCDTargetHandler(module); + break; + case ModuleType.IsoRegTest: + moduleHandler = new MingwBootCDRegTestTargetHandler(module); + break; + case ModuleType.LiveIsoRegTest: + moduleHandler = new MingwLiveCDRegTestTargetHandler(module); + break; + case ModuleType.MessageHeader: + moduleHandler = new MingwMessageHeaderModuleHandler(module); + break; + case ModuleType.Package: + moduleHandler = new MingwPackageModuleHandler(module); + break; + } + + if (moduleHandler != null) + { + moduleHandler.SysGen = SysGen; + moduleHandler.Makefile = makefile; + moduleHandler.Project = Project; + + ModuleHandlers.Add(moduleHandler); + } + + } + + foreach (MingwRBuildModuleHandler moduleHandler2 in ModuleHandlers) + { + if (moduleHandler2.Module.IsBuildable) // Hack + { + makefile.WriteProperty(moduleHandler2.Module.MakeFileTarget, moduleHandler2.ModuleTarget); + } + } + + foreach (MingwRBuildModuleHandler moduleHandler2 in ModuleHandlers) + { + if (moduleHandler2.Module.IsBuildable) // Hack + { + makefile.WriteComplexComment("Buid instructions for module '{0}' on '{1}' [{2}]", + moduleHandler2.Module.Name, + moduleHandler2.Module.Base, + moduleHandler2.Module.Type); + + moduleHandler2.GenerateMakeFile(); + + makefile.WritePhonyTarget(moduleHandler2.Module.MakeFileMakeTarget); + makefile.WriteRule(moduleHandler2.Module.Name, moduleHandler2.Module.MakeFileTargetMacro); + makefile.WriteLine(); + + makefile.WriteSingleLineTarget(moduleHandler2.Module.MakeFileInfoTarget); + makefile.WriteLine("\t@echo =======================Module Info============================"); + makefile.WriteLine("\t@echo Name: '{0}'", moduleHandler2.Module.Name); + makefile.WriteLine("\t@echo Type: '{0}'", moduleHandler2.Module.Type); + makefile.WriteLine("\t@echo Base: '{0}'", moduleHandler2.Module.Base); + makefile.WriteLine("\t@echo XML: '{0}'", moduleHandler2.Module.RBuildPath); + makefile.WriteLine("\t@echo Target: '{0}'", moduleHandler2.Module.TargetName); + makefile.WriteLine("\t@echo ==============================================================="); + makefile.WriteLine(); + + makefile.WriteSingleLineTarget(moduleHandler2.Module.MakeFileFlagDebugTarget); + makefile.WriteLine("\t@echo =======================Module Debug Info======================="); + makefile.WriteLine("\t@echo CFLAGS: '{0}'", moduleHandler2.Module.MakeFileCFlagsMacro); + makefile.WriteLine("\t@echo LFLAGS: '{0}'", moduleHandler2.Module.MakeFileLFlagsMacro); + makefile.WriteLine("\t@echo LIBS: '{0}'", moduleHandler2.Module.MakeFileLibsMacro); + makefile.WriteLine("\t@echo LINKDEPS: '{0}'", moduleHandler2.Module.MakeFileLinkDepsMacro); + makefile.WriteLine("\t@echo NASM: '{0}'", moduleHandler2.Module.MakeFileNASMMacro); + makefile.WriteLine("\t@echo OBJS: '{0}'", moduleHandler2.Module.MakeFileObjsMacro); + makefile.WriteLine("\t@echo RCFLAGS: '{0}'", moduleHandler2.Module.MakeFileRCFlagsMacro); + makefile.WriteLine("\t@echo TARGET: '{0}'", moduleHandler2.Module.MakeFileTargetMacro); + makefile.WriteLine("\t@echo WIDL: '{0}'", moduleHandler2.Module.MakeFileWIDLFlagsMacro); + makefile.WriteLine("\t@echo ==============================================================="); + makefile.WriteLine(); + } + } + + GenerateAllTarget(makefile); + GenerateCleanTarget(makefile); + GenerateInstallTarget(makefile); + GenerateTestTarget(makefile); + } + } + + private void GenerateAllTarget(MakefileWriter makefile) + { + makefile.WriteComplexComment("Generate the ALL target"); + makefile.WriteTarget("all"); + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + if ((module.Enabled) && (module.IncludeInAllTarget)) + { + makefile.WriteIndentedLine(module.MakeFileTargetMacro); + } + } + } + + private void GenerateCleanTarget(MakefileWriter makefile) + { + makefile.WriteComplexComment("Generate the CLEAN target"); + makefile.WriteTarget("clean"); + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + makefile.WriteIndentedLine(module.MakeFileCleanTarget); + } + } + + private void GenerateInstallTarget(MakefileWriter makefile) + { + makefile.WriteComplexComment("Generate the INSTALL target"); + makefile.WriteTarget("install"); + + //foreach (RBuildModule module in SysGen.Project.Platform.Modules) + //{ + // makefile.WriteIndentedLine(module.MakeFileCleanTarget); + //} + } + + private void GenerateTestTarget(MakefileWriter makefile) + { + RBuildFolderCollection folders = new RBuildFolderCollection(); + + makefile.WriteComplexComment("Generate the TEST target"); + makefile.WriteSingleLineTarget("test"); + + foreach (RBuildFolder folder in Project.Folders) + { + if (folders.Contains(folder) == false) + folders.Add(folder); + } + + foreach (RBuildModule module in Project.Modules) + { + foreach (RBuildFolder folder in module.Folders) + { + if (folders.Contains(folder) == false) + folders.Add(folder); + } + } + + foreach (RBuildInstallFolder folder in Project.InstallFolders) + { + if (folders.Contains(folder) == false) + folders.Add(folder); + } + + foreach (RBuildFolder folder in folders) + { + GenerateFolder(makefile, folder); + } + } + + private void GenerateFolder(MakefileWriter makefile, RBuildFolder folder) + { + if ((folder.Root == PathRoot.Default) || + (folder.Root == PathRoot.SourceCode)) + { + makefile.WriteLine("{0}: | {1}", + SysGen.ResolveRBuildFilePath(new RBuildFolder(PathRoot.Intermediate, folder.FullPath)), + SysGen.ResolveRBuildFilePath(new RBuildFolder(PathRoot.Intermediate, folder.Parent.FullPath))); + + makefile.WriteSingleLineIndented("$(ECHO_MKDIR)"); + makefile.WriteSingleLineIndented("$(mkdir) $@"); + + makefile.WriteLine("{0}: | {1}", + SysGen.ResolveRBuildFilePath(new RBuildFolder(PathRoot.Output, folder.FullPath)), + SysGen.ResolveRBuildFilePath(new RBuildFolder(PathRoot.Output, folder.Parent.FullPath))); + + makefile.WriteSingleLineIndented("$(ECHO_MKDIR)"); + makefile.WriteSingleLineIndented("$(mkdir) $@"); + } + + //Create the install and output folders + if (folder.Root == PathRoot.Output || + folder.Root == PathRoot.Install) + { + makefile.WriteLine("{0}: | {1}", + SysGen.ResolveRBuildFilePath(new RBuildFolder(folder.Root, folder.FullPath)), + SysGen.ResolveRBuildFilePath(new RBuildFolder(folder.Root, folder.Parent.FullPath))); + + makefile.WriteSingleLineIndented("$(ECHO_MKDIR)"); + makefile.WriteSingleLineIndented("$(mkdir) $@"); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwRBuildElementHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwRBuildElementHandler.cs new file mode 100644 index 00000000000..f76bcc21151 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/MingwRBuildElementHandler.cs @@ -0,0 +1,923 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public enum LinkerSubSystem + { + Windows, + Console, + Native + } + + public abstract class MingwRBuildMakefileGenerator + { + protected SysGenEngine m_SysGenEngine = null; + protected MakefileWriter m_Makefile = null; + + public SysGenEngine SysGen + { + get { return m_SysGenEngine; } + set { m_SysGenEngine = value; } + } + + public MakefileWriter Makefile + { + get { return m_Makefile; } + set { m_Makefile = value; } + } + + protected virtual string ResolveRBuildFilePath(RBuildFile file) + { + return SysGen.ResolveRBuildFilePath(file); + } + + protected virtual string ResolveRBuildFolderPath(RBuildFolder folder) + { + return SysGen.ResolveRBuildFolderPath(folder); + } + + public virtual string ResolveRBuildFilePath(PathRoot root, RBuildFileSystemInfo file) + { + return SysGen.ResolveRBuildFilePath(root , file); + } + + public abstract void GenerateMakeFile(); + } + + public abstract class MingwRBuildElementHandler : MingwRBuildMakefileGenerator + { + protected RBuildElement m_BuildElement = null; + + public MingwRBuildElementHandler(RBuildElement element) + { + m_BuildElement = element; + } + + public override void GenerateMakeFile() + { + /* Do checking */ + CheckSourceFiles(); + + /* Do makefile generation */ + WriteCommon(); + WriteSpecific(); + //WritePCHFiles(); + WriteFiles(); + WriteLinker(); + WriteImportLibrary(); + WriteCleanTarget(); + } + + protected virtual void WriteFolders() + { + Makefile.WritePropertyListStart(BuildElement.MakeFileFolders); + WriteElementFolders(Makefile, BuildElement); + Makefile.WritePropertyListEnd(); + } + + protected virtual void CheckSourceFiles() + { + } + + protected virtual void WriteCommon() + { + WriteFolders(); + WriteCFlags(); + WriteRCFlags(); + WriteLFlags(); + WriteWIDLFlags(); + } + + protected virtual void WriteStrip() + { + } + + protected virtual void WriteNonSymbolStripped() + { + } + + protected virtual void WriteRsym() + { + } + + protected virtual void WriteImportLibrary() + { + } + + protected virtual void WriteLinker() + { + } + + protected virtual void WriteCleanTarget() + { + } + + protected virtual void WriteSpecific() + { + } + + protected virtual void WriteFiles() + { + } + + protected virtual void WritePCHFiles() + { + } + + protected virtual void WriteCFlags() + { + Makefile.WritePropertyListStart(BuildElement.MakeFileCFlags); + WriteElementIncludes(Makefile, BuildElement); + WriteElementDefines(Makefile, BuildElement); + Makefile.WritePropertyListEnd(); + } + + protected virtual void WriteLFlags() + { + Makefile.WritePropertyListStart(BuildElement.MakeFileLFlags); + WriteLinkerFlags(Makefile, BuildElement); + Makefile.WritePropertyListEnd(); + } + + protected virtual void WriteRCFlags() + { + Makefile.WriteProperty(BuildElement.MakeFileRCFlags, BuildElement.MakeFileCFlagsMacro); + } + + protected virtual void WriteWIDLFlags() + { + Makefile.WriteProperty(BuildElement.MakeFileWIDLFlags, BuildElement.MakeFileCFlagsMacro); + } + + protected void WriteElementDefines(MakefileWriter makefile, RBuildElement element) + { + foreach (RBuildDefine define in element.Defines) + { + if (!define.IsEmpty) + { + makefile.WriteIndentedLine("-D" + define.Name + "=" + define.Value); + } + else + makefile.WriteIndentedLine("-D" + define.Name); + } + } + + protected void WriteElementDependencyFlags(MakefileWriter makefile, RBuildModule module) + { + foreach (RBuildModule dependency in module.Dependencies) + { + Makefile.WriteIndentedLine(dependency.MakeFileTargetMacro); + } + } + + protected void WriteElementIncludes(MakefileWriter makefile, RBuildElement element) + { + foreach (RBuildFolder includeFolder in element.IncludeFolders) + { + Makefile.WriteIndentedLine("-I" + ResolveRBuildFolderPath(includeFolder)); + } + } + + protected void WriteElementFolders(MakefileWriter makefile, RBuildElement element) + { + foreach (RBuildFolder folder in element.Folders) + { + Makefile.WriteIndentedLine(ResolveRBuildFolderPath(folder)); + } + } + + protected void WriteModuleAssemblyFlags(MakefileWriter makefile, RBuildModule module) + { + foreach (string assemblyFlag in module.AssemblyFlags) + { + Makefile.WriteIndentedLine(assemblyFlag); + } + } + + protected void WriteCompilerFlags(MakefileWriter makefile, RBuildElement element) + { + foreach (string compilerFlag in element.CompilerFlags) + { + Makefile.WriteIndentedLine(compilerFlag); + } + } + + protected void WriteLinkerFlags(MakefileWriter makefile, RBuildElement element) + { + foreach (string linkerFlag in element.LinkerFlags) + { + Makefile.WriteIndentedLine(linkerFlag); + } + } + + public RBuildElement BuildElement + { + get { return m_BuildElement; } + } + } + + public abstract class MingwRBuildModuleHandler : MingwRBuildElementHandler + { + private RBuildProject m_Project = null; + private RBuildModule m_Module = null; + + private BackendBuildModule m_CompModule = null; + private BackedBuildFolder m_Folder = null; + + public MingwRBuildModuleHandler(RBuildModule module) + : base(module) + { + m_Module = module; + } + + ////Para que sirve? + //public bool ReferenceObjects + //{ + // get + // { + // switch (Module.Type) + // { + // case ModuleType.RpcServer: + // case ModuleType.RpcClient: + // case ModuleType.RpcProxy: + // case ModuleType.ObjectLibrary: + // //case ModuleType.IdlHeader: + // //case ModuleType.MessageHeader: + // return true; + // } + + // return false; + // } + //} + + public string ModuleTarget + { + get + { + if (Module.Type == ModuleType.IdlHeader) + return Module.MakeFileHeadersMacro; + + if (Module.Type == ModuleType.MessageHeader) + return Module.MakeFileMCHeadersMacro; + + if (Module.Type == ModuleType.RpcServer || + Module.Type == ModuleType.RpcClient || + Module.Type == ModuleType.RpcProxy || + Module.Type == ModuleType.ObjectLibrary) + { + return Module.MakeFileObjsMacro; + } + + if (Module.TargetFile.Root == PathRoot.Intermediate || + Module.TargetFile.Root == PathRoot.Output || + Module.TargetFile.Root == PathRoot.Default) + { + return ResolveRBuildFilePath(Module.TargetFile); + } + else + throw new BuildException("Don't know module target"); + } + } + + public override void GenerateMakeFile() + { + //m_Project = SysGen.Project; + + m_CompModule = new BackendBuildModule(Module, SysGen); + m_Folder = new BackedBuildFolder(SysGen); + m_Folder.BuildFolder.Base = Module.Folder.Base; + m_Folder.BuildFolder.Name = Module.Folder.Name; + m_Folder.BuildFolder.Element = Module; + + // Si se trata de un WinModule agregamos un include a la carpeta intermedia + // ya que algunas dlls de wine generan ahi sus recursos incrustrados como iconos + // o bitmaps + if (CompilableModule.IsWineModule) + { + Module.IncludeFolders.Add(new RBuildFolder(PathRoot.Intermediate, Module.Base)); + } + + // Llamamos a la clase base + base.GenerateMakeFile(); + } + + protected override void WriteFiles() + { + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile sourceFile = new SourceFile(file, Module, SysGen); + + if (CanCompile(file)) + { + WriteFileBuildInstructions(sourceFile); + } + else + throw new Exception("Don't know how to write build instructions for '" + sourceFile.SourceCodeFile.OriginalFullPath + "' on module '" + Module.Name + "'"); + } + } + + protected abstract void WriteFileBuildInstructions(SourceFile sourceFile); + + protected abstract bool CanCompile(RBuildSourceFile file); + + protected override void WriteSpecific() + { + WriteModuleCommon(); + WritePreconditions(); + } + + protected virtual void WritePreconditions() + { + Makefile.WritePropertyAppendListStart(Module.MakeFilePreCondition); + WriteElementDependencyFlags(Makefile, Module); + Makefile.WritePropertyListEnd(); + Makefile.WriteLine(); + + foreach (RBuildSourceFile file in Module.SourceFiles) + { + if (file.IsCompilable) + { + Makefile.WriteLine("{0}: {1}", ResolveRBuildFilePath(file), Module.MakeFilePreConditionMacro); + } + } + + Makefile.WriteLine(); + } + + protected virtual void WriteWidl() + { + Makefile.WritePropertyListStart(Module.MakeFileWIDLFlags); + WriteElementIncludes(Makefile, Module); + Makefile.WritePropertyListEnd(); + + Makefile.WritePropertyAppend(Module.MakeFileWIDLFlags, Project.MakeFileWIDLFlagsMacro); + } + + protected virtual void WriteLibs() + { + Makefile.WritePropertyListStart(Module.MakeFileLibs); + + foreach (RBuildModule dependency in Module.Libraries) + { + if (dependency.IsDLL || dependency.IsLibrary || dependency.IsRPC) + { + if (dependency.Type == ModuleType.ObjectLibrary || + dependency.Type == ModuleType.RpcClient || + dependency.Type == ModuleType.RpcServer || + dependency.Type == ModuleType.RpcProxy) + { + Makefile.WriteIndentedLine(dependency.MakeFileTargetMacro); + } + else + { + Makefile.WriteIndentedLine(ResolveRBuildFilePath(dependency.Dependency)); + } + } + } + + Makefile.WritePropertyListEnd(); + } + + protected void WriteModuleCommon() + { + WriteLibs(); + WriteWidl(); + + if (Module.Host == false) + { + Makefile.WritePropertyAppend(Module.MakeFileCFlags, Project.MakeFileCFlagsMacro); + Makefile.WritePropertyAppend(Module.MakeFileRCFlags, Project.MakeFileRCFlagsMacro); + Makefile.WritePropertyAppend(Module.MakeFileLFlags, Project.MakeFileLFlagsMacro); + } + else + { + Makefile.WritePropertyAppend(Module.MakeFileLFlags, "$(HOST_LFLAGS)"); + } + + WriteLinkDeps(); + + if (Module.AssemblyFlags.Count > 0) + { + Makefile.WritePropertyListStart(Module.MakeFileNASMFlags); + WriteModuleAssemblyFlags(Makefile, Module); + Makefile.WritePropertyListEnd(); + } + + Makefile.WritePropertyAppendListStart(Module.MakeFileCFlags); + WriteCompilerFlags(Makefile, Module); + Makefile.WritePropertyListEnd(); + + Makefile.WriteLine(); + } + + protected virtual void WriteLinkDeps() + { + Makefile.WritePropertyAppend(Module.MakeFileLinkDeps, Module.MakeFileLibsMacro); + } + + public virtual string RpcHeaderDependencies + { + get + { + string dependencies = string.Empty; + + foreach (RBuildModule module in Module.Libraries) + { + if ((module.Type == ModuleType.RpcClient) || + (module.Type == ModuleType.RpcServer) || + (module.Type == ModuleType.IdlHeader)) /// se puede eliminar esta linea? + { + foreach (RBuildSourceFile file in module.SourceFiles) + { + SourceFile sourceFile = new SourceFile(file, module, SysGen); + + if (file.IsWidl) + { + if (module.Type == ModuleType.RpcClient) + dependencies += " " + sourceFile.SourceRpcClientHeaderFile.IntermediateFullPath; + + if (module.Type == ModuleType.RpcServer) + dependencies += " " + sourceFile.SourceRpcServerHeaderFile.IntermediateFullPath; + + //dependencies += " " + sourceFile.SourceCodeHeaderFile.IntermediateFullPath; + } + } + } + } + + return dependencies; + } + } + + public virtual string DefinitionDependencies + { + get + { + string dependencies = string.Empty; + + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile sourceFile = new SourceFile(file, Module, SysGen); + + if (file.IsWineBuild) + { + dependencies += " " + CompilableModule.Definition.OriginalFullPath; + dependencies += " " + sourceFile.SourceCodeActualFile.IntermediateFullPath; + } + else if (file.IsWidl) + { + if (Module.Type == ModuleType.RpcClient || + Module.Type == ModuleType.RpcServer) + { + dependencies += " " + sourceFile.SourceCodeActualFile.IntermediateFullPath; + } + } + } + + return dependencies; + } + } + + public string Linker + { + get + { + if (Module.CPlusPlus) + return CPPCompiler; + + return CCompiler; + } + } + + public string PCHCompiler + { + get + { + if (Module.CPlusPlus) + return CPPCompiler; + + return CCompiler; + } + } + + public string CCompiler + { + get { return (Module.Host ? "$(host_gcc)" : "$(gcc)"); } + } + + public string CPPCompiler + { + get { return (Module.Host ? "$(host_gpp)" : "$(gpp)"); } + } + + public string ArchiveCompiler + { + get { return (Module.Host ? "$(host_ar)" : "$(ar)"); } + } + + protected virtual void WriteAr() + { + Makefile.WriteLine(m_CompModule.Target.IntermediateFullPath + ": " + Module.MakeFileObjsMacro + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_AR)"); + + if (Module.Type == ModuleType.StaticLibrary || + Module.Type == ModuleType.HostStaticLibrary) + { + if (Module.ImportLibrary != null) + { + Makefile.WriteLine("\t${dlltool} --dllname " + Module.ImportLibrary.DllName + " --def " + CompilableModule.Definition.OriginalFullPath + " --output-lib $@ " + MangledSymbols + " " + UnderscoreSymbols); + } + } + + Makefile.WriteLine("\t${ar} -rc $@ " + Module.MakeFileObjsMacro); + Makefile.WriteLine(); + } + + protected virtual void WriteWindResCompiler(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " $(wrc_TARGET) " + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath); + Makefile.WriteLine("\t$(ECHO_WRC)"); + Makefile.WriteLine("\t" + CCompiler + " -xc -E -DRC_INVOKED " + Module.MakeFileRCFlagsMacro + " " + sourceFile.SourceCodeFile.OriginalFullPath + " > " + CompilableModule.RcTempFileNameFullPath); + Makefile.WriteLine("\t$(Q)$(wrc_TARGET) " + Module.MakeFileRCFlagsMacro + " " + CompilableModule.RcTempFileNameFullPath + " " + CompilableModule.ResTempFileNameFullPath); + Makefile.WriteLine("\t-@${rm} " + CompilableModule.RcTempFileNameFullPath + " 2>$(NUL)"); + Makefile.WriteLine("\t${windres} " + CompilableModule.ResTempFileNameFullPath + " -o $@"); + Makefile.WriteLine("\t-@${rm} " + CompilableModule.ResTempFileNameFullPath + " 2>$(NUL)"); + Makefile.WriteLine(); + } + + protected virtual void WriteWIDLTypeLibrary(SourceFile file) + { + Makefile.WriteLine(file.Target.IntermediateFullPath + ": " + file.SourceCodeFile.OriginalFullPath + " $(widl_TARGET) " + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_WIDL)"); + Makefile.WriteLine("\t$(Q)$(widl_TARGET) " + Module.MakeFileWIDLFlagsMacro + " -t -T " + file.Target.IntermediateFullPath + " " + file.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + + protected virtual void WriteWIDLHeader(SourceFile file) + { + Makefile.WriteLine(file.SourceCodeObjectFile.IntermediateFullPath + ": " + file.SourceCodeFile.OriginalFullPath + " $(widl_TARGET) " + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_WIDL)"); + Makefile.WriteLine("\t$(Q)$(widl_TARGET) " + Module.MakeFileWIDLFlagsMacro + " -h -H " + file.SourceCodeObjectFile.IntermediateFullPath + " " + file.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + + protected virtual void WriteWIDLRpcHeader(SourceFile file) + { + Makefile.WriteLine(file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceCodeHeaderFile.IntermediateFullPath + ": " + file.SourceCodeFile.OriginalFullPath + " $(widl_TARGET) | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_WIDL)"); + + if (Module.Type == ModuleType.RpcServer) + { + Makefile.WriteLine("\t$(Q)$(widl_TARGET) " + file.File.Switches + " " + Module.MakeFileWIDLFlagsMacro + " -h -H " + file.SourceCodeHeaderFile.IntermediateFullPath + " -s -S " + file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + else if (Module.Type == ModuleType.RpcClient) + { + Makefile.WriteLine("\t$(Q)$(widl_TARGET) " + file.File.Switches + " " + Module.MakeFileWIDLFlagsMacro + " -h -H " + file.SourceCodeHeaderFile.IntermediateFullPath + " -c -C " + file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + else if (Module.Type == ModuleType.RpcProxy) + { + Makefile.WriteLine("\t$(Q)$(widl_TARGET) " + file.File.Switches + " " + Module.MakeFileWIDLFlagsMacro + " -h -H " + file.SourceCodeHeaderFile.IntermediateFullPath + " -p -P " + file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + + if (Module.Type == ModuleType.RpcServer || + Module.Type == ModuleType.RpcClient) + { + Makefile.WriteLine(file.SourceCodeObjectFile.IntermediateFullPath + ": " + file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceRpcServerHeaderFile.IntermediateFullPath + " " + file.SourceRpcClientHeaderFile.IntermediateFullPath + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_CC)"); + Makefile.WriteLine("\t" + CCompiler + " -c $< -o $@ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + else if (Module.Type == ModuleType.RpcProxy) + { + Makefile.WriteLine(file.SourceCodeObjectFile.IntermediateFullPath + ": " + file.SourceCodeActualFile.IntermediateFullPath + " " + file.SourceCodeHeaderFile.IntermediateFullPath + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_CC)"); + Makefile.WriteLine("\t" + CCompiler + " -c $< -o $@ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + } + + protected virtual void WriteWineBuild(SourceFile sourceFile) + { + Makefile.WriteLine(CompilableModule.Definition.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " $(winebuild_TARGET) | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_WINEBLD)"); + Makefile.WriteLine("\t$(Q)$(winebuild_TARGET) $(WINEBUILD_FLAGS) -o " + CompilableModule.Definition.IntermediateFullPath + " --def -E " + sourceFile.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + + Makefile.WriteLine(sourceFile.SourceCodeActualFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " $(winebuild_TARGET)"); + Makefile.WriteLine("\t$(ECHO_WINEBLD)"); + Makefile.WriteLine("\t$(Q)$(winebuild_TARGET) $(WINEBUILD_FLAGS) -o " + sourceFile.SourceCodeActualFile.IntermediateFullPath + " --pedll " + sourceFile.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeActualFile.IntermediateFullPath + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_CC)"); + Makefile.WriteLine("\t" + CCompiler + " -c $< -o $@ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + + protected virtual void WritePCH(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " " + RpcHeaderDependencies + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath); + Makefile.WriteLine("\t$(ECHO_PCH)"); + Makefile.WriteLine("\t" + PCHCompiler + " -o " + sourceFile.SourceCodeObjectFile.IntermediateFullPath + " " + Module.MakeFileCFlagsMacro + " -g " + sourceFile.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + + protected virtual void WriteCCompiler(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " " + Module.MakeFileHeadersMacro + " " + PrecompiledHeader + " " + RpcHeaderDependencies + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath); + Makefile.WriteLine("\t$(ECHO_CC)"); + Makefile.WriteLine("\t" + CCompiler + " -c $< -o $@ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + + protected virtual void WriteWMC(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.MessageTableHeaderFile.IntermediateFullPath + " " + sourceFile.MessageTableResourceFile.IntermediateFullPath + ": " + "$(wmc_TARGET)" + " " + sourceFile.SourceCodeFile.OriginalFullPath + " | " + sourceFile.MessageTableHeaderFile.IntermediateFolderFullPath + " " + sourceFile.MessageTableResourceFile.IntermediateFolderFullPath); + Makefile.WriteLine("\t$(ECHO_WMC)"); + Makefile.WriteLine("\t$(Q)$(wmc_TARGET) -i -H " + sourceFile.MessageTableHeaderFile.IntermediateFullPath + " -o " + sourceFile.MessageTableResourceFile.IntermediateFullPath + " " + sourceFile.SourceCodeFile.OriginalFullPath); + Makefile.WriteLine(); + } + + protected virtual void WriteCPPCompiler(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " " + Module.MakeFileHeadersMacro + " " + PrecompiledHeader + " " + RpcHeaderDependencies + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath); + Makefile.WriteLine("\t$(ECHO_CC)"); + Makefile.WriteLine("\t" + CPPCompiler + " -c $< -o $@ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + + protected virtual void WriteNASMCompiler(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath /*+ ModuleFolder.IntermediateFullPath*/); + Makefile.WriteLine("\t$(ECHO_NASM)"); + Makefile.WriteLine("\t$(Q)${nasm} -f win32 $< -o $@ " + Module.MakeFileNASMMacro); + Makefile.WriteLine(); + } + + protected virtual void WriteASMCompiler(SourceFile sourceFile) + { + Makefile.WriteLine(sourceFile.SourceCodeObjectFile.IntermediateFullPath + ": " + sourceFile.SourceCodeFile.OriginalFullPath + " | " + sourceFile.SourceCodeFile.IntermediateFolderFullPath /*+ ModuleFolder.IntermediateFullPath*/); + Makefile.WriteLine("\t$(ECHO_GAS)"); + Makefile.WriteLine("\t" + CCompiler + " -x assembler-with-cpp -c $< -o $@ -D__ASM__ " + Module.MakeFileCFlagsMacro); + Makefile.WriteLine(); + } + + protected override void WriteRsym() + { + Makefile.WriteLine("\t$(ECHO_RSYM)"); + Makefile.WriteLine("\t$(Q)$(RSYM_TARGET) $@ $@"); + Makefile.WriteLine(); + } + + protected override void WriteStrip() + { + if (SysGen.Project.Properties["ROS_LEAN_AND_MEAN"] != null) + { + //No s'ha provat + Makefile.WriteLine("\t$(ECHO_STRIP)"); + Makefile.WriteLine("\t${strip} -s -x -X $@"); + Makefile.WriteLine(); + } + } + + protected override void WriteNonSymbolStripped() + { + if (SysGen.Project.Properties["ROS_BUILDNOSTRIP"] != null) + { + //No s'ha provat + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + m_CompModule.TargetNoStrip.OutputFullPath + " 1>$(NUL)"); + Makefile.WriteLine(); + } + } + + protected override void WriteLinker() + { + //Makefile.WriteLine(Module.MakeFileTargetMacro + ": " + CompilableModule.Definition.OriginalFullPath + " " + Module.MakeFileLinkDepsMacro + " " + Module.MakeFileObjsMacro + " $(RSYM_TARGET) $(PEFIXUP_TARGET) | " + /*ModuleFolder.TemporaryFullPath*/ ModuleFolder.OutputFullPath); + Makefile.WriteLine(Module.MakeFileTargetMacro + ": " + Definition + " " + Module.MakeFileLinkDepsMacro + " " + Module.MakeFileObjsMacro + " $(RSYM_TARGET) $(PEFIXUP_TARGET) | " + ModuleFolder.OutputFullPath); + Makefile.WriteLine("\t$(ECHO_LD)"); + + if (Module.IsDLL) + { + Makefile.WriteLine("\t${dlltool} --dllname " + Module.TargetName + " --def " + CompilableModule.Definition.OriginalFullPath + " --output-exp " + m_CompModule.ExpTempFileNameFullPath + " " + MangledSymbols + " " + UnderscoreSymbols); + } + + Makefile.WriteLine("\t" + Linker + " " + LinkerParameters); + + if (Module.IsDLL) + { + Makefile.WriteLine("\t$(Q)$(PEFIXUP_TARGET) " + Module.MakeFileTargetMacro + " -exports" + " " + PefixupParameters); + Makefile.WriteLine("\t-@${rm} " + m_CompModule.ExpTempFileNameFullPath + " 2>$(NUL)"); + } + + Makefile.WriteLine(); + + WriteRsym(); + WriteStrip(); + WriteNonSymbolStripped(); + } + + public string Definition + { + get + { + if (Module.ImportLibrary != null) + return CompilableModule.Definition.OriginalFullPath; + + return string.Empty; + } + } + + public virtual string PefixupParameters + { + get + { + if ((Module.Type == ModuleType.Kernel) || + (Module.Type == ModuleType.KernelModeDLL) || + (Module.Type == ModuleType.KernelModeDriver) || + (Module.Type == ModuleType.KeyboardLayout)) + { + return "-sections"; + } + + return string.Empty; + } + } + + public string LinkerScript + { + get + { + if (Module.LinkerScript != null) + return string.Format("-Wl,-T,{0}", Module.LinkerScript.FullPath); + + return string.Empty; + } + } + + public string MangledSymbols + { + get + { + if (Module.MangledSymbols) + return string.Empty; + + return "--kill-at"; + } + } + + public string UnderscoreSymbols + { + get + { + if (Module.UnderscoreSymbols) + return "--add-underscore"; + + return string.Empty; + } + } + + + protected string PrecompiledHeader + { + get + { + if (Module.PreCompiledHeader != null) + return Module.MakeFilePCHMacro; + + return string.Empty; + } + } + + protected override void WriteCleanTarget() + { + Makefile.WritePhonyTarget(Module.MakeFileCleanTarget); + Makefile.WriteSingleLineTarget(Module.MakeFileCleanTarget); + + if (Module.Type != ModuleType.Cabinet) //Hack: + { + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile cFile = new SourceFile(file, Module, SysGen); + + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeObjectFile.IntermediateFullPath + " 2>$(NUL)"); + } + } + + Makefile.WriteLine("\t-@$(rm) " + Module.MakeFileTargetMacro + " 2>$(NUL)"); + Makefile.WriteLine(); + } + + protected override void WriteImportLibrary () + { + if (Module.HasImportLibrary) + { + Makefile.WriteComment("IMPORT LIBRARY RULE"); + Makefile.WriteLine(ResolveRBuildFilePath(Module.Dependency) + ": " + CompilableModule.Definition.OriginalFullPath + " " + DefinitionDependencies + " | " + ModuleFolder.IntermediateFullPath); + Makefile.WriteLine("\t$(ECHO_DLLTOOL)"); + Makefile.WriteLine("\t$(dlltool) --dllname " + Module.TargetName + " --def " + CompilableModule.Definition.OriginalFullPath + " --output-lib " + /*CompilableModule.Dependency.IntermediateFullPath*/ ResolveRBuildFilePath(Module.Dependency) + " " + MangledSymbols + " " + UnderscoreSymbols); + Makefile.WriteLine(); + } + } + + protected virtual string LinkerParameters + { + get + { + return string.Format("-Wl,--subsystem," + SubSystem + " -Wl,--entry,{0} -Wl,--image-base,{1} " + AdditionalParameters2 + " -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 " + " " + NoStartFiles + " " + Shared + " " + LinkerScript + " " + AdditionalParamters + " -o {2} {3} {4} {5}", + Module.LinkerEntryPoint, + Module.BaseAddress, + Module.MakeFileTargetMacro, + Module.MakeFileObjsMacro, + Module.MakeFileLibsMacro, + Module.MakeFileLFlagsMacro); + } + } + + protected virtual string AdditionalParameters2 + { + get { return string.Empty; } + } + + //Fixme: + protected virtual LinkerSubSystem LinkerSubsystem + { + get { return LinkerSubSystem.Console; } + } + + protected virtual string SubSystem + { + get { return "console"; } + } + + protected virtual string NoStartFiles + { + get + { + if (Module.Type == ModuleType.NativeCUI || + Module.Type == ModuleType.NativeDLL || + Module.Type == ModuleType.Kernel || + Module.Type == ModuleType.KernelModeDLL || + Module.Type == ModuleType.KernelModeDriver || + Module.Type == ModuleType.KeyboardLayout) + { + return "-nostartfiles"; + } + + return string.Empty; + } + } + + protected virtual string Shared + { + get + { + if (Module.IsDLL) + return "-shared"; + + return string.Empty; + } + } + + protected virtual string AdditionalParamters + { + get + { + if (Module.IsDLL) + return m_CompModule.ExpTempFileNameFullPath; + + return string.Empty; + } + } + + public RBuildModule Module + { + get { return m_BuildElement as RBuildModule; } + } + + public RBuildProject Project + { + get { return m_Project; } + set { m_Project = value; } + } + + public BackendBuildModule CompilableModule + { + get { return m_CompModule; } + } + + public BackedBuildFolder ModuleFolder + { + get { return m_Folder; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/Misc/MakefileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/Misc/MakefileWriter.cs new file mode 100644 index 00000000000..5dbb01e08fb --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/Misc/MakefileWriter.cs @@ -0,0 +1,99 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.BuildEngine.Backends +{ + public class MakefileWriter : StreamWriter + { + public MakefileWriter(string path) + : base(path) + { + } + + public void WriteComment(string text) + { + WriteLine("# {0}" , text); + } + + public void WriteComplexComment(string text, params object[] args) + { + WriteComplexComment(string.Format(text, args)); + } + + public void WriteComplexComment(string text) + { + WriteLine(); + WriteLine("#==================================================================================="); + WriteLine("# {0}", text); + WriteLine("#==================================================================================="); + WriteLine(); + } + + public void WriteIndentedLine(string text , params object[] args) + { + WriteIndentedLine(string.Format(text, args)); + WriteLine(); + } + + public void WriteSingleLineIndented(string text) + { + WriteLine("\t{0}", text); + } + + public void WriteIndentedLine(string text) + { + WriteLine("\t{0} \\", text); + } + + public void WriteProperty(string propertyName , string propertyValue) + { + WriteLine("{0} := {1}" , + propertyName , + propertyValue); + } + + public void WritePropertyAppend(string propertyName, string propertyValue) + { + WriteLine("{0} += {1}", + propertyName, + propertyValue); + } + + public void WritePropertyAppendListStart(string propertyName) + { + WriteLine("{0} += \\", propertyName); + } + + public void WritePropertyListStart(string propertyName) + { + WriteLine("{0} := \\", propertyName); + } + + public void WritePropertyListEnd() + { + WriteLine(); + } + + public void WritePhonyTarget(string targetName) + { + WriteLine(".PHONY: {0}", targetName); + } + + public void WriteSingleLineTarget(string targetName) + { + WriteLine("{0}:", targetName); + } + + public void WriteTarget(string targetName) + { + WriteLine("{0}: \\", targetName); + } + + public void WriteRule(string targetName , string targetName2) + { + WriteLine("{0}: {1}", targetName, targetName2); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/Base/MingwRBuildModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/Base/MingwRBuildModuleHandler.cs new file mode 100644 index 00000000000..d599896ff49 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/Base/MingwRBuildModuleHandler.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootLoaderModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootLoaderModuleHandler.cs new file mode 100644 index 00000000000..a3642c0d0e4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootLoaderModuleHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwBootLoaderModuleHandler : MingwRBuildModuleHandler + { + public MingwBootLoaderModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return false; + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + } + + protected override void WriteLinker() + { + Makefile.WriteLine(Module.MakeFileTargetMacro + ": " + Module.MakeFileObjsMacro + " " + Module.MakeFileLinkDepsMacro + " | " + ModuleFolder.OutputFullPath); + Makefile.WriteLine("\t$(ECHO_LD)"); + //Makefile.WriteLine("\t$(ld) {0} -N -Ttext=0x8000 -o {1} {2} {3}", Module.MakeFileLFlagsMacro, CompilableModule.JunkTempFileNameFullPath, Module.MakeFileObjsMacro, Module.MakeFileLinkDepsMacro); + Makefile.WriteLine("\t$(gcc) -Wl,--subsystem,native -Wl,-N -Ttext=0x8000 -o {0} {1} {2} {3}", CompilableModule.JunkTempFileNameFullPath, Module.MakeFileObjsMacro, Module.MakeFileLinkDepsMacro, Module.MakeFileLFlagsMacro); + Makefile.WriteLine("\t$(objcopy) -O binary {0} $@", CompilableModule.JunkTempFileNameFullPath); + Makefile.WriteLine("\t-@$(rm) {0} 2>$(NUL)", CompilableModule.JunkTempFileNameFullPath); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootSectorModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootSectorModuleHandler.cs new file mode 100644 index 00000000000..8db44129cf8 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBootSectorModuleHandler.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwBootSectorModuleHandler : MingwRBuildModuleHandler + { + public MingwBootSectorModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsNASM); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsNASM) + { + WriteNASMCompiler(sourceFile); + } + } + + protected override void WriteLinker() + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBuildToolModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBuildToolModuleHandler.cs new file mode 100644 index 00000000000..ac8a70ff4a9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwBuildToolModuleHandler.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwBuildToolModuleHandler : MingwRBuildModuleHandler + { + public MingwBuildToolModuleHandler(RBuildModule module) + : base(module) + + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsC || file.IsCPP); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + } + + protected override void WriteLinker() + { + Makefile.WriteLine(Module.MakeFileTargetMacro + ": " + Module.MakeFileObjsMacro + " " + Module.MakeFileLinkDepsMacro + " | " + ModuleFolder.OutputFullPath); + Makefile.WriteLine("\t$(ECHO_LD)"); + Makefile.WriteLine("\t" + Linker + " " + Module.MakeFileLFlagsMacro + " -o $@ " + Module.MakeFileObjsMacro + " " + Module.MakeFileLibsMacro ); + Makefile.WriteLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwCabinetModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwCabinetModuleHandler.cs new file mode 100644 index 00000000000..8bc979878c7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwCabinetModuleHandler.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwCabinetModuleHandler : MingwRBuildModuleHandler + { + public MingwCabinetModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return true; + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + } + + protected override void WriteLinker() + { + } + + protected override void WriteSpecific() + { + base.WriteSpecific(); + + Makefile.WriteLine(Module.MakeFileTargetMacro + ": $(cabman_TARGET) " + ModuleFolder.OutputFullPath); + Makefile.WriteLine("\t$(ECHO_CABMAN)"); + Makefile.WriteLine("\t$(Q)$(cabman_TARGET) -M raw -S " + Module.MakeFileTargetMacro + " " + Module.MakeFileSourcesMacro); + Makefile.WriteLine(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwEmbeddedTypeLibModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwEmbeddedTypeLibModuleHandler.cs new file mode 100644 index 00000000000..752cfaf896b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwEmbeddedTypeLibModuleHandler.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwEmbeddedTypeLibModuleHandler : MingwRBuildModuleHandler + { + public MingwEmbeddedTypeLibModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override void CheckSourceFiles() + { + if (Module.SourceFiles.Count > 1) + { + throw new BuildException("Modules of type 'EmbeddedTypeLib' can only contain 1 source file , this module contains '{0}", Module.SourceFiles.Count); + } + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsWidl); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsWidl) + { + WriteWIDLTypeLibrary(sourceFile); + } + } + + protected override void WriteLinker() + { + //WriteAr(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwHostStaticLibraryModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwHostStaticLibraryModuleHandler.cs new file mode 100644 index 00000000000..3a70452326f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwHostStaticLibraryModuleHandler.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwHostStaticLibraryModuleHandler : MingwStaticLibraryModuleHandler + { + public MingwHostStaticLibraryModuleHandler(RBuildModule module) + : base(module) + + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwIdlHeaderModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwIdlHeaderModuleHandler.cs new file mode 100644 index 00000000000..f831d9b6199 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwIdlHeaderModuleHandler.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine +{ + public class MingwMessageHeaderModuleHandler : MingwRBuildModuleHandler + { + public MingwMessageHeaderModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override void WriteCommon() + { + } + + protected override void WriteLinker() + { + } + + protected override void WriteSpecific() + { + WritePreconditions(); + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsMessageTable); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsMessageTable) + { + WriteWMC(sourceFile); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDLLModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDLLModuleHandler.cs new file mode 100644 index 00000000000..e0d03fe16d0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDLLModuleHandler.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwKernelModeDLLModuleHandler : MingwRBuildModuleHandler + { + public MingwKernelModeDLLModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsCPP || file.IsWindResource || file.IsAssembler || file.IsWidl || file.IsNASM || file.IsWineBuild); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsNASM) + { + WriteNASMCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + + if (sourceFile.File.IsWidl) + { + WriteWIDLHeader(sourceFile); + } + + if (sourceFile.File.IsWineBuild) + { + WriteWineBuild(sourceFile); + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDriverModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDriverModuleHandler.cs new file mode 100644 index 00000000000..ebbda411189 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModeDriverModuleHandler.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwKernelModeDriverModuleHandler : MingwRBuildModuleHandler + { + public MingwKernelModeDriverModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsC || file.IsWindResource || file.IsCPP || file.IsAssembler || file.IsWineBuild || file.IsHeader); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsWineBuild) + { + WriteWineBuild(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModuleHandler.cs new file mode 100644 index 00000000000..c432f7f0c3c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwKernelModuleHandler.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwKernelModuleHandler : MingwRBuildModuleHandler + { + public MingwKernelModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsWindResource || file.IsCPP || file.IsAssembler || file.IsMessageTable); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + + if (sourceFile.File.IsMessageTable) + { + WriteWMC(sourceFile); + } + } + + protected override string AdditionalParameters2 + { + get + { + return ""; + //return "-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared"; + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwMessageHeaderModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwMessageHeaderModuleHandler.cs new file mode 100644 index 00000000000..c08b9098994 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwMessageHeaderModuleHandler.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine +{ + public class MingwIdlHeaderModuleHandler : MingwRBuildModuleHandler + { + public MingwIdlHeaderModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override void WriteCommon() + { + } + + protected override void WriteLinker() + { + } + + protected override void WriteSpecific() + { + WriteWIDLFlags(); +// WriteTarget(); + WritePreconditions(); + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsWidl); + } + + protected override void WriteWIDLFlags() + { + Makefile.WriteLine(Module.MakeFileWIDLFlags + " := " + Project.MakeFileWIDLFlagsMacro + " -I" + ModuleFolder.BaseFullPath); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsWidl) + { + WriteWIDLHeader(sourceFile); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeCUIModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeCUIModuleHandler.cs new file mode 100644 index 00000000000..4a8f5ee3436 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeCUIModuleHandler.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwNativeCUIModuleHandler : MingwRBuildModuleHandler + { + public MingwNativeCUIModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsWindResource); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeDLLModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeDLLModuleHandler.cs new file mode 100644 index 00000000000..3f23397da34 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwNativeDLLModuleHandler.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwNativeDLLModuleHandler : MingwRBuildModuleHandler + { + public MingwNativeDLLModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsC || file.IsWindResource || file.IsAssembler || file.IsMessageTable); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsMessageTable) + { + WriteWMC(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwObjectLibraryModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwObjectLibraryModuleHandler.cs new file mode 100644 index 00000000000..b95d425e431 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwObjectLibraryModuleHandler.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwObjectLibraryModuleHandler : MingwRBuildModuleHandler + { + public MingwObjectLibraryModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsNASM || file.IsAssembler || file.IsMessageTable); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + + if (sourceFile.File.IsNASM) + { + WriteNASMCompiler(sourceFile); + } + + if (sourceFile.File.IsMessageTable) + { + WriteWMC(sourceFile); + } + } + + protected override void WriteLinker() + { + } + + protected override string SubSystem + { + get { return "console"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwPackageModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwPackageModuleHandler.cs new file mode 100644 index 00000000000..ce2f83a2108 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwPackageModuleHandler.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwPackageModuleHandler : MingwRBuildModuleHandler + { + public MingwPackageModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return true; + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + } + + protected override void WriteLinker() + { + } + + protected override void WriteSpecific() + { + base.WriteSpecific(); + + //Makefile.WriteLine(Module.MakeFileTargetMacro + ": $(cabman_TARGET) " + ModuleFolder.OutputFullPath); + //Makefile.WriteLine("\t$(ECHO_CABMAN)"); + //Makefile.WriteLine("\t$(Q)$(cabman_TARGET) -M raw -S " + Module.MakeFileTargetMacro + " " + Module.MakeFileSourcesMacro); + //Makefile.WriteLine(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRBuildProjectHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRBuildProjectHandler.cs new file mode 100644 index 00000000000..4f7cfaaff47 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRBuildProjectHandler.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwRBuildProjectHandler : MingwRBuildElementHandler + { + public MingwRBuildProjectHandler(RBuildProject project) + : base(project) + { + } + + protected override void WriteSpecific() + { + Makefile.WritePropertyListStart(Project.MakeFileGCCOptions); + WriteCompilerFlags(Makefile, Project); + Makefile.WritePropertyListEnd(); + + Makefile.WritePropertyAppend(Project.MakeFileCFlags, "-Wall"); + + if (Project.Properties["OARCH"].Value != string.Empty) + { + Makefile.WritePropertyAppend(Project.MakeFileCFlags, "-march=$(OARCH)"); + } + + Makefile.WritePropertyAppend(Project.MakeFileCFlags, Project.MakeFileGCCOptionsMacro); + } + + public RBuildProject Project + { + get { return m_BuildElement as RBuildProject; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcClientHeaderModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcClientHeaderModuleHandler.cs new file mode 100644 index 00000000000..c4fa641f31e --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcClientHeaderModuleHandler.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwRpcClientHeaderModuleHandler : MingwRpcServerHeaderModuleHandler + { + public MingwRpcClientHeaderModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsWidl); + } + + protected override void WriteCleanTarget() + { + base.WriteCleanTarget(); + + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile cFile = new SourceFile(file, Module, SysGen); + + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeHeaderFile.IntermediateFullPath + " 2>$(NUL)"); + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeObjectFile.IntermediateFullPath + " 2>$(NUL)"); + } + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsWidl) + { + WriteWIDLRpcHeader(sourceFile); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcProxyModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcProxyModuleHandler.cs new file mode 100644 index 00000000000..f15d03d9301 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcProxyModuleHandler.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwRpcProxyModuleHandler : MingwRpcServerHeaderModuleHandler + { + public MingwRpcProxyModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsWidl); + } + + protected override void WriteCleanTarget() + { + base.WriteCleanTarget(); + + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile cFile = new SourceFile(file, Module, SysGen); + + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeHeaderFile.IntermediateFullPath + " 2>$(NUL)"); + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeObjectFile.IntermediateFullPath + " 2>$(NUL)"); + } + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsWidl) + { + WriteWIDLRpcHeader(sourceFile); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcServerHeaderModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcServerHeaderModuleHandler.cs new file mode 100644 index 00000000000..a09bbb3069a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwRpcServerHeaderModuleHandler.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwRpcServerHeaderModuleHandler : MingwIdlHeaderModuleHandler + { + public MingwRpcServerHeaderModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override void WriteSpecific() + { + WriteCFlags(); + base.WriteSpecific(); + WriteModuleCommon(); + } + + protected override void WriteCleanTarget() + { + base.WriteCleanTarget(); + + foreach (RBuildSourceFile file in Module.SourceFiles) + { + SourceFile cFile = new SourceFile(file, Module, SysGen); + + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeHeaderFile.IntermediateFullPath + " 2>$(NUL)"); + Makefile.WriteLine("\t-@$(rm) " + cFile.SourceCodeActualFile.IntermediateFullPath + " 2>$(NUL)"); + } + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsWidl); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsWidl) + { + WriteWIDLRpcHeader(sourceFile); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwStaticLibraryModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwStaticLibraryModuleHandler.cs new file mode 100644 index 00000000000..f915a86b2f0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwStaticLibraryModuleHandler.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwStaticLibraryModuleHandler : MingwRBuildModuleHandler + { + public MingwStaticLibraryModuleHandler(RBuildModule module) + : base(module) + + { + } + + /* + protected override void WriteLibs(RBuildModule module) + { + } + */ + + protected override void WriteCFlags() + { + base.WriteCFlags(); + + if (Module.IsStartupLib) + { + Makefile.WritePropertyAppend(Module.MakeFileCFlags, "-Wno-main"); + } + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader ||file.IsC || file.IsAssembler); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + } + + protected override void WriteLinker() + { + WriteAr(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32CUIModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32CUIModuleHandler.cs new file mode 100644 index 00000000000..5097b3971c0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32CUIModuleHandler.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine +{ + public class MingwWin32CUIModuleHandler : MingwRBuildModuleHandler + { + public MingwWin32CUIModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsCPP || file.IsWindResource); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32DLLModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32DLLModuleHandler.cs new file mode 100644 index 00000000000..a8b29f0a082 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32DLLModuleHandler.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwWin32DLLModuleHandler : MingwRBuildModuleHandler + { + public MingwWin32DLLModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsCPP || file.IsWindResource || file.IsAssembler || file.IsWineBuild || file.IsWidl || file.IsMessageTable); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsWineBuild) + { + WriteWineBuild(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsAssembler) + { + WriteASMCompiler(sourceFile); + } + + if (sourceFile.File.IsMessageTable) + { + WriteWMC(sourceFile); + } + + if (sourceFile.File.IsWidl) + { + WriteWIDLHeader(sourceFile); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32GUIModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32GUIModuleHandler.cs new file mode 100644 index 00000000000..b6687778a5d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32GUIModuleHandler.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwWin32GUIModuleHandler : MingwRBuildModuleHandler + { + public MingwWin32GUIModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader || file.IsC || file.IsCPP || file.IsWindResource || file.IsWineBuild); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsWineBuild) + { + WriteWineBuild(sourceFile); + } + } + + protected override string SubSystem + { + get { return "windows"; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32OCXModuleHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32OCXModuleHandler.cs new file mode 100644 index 00000000000..7fe4f0b9c1a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/ModuleHandlers/MingwWin32OCXModuleHandler.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwWin32OCXModuleHandler : MingwRBuildModuleHandler + { + public MingwWin32OCXModuleHandler(RBuildModule module) + : base(module) + { + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return (file.IsHeader ||file.IsC || file.IsWindResource || file.IsCPP || file.IsWineBuild); + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + if (sourceFile.File.IsHeader) + { + WritePCH(sourceFile); + } + + if (sourceFile.File.IsC) + { + WriteCCompiler(sourceFile); + } + + if (sourceFile.File.IsWindResource) + { + WriteWindResCompiler(sourceFile); + } + + if (sourceFile.File.IsCPP) + { + WriteCPPCompiler(sourceFile); + } + + if (sourceFile.File.IsWineBuild) + { + WriteWineBuild(sourceFile); + } + } + + protected override string SubSystem + { + get { return "native"; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/TargetsHandlers/Base/MingwRBuildTargetHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/TargetsHandlers/Base/MingwRBuildTargetHandler.cs new file mode 100644 index 00000000000..b99413d3724 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/Mingw/TargetsHandlers/Base/MingwRBuildTargetHandler.cs @@ -0,0 +1,307 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class MingwLiveCDTargetHandler : MingwRBuildIsoModuleHandler + { + public MingwLiveCDTargetHandler(RBuildModule module) + : base(module) + { + } + + protected override void AddAditionalFiles() + { + //RBuildCDFile livecdBootIni = new RBuildCDFile(); + + //livecdBootIni.Base = "boot\bootdata"; + //livecdBootIni.Name = "livecd.ini"; + //livecdBootIni.NewName = ""; + } + + protected override void WriteCabinetManager() + { + // Not required + } + + protected override void WriteMakeHive() + { + Makefile.WriteLine("\t$(ECHO_MKHIVE)"); + Makefile.WriteLine("\t$(mkhive_TARGET) boot\bootdata " + @"$(OUTPUT)\livecd\reactos\system32\config boot\bootdata\livecd.inf boot\bootdata\hiveinst.inf"); + } + + protected override void WriteCopyCDFiles() + { + foreach (RBuildOutputFile platformFile in SysGen.Project.Files) + { + if (platformFile is RBuildPlatformFile || platformFile is RBuildCDFile) + { + } + else + { + RBuildCDFile cdFile = new RBuildCDFile(); + + cdFile.Root = PathRoot.LiveCD; + cdFile.Name = platformFile.Name; + cdFile.Base = platformFile.InstallBase; + + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + ResolveRBuildFilePath(platformFile) + " " + ResolveRBuildFilePath(cdFile) + " 1>$(NUL)"); + } + } + + foreach (RBuildModule module in SysGen.Project.Modules) + { + if (module.IsInstallable) + { + RBuildCDFile cdFile = new RBuildCDFile(); + + cdFile.Root = PathRoot.LiveCD; + cdFile.Name = module.TargetFile.Name; + cdFile.Base = "reactos" + "//" + module.InstallBase; + + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + ResolveRBuildFilePath(module.TargetFile) + " " + ResolveRBuildFilePath(cdFile) + " 1>$(NUL)"); + } + } + + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t${cp} " + @"boot\bootdata\livecd.ini $(OUTPUT)\livecd\freeldr.ini 1>$(NUL)"); + } + + public override RBuildFolder WorkingFolder + { + get { return new RBuildFolder(PathRoot.Output, "LiveCD"); } + } + + protected override string ResolveRBuildFilePath(RBuildFile file) + { + if (file.Root == PathRoot.CDOutput) + return Path.Combine(SysGen.LiveCDOutputDirectory, file.FullPath); + + return SysGen.ResolveRBuildFilePath(file); + } + } + + public class MingwLiveCDRegTestTargetHandler : MingwLiveCDTargetHandler + { + public MingwLiveCDRegTestTargetHandler(RBuildModule module) + : base(module) + { + } + public override RBuildFolder WorkingFolder + { + get { return new RBuildFolder(PathRoot.Output, "livecdregtest"); } + } + } + + public class MingwBootCDRegTestTargetHandler : MingwBootCDTargetHandler + { + public MingwBootCDRegTestTargetHandler(RBuildModule module) + : base(module) + { + } + + public override RBuildFolder WorkingFolder + { + get { return new RBuildFolder(PathRoot.Output , "cdregtest"); } + } + } + + public class MingwBootCDTargetHandler : MingwRBuildIsoModuleHandler + { + public MingwBootCDTargetHandler(RBuildModule module) + : base(module) + { + } + + protected override void WriteCopyCDFiles() + { + base.WriteCopyCDFiles(); + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + if ((module.Enabled) && (module.IsBootstrap)) + { + RBuildBootstrapFile bootstrapFile = module.Bootstrap; + + if (bootstrapFile != null) + { + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + ResolveRBuildFilePath(bootstrapFile) + " " + ResolveRBuildFilePath(bootstrapFile.CDNewFile) + " 1>$(NUL)"); + } + } + } + + foreach (RBuildOutputFile file in SysGen.Project.Files) + { + RBuildBootstrapFile bootstrapFile = file as RBuildBootstrapFile; + + if (bootstrapFile != null) + { + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + ResolveRBuildFilePath(bootstrapFile) + " " + ResolveRBuildFilePath(bootstrapFile.CDNewFile) + " 1>$(NUL)"); + } + } + } + + protected override void AddFolders() + { + //Ensure folder exists + base.AddFolders(); + + Module.Folders.Add(new RBuildFolder(WorkingFolder, "loader")); + Module.Folders.Add(new RBuildFolder(WorkingFolder, "reactos")); + Module.Folders.Add(new RBuildFolder(WorkingFolder, "reactos/system32")); + } + + protected override string ResolveRBuildFilePath(RBuildFile file) + { + if (file.Root == PathRoot.CDOutput) + return SysGen.NormalizePath(Path.Combine(SysGen.BootCDOutputDirectory, file.FullPath)); + + return SysGen.ResolveRBuildFilePath(file); + } + + public override RBuildFolder WorkingFolder + { + get { return new RBuildFolder(PathRoot.Output , "cd"); } + } + } + + public abstract class MingwRBuildIsoModuleHandler : MingwRBuildModuleHandler + { + private const string PROFILES_FOLDER = "Profiles"; + private const string ALL_USERS_FOLDER = "All Users"; + private const string DEFAULT_USER_FOLDER = "Default User"; + private const string DESKTOP_FOLDER = "Desktop"; + private const string MY_DOCUMENTS_FOLDER = "My Documents"; + + protected List m_BuildTools = new List(); + + public MingwRBuildIsoModuleHandler(RBuildModule module) + : base(module) + { + } + + protected List BuildTools + { + get { return m_BuildTools; } + } + + public override void GenerateMakeFile() + { + AddAditionalFiles(); + AddFolders(); + + WriteFolders(); + WriteTarget(); + WriteCabinetManager(); + WriteCopyCDFiles(); + WriteMakeRegistryHives(); + WriteMakeHive(); + WriteCDMake(); + WriteCleanTarget(); + } + + protected virtual void AddAditionalFiles() + { + } + + protected virtual void WriteMakeHive() + { + } + + protected virtual void AddFolders() + { + Module.Folders.Add(WorkingFolder); + } + + protected virtual void WriteTarget() + { + Makefile.WriteTarget(Module.MakeFileTargetMacro); + Makefile.WriteIndentedLine("all"); + Makefile.WriteIndentedLine("$(cabman_TARGET)"); + Makefile.WriteIndentedLine("$(cdmake_TARGET)"); + Makefile.WriteIndentedLine("$(mkhive_TARGET)"); + Makefile.WriteIndentedLine(Module.MakeFileFoldersMacro); + + foreach (RBuildModule module in SysGen.Project.Platform.Modules) + { + if ((module.Enabled) && (module.IsBootstrap)) + { + Makefile.WriteIndentedLine(module.MakeFileTargetMacro); + } + } + + Makefile.WriteIndentedLine(BootModule.MakeFileTargetMacro); + Makefile.WriteLine(); + } + + protected virtual void WriteMakeRegistryHives() + { + } + + protected virtual void WriteCabinetManager() + { + Makefile.WriteLine("\t$(ECHO_CABMAN)"); + Makefile.WriteLine("\t$(Q)$(cabman_TARGET) -C " + SysGen.Project.PackagesFile + @" -L $(OUTPUT)\cd\reactos -I -P $(OUTPUT)"); + Makefile.WriteLine("\t$(Q)$(cabman_TARGET) -C " + SysGen.Project.PackagesFile + @" -RC $(OUTPUT)\cd\reactos\reactos.inf -L $(OUTPUT)\cd\reactos -N -P $(OUTPUT)"); + Makefile.WriteLine("\t-@${rm} " + @"$(OUTPUT)\cd\reactos\reactos.inf" + " 2>$(NUL)"); + Makefile.WriteLine(); + } + + protected virtual void WriteCDMake() + { + Makefile.WriteLine("\t$(ECHO_CDMAKE)"); + Makefile.WriteLine("\t$(Q)$(cdmake_TARGET) -v -j -m -b " + ResolveRBuildFilePath(BootModule.TargetFile) + " " + ResolveRBuildFolderPath(WorkingFolder) + " " + CDLabel + " " + IsoImage); + Makefile.WriteLine(); + } + + protected virtual void WriteCopyCDFiles() + { + foreach (RBuildOutputFile file in SysGen.Project.Files) + { + RBuildCDFile cdFile = file as RBuildCDFile; + + if (cdFile != null) + { + Makefile.WriteLine("\t$(ECHO_CP)"); + Makefile.WriteLine("\t$(cp) " + ResolveRBuildFilePath(cdFile) + " " + ResolveRBuildFilePath(cdFile.CDNewFile) + " 1>$(NUL)"); + } + } + } + + protected virtual RBuildModule BootModule + { + get { return Module.BootSector; } + } + + public abstract RBuildFolder WorkingFolder { get; } + + public virtual string IsoImage + { + get { return ResolveRBuildFilePath(Module.TargetFile); } + } + + public virtual string CDLabel + { + get { return Module.CDLabel; } + } + + protected override bool CanCompile(RBuildSourceFile file) + { + return false; + } + + protected override void WriteFileBuildInstructions(SourceFile sourceFile) + { + throw new Exception("The method or operation is not implemented."); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/ProjectTreeReport/ProjectTreeReport.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/ProjectTreeReport/ProjectTreeReport.cs new file mode 100644 index 00000000000..3952090f289 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/ProjectTreeReport/ProjectTreeReport.cs @@ -0,0 +1,66 @@ +using System; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class ProjectTreeReport : Backend + { + public ProjectTreeReport(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Tree Report"; } + } + + protected override void Generate() + { + using (StreamWriter sw = new StreamWriter(@"C:\resTree.htm")) + { + using (HtmlTextWriter writer = new HtmlTextWriter(sw)) + { + WriteModule(SysGen.RootTask , writer); + } + } + } + + private void WriteModule(Task task, HtmlTextWriter writer) + { + ITaskContainer container = task as ITaskContainer; + + writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "5"); + writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "5"); + writer.AddAttribute(HtmlTextWriterAttribute.Border, "1"); + writer.AddAttribute(HtmlTextWriterAttribute.Bordercolor, "#000000"); + writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(task.Name); + + if (container != null) + { + if (container.ChildTasks.Count > 0) + { + foreach (Task childTask in container.ChildTasks) + { + WriteModule(childTask, writer); + } + } + } + + writer.RenderEndTag(); + writer.RenderEndTag(); + writer.RenderEndTag(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RBuildDB/RBuildDBBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RBuildDB/RBuildDBBackend.cs new file mode 100644 index 00000000000..032af573ba7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RBuildDB/RBuildDBBackend.cs @@ -0,0 +1,102 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class RBuildDBBackend : Backend + { + public RBuildDBBackend(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "RBuild Database"; } + } + + private string RBuildDBFile + { + get { return Path.Combine(SysGen.BaseDirectory, "rbuilddb.xml"); } + } + + protected override void Generate() + { + // Creates an XML file is not exist + using (XmlTextWriter writer = new XmlTextWriter(RBuildDBFile, Encoding.ASCII)) + { + writer.Indentation = 4; + writer.Formatting = Formatting.Indented; + + // Starts a new document + writer.WriteStartDocument(); + writer.WriteComment("File autogenerated by SysGen"); + writer.WriteStartElement("catalog"); + + writer.WriteStartElement("modules"); + foreach (RBuildModule module in Project.Modules) + { + writer.WriteStartElement("module"); + writer.WriteAttributeString("name", module.Name); + writer.WriteAttributeString("type", module.Type.ToString()); + writer.WriteAttributeString("base", module.Base); + writer.WriteAttributeString("desc", module.Description); + writer.WriteAttributeString("path", module.CatalogPath); + writer.WriteAttributeString("enabled", module.Enabled.ToString()); + + writer.WriteStartElement("libraries"); + + foreach (RBuildModule library in module.Libraries) + writer.WriteElementString("library", library.Name); + + writer.WriteEndElement(); + + writer.WriteStartElement("dependencies"); + + foreach (RBuildModule dependency in module.Dependencies) + writer.WriteElementString("dependency", dependency.Name); + + writer.WriteEndElement(); + + writer.WriteStartElement("requeriments"); + + foreach (RBuildModule requirement in module.Requeriments) + writer.WriteElementString("requires", requirement.Name); + + writer.WriteEndElement(); + + writer.WriteEndElement(); + } + writer.WriteEndElement(); + + writer.WriteStartElement("languages"); + foreach (RBuildLanguage language in Project.Languages) + { + writer.WriteStartElement("language"); + writer.WriteAttributeString("name", language.Name); + writer.WriteEndElement(); + } + writer.WriteEndElement(); + + writer.WriteStartElement("debugchannels"); + foreach (RBuildDebugChannel language in Project.DebugChannels) + { + writer.WriteStartElement("debugchannel"); + writer.WriteAttributeString("name", language.Name); + writer.WriteEndElement(); + } + writer.WriteEndElement(); + writer.WriteEndElement(); + + writer.WriteEndDocument(); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RGenStats/RGenStatBackend.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RGenStats/RGenStatBackend.cs new file mode 100644 index 00000000000..113f0fd290c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/RGenStats/RGenStatBackend.cs @@ -0,0 +1,110 @@ +using System; +using System.Text.RegularExpressions; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Tasks; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine.Backends +{ + public class RGenStatBackend : Backend + { + public RGenStatBackend(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "RGenStat Report"; } + } + + protected override void Generate() + { + using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "\\apistatus.lst")) + { + sw.WriteLine("; Format:"); + sw.WriteLine("; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES"); + sw.WriteLine(); + sw.WriteLine("; Where:"); + sw.WriteLine("; COMPONENT_NAME - Name of the module. Eg. kernel32."); + sw.WriteLine("; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to where rgenstat is run from)."); + sw.WriteLine(); + + foreach (RBuildModule module in Project.Modules) + { + if (module.Type == ModuleType.Kernel || + module.Type == ModuleType.KernelModeDLL || + module.Type == ModuleType.KernelModeDriver || + module.Type == ModuleType.StaticLibrary || + module.Type == ModuleType.ObjectLibrary || + module.Type == ModuleType.Win32DLL || + module.Type == ModuleType.Win32OCX || + module.Type == ModuleType.KeyboardLayout) + { + sw.WriteLine("{0} {1}", + module.Name, + module.BaseURI.ToString().Replace("\\", "/")); + } + } + } + + //using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "\\descriptions.rbuild")) + //{ + // sw.WriteLine(""); + // sw.WriteLine(""); + // sw.WriteLine(""); + // sw.WriteLine(""); + + // foreach (RBuildModule module in Project.Modules) + // { + // if (module.Type == ModuleType.Kernel || + // module.Type == ModuleType.KernelModeDLL || + // module.Type == ModuleType.KernelModeDriver || + // module.Type == ModuleType.BootLoader || + // module.Type == ModuleType.BootProgram || + // module.Type == ModuleType.BootSector || + // module.Type == ModuleType.BuildTool || + // module.Type == ModuleType.Cabinet || + // module.Type == ModuleType.EmbeddedTypeLib || + // module.Type == ModuleType.HostStaticLibrary || + // module.Type == ModuleType.IdlHeader || + // module.Type == ModuleType.NativeCUI || + // module.Type == ModuleType.NativeDLL || + // module.Type == ModuleType.ObjectLibrary || + // module.Type == ModuleType.Package || + // module.Type == ModuleType.RpcClient || + // module.Type == ModuleType.RpcProxy || + // module.Type == ModuleType.RpcServer || + // module.Type == ModuleType.StaticLibrary || + // module.Type == ModuleType.Win32CUI || + // module.Type == ModuleType.Win32DLL || + // module.Type == ModuleType.Win32GUI || + // module.Type == ModuleType.Win32OCX || + // module.Type == ModuleType.Win32SCR || + // module.Type == ModuleType.KeyboardLayout) + + // { + // sw.WriteLine("", + // module.Name.ToUpper(), + // module.Name); + // } + // } + + // sw.WriteLine(""); + //} + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Backends/WarningReport/WarningReport.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/WarningReport/WarningReport.cs new file mode 100644 index 00000000000..5b48f103ae1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Backends/WarningReport/WarningReport.cs @@ -0,0 +1,82 @@ +using System; +using System.Web.UI; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; + +namespace SysGen.BuildEngine.Backends +{ + public class WarningReport : Backend + { + public WarningReport(SysGenEngine sysgen) + : base(sysgen) + { + } + + protected override string FriendlyName + { + get { return "Warning report"; } + } + + protected override void Generate() + { + //using (StreamWriter sw = new StreamWriter(@"C:\roswarning.txt")) + //{ + // foreach (RBuildModule module in Project.Modules) + // { + // if (module.Unicode == false) + // { + // if ((module.Defines.ContainsKey("UNICODE")) || + // (module.Defines.ContainsKey("_UNICODE")) || + // (module.Defines.ContainsKey("_UNICODE_"))) + // { + // sw.WriteLine("- Module '{0}' has unicode defines but 'Unicode' property set to 'False'", module.Name); + // } + // } + + // foreach (KeyValuePair define in Project.Defines) + // { + // if (module.Defines.ContainsKey(define.Key)) + // { + // sw.WriteLine("- Module '{0}' already define '{1}' inherited from project ", module.Name, define.Key); + // } + // } + + // foreach (string flag in Project.CompilerFlags) + // { + // if (module.CompilerFlags.Contains(flag)) + // { + // sw.WriteLine("- Module '{0}' already has compiler flag '{1}' inherited from project ", module.Name, flag); + // } + // } + + // foreach (string flag in Project.LinkerFlags) + // { + // if (module.LinkerFlags.Contains(flag)) + // { + // sw.WriteLine("- Module '{0}' already has linker flag '{1}' inherited from project ", module.Name, flag); + // } + // } + + // foreach (RBuildFolder include in module.IncludeFolders) + // { + // if (Project.IncludeFolders.Contains(include)) + // { + // sw.WriteLine("- Module '{0}' already has include folder '{1}' inherited from project ", module.Name, include.RelativePath); + // } + + // if (SysGen.RBuildFolderExists(include) == false) + // { + // sw.WriteLine("- Module '{0}' includes folder '{1}' which could not be found ", module.Name, include.RelativePath); + // } + // } + // } + //} + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/BackendCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/BackendCollection.cs new file mode 100644 index 00000000000..c2df8997b68 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/BackendCollection.cs @@ -0,0 +1,22 @@ +using System; +using System; +using System.Collections; +using System.Collections.Generic; + +using SysGen.BuildEngine.Log; +using SysGen.BuildEngine.Backends; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public sealed class BackendCollection : List + { + public void Generate() + { + foreach (Backend backend in this) + { + backend.Run(); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/DefineCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/DefineCollection.cs new file mode 100644 index 00000000000..e05ada2c171 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/DefineCollection.cs @@ -0,0 +1,23 @@ +using System; +using System; +using System.Collections; +using System.Collections.Generic; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public class DefineCollection : Dictionary + { + public void Add(string name) + { + Add(name, string.Empty); + } + + public void Add(string name , string value) + { + if (!ContainsKey(name)) + base.Add(name, value); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/FileHandlerCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/FileHandlerCollection.cs new file mode 100644 index 00000000000..ec7b65a5c86 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/FileHandlerCollection.cs @@ -0,0 +1,24 @@ +using System; +using System; +using System.Collections; +using System.Collections.Generic; + +using SysGen.BuildEngine.Log; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public sealed class FileHandlerCollection : List + { + public void ProcessFiles(RBuildPlatformFileCollection files) + { + foreach (RBuildFile file in files) + { + foreach (IFileHandler handler in this) + { + handler.Process(file); + } + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/LogListenerCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/LogListenerCollection.cs new file mode 100644 index 00000000000..7d907c3fe93 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/LogListenerCollection.cs @@ -0,0 +1,14 @@ +using System; +using System; +using System.Collections; +using System.Collections.Generic; + +using SysGen.BuildEngine.Log; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public sealed class LogListenerCollection : List + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskBuilderCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskBuilderCollection.cs new file mode 100644 index 00000000000..386c0b04c24 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskBuilderCollection.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace SysGen.BuildEngine +{ + public class TaskBuilderCollection : List + { + public bool Add(TaskBuilder builder) + { + // prevent adding duplicate builders with the same task name + if (FindBuilderForTask(builder.TaskName) == null) + { + base.Add(builder); + return true; + } + + return false; + } + + public TaskBuilder FindBuilderForTask(string taskName) + { + foreach (TaskBuilder builder in this) + { + if (builder.TaskName == taskName) + { + return builder; + } + } + return null; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskCollection.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskCollection.cs new file mode 100644 index 00000000000..a10cf92f4f1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Collections/TaskCollection.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace SysGen.BuildEngine +{ + public sealed class TaskCollection : List + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Elements/Base/Element.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Elements/Base/Element.cs new file mode 100644 index 00000000000..3de1765b291 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Elements/Base/Element.cs @@ -0,0 +1,306 @@ +using System; +using System.IO; +using System.Reflection; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Log; +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Tasks; + +namespace SysGen.BuildEngine +{ + /// Models a NAnt XML element in the build file. + /// + /// Automatically validates attributes in the element based on Attribute settings in the derived class. + /// + public class Element : IElement + { + protected Location _location = Location.UnknownLocation; + protected SysGenEngine _sysgen = null; + protected RBuildProject _project = null; + protected XmlNode _xmlNode = null; + protected IElement _parent = null; + protected bool m_FailOnMissingRequired = true; + + /// + /// The default contstructor. + /// + public Element() + { + } + + /// A copy contstructor. + protected Element(Element element) : this() + { + _location = element._location; + _sysgen = element._sysgen; + _xmlNode = element._xmlNode; + } + + /// in the build file where the element is defined. + protected virtual Location Location { + get { return _location; } + set { _location = value; } + } + + /// + /// The Parent object. This will be your parent Task, Target, or Project depeding on where the element is defined. + /// + public IElement Parent { get { return _parent; } set { _parent = value; } } + + /// Name of the XML element used to initialize this element. + public virtual string Name + { + get { + ElementNameAttribute elementNameAttribute = (ElementNameAttribute) + Attribute.GetCustomAttribute(GetType(), typeof(ElementNameAttribute)); + + string name = null; + if (elementNameAttribute != null) { + name = elementNameAttribute.Name; + } + return name; + } + } + + /// + /// The this element belongs to. + /// + public virtual SysGenEngine SysGen + { + get { return _sysgen; } + set { _sysgen = value; } + } + + public RBuildProject Project + { + get { return _project; } + set { _project = value; } + } + + public RBuildModule Module + { + get + { + RBuildModule module = RBuildElement as RBuildModule; + + if (module == null) + throw new BuildException(String.Format("Task <{0} ... \\> is not child of any ModuleTask." , Name), Location); + + return module; + } + } + + /// + /// this element belongs to. + /// + public virtual RBuildElement RBuildElement + { + get + { + IElement element = this; + while (element != null) + { + if (element is ISysGenObject) + return ((ISysGenObject)element).RBuildElement; + + //Set to his parent + element = element.Parent; + } + + return SysGen.Project; + } + } + + public string BaseBuildLocation + { + get { return Path.GetDirectoryName(new Uri(_xmlNode.BaseURI).LocalPath); } + } + + public XmlNode XmlNode + { + get { return _xmlNode; } + } + + /// + /// Initializes all build attributes. + /// + private void InitializeProperties(XmlNode elementNode) + { + // Get the current element Type + Type currentType = GetType(); + + PropertyInfo[] propertyInfoArray = currentType.GetProperties(BindingFlags.Public|BindingFlags.Instance); + foreach (PropertyInfo propertyInfo in propertyInfoArray ) + { + // process all TaskPropertyAttribute attributes + TaskPropertyAttribute[] propertyAttributes = (TaskPropertyAttribute[]) + Attribute.GetCustomAttributes(propertyInfo, typeof(TaskPropertyAttribute) , false); + + foreach(TaskPropertyAttribute propertyAttribute in propertyAttributes) + { + string propertyValue = null; + + if (propertyAttribute.Location == TaskPropertyLocation.Attribute) + { + if (elementNode.Attributes[propertyAttribute.Name] != null) + { + propertyValue = elementNode.Attributes[propertyAttribute.Name].Value; + } + } + else if (propertyAttribute.Location == TaskPropertyLocation.Node) + { + propertyValue = elementNode.InnerText; + } + + // check if its required + if (propertyValue == null && propertyAttribute.Required && m_FailOnMissingRequired) + { + throw new BuildException(String.Format("'{0}' is a required '{1}' of <{2} ... \\>.", propertyAttribute.Name, propertyAttribute.Location , Name), Location); + } + + if (propertyValue != null) + { + //string attrValue = attributeNode.Value; + if (propertyAttribute.ExpandProperties) + { + // expand attribute properites + propertyValue = SysGen.ExpandProperties(propertyValue); + } + + if (propertyInfo.CanWrite) + { + // set the property value instead + MethodInfo info = propertyInfo.GetSetMethod(); + object[] paramaters = new object[1]; + + Type propertyType = propertyInfo.PropertyType; + + // If the object is an emum + if (propertyType.IsSubclassOf(typeof(System.Enum))) + { + try + { + paramaters[0] = Enum.Parse(propertyType, propertyValue, true); + } + catch (Exception) + { + // catch type conversion exceptions here + string message = string.Format("Invalid value '{0}'. Valid values for this attribute are:\n", propertyValue); + foreach (object value in Enum.GetValues(propertyType)) + { + message += string.Format("\t{0}\n", value.ToString()); + } + throw new BuildException(message, Location); + } + } + else + { + //validate attribute value with custom ValidatorAttribute(ors) + ValidatorAttribute[] validateAttributes = (ValidatorAttribute[]) + Attribute.GetCustomAttributes(propertyInfo, typeof(ValidatorAttribute)); + try + { + foreach (ValidatorAttribute validator in validateAttributes) + validator.Validate(propertyValue); + } + catch (ValidationException ve) + { + throw new ValidationException(ve.Message, Location); + } + + if (propertyType == typeof(System.Boolean)) + { + paramaters[0] = Convert.ChangeType(SysGenConversion.ToBolean(propertyValue), propertyInfo.PropertyType); + } + else + { + paramaters[0] = Convert.ChangeType(propertyValue, propertyInfo.PropertyType); + } + } + + info.Invoke(this, paramaters); + } + else + { + new BuildException(string.Format("Property '{0}' was found but '{1}' does no implement Set", propertyAttribute.Name, Name)); + } + } + } + + // now do nested BuildElements + BuildElementAttribute buildElementAttribute = (BuildElementAttribute) + Attribute.GetCustomAttribute(propertyInfo, typeof(BuildElementAttribute)); + + if (buildElementAttribute != null) + { + // get value from xml node + XmlNode nestedElementNode = elementNode[buildElementAttribute.Name, elementNode.OwnerDocument.DocumentElement.NamespaceURI]; + // check if its required + if (nestedElementNode == null && buildElementAttribute.Required) { + throw new BuildException(String.Format("'{0}' is a required element of <{1} ...//>.", buildElementAttribute.Name, this.Name), Location); + } + if (nestedElementNode != null) { + Element childElement = (Element)propertyInfo.GetValue(this, null); + // Sanity check: Ensure property wasn't null. + if ( childElement == null ) + throw new BuildException(String.Format("Property '{0}' value cannot be null for <{1} ...//>", propertyInfo.Name, this.Name), Location); + childElement.SysGen = SysGen; + childElement.Initialize(nestedElementNode); + } + } + } + } + + /// Performs default initialization. + /// + /// Derived classes that wish to add custom initialization should override . + /// + public void Initialize(XmlNode elementNode) + { + if (SysGen == null) + throw new InvalidOperationException("Element has invalid BuildFileLoader property."); + + // Save the element node + _xmlNode = elementNode; + + // Save position in buildfile for reporting useful error messages. + try + { + _location = SysGen.LocationMap.GetLocation(elementNode); + } + catch(ArgumentException ae) + { + BuildLog.WriteLineIf(SysGen.Verbose, ae.ToString()); + } + + InitializeProperties(elementNode); + + OnInit(); + + // Allow inherited classes a chance to do some custom initialization. + InitializeElement(elementNode); + + // The Element has been completly initialized + OnLoad(); + } + + /// + /// Allows derived classes to provide extra initialization and validation not covered by the base class. + /// + /// The xml node of the element to use for initialization. + protected virtual void InitializeElement(XmlNode elementNode) + { + } + + protected virtual void OnLoad() + { + } + + protected virtual void OnInit() + { + } + + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/BuildException.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/BuildException.cs new file mode 100644 index 00000000000..b8b422221be --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/BuildException.cs @@ -0,0 +1,101 @@ +using System; +using System.Runtime.Serialization; + +namespace SysGen.BuildEngine +{ + /// + /// Thrown whenever an error occurs during the build. + /// + [Serializable] + public class BuildException : ApplicationException + { + private Location _location = Location.UnknownLocation; + + /// + /// Constructs a build exception with no descriptive information. + /// + public BuildException() : base() { + } + + public BuildException(String message, params object[] args) + : base(string.Format(message, args)) + { + } + + /// + /// Constructs an exception with a descriptive message. + /// + public BuildException(String message) : base(message) { + } + + /// + /// Constructs an exception with a descriptive message and an + /// instance of the Exception that is the cause of the current Exception. + /// + public BuildException(Exception e, String message) : base(message, e) { + } + + /// + /// Constructs an exception with a descriptive message and an + /// instance of the Exception that is the cause of the current Exception. + /// + public BuildException(Exception e, String message,params object[] args) + : base(string.Format(message , args), e) + { + } + + /// + /// Constructs an exception with a descriptive message and location + /// in the build file that caused the exception. + /// + /// The error message that explains the reason for the exception. + /// Location in the build file where the exception occured. + public BuildException(String message, Location location) : base(message) { + _location = location; + } + + /// + /// Constructs an exception with the given descriptive message, the + /// location in the build file and an instance of the Exception that + /// is the cause of the current Exception. + /// + /// The error message that explains the reason for the exception. + /// Location in the build file where the exception occured. + /// An instance of Exception that is the cause of the current Exception. + public BuildException(String message, Location location, Exception e) : base(message, e) { + _location = location; + } + + /// Initializes a new instance of the BuildException class with serialized data. + public BuildException(SerializationInfo info, StreamingContext context) : base(info, context) { + /* + string fileName = info.GetString("Location.FileName"); + int lineNumber = info.GetInt32("Location.LineNumber"); + int columnNumber = info.GetInt32("Location.ColumnNumber"); + */ + _location = info.GetValue("Location", _location.GetType()) as Location; + } + + /// Sets the SerializationInfo object with information about the exception. + /// The object that holds the serialized object data. + /// The contextual information about the source or destination. + /// For more information, see SerializationInfo in the Microsoft documentation. + public override void GetObjectData(SerializationInfo info, StreamingContext context) { + base.GetObjectData(info, context); + info.AddValue("Location", _location); + } + + public override string Message { + get { + string message = base.Message; + + // only include location string if not empty + string locationString = _location.ToString(); + if (locationString != String.Empty) { + message = locationString + "\n " + message; + } + return message; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/ValidationException.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/ValidationException.cs new file mode 100644 index 00000000000..0150c5c79f0 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Exceptions/ValidationException.cs @@ -0,0 +1,62 @@ +using System; +using System.Runtime.Serialization; + +namespace SysGen.BuildEngine +{ + /// + /// This exception indicates that an error has occured while performing a validate operation. + /// The ValidationEventHandler can cause this exception to be thrown during the validate operations + /// + [Serializable] + public class ValidationException : BuildException + { + /// + /// Constructs a build exception with no descriptive information. + /// + public ValidationException() : base() {} + + /// + /// Constructs an exception with a descriptive message. + /// + public ValidationException(String message) : base(message) {} + + /// + /// Constructs an exception with a descriptive message and an + /// instance of the Exception that is the cause of the current Exception. + /// + public ValidationException(String message, Exception e) : base(e, message) {} + + /// + /// Constructs an exception with a descriptive message and location + /// in the build file that caused the exception. + /// + /// The error message that explains the reason for the exception. + /// Location in the build file where the exception occured. + public ValidationException(String message, Location location) : base(message, location) {} + + /// + /// Constructs an exception with the given descriptive message, the + /// location in the build file and an instance of the Exception that + /// is the cause of the current Exception. + /// + /// The error message that explains the reason for the exception. + /// Location in the build file where the exception occured. + /// An instance of Exception that is the cause of the current Exception. + public ValidationException(String message, Location location, Exception e) : base(message, location, e) {} + + /// Initializes a new instance of the ValidationException class with serialized data. + public ValidationException(SerializationInfo info, StreamingContext context) : base(info, context) {} + + /// Sets the SerializationInfo object with information about the exception. + /// The object that holds the serialized object data. + /// The contextual information about the source or destination. + /// For more information, see SerializationInfo in the Microsoft documentation. + public override void GetObjectData(SerializationInfo info, StreamingContext context) {} + + public override string Message { + get { + return base.Message; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedCFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedCFileWriter.cs new file mode 100644 index 00000000000..9f37bd4c0e5 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedCFileWriter.cs @@ -0,0 +1,30 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine.Framework; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public abstract class AutoGeneratedCFileWriter : AutoGeneratedFileWriter + { + public AutoGeneratedCFileWriter(RBuildModule module, string file) + : base(module , file) + { + } + + protected virtual void WriteHeader() + { + WriteLine("/* This file is automatically generated. */"); + WriteLine(); + } + + protected virtual void WriteFooter() + { + WriteLine("/* EOF */"); + WriteLine(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedFileWriter.cs new file mode 100644 index 00000000000..02a03e04fe3 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedFileWriter.cs @@ -0,0 +1,39 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public abstract class AutoGeneratedFileWriter : StreamWriter + { + RBuildProject m_Project = null; + RBuildModule m_Module = null; + + public AutoGeneratedFileWriter(RBuildProject project, string file) + : base(file) + { + m_Project = project; + } + + public AutoGeneratedFileWriter(RBuildModule module, string file) + : base(file) + { + m_Module = module; + } + + protected RBuildProject Project + { + get { return m_Project; } + } + + protected RBuildModule Module + { + get { return m_Module; } + } + + public abstract void WriteFile(); + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedInfFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedInfFileWriter.cs new file mode 100644 index 00000000000..93135c8771b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/Base/AutoGeneratedInfFileWriter.cs @@ -0,0 +1,54 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public abstract class AutoGeneratedInfFileWriter : AutoGeneratedFileWriter + { + public AutoGeneratedInfFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + protected virtual void WriteHeader() + { + WriteSection("Version"); + WriteLine("Signature = \"$Windows NT$\""); + WriteLine("ClassGUID = {00000000-0000-0000-0000-000000000000}"); + WriteLine(); + } + + protected void WriteSection(string sectionName) + { + WriteLine("[{0}]", sectionName); + } + + protected void WriteComment (string comment) + { + WriteLine("; {0}", comment); + } + + protected void WriteAssignment(string name , string value) + { + WriteLine("{0} = {1}", + name , + value); + } + + protected void WriteBooleanAssignment(string name, bool value) + { + if (value) + { + WriteAssignment(name, "yes"); + } + else + { + WriteAssignment(name, "no"); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/BuildNumberFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/BuildNumberFileWriter.cs new file mode 100644 index 00000000000..330c9162ded --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/BuildNumberFileWriter.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.Framework; +using SysGen.RBuild.Framework; + +namespace SysGen.Framework +{ + public class BuildNumberFileWriter : AutoGeneratedCFileWriter + { + public BuildNumberFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteCompilationUnit(); + WriteFooter(); + } + + private void WriteBuildNumber() + { + WriteLine("#ifndef _INC_REACTOS_BUILDNO"); + WriteLine("#define _INC_REACTOS_BUILDNO"); + WriteLine("#define KERNEL_VERSION_BUILD 20080427"); + WriteLine("#define KERNEL_VERSION_BUILD_HEX 0x8187"); + WriteLine("#define KERNEL_VERSION_BUILD_STR \"20080427-r33159\""); + WriteLine("#define KERNEL_VERSION_BUILD_RC \"20080427-r33159\0\""); + WriteLine("#define KERNEL_RELEASE_RC \"0.4-SVN\0\""); + WriteLine("#define KERNEL_RELEASE_STR \"0.4-SVN\""); + WriteLine("#define KERNEL_VERSION_RC \"0.4-SVN\0\""); + WriteLine("#define KERNEL_VERSION_STR \"0.4-SVN\""); + WriteLine("#define REACTOS_DLL_VERSION_MAJOR 42"); + WriteLine("#define REACTOS_DLL_RELEASE_RC \"42.4-SVN\0\""); + WriteLine("#define REACTOS_DLL_RELEASE_STR \"42.4-SVN\""); + WriteLine("#define REACTOS_DLL_VERSION_RC \"42.4-SVN\0\""); + WriteLine("#define REACTOS_DLL_VERSION_STR \"42.4-SVN\""); + WriteLine("#endif"); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/CompilationUnitFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/CompilationUnitFileWriter.cs new file mode 100644 index 00000000000..e0dd0063b8c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/CompilationUnitFileWriter.cs @@ -0,0 +1,42 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class CompilationUnitFileWriter : AutoGeneratedCFileWriter + { + private RBuildCompilationUnitFile m_CompilationUnit = null; + + public CompilationUnitFileWriter(RBuildModule module, RBuildCompilationUnitFile unit , string file) + : base(module , file) + { + m_CompilationUnit = unit; + } + + protected override void WriteHeader() + { + base.WriteHeader(); + + WriteLine("#define ONE_COMPILATION_UNIT"); + WriteLine(); + } + + public override void WriteFile() + { + WriteHeader(); + WriteCompilationUnit(); + } + + private void WriteCompilationUnit() + { + foreach (RBuildSourceFile file in m_CompilationUnit.SourceFiles) + { + WriteLine("#include <{0}>", file.FullPath); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DefinitionFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DefinitionFileWriter.cs new file mode 100644 index 00000000000..d0d11a5073b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DefinitionFileWriter.cs @@ -0,0 +1,21 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class DefinitionFileWriter : AutoGeneratedFileWriter + { + public DefinitionFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DffFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DffFileWriter.cs new file mode 100644 index 00000000000..ce146aca3bf --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/DffFileWriter.cs @@ -0,0 +1,139 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class DffFileWriter : AutoGeneratedFileWriter + { + public DffFileWriter(RBuildProject project , string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteModuleTargets(); + } + + protected void WriteHeader() + { + WriteLine("; Main ReactOS package"); + WriteLine(); + WriteLine(".Set DiskLabelTemplate=\"ReactOS\" ; Label of disk"); + WriteLine(".Set CabinetNameTemplate=\"reactos.cab\" ; reactos.cab"); + WriteLine(".Set InfFileName=\"reactos.inf\" ; reactos.inf"); + WriteLine(); + WriteLine(";.Set Cabinet=on"); + WriteLine(";.Set Compress=on"); + WriteLine(); + WriteLine(".InfBegin"); + WriteLine("[Version]"); + WriteLine("Signature = \"$ReactOS$\""); + WriteLine(); + WriteLine("[Directories]"); + + foreach (RBuildInstallFolder folder in Project.InstallFolders) + { + if (folder.Name == string.Empty || + folder.Name == ".") + { + WriteLine("{0} =", + folder.ID); + } + else + WriteLine("{0} = {1}", + folder.ID, + folder.Name); + } + + WriteLine(".InfEnd"); + WriteLine(); + WriteLine("; Contents of disk"); + WriteLine(".InfBegin"); + WriteLine("[SourceFiles]"); + WriteLine(".InfEnd"); + } + + protected void WriteModuleTargets() + { + RBuildInstallFolder installFolder = null; + + WriteLine(); + WriteLine(";Module targets"); + WriteLine(); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Enabled) + { + if ((module.IsInstallable) && (module.HasInstallBase)) + { + if ((!module.IsBootstrap || module.IsSpecialIncludedBootStrap) && !module.IsSpecialExcludedBootStrap) + { + //Get the install folder + installFolder = Project.InstallFolders.GetByName(module.InstallBase); + + if (installFolder == null) + throw new BuildException("InstallBase '{0}' for module '{1}' references a non existant install folder", + module.InstallBase, + module.Name); + + WriteLine("{0,-90}\t{1,10}", + module.TargetFile.FullPath, + installFolder.ID); + } + } + + foreach (RBuildOutputFile file in module.Files) + { + RBuildPlatformFile platformFile = file as RBuildPlatformFile; + + if (platformFile != null) + { + //Get the install folder + installFolder = Project.InstallFolders.GetByName(file.InstallBase); + + if (installFolder == null) + throw new BuildException("InstallBase '{0}' for file '{1}' references a non existant install folder", + platformFile.InstallBase, + platformFile.FullPath); + + WriteLine("{0,-90}\t{1,10}", + platformFile.FullPath, + installFolder.ID); + } + } + } + } + + WriteLine(); + WriteLine(";Install files"); + WriteLine(); + + foreach (RBuildOutputFile file in Project.Files) + { + RBuildPlatformFile platformFile = file as RBuildPlatformFile; + + if (platformFile != null) + { + //Get the install folder + installFolder = Project.InstallFolders.GetByName(file.InstallBase); + + if (installFolder == null) + throw new BuildException("InstallBase '{0}' for file '{1}' references a non existant install folder", + platformFile.InstallBase, + platformFile.FullPath); + + WriteLine("{0,-90}\t{1,10}", + platformFile.FullPath, + installFolder.ID); + } + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderCreditsFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderCreditsFileWriter.cs new file mode 100644 index 00000000000..aa453d2ec5f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderCreditsFileWriter.cs @@ -0,0 +1,36 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class HeaderCreditsFileWriter : AutoGeneratedFileWriter + { + public HeaderCreditsFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteLine("/* This file is autogenerated */"); + WriteLine(); + WriteLine("const char* szAutoContributors[]="); + WriteLine("{"); + + foreach (RBuildContributor contributor in Project.Contributors) + { + WriteLine("\t\t{0},", contributor.FullName); + } + + WriteLine("\t0"); + WriteLine("};"); + + // Adds a blank line + WriteLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderRosCfgFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderRosCfgFileWriter.cs new file mode 100644 index 00000000000..5f9a2693b60 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/HeaderRosCfgFileWriter.cs @@ -0,0 +1,26 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class HeaderRosCfgFileWriter : AutoGeneratedFileWriter + { + public HeaderRosCfgFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteLine("/* This file is autogenerated */"); + WriteLine(); + + // Adds a blank line + WriteLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupComponentSetupFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupComponentSetupFileWriter.cs new file mode 100644 index 00000000000..f3eaa983bdb --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupComponentSetupFileWriter.cs @@ -0,0 +1,84 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public abstract class SysSetupComponentSetupFileWriter : AutoGeneratedInfFileWriter + { + public SysSetupComponentSetupFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + protected virtual void WriteHeader() + { + WriteSection("Version"); + WriteLine("Signature = \"$Windows NT$\""); + WriteLine(); + } + + protected virtual void WriteaAddRegDirective() + { + WriteSection("DefaultInstall"); + WriteLine("AddReg=Install.Reg"); + WriteLine(); + } + + public override void WriteFile() + { + WriteHeader(); + WriteaAddRegDirective(); + WriteContent(); + } + + protected abstract void WriteContent(); + } + + public class DesktopComponentSetupFileWriter : SysSetupComponentSetupFileWriter + { + public DesktopComponentSetupFileWriter(RBuildProject project, string file) + : base(project, file) + { + } + + protected override void WriteContent() + { + WriteLine("[Install.Reg]"); + + if (Project.Platform.Screensaver != null) + { + WriteLine("HKU,\"Control Panel\\Desktop\",\"1SCRNSAVE.EXE\",0x00000000,\"{0}\"", + Project.Platform.Screensaver.PlatformInstall.FullPath); + } + + if (Project.Platform.Wallpaper != null) + { + WriteLine("HKU,\"Control Panel\\Desktop\",\"1Wallpaper\",0x00000000,\"{0}\"", + Project.Platform.Wallpaper.PlatformInstall.FullPath); + } + } + } + + public class ShellComponentSetupFileWriter : SysSetupComponentSetupFileWriter + { + public ShellComponentSetupFileWriter(RBuildProject project, string file) + : base(project, file) + { + } + + protected override void WriteContent() + { + WriteLine("[Install.Reg]"); + + if (Project.Platform.Shell != null) + { + WriteLine("HKLM,\"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\",\"Shell\",0x00020000,\"{0}\"", + Project.Platform.Shell.PlatformInstall.FullPath); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupFileWriter.cs new file mode 100644 index 00000000000..e18646da744 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/SysSetupFileWriter.cs @@ -0,0 +1,92 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class SysSetupFileWriter : AutoGeneratedInfFileWriter + { + public SysSetupFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteInfDevicesSection(); + WriteInfRegistrationPhase2Section(); + WriteInfOleControlDllsSection(); + WriteInfAlwaysSection(); + } + + protected void WriteInfDevicesSection() + { + WriteLine("[DeviceInfsToInstall]"); + WriteLine("cdrom.inf"); + WriteLine("display.inf"); + WriteLine("hdc.inf"); + WriteLine("keyboard.inf"); + WriteLine("machine.inf"); + WriteLine("msmouse.inf"); + WriteLine("NET_NIC.inf"); + WriteLine("ports.inf"); + WriteLine("scsi.inf"); + WriteLine("usbport.inf"); + WriteLine(); + } + + protected void WriteInfRegistrationPhase2Section() + { + WriteLine("[RegistrationPhase2]"); + WriteLine("RegisterDlls=OleControlDlls"); + WriteLine(); + } + + protected void WriteInfOleControlDllsSection() + { + WriteLine("[OleControlDlls]"); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.AutoRegister != null) + { + WriteLine("{0},,{1},{2}", + "11", + module.TargetName, + module.AutoRegister.RegistrationType); + } + } + WriteLine(); + } + + protected void WriteInfAlwaysSection() + { + WriteLine("[Infs.Always]"); + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Setup != null) + { + WriteLine("{0},{1}", + module.Setup.Name, + module.Setup.InstallSection); + } + } + + foreach (RBuildOutputFile file in Project.Files) + { + RBuildSetupFile setup = file as RBuildSetupFile; + + if (setup != null) + { + WriteLine("{0},{1}", + setup.Name, + setup.InstallSection); + } + } + WriteLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtCreditsFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtCreditsFileWriter.cs new file mode 100644 index 00000000000..280bdba0074 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtCreditsFileWriter.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class TxtCreditsFileWriter : AutoGeneratedFileWriter + { + public TxtCreditsFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteLine("ReactOS is available thanks to the work of:"); + WriteLine(); + + foreach (RBuildContributor contributor in Project.Contributors) + { + if (contributor.HasAlias) + { + WriteLine("\t{0} ({1})", + contributor.FullName, + contributor.Alias); + } + else + { + WriteLine("\t{0}", contributor.FullName); + } + + if (contributor.HasMail) + { + WriteLine("\t\t{0}", contributor.Mail); + } + + if (contributor.HasLocation) + { + WriteLine("\t\t{0}, {1}", + contributor.City , + contributor.Country); + } + + // Adds a blank line + WriteLine(); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupFileWriter.cs new file mode 100644 index 00000000000..f1f55d52d56 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupFileWriter.cs @@ -0,0 +1,137 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class TxtSetupFileWriter : AutoGeneratedInfFileWriter + { + public TxtSetupFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteDirectories(); + WriteSourceDiskDiles(); + WriteLanguages(); + WriteKeyboardLayouts(); + WriteKeyboardLayoutFiles(); + WriteRegistryInstall(); + } + + protected override void WriteHeader() + { + WriteSection("Version"); + WriteLine("Signature = \"$ReactOS$\""); + WriteLine(); + } + + public void WriteDirectories() + { + WriteLine("[Directories]"); + WriteLine("; = "); + + foreach (RBuildInstallFolder folder in Project.InstallFolders) + { + WriteLine("{0} = {1}", + folder.ID, + folder.Name); + } + } + + public void WriteSourceDiskDiles() + { + RBuildInstallFolder installFolder = null; + + WriteLine("[SourceDisksFiles]"); + + foreach (RBuildModule module in Project.Modules) + { + if (module.Bootstrap != null) + { + if (module.Type == ModuleType.KernelModeDriver || + module.Type == ModuleType.KernelModeDLL) + { + //Get the install folder + installFolder = Project.InstallFolders.GetByName(module.InstallBase); + + if (installFolder == null) + throw new BuildException("InstallBase '{0}' for module '{1}' references a non existant install folder", + module.InstallBase, + module.Name); + + WriteLine("{0,-50}\t{1,50}", + module.TargetFile.FullPath, + installFolder.ID); + } + } + } + + WriteLine(); + } + + protected void WriteLanguages() + { + WriteSection("Languages"); + + foreach (RBuildLanguage language in Project.Platform.Languages) + { + WriteLine("{0} = \"{1}\"", + language.LCID, + language.Name); + } + + WriteLine(); + } + + protected void WriteKeyboardLayouts() + { + WriteSection("KeyboardLayout"); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.KeyboardLayout) + { + WriteLine("{0} = \"{1}\"", + module.LCID , + module.Description); + } + } + + WriteLine(); + } + + protected void WriteKeyboardLayoutFiles() + { + WriteSection("Files.KeyboardLayout"); + + foreach (RBuildModule module in Project.Platform.Modules) + { + if (module.Type == ModuleType.KeyboardLayout) + { + WriteLine("{0} = {1}", + module.LCID, + module.TargetName); + } + } + + WriteLine(); + } + + protected void WriteRegistryInstall() + { + WriteLine("[HiveInfs.Install]"); + WriteLine("AddReg=hivecls.inf,AddReg"); + WriteLine("AddReg=hivedef.inf,AddReg"); + WriteLine("AddReg=hivesft.inf,AddReg"); + WriteLine("AddReg=hivesys.inf,AddReg"); + WriteLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupHiveFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupHiveFileWriter.cs new file mode 100644 index 00000000000..2a510834d9f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/TxtSetupHiveFileWriter.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class TxtSetupHiveFileWriter : AutoGeneratedInfFileWriter + { + public TxtSetupHiveFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteDirectories(); + } + + protected override void WriteHeader() + { + WriteSection("Version"); + WriteLine("Signature = \"$ReactOS$\""); + WriteLine(); + } + + public void WriteDirectories() + { + WriteLine("[AddReg]"); + + if (Project.Platform.Shell != null) + { + WriteLine("HKLM,\"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\",\"Shell\",0x00020000,\"{0}\"", + Project.Platform.Shell.PlatformInstall.FullPath); + } + + if (Project.Platform.Screensaver != null) + { + WriteLine("HKCU,\"Control Panel\\Desktop\",\"SCRNSAVE.EXE\",0x00000000,\"{0}\"", + Project.Platform.Screensaver.PlatformInstall.FullPath); + } + + if (Project.Platform.Wallpaper != null) + { + WriteLine("HKCU,\"Control Panel\\Desktop\",\"Wallpaper\",0x00000000,\"{0}\"", + Project.Platform.Wallpaper.PlatformInstall.FullPath); + } + + if (Project.Platform.DebugChannels.Count > 0) + { + WriteLine("HKCU,\"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\",\"DEBUGCHANNEL\",0x00020000,\"{0}\"", + Project.Platform.DebugChannels.Text); + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/UnAttendSetupFileWriter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/UnAttendSetupFileWriter.cs new file mode 100644 index 00000000000..7f6ae75f7e4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/FileWriters/UnAttendSetupFileWriter.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Framework +{ + public class UnAttendSetupFileWriter : AutoGeneratedInfFileWriter + { + public UnAttendSetupFileWriter(RBuildProject project, string file) + : base(project , file) + { + } + + public override void WriteFile() + { + WriteHeader(); + WriteUnAttendFile(); + } + + protected override void WriteHeader() + { + WriteSection("Unattend"); + WriteLine("Signature = \"$ReactOS$\""); + WriteLine(); + } + + protected void WriteUnAttendFile() + { + WriteBooleanAssignment("UnattendSetupEnabled", false); + WriteAssignment("DestinationDiskNumber", "0"); + WriteAssignment("DestinationPartitionNumber", "1"); + WriteAssignment("MBRInstallType", "2"); + WriteAssignment("FullName", "MyName"); + WriteAssignment("OrgName", "MyOrg"); + WriteAssignment("ComputerName", "MyComputer"); + WriteAssignment("AdminPassword", "MyPassword"); + WriteAssignment("TimeZoneIndex", "85"); + WriteAssignment("FormatPartition", "1"); + WriteAssignment("AutoPartition", "1"); + WriteAssignment("DisableVmwInst", "1"); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Handlers/SysSetupFileHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Handlers/SysSetupFileHandler.cs new file mode 100644 index 00000000000..0ae911e0fc6 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Handlers/SysSetupFileHandler.cs @@ -0,0 +1,138 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Handlers +{ + public abstract class AutoGeneratedFileHandler : IFileHandler + { + protected SysGenEngine m_SysGenEngine = null; + protected RBuildFile m_OriginalFile = null; + protected RBuildFile m_DestFile = null; + + public AutoGeneratedFileHandler(SysGenEngine engine) + { + m_SysGenEngine = engine; + } + + public void Process(RBuildFile file) + { + m_OriginalFile = file; + + if (file.Name == FileName) + { + // Set the generated file to the temporary path + m_DestFile = new RBuildFile(); + m_DestFile.Root = PathRoot.Intermediate; + m_DestFile.Base = file.Base; + m_DestFile.Name = file.Name; + + // Auto generate this file + AutoGenerate(); + + file = m_DestFile; + } + } + + protected abstract void AutoGenerate(); + + protected abstract string FileName { get; } + } + + public class HiveAutoGeneratedFileHandler : AutoGeneratedFileHandler + { + public HiveAutoGeneratedFileHandler(SysGenEngine engine) + : base(engine) + { + } + + protected override string FileName + { + get { return "hivedef.inf"; } + } + + protected override void AutoGenerate() + { + File.Copy( + m_SysGenEngine.ResolveRBuildFilePath(m_OriginalFile), + m_SysGenEngine.ResolveRBuildFilePath(m_DestFile)); + + File.WriteAllText (m_SysGenEngine.ResolveRBuildFilePath(m_DestFile) , + "; Set default wallpaper\n" + + "HKCU,\"Control Panel\\Desktop\",\"Wallpaper\",0000000000,\"%SystemRoot%\\Green.bmp\"" + + "HKCU,\"Control Panel\\Desktop\",\"WallpaperStyle\",0x00000002,0x00000000\n" + + "HKCU,\"Control Panel\\Desktop\",\"TileWallpaper\",0x00000002,0x00000000\n"); + + } + } + + public class AutorunFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "autorun.inf") + { + int i = 0; + } + } + } + + public class SysSetupFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "syssetup.inf") + { + int i = 0; + } + } + } + + public class TxtSetupFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "txtsetup.sif") + { + int i = 0; + } + } + } + + public class UnattendFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "unattend.inf") + { + int i = 0; + } + } + } + + public class DownloaderFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "downloader.xml") + { + int i = 0; + } + } + } + + public class UnAttendedSetupFileHandler : IFileHandler + { + public void Process(RBuildFile file) + { + if (file.Name == "unattend.inf") + { + int i = 0; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IBuildStatusMailReporter.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IBuildStatusMailReporter.cs new file mode 100644 index 00000000000..4d156d6cc5b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IBuildStatusMailReporter.cs @@ -0,0 +1,10 @@ +using System; + +namespace SysGen.BuildEngine +{ + public interface IBuildStatusMailReporter + { + string MailAdress { get; } + string Subject { get; } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IDirectory.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IDirectory.cs new file mode 100644 index 00000000000..9db7825e601 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IDirectory.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public interface IDirectory + { + PathRoot Root { get; } + string BasePath { get; } + + RBuildFolder Folder { get;} + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IElement.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IElement.cs new file mode 100644 index 00000000000..58ca260b44d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IElement.cs @@ -0,0 +1,21 @@ +using System; +using System.Xml; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public interface IElement + { + string BaseBuildLocation { get; } + void Initialize(System.Xml.XmlNode elementNode); + RBuildModule Module { get; } + string Name { get; } + IElement Parent { get; set; } + RBuildProject Project { get; set; } + //PropertyCollection Properties { get; } + RBuildElement RBuildElement { get; } + SysGenEngine SysGen { get; set; } + XmlNode XmlNode { get; } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IFileHandler.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IFileHandler.cs new file mode 100644 index 00000000000..8aa1e081b57 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IFileHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + public interface IFileHandler + { + void Process(RBuildFile file); + } + + public abstract class NamedFileHandler : IFileHandler + { + public abstract string FileName { get; } + + public void Process(RBuildFile file) + { + if (file.Name == FileName) + { + } + } + + protected abstract void Process(); + } + + public abstract class RegenerateFileHandler : NamedFileHandler + { + public virtual void Generate() + { + + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IRBuildInstallable.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IRBuildInstallable.cs new file mode 100644 index 00000000000..f3c94193996 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/IRBuildInstallable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.Framework +{ + public class IRBuildInstallable + { + string InstallBase; + + RBuildInstallFolder InstallFolder; + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ISysGenObject.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ISysGenObject.cs new file mode 100644 index 00000000000..20c3246615a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ISysGenObject.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine +{ + /// + /// Represent one of the root element object types for SysGen : Project and Module + /// + public interface ISysGenObject + { + RBuildElement RBuildElement { get; } + } + + public interface ISysGenObjectFileContainer + { + RBuildFileCollection Files { get; } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITask.cs new file mode 100644 index 00000000000..7e2e4f4eabe --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITask.cs @@ -0,0 +1,18 @@ +using System; + +namespace SysGen.BuildEngine +{ + public interface ITask : IElement + { + void Execute(); + bool FailOnError { get; set; } + bool IfDefined { get; set; } + bool IfNotDefined { get; set; } + string LogPrefix { get; } + string Name { get; } + void PostExecute(); + void PreExecute(); + string ToString(); + bool Verbose { get; set; } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITaskContainer.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITaskContainer.cs new file mode 100644 index 00000000000..053c6d2b849 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Interfaces/ITaskContainer.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.BuildEngine +{ + public interface ITaskContainer : ITask + { + bool ExecuteChilds { get; } + TaskCollection ChildTasks { get; } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Location.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Location.cs new file mode 100644 index 00000000000..d030fe2b0d5 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Location.cs @@ -0,0 +1,89 @@ +using System; +using System.IO; +using System.Text; + +namespace SysGen.BuildEngine +{ + /// + /// Stores the file name, line number and column number to record a position in a text file. + /// + [Serializable] + public class Location { + string _fileName = null; + int _lineNumber = 0; + int _columnNumber = 0; + + public static readonly Location UnknownLocation = new Location(); + + /// Creates a location consisting of a file name, line number and column number. + /// fileName can be a local URI resource, e.g., file:///C:/WINDOWS/setuplog.txt + public Location(string fileName, int lineNumber, int columnNumber) { + Init(fileName, lineNumber, columnNumber); + } + + /// Creates a location consisting of a file name. + /// fileName can be a local URI resource, e.g., file:///C:/WINDOWS/setuplog.txt + public Location(string fileName) { + Init(fileName, 0, 0); + } + + /// Creates an "unknown" location. + private Location() { + Init(null, 0, 0); + } + + /// Private Init function. + private void Init(string fileName, int lineNumber, int columnNumber) { + if (fileName != null) { + try { + // first check to see if fileName is a URI + Uri uri = new Uri(fileName); + fileName = uri.LocalPath; + } catch { + // must be a simple filename + fileName = Path.GetFullPath(fileName); + } + } + _fileName = fileName; + _lineNumber = lineNumber; + _columnNumber = columnNumber; + } + + /// Gets a string containing the file name for the location. + /// The file name includes both the file path and the extension. + public string FileName { + get { return _fileName; } + } + + /// Gets the line number for the location. + /// Lines start at 1. Will be zero if not specified. + public int LineNumber { + get { return _lineNumber; } + } + + /// Gets the column number for the location. + /// Columns start a 1. Will be zero if not specified. + public int ColumnNumber { + get { return _columnNumber; } + } + + /// + /// Returns the file name, line number and a trailing space. An error + /// message can be appended easily. For unknown locations, returns + /// an empty string. + /// + public override string ToString() { + StringBuilder sb = new StringBuilder(""); + + if (_fileName != null) { + sb.Append(_fileName); + if (_lineNumber != 0) { + sb.Append(String.Format("({0},{1})", _lineNumber, _columnNumber)); + } + sb.Append(":"); + } + + return sb.ToString(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/LocationMap.cs b/reactos/tools/sysgen/SysGen.BuildEngine/LocationMap.cs new file mode 100644 index 00000000000..ad6c73e2900 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/LocationMap.cs @@ -0,0 +1,211 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.XPath; +using System.Collections; + +namespace SysGen.BuildEngine +{ + /// + /// Maps XML nodes to the text positions from their original source. + /// + public class LocationMap { + + struct TextPosition { + public static readonly TextPosition InvalidPosition = new TextPosition(-1,-1); + + public TextPosition(int line, int column) { + Line = line; + Column = column; + } + + public int Line; + public int Column; + } + + // The LocationMap uses a hash table to map filenames to resolve specific maps. + Hashtable _fileMap = new Hashtable(); + + public LocationMap() { + } + + /// Add a XmlDocument to the map. + /// + /// A document can only be added to the map once. + /// + public void Add(XmlDocument doc) { + // prevent duplicate mapping + // NOTE: if this becomes a liability then just return when a duplicate map has happened + string fileName = doc.BaseURI; + + //check for non-backed documents + if(fileName == "") + return; + + if (_fileMap.ContainsKey(fileName)) { + throw new ArgumentException(String.Format("XmlDocument '{0}' already mapped.", fileName), "doc"); + } + + Hashtable map = new Hashtable(); + + string parentXPath = "/"; // default to root + string previousXPath = ""; + int previousDepth = 0; + + // Load text reader. + XmlTextReader reader = new XmlTextReader(fileName); + + reader.XmlResolver = null; + + try { + map.Add((object) "/", (object) new TextPosition(1, 1)); + + ArrayList indexAtDepth = new ArrayList(); + + // loop thru all nodes in the document + while (reader.Read()) { + // Ignore nodes we aren't interested in + if ((reader.NodeType != XmlNodeType.Whitespace) && + (reader.NodeType != XmlNodeType.EndElement) && + (reader.NodeType != XmlNodeType.ProcessingInstruction) && + (reader.NodeType != XmlNodeType.XmlDeclaration)) { + + int level = reader.Depth; + string currentXPath = ""; + + // If we are higher than before + if (reader.Depth < previousDepth) { + // Clear vars for new depth + string[] list = parentXPath.Split('/'); + string newXPath = ""; // once appended to / will be root node ... + + for (int j = 1; j < level+1; j++) { + newXPath += "/" + list[j]; + } + + // higher than before so trim xpath\ + parentXPath = newXPath; // one up from before + + // clear indexes for depth greater than ours + indexAtDepth.RemoveRange(level+1, indexAtDepth.Count - (level+1)); + + } else if (reader.Depth > previousDepth) { + // we are lower + parentXPath = previousXPath; + } + + // End depth setup + // Setup up index array + // add any needed extra items ( usually only 1 ) + // would have used array but not sure what maximum depth will be beforehand + for (int index = indexAtDepth.Count; index < level+1; index++) { + indexAtDepth.Add(0); + } + // Set child index + if ((int) indexAtDepth[level] == 0) { + // first time thru + indexAtDepth[level] = 1; + } else { + indexAtDepth[level] = (int) indexAtDepth[level] + 1; // lower so append to xpath + } + + // Do actual XPath generation + if (parentXPath.EndsWith("/")) { + currentXPath = parentXPath; + } else { + currentXPath = parentXPath + "/"; // add seperator + } + + // Set the final XPath + currentXPath += "child::node()[" + indexAtDepth[level] + "]"; + + // Add to our hash structures + map.Add((object) currentXPath, (object) new TextPosition(reader.LineNumber, reader.LinePosition)); + + // setup up loop vars for next iteration + previousXPath = currentXPath; + previousDepth = reader.Depth; + } + } + } finally { + reader.Close(); + } + + // add map at the end to prevent adding maps that had errors + _fileMap.Add(fileName, map); + + } + + /// Return the in the xml file for the given node. + /// + /// The node passed in must be from a XmlDocument that has been added to the map. + /// + public Location GetLocation(XmlNode node) { + // find hashtable this node's file is mapped under + string fileName = node.BaseURI; + if (fileName == "" ) { + return new Location(null, 0, 0 ); // return null location because we have a fileless node. + } + if (!_fileMap.ContainsKey(fileName)) { + //throw new ArgumentException("Xml node has not been mapped."); + return new Location(null, 0, 0); + } + + // find xpath for node + Hashtable map = (Hashtable) _fileMap[fileName]; + string xpath = GetXPathFromNode(node); + if (!map.ContainsKey(xpath)) { + //throw new ArgumentException("Xml node has not been mapped."); + return new Location(null, 0, 0); + } + + TextPosition pos = (TextPosition) map[xpath]; + Location location = new Location(fileName, pos.Line, pos.Column); + return location; + } + + private string GetXPathFromNode(XmlNode node) { + // IM TODO review this algorithm - tidy up + XPathNavigator nav = node.CreateNavigator(); + + string xpath = ""; + int index = 0; + + while (nav != null && nav.NodeType.ToString() != "Root") + { + // loop thru children until we find ourselves + XPathNavigator navParent = nav.Clone(); + navParent.MoveToParent(); + int parentIndex = 0; + navParent.MoveToFirstChild(); + if (navParent.IsSamePosition(nav)) { + index = parentIndex; + } + while (navParent.MoveToNext()) { + parentIndex++; + if (navParent.IsSamePosition(nav)) { + index = parentIndex; + } + } + + nav.MoveToParent(); // do loop condition here + index++; // Convert to 1 based index + + string thisNode = "child::node()[" + index + "]"; + + if (xpath == "") { + xpath = thisNode; + } else { + // build xpath string + xpath = thisNode + "/" + xpath; + } + } + + // prepend slash to ... + xpath = "/" + xpath; + + return xpath; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Log/Log.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Log.cs new file mode 100644 index 00000000000..96de3e19a2a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Log.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; + +namespace SysGen.BuildEngine.Log +{ + public class BuildEventArgs : EventArgs + { + protected string _name = string.Empty; + + public BuildEventArgs(string name) + { + _name = name; + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + } + + /// Delegate to handle Build events + public delegate void BuildEventHandler(object sender, BuildEventArgs e); + + public interface IBuildEventConsumer + { + /// Signals that a build has started. This event is fired before any targets have started. + void BuildStarted(object sender, BuildEventArgs e); + + /// Signals that the last target has finished. This event will still be fired if an error occurred during the build. + void BuildFinished(object sender, BuildEventArgs e); + + /// Signals that a target has started. + void TargetStarted(object sender, BuildEventArgs e); + + /// Signals that a target has finished. This event will still be fired if an error occurred during the build. + void TargetFinished(object sender, BuildEventArgs e); + + /// Signals that a task has started. + void TaskStarted(object sender, BuildEventArgs e); + + /// Signals that a task has finished. This event will still be fired if an error occurred during the build. + void TaskFinished(object sender, BuildEventArgs e); + } + + public abstract class LogListener { + public abstract void Write(string message); + public abstract void WriteLine(string message); + public virtual void WriteLine(string message, string messageType) { + WriteLine(message); + } + + public virtual void Flush() { + } + } + + /// Provides a set of methods and properties that log the execution of the build process. This class cannot be inherited. + public sealed class BuildLog + { + private static bool _autoFlush; + private static int _indentLevel; + private static int _indentSize; + private static bool _needIndent; // true if the output should be indented; otherwise, false + private static LogListenerCollection _listeners; + + static BuildLog() + { + _autoFlush = false; + _indentLevel = 0; + _indentSize = 4; + _needIndent = true; + _listeners = new LogListenerCollection(); + _listeners.Add(new ConsoleLogger()); + } + + /// Gets or sets whether Flush should be called on the Listeners after every write. + public static bool AutoFlush { + get { return _autoFlush; } + set { _autoFlush = value; } + } + + /// Gets or sets the indent level. Default is zero. + public static int IndentLevel { + get { return _indentLevel; } + set { _indentLevel = value; } + } + + /// Gets or sets the number of spaces in an indent. Default is four. + public static int IndentSize { + get { return _indentSize; } + set { _indentSize = value; } + } + + /// Gets the collection of listeners that is monitoring the log output. + public static LogListenerCollection Listeners { + get { return _listeners; } + } + + /// Flushes the output buffer, and causes buffered data to be written to the Listeners. + public static void Flush() { + foreach (LogListener l in _listeners) { + l.Flush(); + } + } + + /// Increases the current IndentLevel by one. + public static void Indent() { + _indentLevel++; + } + + /// Decreases the current IndentLevel by one. + public static void Unindent() { + if (_indentLevel > 0) { + _indentLevel--; + } + } + + /// Indents the message if needed. + private static string FormatMessage(string message) { + // if we are starting a new line then first indent the string + if (_needIndent) { + if (IndentLevel > 0) { + StringBuilder sb = new StringBuilder(message); + sb.Insert(0, " ", IndentLevel * IndentSize); + message = sb.ToString(); + } + _needIndent = false; + } + return message; + } + + /// Writes the given message to the log. + public static void Write(string message) { + message = FormatMessage(message); + foreach (LogListener l in _listeners) { + l.Write(message); + } + + if (AutoFlush) { + Flush(); + } + } + + /// Writes the given message to the log. + public static void Write(string format, params object[] arg) { + Write(String.Format(format, arg)); + } + + /// Writes the given message to the log if condition is true. + public static void WriteIf(bool condition, string message) { + if (condition) { + Write(message); + } + } + + /// Writes the given message to the log if condition is true. + public static void WriteIf(bool condition, string format, params object[] arg) { + if (condition) { + Write(String.Format(format, arg)); + } + } + + /// Writes the given message to the log. + public static void WriteLine(string message) { + Write(message + Environment.NewLine); + _needIndent = true; + } + + /// Writes the given message to the log. + public static void WriteLine() { + WriteLine(String.Empty); + } + + /// Writes the given message to the log. + public static void WriteLine(string format, params object[] arg) { + WriteLine(String.Format(format, arg)); + } + + public static void WriteMessage(string message, string messageType) { + message = FormatMessage(message); + foreach (LogListener l in _listeners) { + l.WriteLine(message, messageType); + } + + if (AutoFlush) { + Flush(); + } + } + + /// Writes the given message to the log if condition is true. + public static void WriteLineIf(bool condition, string message) { + if (condition) { + WriteLine(message); + } + } + + /// Writes the given message to the log if condition is true. + public static void WriteLineIf(bool condition, string format, params object[] arg) { + if (condition) { + WriteLine(String.Format(format, arg)); + } + } + } + + public class LogWriter : StringWriter { + public override void Close() { + BuildLog.Write(GetStringBuilder().ToString()); + base.Close(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/ConsoleLogger.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/ConsoleLogger.cs new file mode 100644 index 00000000000..8ffa3fee74c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/ConsoleLogger.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.BuildEngine.Log +{ + /// + /// The standard logger that will suffice for any command line based nant runner. + /// + public class ConsoleLogger : LogListener + { + public override void Write(string message) + { + Console.Write(message); + } + + public override void WriteLine(string message) + { + Console.WriteLine(message); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/StringLogger.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/StringLogger.cs new file mode 100644 index 00000000000..0a6319873b8 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/StringLogger.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; + +namespace SysGen.BuildEngine.Log +{ + /// + /// Used for test classes to check output. + /// + public class StringLogger : LogListener + { + private StringWriter _writer = new StringWriter(); + + public override void Write(string message) + { + _writer.Write(message); + } + + public override void WriteLine(string message) + { + _writer.WriteLine(message); + } + + /// + /// Returns the contents of log captured. + /// + public override string ToString() + { + return _writer.ToString(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/XmlLogger.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/XmlLogger.cs new file mode 100644 index 00000000000..bc2da4f0e44 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Log/Loggers/XmlLogger.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; + +namespace SysGen.BuildEngine.Log +{ + /// + /// Used to wrap log messages in xml <message/> elements + /// + public class XmlLogger : LogListener, IBuildEventConsumer + { + public class Elements + { + public const string BUILD_RESULTS = "buildresults"; + public const string MESSAGE = "message"; + public const string TARGET = "target"; + public const string TASK = "task"; + public const string STATUS = "status"; + } + + public class Attributes + { + public const string PROJECT = "project"; + public const string MESSAGETYPE = "type"; + } + + private TextWriter _writer = Console.Out; + private XmlTextWriter _xmlWriter = new XmlTextWriter(Console.Out); + + public XmlLogger() + { + + } + + public XmlLogger(TextWriter writer) + { + _writer = writer; + _xmlWriter = new XmlTextWriter(_writer); + _xmlWriter.Formatting = Formatting.Indented; + } + + public string StripFormatting(string message) + { + //looking for zero or more white space from front of line followed by + //one or more of just about anything between [ and ] followed by a message + //which we will capture. ' [blah] + Regex r = new Regex(@"(?ms)^\s*?\[[\s\w\d]+\](.+)"); + + Match m = r.Match(message); + if (m.Success) + { + return m.Groups[1].Captures[0].Value.Trim(); + } + return message; + } + + public bool IsJustWhiteSpace(string message) + { + Regex r = new Regex(@"^\s*$"); + + return r.Match(message).Success; + } + + #region LogListener Overrides + + public override void Write(string formattedMessage) + { + WriteLine(formattedMessage, null); + } + + public override void WriteLine(string message) + { + WriteLine(message, null); + } + + public override void WriteLine(string message, string messageType) + { + string rawMessage = StripFormatting(message.Trim()); + if (IsJustWhiteSpace(rawMessage)) + { + return; + } + + _xmlWriter.WriteStartElement(Elements.MESSAGE); + + if (messageType != null && messageType != String.Empty) + { + _xmlWriter.WriteAttributeString(Attributes.MESSAGETYPE, messageType); + } + + if (IsValidXml(rawMessage)) + { + rawMessage = Regex.Replace(rawMessage, @"<\?.*\?>", String.Empty); + _xmlWriter.WriteRaw(rawMessage); + } + else + { + _xmlWriter.WriteCData(StripCData(rawMessage)); + } + _xmlWriter.WriteEndElement(); + _xmlWriter.Flush(); + } + + private bool IsValidXml(string message) + { + if (Regex.Match(message, @"^<.*>").Success) + { + // validate xml + XmlValidatingReader reader = new XmlValidatingReader(message, XmlNodeType.Element, null); + try { while (reader.Read()) { } } + catch (Exception) { return false; } + finally { reader.Close(); } + return true; + } + return false; + } + + private string StripCData(string message) + { + string strippedMessage = Regex.Replace(message, @"", String.Empty); + } + + public override void Flush() + { + _writer.Flush(); + } + + /// Returns the contents of log captured. + public override string ToString() + { + return _writer.ToString(); + } + + #endregion + + #region IBuildEventConsumer Implementation + + public void BuildStarted(object obj, BuildEventArgs args) + { + _xmlWriter.WriteStartElement(Elements.BUILD_RESULTS); + _xmlWriter.WriteAttributeString(Attributes.PROJECT, args.Name); + } + + public void BuildFinished(object obj, BuildEventArgs args) + { + _xmlWriter.WriteEndElement(); + } + + public void TargetStarted(object obj, BuildEventArgs args) + { + _xmlWriter.WriteStartElement(Elements.TARGET); + WriteNameAttribute(args.Name); + _xmlWriter.Flush(); + } + + public void TargetFinished(object obj, BuildEventArgs args) + { + _xmlWriter.WriteEndElement(); + _xmlWriter.Flush(); + } + + public void TaskStarted(object obj, BuildEventArgs args) + { + _xmlWriter.WriteStartElement(Elements.TASK); + WriteNameAttribute(args.Name); + _xmlWriter.Flush(); + } + + public void TaskFinished(object obj, BuildEventArgs args) + { + _xmlWriter.WriteEndElement(); + _xmlWriter.Flush(); + } + + private void WriteNameAttribute(string name) + { + _xmlWriter.WriteAttributeString("name", name); + } + + private void WriteStatus(string status) + { + _xmlWriter.WriteStartElement(Elements.STATUS); + _xmlWriter.WriteAttributeString("value", status); + _xmlWriter.WriteEndElement(); + } + #endregion + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskBuilder.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskBuilder.cs new file mode 100644 index 00000000000..6fbe2b65424 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskBuilder.cs @@ -0,0 +1,72 @@ +using System; +using System.Reflection; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine +{ + public class TaskBuilder + { + private string _className; + private string _assemblyFileName; + private string _taskName; + + public TaskBuilder(string className) : this(className, null) { + } + + public TaskBuilder(string className, string assemblyFileName) { + _className = className; + _assemblyFileName = assemblyFileName; + + // get task name from attribute + Assembly assembly = GetAssembly(); + TaskNameAttribute taskNameAttribute = (TaskNameAttribute) + Attribute.GetCustomAttribute(assembly.GetType(ClassName), typeof(TaskNameAttribute)); + + _taskName = taskNameAttribute.FullTaskName; // Name; + } + + public string ClassName + { + get { return _className; } + } + + public string AssemblyFileName + { + get { return _assemblyFileName; } + } + + public string TaskName + { + get { return _taskName; } + } + + private Assembly GetAssembly() { + Assembly assembly = null; + if (AssemblyFileName == null) { + assembly = Assembly.GetExecutingAssembly(); + } else { + //check to see if it is loaded already + Assembly [] ass = AppDomain.CurrentDomain.GetAssemblies(); + for (int i = 0; i < ass.Length; i++){ + try { + if(ass[i].Location.Equals(AssemblyFileName)) { + assembly = ass[i]; + return assembly; + } + } + // System.Reflection.Emit.Assembly have no location and will fail + catch{} + } + //load if not loaded + if(assembly == null) + assembly = Assembly.LoadFrom(AssemblyFileName); + } + return assembly; + } + + public Task CreateTask() + { + return (Task)GetAssembly().CreateInstance(ClassName, true); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskFactory.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskFactory.cs new file mode 100644 index 00000000000..66c14ff3a17 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Plugins/TaskFactory.cs @@ -0,0 +1,136 @@ +using System; +using System.IO; +using System.Xml; +using System.Reflection; +using System.Collections; + +namespace SysGen.BuildEngine +{ + /// + /// The TaskFactory comprises all of the loaded, and available, tasks. + /// Use these static methods to register, initialize and create a task. + /// + public class TaskFactory + { + static TaskBuilderCollection _builders = new TaskBuilderCollection(); + static ArrayList _projects = new ArrayList(); + + /// + /// Initializes the tasks in the executing assembly, and basedir of the current domain. + /// + static TaskFactory() + { + // initialize builtin tasks + AddTasks(Assembly.GetExecutingAssembly()); + AddTasks(Assembly.GetCallingAssembly()); + + + //string nantBinDir = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); + //ScanDir(nantBinDir); + //ScanDir(Path.Combine(nantBinDir, "tasks")); + } + + /* + /// Scans the path for any Tasks assemblies and adds them. + /// The directory to scan in. + protected static void ScanDir(string path) { + // Don't do anything if we don't have a valid directory path + if(path == null || path == string.Empty) { + return; + } + + // intialize tasks found in assemblies that end in Tasks.dll + DirectoryScanner scanner = new DirectoryScanner(); + scanner.BaseDirectory = path; + scanner.Includes.Add("*Tasks.dll"); + + //needed for testing + scanner.Includes.Add("*Tests.dll"); + scanner.Includes.Add("*Test.dll"); + + foreach(string assemblyFile in scanner.FileNames) { + //Log.WriteLine("{0}:Add Tasks from {1}", AppDomain.CurrentDomain.FriendlyName, assemblyFile); + + AddTasks(Assembly.LoadFrom(assemblyFile)); + //AddTasks(AppDomain.CurrentDomain.Load(assemblyFile.Replace(AppDomain.CurrentDomain.BaseDirectory,"").Replace(".dll",""))); + } + + } + */ + + /* + /// Adds any Task Assemblies in the Project.BaseDirectory. + /// The project to work from. + public static void AddProject(SysGenEngine project) { + if(project.BaseDirectory != null && !project.BaseDirectory.Equals(string.Empty)) { + ScanDir(project.BaseDirectory); + ScanDir(Path.Combine(project.BaseDirectory, "tasks")); + } + //create weakref to project. It is possible that project may go away, we don't want to hold it. + _projects.Add(new WeakReference(project)); + foreach(TaskBuilder tb in Builders) { + UpdateProjectWithBuilder(project, tb); + } + }*/ + + /// Returns the list of loaded TaskBuilders + public static TaskBuilderCollection Builders { + get { return _builders; } + } + /// Scans the given assembly for any classes derived from Task and adds a new builder for them. + /// The Assembly containing the new tasks to be loaded. + /// The count of tasks found in the assembly. + public static int AddTasks(Assembly assembly) { + int taskCount = 0; + try { + foreach(Type type in assembly.GetTypes()) { + if (type.IsSubclassOf(typeof(Task)) && !type.IsAbstract) { + TaskBuilder tb = new TaskBuilder(type.FullName, assembly.Location); + if (_builders.Add(tb)) { + foreach(WeakReference wr in _projects) { + if(!wr.IsAlive) + continue; + SysGenEngine p = wr.Target as SysGenEngine; + if(p == null) + continue; + UpdateProjectWithBuilder(p, tb); + } + taskCount++; + } + } + } + } + // For assemblies that don't have types + catch{}; + + return taskCount; + } + + protected static void UpdateProjectWithBuilder(SysGenEngine sysGen, TaskBuilder taskBuilder) + { + // add a true property for each task (use in build to test for task existence). + // add a property for each task with the assembly location. + sysGen.Properties.AddReadOnly("SysGen.Tasks." + taskBuilder.TaskName + ".Available", Boolean.TrueString); + sysGen.Properties.AddReadOnly("SysGen.Tasks." + taskBuilder.TaskName + ".Assembly", taskBuilder.AssemblyFileName); + } + + /// Creates a new Task instance for the given xml and project. + /// The XML to initialize the task with. + /// The Project that the Task belongs to. + /// The Task instance. + public static Task CreateTask(XmlNode taskNode, SysGenEngine proj) + { + string taskName = taskNode.Name; + + TaskBuilder builder = _builders.FindBuilderForTask(taskName); + if (builder == null && proj != null) { + Location location = proj.LocationMap.GetLocation(taskNode); + throw new BuildException(String.Format("Unknown task <{0}>", taskName), location); + } + + Task task = builder.CreateTask(); + task.SysGen = proj; + return task; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..be7575e9d01 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Properties/AssemblyInfo.cs @@ -0,0 +1,15 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("SysGen")] +[assembly: AssemblyDescription("SysGen ReactOS Build Tool")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SysGen")] +[assembly: AssemblyCopyright("Copyright (C) 2007 J.Marc Piulachs")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("0.1.0.*")] + +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyName("")] \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj b/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj new file mode 100644 index 00000000000..515cf8ded34 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj @@ -0,0 +1,381 @@ + + + Local + 9.0.30729 + 2.0 + {8F5F8375-4097-4952-B860-784EB9961ABE} + Debug + AnyCPU + + + + + SysGen.Framework + + + JScript + Grid + IE50 + false + Library + SysGen.Framework + + + + + + + 2.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + bin\Debug\ + false + 285212672 + false + + + + + + + true + 4096 + false + false + false + false + 1 + full + prompt + + + bin\Debug\ + false + 285212672 + false + + + + + + + true + 4096 + false + false + false + false + 1 + full + prompt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + Code + + + Code + + + Code + + + + Code + + + + Code + + + Code + + + Code + + + Code + + + + + + + + Code + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + Code + + + Code + + + Code + + + + + + + + + + + + + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + SysGen.RBuild.Framework + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj.user b/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj.user new file mode 100644 index 00000000000..ef20f1c8f95 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGen.Framework.csproj.user @@ -0,0 +1,19 @@ + + + ShowAllFiles + + + + + + + + + + + + + en-US + false + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGenConversion.cs b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenConversion.cs new file mode 100644 index 00000000000..e9fe9b97686 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenConversion.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.BuildEngine +{ + class SysGenConversion + { + public static bool ToBolean(object value) + { + switch (value.ToString().ToLower()) + { + case "yes": + case "true": + case "1": + return true; + case "no": + case "false": + case "0": + return false; + } + + throw new ValidationException(String.Format("Cannot resolve to '{0}' to Boolean value.", value.ToString())); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGenDependencyTracker.cs b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenDependencyTracker.cs new file mode 100644 index 00000000000..1f49363684b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenDependencyTracker.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Framework; + +namespace SysGen.BuildEngine +{ + public class SysGenDependencyTracker + { + RBuildProject m_Project = null; + RBuildModuleCollection m_Modules = new RBuildModuleCollection(); + RBuildModuleCollection m_DependsOn = new RBuildModuleCollection(); + RBuildModuleCollection m_DependencyOf = new RBuildModuleCollection(); + + public SysGenDependencyTracker(RBuildProject project) + { + m_Project = project; + } + + public SysGenDependencyTracker(RBuildProject project, RBuildModule module) + : this(project) + { + m_Modules.Add(module); + Calculate(); + } + + public SysGenDependencyTracker(RBuildProject project, RBuildModuleCollection modules) + : this(project) + { + m_Modules.Add(modules); + Calculate(); + } + + public void Calculate() + { + m_DependsOn.Clear(); + m_DependencyOf.Clear(); + + foreach (RBuildModule module in m_Modules) + { + GetModuleDependencies(module); + } + + foreach (RBuildModule projectModule in m_Project.Modules) + { + foreach (RBuildModule module in m_Modules) + { + if (projectModule.Needs.Contains(module)) + { + m_DependencyOf.Add(projectModule); + } + } + } + } + + private void GetModuleDependencies(RBuildModule module) + { + foreach (RBuildModule library in module.Needs) + { + if (m_DependsOn.Contains(library) == false) + { + if (m_Modules.Contains(library) == false) + { + //Add it to the list of dependencies + m_DependsOn.Add(library); + + //Investigate the module to find its dependencies + GetModuleDependencies(library); + } + } + } + } + + public RBuildModuleCollection DependsOn + { + get { return m_DependsOn; } + } + + public RBuildModuleCollection DependencyOf + { + get { return m_DependencyOf; } + } + + public RBuildModuleCollection Missing + { + get + { + RBuildModuleCollection missing = new RBuildModuleCollection(); + + foreach (RBuildModule dependency in DependsOn) + { + if (m_Project.Platform.Modules.Contains(dependency) == false) + missing.Add(dependency); + } + + return missing; + } + } + + public RBuildModuleCollection Using + { + get + { + RBuildModuleCollection missing = new RBuildModuleCollection(); + + foreach (RBuildModule dependency in DependencyOf) + { + if (m_Project.Platform.Modules.Contains(dependency) == true) + missing.Add(dependency); + } + + return missing; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGenEngine.cs b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenEngine.cs new file mode 100644 index 00000000000..70d8b470285 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenEngine.cs @@ -0,0 +1,825 @@ +using System; +using System.Text.RegularExpressions; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.XPath; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Log; +using SysGen.BuildEngine.Tasks; +using SysGen.BuildEngine.Handlers; +using SysGen.BuildEngine.Backends; + +namespace SysGen.BuildEngine +{ + public class SysGenEngine + { + private Task m_RootTask = null; + + private RBuildProject m_Project = null; + private RBuildPlatform m_Platform = null; + + //private TargetCollection m_Targets = new TargetCollection(); + private FileHandlerCollection m_FileHandlers = new FileHandlerCollection(); + private BackendCollection m_Backends = new BackendCollection(); + private RBuildPropertyCollection m_Properties = new RBuildPropertyCollection(); + private StringCollection m_XmlBuildFiles = new StringCollection(); + + //xml element and attribute names that are not defined in metadata + protected const string PROJECT_XMLROOT = "project"; + protected const string PROJECT_NAME_ATTRIBUTE = "name"; + protected const string PROJECT_DEFAULT_ATTRIBUTE = "default"; + protected const string PROJECT_BASEDIR_ATTRIBUTE = "basedir"; + + public const string SYSGEN_PROPERTY_FILENAME = "SysGen.Filename"; + public const string SYSGEN_PROPERTY_VERSION = "SysGen.Version"; + public const string SYSGEN_PROPERTY_LOCATION = "SysGen.Location"; + public const string SYSGEN_PROPERTY_PROJECT_NAME = "SysGen.Project.Name"; + public const string SYSGEN_PROPERTY_PROJECT_BUILDFILE = "SysGen.Project.File"; + public const string SYSGEN_PROPERTY_PROJECT_BASEDIR = "SysGen.Project.BaseDir"; + + private string m_BaseDir = null; + private bool m_Verbose = false; + private bool m_ExecuteBackends = true; + private bool m_SetDefaults = true; + + private LocationMap _locationMap = new LocationMap(); + private XmlDocument _doc = null; // set in ctorHelper + + public static event BuildEventHandler BuildStarted; + public static event BuildEventHandler BuildFinished; + public static event BuildEventHandler TargetStarted; + public static event BuildEventHandler TargetFinished; + public static event BuildEventHandler TaskStarted; + public static event BuildEventHandler TaskFinished; + public static event BuildEventHandler TaskException; + public static event BuildEventHandler BuildFileLoaded; + + public static void OnBuildFileLoaded(object o, BuildEventArgs e) + { + if (BuildFileLoaded != null) + BuildFileLoaded(o, e); + } + + public static void OnBuildStarted(object o, BuildEventArgs e) + { + if (BuildStarted != null) + BuildStarted(o, e); + } + + public static void OnBuildFinished(object o, BuildEventArgs e) + { + if (BuildFinished != null) + BuildFinished(o, e); + } + + public static void OnTargetStarted(object o, BuildEventArgs e) + { + if (TargetStarted != null) + TargetStarted(o, e); + } + + public static void OnTargetFinished(object o, BuildEventArgs e) + { + if (TargetFinished != null) + TargetFinished(o, e); + } + + public static void OnTaskStarted(object o, BuildEventArgs e) + { + if (TaskStarted != null) + TaskStarted(o, e); + } + + public static void OnTaskFinished(object o, BuildEventArgs e) + { + if (TaskFinished != null) + TaskFinished(o, e); + } + + public static void OnTaskException(object o, BuildEventArgs e) + { + if (TaskException != null) + TaskException(o, e); + } + + public RBuildProject Project + { + get { return m_Project; } + set + { + if (m_Project != null) + throw new BuildException("Only one ProjectTask is allowed per project"); + + m_Project = value; + + InitializeEnvironment(); + } + } + + public Task RootTask + { + get { return m_RootTask; } + set { m_RootTask = value; } + } + + public StringCollection BuildFiles + { + get { return m_XmlBuildFiles; } + } + + public bool SetDefaults + { + get { return m_SetDefaults; } + set { m_SetDefaults = value; } + } + + public SysGenEngine(string path, string project) : this (Path.Combine (path , project)) + { + } + + /// + /// Constructs a new Project with the given source. + /// + /// + /// The Source should be the full path to the build file. + /// This can be of any form that XmlDocument.Load(string url) accepts. + /// + /// If the source is a uri of form 'file:///path' then use the path part. + public SysGenEngine(string source) + { + string path = source; + //if the source is not a valid uri, pass it thru. + //if the source is a file uri, pass the localpath of it thru. + try + { + Uri testURI = new Uri(source); + if (testURI.IsFile) + { + path = testURI.LocalPath; + } + } + catch (Exception e) + { + //do nothing. + e.ToString(); + } + finally + { + if (path == null) + path = source; + } + + ctorHelper(LoadBuildFile(path)); + } + + /// + /// Inits stuff: + /// TaskFactory: Calls Initialize and AddProject + /// Log.IndentSize set to 12 + /// Project properties are initialized ("nant.* stuff set") + /// + /// NAnt Props: + /// nant.filename + /// nant.version + /// nant.location + /// nant.project.name + /// nant.project.buildfile (if doc has baseuri) + /// nant.project.basedir + /// nant.project.default = defaultTarget + /// nant.tasks.[name] = true + /// nant.tasks.[name].location = AssemblyFileName + /// + /// + /// The Project Document. + protected virtual void ctorHelper(XmlDocument doc) + { + //TaskFactory.AddProject(this); + BuildLog.IndentSize = 12; + _doc = doc; + + string newBaseDir = null; + + //check to make sure that the root element in named correctly + if(!doc.DocumentElement.Name.Equals(PROJECT_XMLROOT)) + throw new ApplicationException("Root Element must be named " + PROJECT_XMLROOT + " in " + doc.BaseURI); + + /* + // get project attributes + if(doc.DocumentElement.HasAttribute(PROJECT_NAME_ATTRIBUTE)) + _projectName = doc.DocumentElement.GetAttribute(PROJECT_NAME_ATTRIBUTE); + + if(doc.DocumentElement.HasAttribute(PROJECT_BASEDIR_ATTRIBUTE)) + newBaseDir = doc.DocumentElement.GetAttribute(PROJECT_BASEDIR_ATTRIBUTE); + + if(doc.DocumentElement.HasAttribute(PROJECT_DEFAULT_ATTRIBUTE)) + _defaultTargetName = doc.DocumentElement.GetAttribute(PROJECT_DEFAULT_ATTRIBUTE); + */ + + // give the project a meaningful base directory + if (newBaseDir == null) { + if (BuildFileLocalName != null) { + newBaseDir = Path.GetDirectoryName(BuildFileLocalName); + } + else { + newBaseDir = Environment.CurrentDirectory; + } + } + + newBaseDir = Path.GetFullPath(newBaseDir); + //BaseDirectory must be rooted. + BaseDirectory = newBaseDir; + + } + + internal void InitializeBuildFile(XmlDocument doc, ITaskContainer parent) + { + // load line and column number information into position map + LocationMap.Add(doc); + + // initialize targets and global tasks + foreach (XmlNode childNode in doc.ChildNodes) + { + if (CanProcessNode(childNode)) + { + LoadChildTask(childNode, parent); + } + } + } + + internal bool CanProcessNode(XmlNode childNode) + { + if ((childNode.NodeType == XmlNodeType.Element) && + (childNode.Name.StartsWith("#") == false) && + (childNode.Name.StartsWith("xml") == false) && + (childNode.Name.StartsWith("!") == false) && + (childNode.NamespaceURI.Equals(string.Empty) || + (childNode.NamespaceURI.Equals("http://www.w3.org/2001/XInclude")))) + { + return true; + } + + return false; + } + + internal Task LoadChildTask(XmlNode taskNode, ITaskContainer parent) + { + try + { + Task task = TaskFactory.CreateTask(taskNode, this); + + task.Parent = parent; + task.Project = m_Project; + task.SysGen = this; + task.Initialize(taskNode); + + if (task != RootTask) + parent.ChildTasks.Add(task); + + return task; + } + catch (BuildException be) + { + BuildLog.WriteLine("{0} Failed to created Task for '{1}' xml element for reason: \n {2}", parent.LogPrefix, taskNode.Name, be.Message); + } + + return null; + } + + /// + /// Creates a new XmlDocument based on the project definition. + /// + /// The source of the document. Any form that is valid for XmlDocument.Load(string url) can be used here. + /// The project document. + private XmlDocument LoadBuildFile(string source) + { + XmlDocument doc = new XmlDocument(); + + try + { + OnBuildFileLoaded(this, new BuildEventArgs(source)); + + doc.XmlResolver = null; + doc.Load(source); + + //Add the build file to the collection of readed xml build files + m_XmlBuildFiles.Add(source); + } + catch (XmlException e) + { + string message = "Error loading buildfile"; + Location location = new Location(source, e.LineNumber, e.LinePosition); + throw new BuildException(message, location, e); + } + catch (Exception e) + { + string message = "Error loading buildfile"; + Location location = new Location(source); + throw new BuildException(message, location, e); + } + return doc; + } + + public virtual bool RBuildFolderExists(RBuildFolder folder) + { + return Directory.Exists(ResolveRBuildFilePath(folder)); + } + + public virtual bool RBuildFileExists(RBuildFile file) + { + return File.Exists(ResolveRBuildFilePath(file)); + } + + public virtual string ResolveRBuildFilePath(RBuildFileSystemInfo file) + { + return NormalizePath(Path.Combine(GetPathRoot(file.Root), file.FullPath)); + } + + public virtual string ResolveRBuildFolderPath(RBuildFolder folder) + { + return NormalizePath(Path.Combine(GetPathRoot(folder.Root), folder.FullPath)); + } + + public virtual string ResolveRBuildFilePath(PathRoot root, RBuildFileSystemInfo file) + { + return NormalizePath(Path.Combine(GetPathRoot(root), file.FullPath)); + } + + public string NormalizePath(string path) + { + return path.Replace( + Path.AltDirectorySeparatorChar, + Path.DirectorySeparatorChar); + } + + public string IntermediateDirectory + { + get { return Path.Combine(BaseDirectory, "obj-i386"); } + } + + public string DocumentationDirectory + { + get { return Path.Combine(BaseDirectory, "doc-i386"); } + } + + public string ISODirectory + { + get { return Path.Combine(BaseDirectory, "iso-i386"); } + } + + public string OutputDirectory + { + get { return Path.Combine(BaseDirectory, "output-i386"); } + } + + public string BootCDOutputDirectory + { + get { return Path.Combine(OutputDirectory, "cd"); } + } + + public string LiveCDOutputDirectory + { + get { return Path.Combine(OutputDirectory, "livecd"); } + } + + public string TemporaryDirectory + { + get { return Path.Combine(BaseDirectory, "obj-i386"); } + } + + public string InstallDirectory + { + get { return Path.Combine(BaseDirectory, "reactos"); } + } + + public string GetPathRoot(PathRoot root) + { + switch (root) + { + case PathRoot.Default: + case PathRoot.SourceCode: + return BaseDirectory; + break; + case PathRoot.LiveCD: + return LiveCDOutputDirectory; + break; + case PathRoot.BootCD: + return BootCDOutputDirectory; + break; + case PathRoot.Intermediate: + return IntermediateDirectory; + break; + case PathRoot.Install: + return InstallDirectory; + break; + case PathRoot.Output: + return OutputDirectory; + break; + case PathRoot.Temporary: + return TemporaryDirectory; + break; + case PathRoot.Platform: + return "%SystemRoot%"; + break; + default: + throw new Exception("Unknown PathRoot"); + } + } + + /// + /// The Base Directory used for relative references. + /// + /// + /// The directory must be rooted. (must start with drive letter, unc, etc.) + /// The BaseDirectory sets and gets the special property named 'nant.project.basedir'. + /// + public string BaseDirectory + { + get + { + //string basedir = null; // = Properties[NANT_PROPERTY_PROJECT_BASEDIR]; + + if (m_BaseDir == null) + return null; + + if (!Path.IsPathRooted(m_BaseDir)) + throw new BuildException("BaseDirectory must be rooted! " + m_BaseDir); + + return m_BaseDir; + } + set + { + if (!Path.IsPathRooted(value)) + throw new BuildException("BaseDirectory must be rooted! " + value); + + m_BaseDir = value; + + //Properties[NANT_PROPERTY_PROJECT_BASEDIR] = value; + } + } + + /// + /// The URI form of the current Document + /// + public Uri BuildFileURI { + get { + //TODO: Need to remove this. + if(Doc == null || Doc.BaseURI == "") { + return null;//new Uri("http://localhost"); + } + else { + return new Uri(Doc.BaseURI); + } + } + } + + /// + /// If the build document is not file backed then null will be returned. + /// + public string BuildFileLocalName { + get { + if (BuildFileURI != null && BuildFileURI.IsFile) { + return BuildFileURI.LocalPath; + } + else { + return null; + } + } + } + + /// Returns the active build file + public virtual XmlDocument Doc { + get { return _doc; } + } + + /// + /// When true tasks should output more build log messages. + /// + public bool Verbose + { + get { return m_Verbose; } + set { m_Verbose = value; } + } + + public bool RunBackends + { + get { return m_ExecuteBackends; } + set { m_ExecuteBackends = value; } + } + + public RBuildPlatform Platform + { + get { return m_Platform; } + } + + public RBuildPropertyCollection Properties + { + get { return m_Properties; } + } + + internal LocationMap LocationMap { + get { return _locationMap; } + } + + ///// + ///// The targets defined in the this project. + ///// + //public TargetCollection Targets + //{ + // get { return m_Targets; } + //} + + /// Executes the default target. + /// + /// No top level error handling is done. Any BuildExceptions will make it out of this method. + /// + public virtual void Execute() + { + //InitializeEnvironment(); + + //will initialize the list of Targets, and execute any global tasks. + InitializeBuildFile(Doc, null); + + RegisterBackends(); + + if (Project.InstallFolders.Count == 0) + { + Project.InstallFolders.Add(new RBuildInstallFolder("1", @".")); + Project.InstallFolders.Add(new RBuildInstallFolder("2", @"system32")); + Project.InstallFolders.Add(new RBuildInstallFolder("3", @"system32\config")); + Project.InstallFolders.Add(new RBuildInstallFolder("4", @"system32\drivers")); + Project.InstallFolders.Add(new RBuildInstallFolder("5", @"system")); + Project.InstallFolders.Add(new RBuildInstallFolder("17", @"system32\drivers\etc")); + Project.InstallFolders.Add(new RBuildInstallFolder("20", @"inf")); + Project.InstallFolders.Add(new RBuildInstallFolder("22", @"fonts")); + Project.InstallFolders.Add(new RBuildInstallFolder("201", @"system32\bin")); + Project.InstallFolders.Add(new RBuildInstallFolder("202", @"media\fonts")); + Project.InstallFolders.Add(new RBuildInstallFolder("203", @"bin")); + Project.InstallFolders.Add(new RBuildInstallFolder("204", @"media")); + } + + if (Project.DebugChannels.Count == 0) + { + Project.DebugChannels.Add(new RBuildDebugChannel("ole")); + Project.DebugChannels.Add(new RBuildDebugChannel("rpc")); + Project.DebugChannels.Add(new RBuildDebugChannel("gdi")); + Project.DebugChannels.Add(new RBuildDebugChannel("crtdll")); + Project.DebugChannels.Add(new RBuildDebugChannel("mshtml")); + Project.DebugChannels.Add(new RBuildDebugChannel("setupapi")); + Project.DebugChannels.Add(new RBuildDebugChannel("typelib")); + Project.DebugChannels.Add(new RBuildDebugChannel("shdocvw")); + Project.DebugChannels.Add(new RBuildDebugChannel("combo")); + Project.DebugChannels.Add(new RBuildDebugChannel("listview")); + Project.DebugChannels.Add(new RBuildDebugChannel("ntdll")); + Project.DebugChannels.Add(new RBuildDebugChannel("richedit")); + Project.DebugChannels.Add(new RBuildDebugChannel("statusbar")); + Project.DebugChannels.Add(new RBuildDebugChannel("text")); + Project.DebugChannels.Add(new RBuildDebugChannel("toolbar")); + } + + if (Project.Languages.Count == 0) + { + Project.Languages.Add(new RBuildLanguage("en-us")); + Project.Languages.Add(new RBuildLanguage("es-es")); + } + + m_RootTask.PreExecute(); + m_RootTask.Execute(); + m_RootTask.PostExecute(); + + SetPlatformDefaults(); + + //m_FileHandlers.Add(new TxtSetupFileHandler(this)); + //m_FileHandlers.Add(new SysSetupFileHandler(this)); + //m_FileHandlers.Add(new UnattendFileHandler(this)); + //m_FileHandlers.Add(new DownloaderFileHandler(this)); + //m_FileHandlers.Add(new AutorunFileHandler(this)); + //m_FileHandlers.Add(new HiveAutoGeneratedFileHandler(this)); + m_FileHandlers.ProcessFiles(Project.Files); + + if (RunBackends) + Backends.Generate(); + } + + private void SetPlatformDefaults() + { + if (SetDefaults) + { + if (Project.Platform.Modules.Count == 0) + { + foreach (RBuildModule module in Project.Modules) + { + Project.Platform.Modules.Add(module); + } + } + + if (Project.Languages.Count == 0) + { + foreach (RBuildLanguage language in Project.Languages) + { + Project.Platform.Languages.Add(language); + } + } + + if (Project.DebugChannels.Count == 0) + { + foreach (RBuildDebugChannel channel in Project.DebugChannels) + { + Project.Platform.DebugChannels.Add(channel); + } + } + } + } + + private void RegisterBackends() + { + //m_Backends.Add(new CatalogBackend(this)); + //m_Backends.Add(new MingwBackend(this)); + m_Backends.Add(new HtmlBackend(this)); + //m_Backends.Add(new RGenStatBackend(this)); + //m_Backends.Add(new BaseAddressReportBackend(this)); + //m_Backends.Add(new BuildLogReport(this)); + //m_Backends.Add(new ProjectTreeReport(this)); + m_Backends.Add(new RBuildDBBackend(this)); + //m_Backends.Add(new APIDocumentation(this)); + } + + public void CleanCustomConfigs() + { + Directory.SetCurrentDirectory (BaseDirectory); + + if (File.Exists("config.rbuild")) + File.Delete("config.rbuild"); + + if (File.Exists("config-arm.rbuild")) + File.Delete("config-arm.rbuild"); + + if (File.Exists("config-ppc.rbuild")) + File.Delete("config-ppc.rbuild"); + } + + public BackendCollection Backends + { + get { return m_Backends; } + } + + private void InitializeEnvironment() + { + Assembly ass = Assembly.GetExecutingAssembly(); + + Properties.AddReadOnly(SYSGEN_PROPERTY_FILENAME, ass.CodeBase); + Properties.AddReadOnly(SYSGEN_PROPERTY_VERSION, ass.GetName().Version.ToString()); + Properties.AddReadOnly(SYSGEN_PROPERTY_LOCATION, AppDomain.CurrentDomain.BaseDirectory); + + Project.Properties.AddReadOnly("CDOUTPUT", BootCDOutputDirectory + @"\reactos"); + Project.Properties.AddReadOnly("INTERMEDIATE", IntermediateDirectory); + Project.Properties.AddReadOnly("SOURCECODE", BaseDirectory); + Project.Properties.AddReadOnly("OUTPUT", OutputDirectory); + Project.Properties.AddReadOnly("INSTALL", InstallDirectory); + Project.Properties.AddReadOnly("TEMP", TemporaryDirectory); + Project.Properties.AddReadOnly("DOC", DocumentationDirectory); + } + + /// + /// Does Execute() and wraps in error handling and time stamping. + /// + /// Indication of success + public bool ReadBuildFiles() + { + //SysGenEngine.OnBuildStarted(this, new BuildEventArgs(_projectName)); + + bool success = true; + try + { + // Remember when the build was started + DateTime startTime = DateTime.Now; + + BuildLog.WriteLine(); + BuildLog.WriteLine("SysGen 0.2"); + BuildLog.WriteLine(); + BuildLog.WriteLine("Running on {0}", Environment.OSVersion.VersionString); + BuildLog.WriteLine(); + BuildLog.WriteLine("Buildfile: {0}", BuildFileURI.AbsolutePath); + BuildLog.WriteLine("Base Directory: {0}", BaseDirectory); + BuildLog.WriteLine(); + BuildLog.WriteLine("Reading rbuild files :"); + BuildLog.WriteLine(); + + Execute(); + + TimeSpan buildTime = DateTime.Now - startTime; + + BuildLog.WriteLine(); + BuildLog.WriteLine("{0} SysGen Module(s) detected.", Project.Modules.Count); + BuildLog.WriteLine("{0} Platform Module(s) detected.", Project.Platform.Modules.Count); + BuildLog.WriteLine(); + BuildLog.WriteLine("SysGen COMPLETED in {0} second(s)", (int)buildTime.TotalSeconds); + BuildLog.WriteLine(); + + //SysGenEngine.OnBuildFinished(this, new BuildEventArgs(_projectName)); + + success = true; + return true; + + } + catch (BuildException e) + { + BuildLog.WriteMessage("Build Failed" , "error"); + BuildLog.WriteLine(); + BuildLog.WriteLine(e.Message); + + if (e.InnerException != null) + { + BuildLog.WriteLine( e.InnerException.Message); + } + + success = false; + return false; + + } + catch (Exception e) + { + //throw; + // all other exceptions should have been caught + string message = "\nINTERNAL ERROR\n" + e.ToString() + "\nPlease send bug report to nant-developers@lists.sourceforge.net"; + BuildLog.WriteMessage(message, "error"); + success = false; + return false; + } + finally + { + //SysGenEngine.OnBuildFinished(this, new BuildEventArgs(_projectName)); + } + } + + /// Combine with project's to form a full path to file or directory. + /// + /// If it is possible for the path to contain property macros the path call first. + /// + /// + /// A rooted path. + /// + /// The relative or absolute path. + public string GetFullPath(string path) { + if (path == null) { + return BaseDirectory; + } + + //Docs above read we should do this. But it should be done before it gets here. + //path = this.ExpandProperties(path); + + if (!Path.IsPathRooted(path)) { + path = Path.Combine(BaseDirectory, path); + } + return path; + } + + public string GetRelativePath(string path) + { + return path.Replace(BaseDirectory +"\\" , string.Empty); + } + + /// + /// Expands a string from known properties + /// + /// The string with replacement tokens + /// The expanded and replaced string + public string ExpandProperties(string input) + { + string output = input; + if (input != null) + { + //matches ${abc} and $(abc) style properties + const string pattern = @"\$\{(?([^\}]*))\}|\$\(((?[^\}]*))\)"; + foreach (Match m in Regex.Matches(input, pattern)) + { + if (m.Length > 0) + { + try + { + string token = m.ToString(); + string propertyName = m.Groups["name"].Value; + + if (Project.Properties[propertyName] != null) + { + output = output.Replace(token, Project.Properties[propertyName].Value); + } + else + throw new BuildException(String.Format("Property '{0}' has not been set!", propertyName)); + } + catch (ArgumentException ae) + { + throw new BuildException(String.Format("Bad formed property")); + } + } + } + } + return output; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/SysGenPathResolver.cs b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenPathResolver.cs new file mode 100644 index 00000000000..1c1947b6d70 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/SysGenPathResolver.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; + +//using SysGen.RBuild.Framework; +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Tasks; + +namespace SysGen.BuildEngine +{ + class SysGenPathResolver + { + //public static string GetPath(Task current) + //{ + // return GetPath(current, SysGen.ProjectTask); + //} + + public static string GetPath(Task current, Task root) + { + IElement task = current.Parent; + while (task != root) + { + DirectoryTask directory = task as DirectoryTask; + + if (directory != null) + return directory.Folder.FullPath; + + task = task.Parent; + } + + return string.Empty; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/Task.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/Task.cs new file mode 100644 index 00000000000..5bee2d549d5 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/Task.cs @@ -0,0 +1,257 @@ +using System; +using System.IO; +using System.Reflection; +using System.Xml; + +using SysGen.RBuild.Framework; + +using SysGen.BuildEngine.Log; +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Tasks; + +namespace SysGen.BuildEngine +{ + public enum TaskExecuteStage + { + PreExecute, + Execute, + PostExecute + } + + /// + /// Provides the abstract base class for tasks. + /// + /// + /// A task is a piece of code that can be executed. + /// + public abstract class Task : Element, ITask + { + protected bool _failOnError = true; + protected bool _verbose = false; + protected bool _ifDefined = true; + protected bool _ifNotDefined = false; + + TaskExecuteStage _stage = TaskExecuteStage.PreExecute; + + /// + /// Determines if task failure stops the build, or is just reported. Default is "true". + /// + [TaskAttribute("failonerror")] + [BooleanValidator()] + public bool FailOnError { + get { return _failOnError; } + set { _failOnError = value; } + } + + /// + /// Task reports detailed build log messages. Default is "false". + /// + [TaskAttribute("verbose")] + [BooleanValidator()] + public bool Verbose { + get { return (_verbose || SysGen.Verbose); } + set { _verbose = value; } + } + + /// + /// If true then the task will be executed; otherwise skipped. Default is "true". + /// + [TaskAttribute("if")] + [BooleanValidator()] + public bool IfDefined { + get { return _ifDefined; } + set { _ifDefined = value; } + } + + /// + /// Opposite of if. If false then the task will be executed; otherwise skipped. Default is "false". + /// + [TaskAttribute("ifnot")] + [BooleanValidator()] + public bool IfNotDefined + { + get { return _ifNotDefined; } + set { _ifNotDefined = value; } + } + + public string XmlFile + { + get { return new Uri(_xmlNode.OwnerDocument.BaseURI).LocalPath; } + } + + public string RBuildFile + { + get { return Path.GetFileName(XmlFile); } + } + + /// The name of the task. + public override string Name { + get { + string name = null; + TaskNameAttribute taskName = (TaskNameAttribute) Attribute.GetCustomAttribute(GetType(), typeof(TaskNameAttribute)); + if (taskName != null) { + name = taskName.Name; + } + return name; + } + } + + public RBuildFolder InFolder + { + get + { + IElement task = Parent; + while (task != SysGen.RootTask) + { + DirectoryTask directory = task as DirectoryTask; + + if (directory != null) + return directory.Folder; + + task = task.Parent; + } + + return SysGen.Project.Folder; + } + } + + /// + /// The prefix used when sending messages to the log. + /// + public string LogPrefix { + get { + string prefix = "[" + Name + "] "; + return prefix.PadLeft(BuildLog.IndentSize); + } + } + + private TaskExecuteStage ExecutionStage + { + get { return _stage; } + } + + /// + /// Executes the task unless it is skipped. Do not ovveride/new this method. Use ExecuteTask instead. + /// + public void Execute() + { + RunTask(TaskExecuteStage.Execute); + } + + public void PostExecute() + { + RunTask(TaskExecuteStage.PostExecute); + } + + public void PreExecute() + { + RunTask(TaskExecuteStage.PreExecute); + } + + private void RunTask (TaskExecuteStage stage) + { + // Save the current execution stage + _stage = stage; + + if (IfDefined && !IfNotDefined) + { + try + { + SysGenEngine.OnTaskStarted(this, new BuildEventArgs(Name)); + + switch (stage) + { + case TaskExecuteStage.PreExecute: + PreExecuteTask(); + break; + case TaskExecuteStage.Execute: + ExecuteTask(); + break; + case TaskExecuteStage.PostExecute: + PostExecuteTask(); + break; + } + + if (this is ITaskContainer) + { + ITaskContainer taskContainer = this as ITaskContainer; + + if (taskContainer.ExecuteChilds) + { + foreach (Task taskChild in taskContainer.ChildTasks) + { + taskChild.RunTask(stage); + } + } + } + } + catch (Exception e) + { + SysGenEngine.OnTaskException(this, new BuildEventArgs(Name)); + + if (FailOnError) + { + throw; + } + else + { + BuildLog.WriteLine(e.Message); + if (e.InnerException != null) + { + BuildLog.WriteLine(e.InnerException.Message); + } + } + } + finally + { + SysGenEngine.OnTaskFinished(this, new BuildEventArgs(Name)); + } + } + } + + protected override void InitializeElement(XmlNode elementNode) + { + if (this is ITaskContainer) + { + ITaskContainer taskContainer = this as ITaskContainer; + + foreach (XmlNode childNode in elementNode.ChildNodes) + { + if (SysGen.CanProcessNode(childNode)) + SysGen.LoadChildTask(childNode, taskContainer); + } + } + + // Just defer for now so that everything just works + InitializeTask(elementNode); + } + + /// Initializes the task. + protected virtual void InitializeTask(XmlNode taskNode) + { + } + + protected virtual void PostExecuteTask() + { + } + + /// + /// Executes the task. + /// + protected virtual void ExecuteTask() + { + } + + /// + /// Executes the task. + /// + protected virtual void PreExecuteTask() + { + } + + public override string ToString() + { + return Name; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/TaskContainer.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/TaskContainer.cs new file mode 100644 index 00000000000..2de6d0e28ca --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/Base/TaskContainer.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine +{ + /// + /// A Generic Task Container + /// + public abstract class TaskContainer : Task , ITaskContainer + { + protected bool m_ExecuteChilds = true; + protected TaskCollection _childTasks = new TaskCollection(); + + /// + /// Available child instances. + /// + public TaskCollection ChildTasks + { + get { return _childTasks; } + } + + public bool ExecuteChilds + { + get { return m_ExecuteChilds; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIFallbackTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIFallbackTask.cs new file mode 100644 index 00000000000..535407ef36f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIFallbackTask.cs @@ -0,0 +1,11 @@ +using System; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("fallback", Namespace = "xi")] + public class XIFallbackTask : TaskContainer + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIIncludeTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIIncludeTask.cs new file mode 100644 index 00000000000..66b66c028df --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Build/XIIncludeTask.cs @@ -0,0 +1,148 @@ +using System; +using System.IO; +using System.Xml; +using System.Collections; +using System.Collections.Specialized; + +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Log; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + /// + /// Include an external build file. + /// + [TaskName("include", Namespace = "xi")] + public class XIIncludeTask : FileSystemInfoBaseTask, ITaskContainer //TaskContainer + { + private TaskCollection m_ChildTasks = new TaskCollection(); + + /// + /// Used to check for recursived includes. + /// + private static Stack _includedFiles = new Stack(); + + ///// + ///// The file to be included + ///// + //private string _href = null; + + /// Build file to include. + [TaskAttribute("href", Required = true)] + public string BuildFileName + { + get { return m_FileSystemInfo.Name; } + set { m_FileSystemInfo.Name = value; } + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildFile(); + } + + public TaskCollection ChildTasks + { + get { return m_ChildTasks; } + } + + public bool ExecuteChilds + { + get { return true; } + } + + protected override void OnInit() + { + base.OnInit(); + + Base = SysGenPathResolver.GetPath(this, SysGen.RootTask); + } + + /// Verify parameters. + /// Xml taskNode used to define this task instance. + protected override void InitializeTask(XmlNode taskNode) + { + //base.InitializeTask(taskNode); + + FailOnError = false; + + /* + // Task can only be included as a global task. + // This might not be a firm requirement but you could get some real + // funky errors if you start including targets wily-nily. + if (Parent != null ) + { + if ((!(Parent is RbuildTask)) || (!(Parent is ProjectTask))) + throw new BuildException("Task not allowed in targets. Must be at project level.", Location); + } + */ + + // Check for recursive include. + string buildFileName = Path.Combine(BaseBuildLocation, BuildFileName); + foreach (string currentFileName in _includedFiles) { + if (currentFileName == buildFileName) { + throw new BuildException("Recursive includes are not allowed.", Location); + } + } + + string includedFileName = Path.Combine(BaseBuildLocation , BuildFileName); + string includeRelative = SysGen.GetRelativePath(includedFileName); + + // push ourselves onto the stack (prevents recursive includes) + _includedFiles.Push(includedFileName); + + BuildLog.WriteLine("Including {0}", includeRelative); + + try + { + XmlDocument doc = new XmlDocument(); + doc.XmlResolver = null; + doc.Load(includedFileName); + + SysGen.InitializeBuildFile(doc, this); + + SysGen.BuildFiles.Add(includedFileName); + } + catch (BuildException) + { + throw; + } + catch (IOException e) + { + try + { + if (ChildTasks.Count == 0) + throw new BuildException("Could not include build file " + includedFileName, Location, e); + + BuildLog.WriteLine("Including {0} Failed. Fallback present and executed", includeRelative); + //BuildLog.WriteLine("Include {0} not found. Fallback executed", includeRelative); + } + catch (Exception fallbackException) + { + throw new BuildException("Could not include build file " + includedFileName + " fallback also failed", Location, fallbackException); + } + } + catch (ArgumentException e) + { + //Puede pasar + } + catch (Exception e) + { + throw new BuildException("Could not include build file " + includedFileName + " " + e.Message, Location, e); + } + finally + { + // pop off the stack + _includedFiles.Pop(); + } + } + + protected override void ExecuteTask() + { + } + + protected override void PreExecuteTask() + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfNotTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfNotTask.cs new file mode 100644 index 00000000000..b1530a34756 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfNotTask.cs @@ -0,0 +1,49 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.Specialized; + +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Log; + +namespace SysGen.BuildEngine.Tasks +{ + /// + /// The opposite of the if task. + /// + /// + /// Check existence of a property + /// + /// + /// + /// + /// ]]> + /// + /// Check that a property value is not true + /// + /// + /// + /// + /// ]]> + /// + /// + /// + /// Check that a target does not exist + /// + /// + /// + /// + /// ]]> + /// + [TaskName("ifnot")] + public class IfNotTask : IfTask + { + protected override bool ConditionsTrue + { + get { return !base.ConditionsTrue; } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfTask.cs new file mode 100644 index 00000000000..a9bff9a22e6 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/BuiltIn/Logic/IfTask.cs @@ -0,0 +1,134 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.Specialized; + +using SysGen.BuildEngine.Attributes; +using SysGen.BuildEngine.Log; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("if")] + public class IfTask : TaskContainer + { + protected string _propName = null; + protected string _propValue = null; + protected string _propNameTrue = null; + protected string _propNameExists = null; + + /// + /// Used to test whether a property is true. + /// + [TaskAttribute("propertytrue")] + public string PropertyNameTrue { + set {_propNameTrue = value;} + } + + /// + /// Used to test whether a property exists. + /// + [TaskAttribute("propertyexists")] + public string PropertyNameExists { + set {_propNameExists = value;} + } + + /// + /// Used to test whether a property exists. + /// + [TaskAttribute("property")] + public string PropertyName + { + set { _propName = value; } + } + + /// + /// Used to test whether a property exists. + /// + [TaskAttribute("value")] + public string PropertyValue + { + set { _propValue = value; } + } + + protected override void PreExecuteTask() + { + if (!ConditionsTrue) + { + m_ExecuteChilds = false; + } + } + + /* + protected override void ExecuteTask() { + if(!ConditionsTrue) { + m_ExecuteChilds = false; + } + }*/ + + protected virtual bool ConditionsTrue + { + get + { + bool ret = true; + + if (_propName != null) + { + if (_propValue != null) + { + if (SysGen.Project.Properties.PropertyExists(_propName)) + { + return (SysGen.Project.Properties[_propName].Value == _propValue); + } + + return false; + } + else + { + ret = ret && SysGen.Project.Properties.PropertyExists(_propNameExists); + } + } + + ////check for target + //if(_targetName != null) { + // ret = ret && (SysGen.Targets.Find(_targetName) != null); + // if (!ret) return false; + //} + + //Check for the Property value of true. + if (_propNameTrue != null) + { + try + { + ret = ret && bool.Parse(SysGen.Project.Properties[_propNameTrue].Value); + } + catch (Exception e) + { + throw new BuildException("Property True test failed for '" + _propNameTrue + "'", Location, e); + } + } + + //Check for Property existence + if(_propNameExists != null) + { + ret = ret && SysGen.Project.Properties.PropertyExists(_propNameExists); + } + + ////check for uptodate file + //if(_uptodateFile != null) { + // FileInfo primaryFile = new FileInfo(_uptodateFile); + // if(primaryFile == null) { + // ret = true; + // } + // else { + // string newerFile = FileSet.FindMoreRecentLastWriteTime(_compareFiles.FileNames, primaryFile.LastWriteTime); + // bool bNeedsAnUpdate = (null == newerFile); + // BuildLog.WriteLineIf(SysGen.Verbose && bNeedsAnUpdate, "{0) is newer than {1}" , newerFile, primaryFile.Name); + // ret = !bNeedsAnUpdate; + // } + //} + + return ret; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoFilesTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoFilesTask.cs new file mode 100644 index 00000000000..6e74be382a7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoFilesTask.cs @@ -0,0 +1,63 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class AutoFilesBaseTask : AutoResolvableFileSystemInfoBaseTask + { + private string m_Pattern = "*.*"; + + public AutoFilesBaseTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildFolder(); + } + + public RBuildFolder Folder + { + get { return m_FileSystemInfo as RBuildFolder; } + } + + [TaskAttribute("pattern")] + public string Pattern { get { return m_Pattern; } set { m_Pattern = value; } } + + protected override void ExecuteTask() + { + base.ExecuteTask(); + + foreach(string file in Directory.GetFiles (SysGen.ResolveRBuildFolderPath(Folder) , Pattern)) + { + AddFile(file); + } + } + + protected abstract void AddFile (string file); + } + + [TaskName("autoinstallfiles")] + public class AutoInstallFiles : AutoFilesBaseTask + { + private string m_InstallBase = "."; + + [TaskAttribute("installbase")] + public string InstallBase { get { return m_InstallBase; } set { m_InstallBase = value; } } + + protected override void AddFile(string file) + { + RBuildInstallFile autoFile = new RBuildInstallFile(); + + autoFile.Root = Root; + autoFile.Base = Folder.Base; + autoFile.Name = Path.GetFileName(file); + autoFile.InstallBase = InstallBase; + + RBuildElement.Files.Add(autoFile); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoInstallFilesTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoInstallFilesTask.cs new file mode 100644 index 00000000000..9548900348d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoInstallFilesTask.cs @@ -0,0 +1,15 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + //[TaskName("autoinstallfiles")] + //public class AutoInstallFilesTask : AutoFilesTask + //{ + // protected override void ExecuteTask() + // { + // } + //} +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoManifest.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoManifest.cs new file mode 100644 index 00000000000..866d06eb058 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoManifest.cs @@ -0,0 +1,15 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("automanifest")] + public class AutoManifest : ValueBaseTask + { + protected override void ExecuteTask() + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoRegisterTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoRegisterTask.cs new file mode 100644 index 00000000000..045fdb851ac --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoRegisterTask.cs @@ -0,0 +1,33 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("autoregister")] + public class AutoRegisterTask : Task + { + RBuildAutoRegister m_AutoRegister = new RBuildAutoRegister(); + + [TaskAttribute("type", Required = true)] + public AutoRegisterType Type { get { return m_AutoRegister.Type; } set { m_AutoRegister.Type = value; } } + + [TaskAttribute("infsection", Required = true)] + public string InfSection { get { return m_AutoRegister.InfSection; } set { m_AutoRegister.InfSection = value; } } + + protected override void ExecuteTask() + { + if ((Module.Type == ModuleType.Win32DLL) || + (Module.Type == ModuleType.Win32OCX)) + { + if (Module.AutoRegister != null) + throw new BuildException("There can be only one element for a module", Location); + + Module.AutoRegister = m_AutoRegister; + } + else + throw new BuildException(" is not applicable for this module type", Location); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoResource.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoResource.cs new file mode 100644 index 00000000000..359132395d1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/AutoResource.cs @@ -0,0 +1,15 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + //[TaskName("autoresource")] + //public class AutoResourceTask : AutoFilesTask + //{ + // protected override void ExecuteTask() + // { + // } + //} +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AuthorBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AuthorBaseTask.cs new file mode 100644 index 00000000000..a12ea2f5202 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AuthorBaseTask.cs @@ -0,0 +1,26 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class AuthorBaseTask : Task + { + protected string m_Alias = null; + protected RBuildAuthor m_Author = new RBuildAuthor(); + + [TaskValue(Required=true)] + public virtual string Alias { get { return m_Alias; } set { m_Alias = value; } } + + protected override void ExecuteTask() + { + m_Author.Contributor = Project.Contributors.GetByName(Alias); + + if (m_Author.Contributor == null) + throw new BuildException(string.Format("Could not resolve contributor '{0}' referenced by module '{1}'", Alias, Module.Name, Location)); + + Module.Authors.Add(m_Author); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AutoFilesTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AutoFilesTask.cs new file mode 100644 index 00000000000..7a4dc70523b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/AutoFilesTask.cs @@ -0,0 +1,19 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + //public abstract class AutoFilesTask : Task + //{ + // FileSet files = new FileSet(); + + // [FileSet("files")] + // public FileSet Files + // { + // get { return files; } + // set { files = value; } + // } + //} +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/CDFileBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/CDFileBaseTask.cs new file mode 100644 index 00000000000..869df983965 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/CDFileBaseTask.cs @@ -0,0 +1,42 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class CDFileBaseTask : FileBaseTask //PlatformFileBaseTask + { + public CDFileBaseTask() + { + } + + [TaskAttribute("installbase")] + public string InstallBase { get { return CDFile.InstallBase; } set { CDFile.InstallBase = value; } } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildCDFile(); + } + + /// + /// The name of the define to set. + /// + [TaskAttribute("nameoncd")] + public string NameOnCD { get { return CDFile.NewName; } set { CDFile.NewName = value; } } + + private RBuildCDFileBase CDFile + { + get { return m_FileSystemInfo as RBuildCDFileBase; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + //Add the file + RBuildElement.Files.Add(CDFile); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileBaseTask.cs new file mode 100644 index 00000000000..67773a31bed --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileBaseTask.cs @@ -0,0 +1,47 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class FileBaseTask : FileSystemInfoBaseTask + { + public FileBaseTask() + { + } + + /// + /// The define value. + /// + [TaskValue] + public virtual string FileName { get { return m_FileSystemInfo.Name; } set { m_FileSystemInfo.Name = value; } } + + ///// + ///// Get the underlying . + ///// + //public RBuildPlatformFile PlatformFile + //{ + // get { return m_FileSystemInfo as RBuildPlatformFile; } + //} + + //public override string BasePath + //{ + // get + // { + // IElement task = this; + // while (task != SysGen.ProjectTask) + // { + // if (task is IDirectory) + // return ((IDirectory)task).BasePath; + + // task = task.Parent; + // } + + // //Is in the root + // return string.Empty; + // } + //} + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileSystemInfoBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileSystemInfoBaseTask.cs new file mode 100644 index 00000000000..3046065d483 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FileSystemInfoBaseTask.cs @@ -0,0 +1,119 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class AutoResolvableFileSystemInfoBaseTask : FileSystemInfoBaseTask + { + protected override bool TryToResolveBasePath() + { + if (Base == "eventlog_server") + { + int i = 10; + } + + if ((Base != null) && (Base != string.Empty)) + { + if (Base != Project.Name) + { + // Get the referenced module + RBuildModule module = Project.Modules.GetByName(Base); + + if (module == null) + throw new BuildException(string.Format("Could not resolve module base '{0}' for module '{1}'", Base, Module.Name, Location)); + + // If no path has been specified by the user + // set the module default path + if (Root == PathRoot.Default) + Root = module.IncludeDefaultRoot; + + // Set the base to the module root + m_FileSystemInfo.Base = module.Folder.FullPath; + } + else + { + // Set the base to the project root + m_FileSystemInfo.Base = Project.Base; + } + } + else + { + // Set the base to the folder containing the module + m_FileSystemInfo.Base = InFolder.FullPath; + } + + if (m_FileSystemInfo.Base == null || m_FileSystemInfo.Name == null) + { + int i = 10; + } + + return true; + } + } + + public abstract class FileSystemInfoBaseTask : Task + { + protected RBuildFileSystemInfo m_FileSystemInfo = null; + + public FileSystemInfoBaseTask() + { + CreateFileSystemObject(); + } + + protected abstract void CreateFileSystemObject(); + + /// + /// The name of the define to set. + /// + [TaskAttribute("base")] + public string Base { get { return m_FileSystemInfo.Base; } set { m_FileSystemInfo.Base = value; } } + + /// + /// The name of the define to set. + /// + [TaskAttribute("root")] + public PathRoot Root { get { return m_FileSystemInfo.Root; } set { m_FileSystemInfo.Root = value; } } + + /// + /// Get the underlying . + /// + public RBuildFileSystemInfo FileSystemInfo + { + get { return m_FileSystemInfo; } + } + + protected virtual void SetRBuildElement() + { + //m_FileSystemInfo.Element = RBuildElement; + } + + protected virtual void SetRootFromParent() + { + } + + protected virtual bool TryToResolveBasePath () + { + return false; + } + + protected override void PreExecuteTask() + { + SetRootFromParent(); + SetRBuildElement(); + } + + protected override void ExecuteTask() + { + // Give the oportunity to subclasses to resolve the path + if (!TryToResolveBasePath()) + { + // If no base path has been specified default to current + if (string.IsNullOrEmpty(Base)) + Base = SysGenPathResolver.GetPath(this, SysGen.RootTask); + } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FolderBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FolderBaseTask.cs new file mode 100644 index 00000000000..c17c86473f2 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/FolderBaseTask.cs @@ -0,0 +1,15 @@ +//using System; + +//using SysGen.BuildEngine.Attributes; +//using SysGen.RBuild.Framework; + +//namespace SysGen.BuildEngine.Tasks +//{ +// public abstract class FolderBaseTask : Task +// { +// protected override void CreateFileSystemObject() +// { +// m_FileSystemInfo = new RBuildFolder(); +// } +// } +//} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PlatformFileBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PlatformFileBaseTask.cs new file mode 100644 index 00000000000..2bfa1c70702 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PlatformFileBaseTask.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class PlatformFileBaseTask : FileBaseTask + { + /// + /// The define value. + /// + [TaskValue] + public string FileName { get { return m_FileSystemInfo.Name; } set { m_FileSystemInfo.Name = value; } } + + [TaskAttribute("installbase")] + public string InstallBase { get { return PlatformFile.InstallBase; } set { PlatformFile.InstallBase = value; } } + + /// + /// Get the underlying . + /// + public RBuildPlatformFile PlatformFile + { + get { return m_FileSystemInfo as RBuildPlatformFile; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + //Add the file + RBuildElement.Files.Add(PlatformFile); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PropertyBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PropertyBaseTask.cs new file mode 100644 index 00000000000..cc9e8fd8c55 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/PropertyBaseTask.cs @@ -0,0 +1,38 @@ +using System; +using System.Xml; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class PropertyBaseTask : Task + { + protected string m_Name = null; + protected string m_Value = String.Empty; + protected bool m_ReadOnly = false; + protected bool m_Internal = false; + + /// the name of the property to set. + [TaskAttribute("name", Required=true)] + public string PropName { get { return m_Name; } set { m_Name = value; } } + + /// the value of the property. + [TaskAttribute("value", Required=true)] + public string Value { get { return m_Value; } set { m_Value = value; } } + + /// the value of the property. + [TaskAttribute("readonly")] + [BooleanValidator()] + public bool ReadOnly { get { return m_ReadOnly; } set { m_ReadOnly = value; } } + + [TaskAttribute("internal")] + [BooleanValidator()] + public bool Internal { get { return m_Internal; } set { m_Internal = value; } } + + protected override void OnLoad() + { + Project.Properties.Add(new RBuildProperty(m_Name, m_Value, m_ReadOnly, m_Internal)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/RbuildElementBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/RbuildElementBaseTask.cs new file mode 100644 index 00000000000..7afe7a5f9ab --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/RbuildElementBaseTask.cs @@ -0,0 +1,16 @@ +using System; +using System.Xml; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class RbuildElementBaseTask : Task + { + protected override void OnLoad() + { + + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/ValueBaseTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/ValueBaseTask.cs new file mode 100644 index 00000000000..ae1c1137c7f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Base/ValueBaseTask.cs @@ -0,0 +1,16 @@ +using System; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + public abstract class ValueBaseTask : Task + { + protected string _value = null; + + /// + /// The define value. + /// + [TaskValue] + public virtual string Value { get { return _value; } set { _value = value; } } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BaseAdressTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BaseAdressTask.cs new file mode 100644 index 00000000000..39ea6a8c071 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BaseAdressTask.cs @@ -0,0 +1,17 @@ +using System; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("baseadress")] + public class BaseAdressTask : PropertyBaseTask + { + protected override void OnLoad() + { + Project.Properties.Add(new RBuildBaseAdress(m_Name, m_Value)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootSector.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootSector.cs new file mode 100644 index 00000000000..05ce34d2b35 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootSector.cs @@ -0,0 +1,44 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("bootsector")] + public class BootSector : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildModule bootModule = Project.Modules.GetByName(Value); + + if (bootModule != null) + { + if (bootModule.Type == ModuleType.BootSector) + { + if (Module.Type == ModuleType.Iso || + Module.Type == ModuleType.IsoRegTest || + Module.Type == ModuleType.LiveIso || + Module.Type == ModuleType.LiveIsoRegTest) + { + if (Module.BootSector == null) + Module.BootSector = bootModule; + } + else + throw new BuildException(" is not applicable for this module type.", Location); + } + else + throw new BuildException(" for module '{0}' is referencing a non BootSector module '{1}'", + Module.Name, + bootModule.Name, + Location); + } + else + throw new BuildException(" for module '{0}' is referencing a non existing module '{1}'", + Module.Name, + Value, + Location); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapFileTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapFileTask.cs new file mode 100644 index 00000000000..7d68ee9fc99 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapFileTask.cs @@ -0,0 +1,40 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("bootstrapfile")] + public class BootstrapFileTask : CDFileBaseTask //FileBaseTask ///PlatformFileBaseTask + { + public BootstrapFileTask() + { + } + + [TaskValue] + public string FileName { get { return m_FileSystemInfo.Name; } set { m_FileSystemInfo.Name = value; } } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildBootstrapFile(); + } + + public RBuildBootstrapFile BootStrapFile + { + get { return m_FileSystemInfo as RBuildBootstrapFile; } + } + + protected override bool TryToResolveBasePath() + { + Base = "i386"; + return true; + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapTask.cs new file mode 100644 index 00000000000..a3713de30bf --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BootstrapTask.cs @@ -0,0 +1,52 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("bootstrap")] + public class BootstrapTask : CDFileBaseTask + { + public BootstrapTask() + { + m_FileSystemInfo = new RBuildBootstrapFile(); + } + + private RBuildBootstrapFile BootstrapFile + { + get { return m_FileSystemInfo as RBuildBootstrapFile; } + } + + protected override void ExecuteTask() + { + if ((Module.Type == ModuleType.Kernel) || + (Module.Type == ModuleType.KernelModeDLL) || + (Module.Type == ModuleType.KeyboardLayout) || + (Module.Type == ModuleType.KernelModeDriver) || + (Module.Type == ModuleType.NativeDLL) || + (Module.Type == ModuleType.NativeCUI) || + (Module.Type == ModuleType.Win32DLL) || + (Module.Type == ModuleType.Win32OCX) || + (Module.Type == ModuleType.Win32CUI) || + (Module.Type == ModuleType.Win32SCR) || + (Module.Type == ModuleType.Win32GUI) || + (Module.Type == ModuleType.BootSector) || + (Module.Type == ModuleType.BootLoader) || + (Module.Type == ModuleType.BootProgram) || + (Module.Type == ModuleType.Cabinet)) + { + BootstrapFile.Element = RBuildElement; + BootstrapFile.Name = Module.TargetName; + BootstrapFile.Root = Module.TargetDefaultRoot; + BootstrapFile.Base = Module.Folder.FullPath; + + Module.Bootstrap = BootstrapFile; + + //Project.Files.Add(BootstrapFile); + } + else + throw new BuildException(" is not applicable for this module type.", Location); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BuildFamilyTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BuildFamilyTask.cs new file mode 100644 index 00000000000..29d2ead87aa --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/BuildFamilyTask.cs @@ -0,0 +1,27 @@ +using System; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + /// + /// Just a task container + /// + [TaskName("buildfamily")] + public class BuildFamilyTask : Task + { + private RBuildBuildFamily m_BuildFamily = new RBuildBuildFamily(); + + [TaskAttribute("name", Required = true)] + public string FamilyName { get { return m_BuildFamily.Name; } set { m_BuildFamily.Name = value; } } + + [TaskAttribute("description")] + public string FamilyDescription { get { return m_BuildFamily.Description; } set { m_BuildFamily.Description = value; } } + + protected override void PreExecuteTask() + { + Project.BuildFamilies.Add(m_BuildFamily); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CDFileTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CDFileTask.cs new file mode 100644 index 00000000000..6f9b6bcf13a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CDFileTask.cs @@ -0,0 +1,20 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("cdfile")] + public class CDFileTask : CDFileBaseTask + { + public CDFileTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildCDFile(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilationUnitTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilationUnitTask.cs new file mode 100644 index 00000000000..d08a5005ed7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilationUnitTask.cs @@ -0,0 +1,58 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("compilationunit")] + public class CompilationUnitTask : FileSystemInfoBaseTask, ITaskContainer, IRBuildSourceFilesContainer + { + private TaskCollection m_ChildTasks = new TaskCollection(); + + public CompilationUnitTask() + { + Root = PathRoot.Intermediate; + } + + public TaskCollection ChildTasks + { + get { return m_ChildTasks; } + } + + public bool ExecuteChilds + { + get { return true; } + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildCompilationUnitFile(); + } + + public RBuildCompilationUnitFile CompilationUnit + { + get { return m_FileSystemInfo as RBuildCompilationUnitFile; } + } + + public RBuildSourceFileCollection SourceFiles + { + get { return CompilationUnit.SourceFiles; } + } + + /// + /// The name of the compilation unit to set. + /// + [TaskAttribute("name")] + public string FileName { get { return m_FileSystemInfo.Name; } set { m_FileSystemInfo.Name = value; } } + + protected override void ExecuteTask() + { + base.ExecuteTask(); + + // Add the compilation unit to the current module + Module.CompilationUnits.Add(CompilationUnit); + } + + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilerFlagTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilerFlagTask.cs new file mode 100644 index 00000000000..87eb278d232 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/CompilerFlagTask.cs @@ -0,0 +1,14 @@ +using System; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("compilerflag")] + public class CompilerFlagTask : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildElement.CompilerFlags.Add(Value); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ComponentTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ComponentTask.cs new file mode 100644 index 00000000000..7063b105a2d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ComponentTask.cs @@ -0,0 +1,12 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("component")] + public class ComponentTask : Task + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ContributorTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ContributorTask.cs new file mode 100644 index 00000000000..a6528adddea --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ContributorTask.cs @@ -0,0 +1,42 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("contributor")] + public class ContributorTask : Task + { + private RBuildContributor m_Contributor = new RBuildContributor(); + + [TaskAttribute("firstname", Required = true)] + public string FirstName { get { return m_Contributor.FirstName; } set { m_Contributor.FirstName = value; } } + + [TaskAttribute("city")] + public string City { get { return m_Contributor.City; } set { m_Contributor.City = value; } } + + [TaskAttribute("country")] + public string Country { get { return m_Contributor.Country; } set { m_Contributor.Country = value; } } + + [TaskAttribute("lastname")] + public string LastName { get { return m_Contributor.LastName; } set { m_Contributor.LastName = value; } } + + [TaskAttribute("alias")] + public string Alias { get { return m_Contributor.Alias; } set { m_Contributor.Alias = value; } } + + [TaskAttribute("mail")] + public string Mail { get { return m_Contributor.Mail; } set { m_Contributor.Mail = value; } } + + [TaskAttribute("website")] + public string Website { get { return m_Contributor.Website; } set { m_Contributor.Website = value; } } + + [TaskAttribute("active")] + public bool Active { get { return m_Contributor.Active; } set { m_Contributor.Active = value; } } + + protected override void ExecuteTask() + { + Project.Contributors.Add(m_Contributor); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DebugChannelTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DebugChannelTask.cs new file mode 100644 index 00000000000..886d0489155 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DebugChannelTask.cs @@ -0,0 +1,54 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("debugchannel")] + public class DebugChannelTask : Task + { + RBuildDebugChannel m_DebugChannel = new RBuildDebugChannel(); + + [TaskAttribute("name")] + [TaskValue] + public string ChannelName + { + get { return m_DebugChannel.Name; } + set { m_DebugChannel.Name = value; } + } + + [TaskAttribute("warning")] + public bool Warning + { + get { return m_DebugChannel.Warn; } + set { m_DebugChannel.Warn = value; } + } + + [TaskAttribute("trace")] + public bool Trace + { + get { return m_DebugChannel.Trace; } + set { m_DebugChannel.Trace = value; } + } + + [TaskAttribute("fixme")] + public bool Fixme + { + get { return m_DebugChannel.Fixme; } + set { m_DebugChannel.Fixme = value; } + } + + [TaskAttribute("error")] + public bool Error + { + get { return m_DebugChannel.Error; } + set { m_DebugChannel.Error = value; } + } + + protected override void ExecuteTask() + { + Project.DebugChannels.Add(m_DebugChannel); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DefineTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DefineTask.cs new file mode 100644 index 00000000000..071ff49d50f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DefineTask.cs @@ -0,0 +1,45 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("define")] + public class DefineTask : Task + { + private string _name = null; + private string _value = String.Empty; + private string _backend = String.Empty; + private bool _empty = false; + + /// + /// The name of the define to set. + /// + [TaskAttribute("name", Required=true)] + public string DefineName { get { return _name; } set { _name = value; } } + + /// + /// The define value. + /// + [TaskAttribute("value")] + [TaskValue] + public string DefineValue { get { return _value; } set { _value = value; } } + + /// + /// The name of the define to set. + /// + [TaskAttribute("empty")] + [BooleanValidator] + public bool Empty { get { return _empty; } set { _empty = value; } } + + // TODO : Remove ? + [TaskAttribute("backend")] + public string Backend { get { return _backend; } set { _backend = value; } } + + protected override void ExecuteTask() + { + RBuildElement.Defines.Add(new RBuildDefine(DefineName, DefineValue)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DependencyTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DependencyTask.cs new file mode 100644 index 00000000000..d9a90606f42 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DependencyTask.cs @@ -0,0 +1,27 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("dependency")] + public class DependencyTask : ValueBaseTask + { + /// + /// The define value. + /// + [TaskValue(Required = true)] + public virtual string Value { get { return _value; } set { _value = value; } } + + protected override void ExecuteTask() + { + RBuildModule dependency = Project.Modules.GetByName(Value); + + if (dependency == null) + throw new BuildException("Unknown dependency '{0}' referenced by module '{1}'", Value, Module.Name); + + Module.Dependencies.Add(dependency); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DeveloperTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DeveloperTask.cs new file mode 100644 index 00000000000..1c2a6a4fe61 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DeveloperTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("developer")] + public class DeveloperTask : AuthorBaseTask + { + public DeveloperTask() + { + m_Author.Role = AuthorRole.Developer; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DirectoryTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DirectoryTask.cs new file mode 100644 index 00000000000..efc632767c8 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/DirectoryTask.cs @@ -0,0 +1,59 @@ +using System.IO; +using System.Collections.Generic; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("directory")] + public class DirectoryTask : FileSystemInfoBaseTask, ITaskContainer//, IDirectory + { + private TaskCollection m_ChildTasks = new TaskCollection(); + + public DirectoryTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildFolder(); + } + + public TaskCollection ChildTasks + { + get { return m_ChildTasks; } + } + + public bool ExecuteChilds + { + get { return true; } + } + + /// + /// The directory name. + /// + [TaskAttribute("name", Required = true)] + public virtual string Name { get { return m_FileSystemInfo.Name; } set { m_FileSystemInfo.Name = value; } } + + public RBuildFolder Folder + { + get { return m_FileSystemInfo as RBuildFolder; } + } + + protected override void OnInit() + { + base.OnInit(); + + Base = SysGenPathResolver.GetPath(this, SysGen.RootTask); + } + + protected override void ExecuteTask() + { + base.ExecuteTask(); + + if (RBuildElement.Folders.Contains(Folder) == false) + RBuildElement.Folders.Add(Folder); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FamilyTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FamilyTask.cs new file mode 100644 index 00000000000..6051c9b52c8 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FamilyTask.cs @@ -0,0 +1,28 @@ +using System; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("family")] + public class FamilyTask : Task + { + private RBuildFamily m_Family = new RBuildFamily(); + + [TaskValue(Required = true)] + public string FamilyName { get { return m_Family.Name; } set { m_Family.Name = value; } } + + protected override void ExecuteTask() + { + RBuildBuildFamily buildFamily = Project.BuildFamilies.GetByName(FamilyName); + + if (buildFamily == null) + throw new BuildException("Module '{0}' references a no existant family '{1}'", + Module.Name, + FamilyName); + + Module.Families.Add(m_Family); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FileTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FileTask.cs new file mode 100644 index 00000000000..0b3e3af243d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/FileTask.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("file")] + public class FileTask : FileBaseTask + { + public FileTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildSourceFile(); + } + + [TaskAttribute("switches")] + public string Switches { get { return SourceFile.Switches; } set { SourceFile.Switches = value; } } + + [TaskAttribute("first")] + [BooleanValidator] + public bool First { get { return SourceFile.First; } set { SourceFile.First = value; } } + + /// + /// Set the root to the same as the containing folder + /// + protected override void SetRootFromParent() + { + Root = InFolder.Root; + } + + public RBuildSourceFile SourceFile + { + get { return m_FileSystemInfo as RBuildSourceFile; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + //Add the file + Module.SourceFiles.Add(SourceFile); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/GroupTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/GroupTask.cs new file mode 100644 index 00000000000..f98029aa1fd --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/GroupTask.cs @@ -0,0 +1,13 @@ +using System; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + /// + /// Just a simple task container + /// + [TaskName("group")] + public class GroupTask : TaskContainer + { + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ImportLibraryTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ImportLibraryTask.cs new file mode 100644 index 00000000000..31e212c0a7a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ImportLibraryTask.cs @@ -0,0 +1,50 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("importlibrary")] + public class ImportLibraryTask : AutoResolvableFileSystemInfoBaseTask //FileBaseTask + { + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildImportLibrary(); + } + + public RBuildImportLibrary ImportLibrary + { + get { return m_FileSystemInfo as RBuildImportLibrary; } + } + + /// + /// The directory name. + /// + [TaskAttribute("dllname")] + public string DllName { get { return ImportLibrary.DllName; } set { ImportLibrary.DllName = value; } } + + /// + /// The directory name. + /// + [TaskAttribute("definition", Required = true)] + public string Definition { get { return ImportLibrary.Name; } set { ImportLibrary.Name = value; } } + + protected override void ExecuteTask() + { + base.ExecuteTask(); + + //Hack:: + if (ImportLibrary.IsSpecFile) + ImportLibrary.Root = PathRoot.Intermediate; + + if ((DllName == null) && (Module.Type == ModuleType.StaticLibrary)) + throw new BuildException(" dllname attribute is required.", Location); + + if (Module.ImportLibrary != null) + throw new BuildException("Only one is allowed per module.", Location); + + Module.ImportLibrary = ImportLibrary; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/IncludeTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/IncludeTask.cs new file mode 100644 index 00000000000..b923ecf157b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/IncludeTask.cs @@ -0,0 +1,42 @@ +using System; +using System.IO; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("include")] + public class IncludeTask : AutoResolvableFileSystemInfoBaseTask //FileSystemInfoBaseTask + { + public IncludeTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildFolder(); + } + + [TaskValue] + public virtual string IncludePath + { + get { return m_FileSystemInfo.Name; } + set { m_FileSystemInfo.Name = value; } + } + + public RBuildFolder IncludeFolder + { + get { return m_FileSystemInfo as RBuildFolder; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + //Add include folder... + RBuildElement.IncludeFolders.Add(IncludeFolder); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstalFolder.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstalFolder.cs new file mode 100644 index 00000000000..f395b8efda9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstalFolder.cs @@ -0,0 +1,31 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("installfolder")] + public class InstalFolder : Task + { + RBuildInstallFolder m_InstallFolder = new RBuildInstallFolder(); + + /// + /// The name of the define to set. + /// + [TaskAttribute("id")] + public string ID { get { return m_InstallFolder.ID; } set { m_InstallFolder.ID = value; } } + + /// + /// The name of the define to set. + /// + [TaskAttribute("name")] + [TaskValue(Required = true)] + public string Name { get { return m_InstallFolder.Name; } set { m_InstallFolder.Name = value; } } + + protected override void ExecuteTask() + { + Project.InstallFolders.Add(m_InstallFolder); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallComponent.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallComponent.cs new file mode 100644 index 00000000000..36fc4567114 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallComponent.cs @@ -0,0 +1,39 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("installcomponent")] + public class InstallComponent : FileBaseTask + { + public InstallComponent() + { + } + + [TaskAttribute("section")] + public string InstallSection { get { return InstallComponentFile.InstallSection; } set { InstallComponentFile.InstallSection = value; } } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildInfInstallerFile(); + } + + public RBuildInfInstallerFile InstallComponentFile + { + get { return m_FileSystemInfo as RBuildInfInstallerFile; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + if (Module.LinkerScript != null) + throw new BuildException("Only one is allowed per module", Location); + + //Module.InfInstall = InstallComponentFile; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallFileTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallFileTask.cs new file mode 100644 index 00000000000..ec7bb2a3154 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallFileTask.cs @@ -0,0 +1,31 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("installfile")] + public class InstallFileTask : PlatformFileBaseTask + { + public InstallFileTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildInstallFile(); + } + + /// + /// The name of the define to set. + /// + [TaskAttribute("newname")] + public string NewName { get { return InstallFile.NewName; } set { InstallFile.NewName = value; } } + + private RBuildInstallFile InstallFile + { + get { return m_FileSystemInfo as RBuildInstallFile; } + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallWallPaperFileTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallWallPaperFileTask.cs new file mode 100644 index 00000000000..d8e8e4a774f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/InstallWallPaperFileTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("installwallpaperfile")] + public class InstallWallPaperFileTask : PlatformFileBaseTask + { + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildInstallWallpaperFile(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LanguageTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LanguageTask.cs new file mode 100644 index 00000000000..4acf0a8788c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LanguageTask.cs @@ -0,0 +1,24 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("language")] + public class LanguageTask : Task + { + RBuildLanguage m_Language = new RBuildLanguage(); + + [TaskAttribute("isoname")] + public string IsoName { get { return m_Language.Name; } set { m_Language.Name = value; } } + + [TaskAttribute("lcid")] + public string LCID { get { return m_Language.LCID; } set { m_Language.LCID = value; } } + + protected override void ExecuteTask() + { + Project.Languages.Add(m_Language); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LibraryTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LibraryTask.cs new file mode 100644 index 00000000000..79c3f159b1a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LibraryTask.cs @@ -0,0 +1,51 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("library")] + public class LibraryTask : ValueBaseTask + { + /// + /// The define value. + /// + [TaskValue(Required=true)] + public override string Value { get { return _value; } set { _value = value; } } + + protected override void ExecuteTask() + { + RBuildModule libModule = Project.Modules.GetByName(Value); + + if (libModule == null) + throw new BuildException("Unknown library dependency '{0}' referenced by module '{1}'", Value, Module.Name); + + if (Module.Host != libModule.Host) + throw new BuildException("Module '{0}' is trying to link against library '{1}' but can't mix target and hosts", + Module.Name, + libModule.Name); + + if ((libModule.Type != ModuleType.NativeDLL) && + (libModule.Type != ModuleType.Win32DLL) && + (libModule.Type != ModuleType.StaticLibrary) && + (libModule.Type != ModuleType.ObjectLibrary) && + (libModule.Type != ModuleType.Kernel) && + (libModule.Type != ModuleType.KernelModeDLL) && + (libModule.Type != ModuleType.KernelModeDriver) && + (libModule.Type != ModuleType.KeyboardLayout) && + (libModule.Type != ModuleType.RpcServer) && + (libModule.Type != ModuleType.RpcClient) && + (libModule.Type != ModuleType.RpcProxy) && + (libModule.Type != ModuleType.HostStaticLibrary)) + { + throw new BuildException("Module '{0}' is trying to use Module '{1}' as a library but it is a '{2}'", + Module.Name, + libModule.Name, + libModule.Type); + } + + Module.Libraries.Add(libModule); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerFlagTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerFlagTask.cs new file mode 100644 index 00000000000..7a12e3fae3a --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerFlagTask.cs @@ -0,0 +1,14 @@ +using System; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("linkerflag")] + public class LinkerFlagTask : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildElement.LinkerFlags.Add(Value); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerScriptTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerScriptTask.cs new file mode 100644 index 00000000000..e52c49ab9ff --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LinkerScriptTask.cs @@ -0,0 +1,36 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("linkerscript")] + public class LinkerScriptTask : FileBaseTask + { + public LinkerScriptTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildFile(); + } + + public RBuildFile ScriptFile + { + get { return m_FileSystemInfo as RBuildFile; } + } + + protected override void ExecuteTask() + { + //Call the base class + base.ExecuteTask(); + + if (Module.LinkerScript != null) + throw new BuildException("Only one is allowed per module", Location); + + Module.LinkerScript = ScriptFile; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LocalizationTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LocalizationTask.cs new file mode 100644 index 00000000000..907505d86ca --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/LocalizationTask.cs @@ -0,0 +1,41 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("localization")] + public class LocalizationTask : FileBaseTask + { + public LocalizationTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildLocalizationFile(); + } + + [TaskAttribute("isoname")] + public string IsoName { get { return LocalizationFile.IsoName; } set { LocalizationFile.IsoName = value; } } + + [TaskAttribute("dirty")] + public bool Dirty { get { return LocalizationFile.Dirty; } set { LocalizationFile.Dirty = value; } } + + private RBuildLocalizationFile LocalizationFile + { + get { return m_FileSystemInfo as RBuildLocalizationFile; } + } + + protected override void ExecuteTask() + { + RBuildLanguage language = Project.Languages.GetByName(IsoName); + + if (language == null) + throw new BuildException("Unknown language '{0}' referenced by module '{1}'", IsoName, Module.Name); + + Module.LocalizationFiles.Add(LocalizationFile); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MantainterTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MantainterTask.cs new file mode 100644 index 00000000000..91f61db53a1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MantainterTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("mantainer")] + public class MantainterTask : AuthorBaseTask + { + public MantainterTask() + { + m_Author.Role = AuthorRole.Mantainer; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MetadataTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MetadataTask.cs new file mode 100644 index 00000000000..3e2b4b67053 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/MetadataTask.cs @@ -0,0 +1,27 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("metadata")] + public class MetadataTask : Task + { + RBuildMetadata m_Metadata = new RBuildMetadata(); + + /// + /// The module description. + /// + [TaskAttribute("description")] + public string Description { get { return m_Metadata.Description; } set { m_Metadata.Description = value; } } + + protected override void ExecuteTask() + { + if (Module.Metadata != null) + throw new BuildException("Only one is allowed per module.", Location); + + Module.Metadata = m_Metadata; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleStateTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleStateTask.cs new file mode 100644 index 00000000000..f15b47bf9dc --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleStateTask.cs @@ -0,0 +1,34 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("modulestate")] + public class ModuleStateTask : Task + { + private string m_ModuleName = null; + private bool m_Enabled = true; + + [TaskAttribute("name")] + public string ModuleName { get { return m_ModuleName; } set { m_ModuleName = value; } } + + [TaskAttribute("enabled")] + [BooleanValidator] + public bool Enabled { get { return m_Enabled; } set { m_Enabled = value; } } + + protected override void ExecuteTask() + { + if (ModuleName != null) + { + RBuildModule module = Project.Modules.GetByName(ModuleName); + + if (module == null) + throw new BuildException(string.Format("Could not change state for module '{0}'", ModuleName, Location)); + + module.Enabled = Enabled; + } + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleTask.cs new file mode 100644 index 00000000000..1a790f41d11 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ModuleTask.cs @@ -0,0 +1,588 @@ +using System; +using System.IO; +using System.Xml; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("module")] + public class ModuleTask : TaskContainer /*AutoResolvableFileSystemInfoBaseTask ,, ITaskContainer,*/ /*TaskContainer,*/ , ISysGenObject/*, IDirectory,*/, IRBuildSourceFilesContainer + { + protected RBuildModule m_Module = new RBuildModule(); + + [TaskAttribute("name", Required = true)] + [StringValidator(AllowEmpty = false, AllowSpaces = false)] + public string ModuleName + { + get { return m_Module.Name; } + set { m_Module.Name = value; } + } + + [TaskAttribute("type", Required = true)] + public ModuleType Type + { + get { return m_Module.Type; } + set { m_Module.Type = value; } + } + + [TaskAttribute("buildtype")] + public string BuildType + { + get { return m_Module.BuildType; } + set { m_Module.BuildType = value; } + } + + [TaskAttribute("description", ExpandProperties = true)] + public string Description + { + get { return m_Module.Description; } + set { m_Module.Description = value; } + } + + [TaskAttribute("lcid")] + public string LCID + { + get { return m_Module.LCID; } + set { m_Module.LCID = value; } + } + + [TaskAttribute("installname")] + public string InstallName + { + get { return m_Module.InstallName; } + set { m_Module.InstallName = value; } + } + + [TaskAttribute("installbase")] + [UriValidatorAttribute] + public string InstallBase + { + get { return m_Module.InstallBase; } + set { m_Module.InstallBase = value; } + } + + [TaskAttribute("output")] + public string Output + { + get { return m_Module.OutputName; } + set { m_Module.OutputName = value; } + } + + [TaskAttribute("baseaddress")] + public string BaseAdress + { + get { return m_Module.BaseAddress; } + set { m_Module.BaseAddress = value; } + } + + [TaskAttribute("entrypoint")] + public string EntryPoint + { + get { return m_Module.EntryPoint; } + set { m_Module.EntryPoint = value; } + } + + [TaskAttribute("aliasof")] + public string AliasOf + { + get { return m_Module.AliasOf; } + set { m_Module.AliasOf = value; } + } + + [TaskAttribute("extension")] + public string Extension + { + get { return m_Module.Extension; } + set { m_Module.Extension = value; } + } + + [TaskAttribute("unicode")] + [BooleanValidator()] + public bool Unicode + { + get { return m_Module.Unicode; } + set { m_Module.Unicode = value; } + } + + [TaskAttribute("host")] + [BooleanValidator()] + public bool Host + { + get { return m_Module.Host; } + set { m_Module.Host = value; } + } + + [TaskAttribute("isstartuplib")] + [BooleanValidator()] + public bool IsStartupLib + { + get { return m_Module.IsStartupLib; } + set { m_Module.IsStartupLib = value; } + } + + [TaskAttribute("underscoresymbols")] + [BooleanValidator()] + public bool UnderscoreSymbols + { + get { return m_Module.UnderscoreSymbols; } + set { m_Module.UnderscoreSymbols = value; } + } + + [TaskAttribute("mangledsymbols")] + [BooleanValidator()] + public bool MangledSymbols + { + get { return m_Module.MangledSymbols; } + set { m_Module.MangledSymbols = value; } + } + + [TaskAttribute("allowwarnings")] + [BooleanValidator()] + public bool AllowWarnings + { + get { return m_Module.AllowWarnings; } + set { m_Module.AllowWarnings = value; } + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public RBuildElement RBuildElement + { + get { return m_Module; } + } + + public PathRoot Root + { + get { return PathRoot.Default; } + } + + public RBuildSourceFileCollection SourceFiles + { + get { return Module.SourceFiles; } + } + + protected override void OnLoad() + { + base.OnLoad(); + + if ((Module.Type == ModuleType.BootLoader) || + (Module.Type == ModuleType.BootProgram) || + (Module.Type == ModuleType.BootSector) || + (Module.Type == ModuleType.EmbeddedTypeLib) || + (Module.Type == ModuleType.IdlHeader) || + (Module.Type == ModuleType.Kernel) || + (Module.Type == ModuleType.KernelModeDLL) || + (Module.Type == ModuleType.KernelModeDriver) || + (Module.Type == ModuleType.NativeCUI) || + (Module.Type == ModuleType.NativeDLL) || + (Module.Type == ModuleType.ObjectLibrary) || + (Module.Type == ModuleType.StaticLibrary) || + (Module.Type == ModuleType.RpcClient) || + (Module.Type == ModuleType.RpcServer) || + (Module.Type == ModuleType.RpcProxy) || + (Module.Type == ModuleType.Win32CUI) || + (Module.Type == ModuleType.Win32DLL) || + (Module.Type == ModuleType.Win32GUI) || + (Module.Type == ModuleType.Win32OCX) || + (Module.Type == ModuleType.Win32SCR) || + //(Module.Type == ModuleType.Alias) || + (Module.Type == ModuleType.HostStaticLibrary) || + (Module.Type == ModuleType.BuildTool) || + (Module.Type == ModuleType.Cabinet) || + (Module.Type == ModuleType.KeyboardLayout) || + (Module.Type == ModuleType.Iso) || + (Module.Type == ModuleType.IsoRegTest) || + (Module.Type == ModuleType.LiveIso) || + (Module.Type == ModuleType.LiveIsoRegTest) || + (Module.Type == ModuleType.MessageHeader) || + (Module.Type == ModuleType.Package) || + (Module.Type == ModuleType.ModuleGroup) || + (Module.Type == ModuleType.PlatformProfile)) + { + Module.Folder.Base = SysGenPathResolver.GetPath(this, SysGen.RootTask); + //Module.Base = SysGenPathResolver.GetPath(this, SysGen.ProjectTask); //BasePath; + Module.Path = SysGen.BaseDirectory; + Module.XmlFile = XmlFile; + Module.RBuildFile = RBuildFile; + Module.Enabled = false; + + //HACK: + if (Type == ModuleType.HostStaticLibrary || + Type == ModuleType.BuildTool) + { + Module.Host = true; + } + + // Add the module to the project + Project.Modules.Add(Module); + } + else + { + Console.WriteLine("WARNING: modules of type '{0}' are being omited" , Module.Type); + } + } + + private void AddModuleDefines() + { + switch (Type) + { + case ModuleType.NativeCUI: + { + Module.Defines.Add("__NTAPP__"); + } + break; + case ModuleType.KernelModeDriver: + { + Module.Defines.Add("__NTDRIVER__"); + } + break; + } + + if (Unicode) + { + Module.Defines.Add("UNICODE"); + Module.Defines.Add("_UNICODE"); + } + } + + private void AddModuleLinkerFlags() + { + switch (Type) + { + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + case ModuleType.Win32CUI: + case ModuleType.Win32GUI: + case ModuleType.Win32SCR: + { + Module.LinkerFlags.Add("-nostartfiles"); + Module.LinkerFlags.Add("-lgcc"); + + if (Module.CPlusPlus) + Module.LinkerFlags.Add("-nostdlib"); + } + break; + case ModuleType.Kernel: + { + break; + } + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + case ModuleType.NativeCUI: + case ModuleType.NativeDLL: + case ModuleType.Test: + case ModuleType.BootLoader: + case ModuleType.BootProgram: + { + Module.LinkerFlags.Add("-nostartfiles"); + Module.LinkerFlags.Add("-nostdlib"); + } + break; + } + + Module.LinkerFlags.Add("-g"); + } + + private void AddDebugSupportLibraries() + { + switch (Type) + { + case ModuleType.Win32DLL: + case ModuleType.Win32OCX: + case ModuleType.Win32CUI: + case ModuleType.Win32GUI: + case ModuleType.Win32SCR: + case ModuleType.NativeCUI: + case ModuleType.NativeDLL: + { + Module.Libraries.Add(Project.Modules.GetByName("debugsup_ntdll")); + } + break; + case ModuleType.KeyboardLayout: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + { + Module.Libraries.Add(Project.Modules.GetByName("debugsup_ntoskrnl")); + } + break; + } + } + + private void AddModuleCompilerFlags() + { + if (!AllowWarnings) + { + Module.CompilerFlags.Add("-Werror"); + } + + // Always force disabling of sibling calls optimisation for GCC + // (TODO: Move to version-specific once this bug is fixed in GCC) + Module.CompilerFlags.Add("-fno-optimize-sibling-calls"); + Module.CompilerFlags.Add("-g"); + Module.CompilerFlags.Add("-pipe"); + } + + private void AddRequiredBuildTools() + { + switch (Module.Type) + { + case ModuleType.BootLoader: + case ModuleType.BootProgram: + case ModuleType.BootSector: + case ModuleType.EmbeddedTypeLib: + case ModuleType.IdlHeader: + case ModuleType.MessageHeader: + case ModuleType.Kernel: + case ModuleType.KernelModeDLL: + case ModuleType.KernelModeDriver: + case ModuleType.NativeCUI: + case ModuleType.NativeDLL: + case ModuleType.ObjectLibrary: + case ModuleType.StaticLibrary: + case ModuleType.RpcClient: + case ModuleType.RpcServer: + case ModuleType.RpcProxy: + case ModuleType.Win32CUI: + case ModuleType.Win32DLL: + case ModuleType.Win32GUI: + case ModuleType.Win32OCX: + case ModuleType.Win32SCR: + case ModuleType.HostStaticLibrary: + case ModuleType.KeyboardLayout: + Module.Requeriments.Add(Project.Modules.GetByName("wrc")); + Module.Requeriments.Add(Project.Modules.GetByName("wmc")); + Module.Requeriments.Add(Project.Modules.GetByName("widl")); + Module.Requeriments.Add(Project.Modules.GetByName("winebuild")); + Module.Requeriments.Add(Project.Modules.GetByName("winebuild")); + break; + case ModuleType.Cabinet: + Module.Requeriments.Add(Project.Modules.GetByName("cabman")); + break; + case ModuleType.Iso: + Module.Requeriments.Add(Project.Modules.GetByName("cdmake")); + Module.Requeriments.Add(Project.Modules.GetByName("cabman")); + break; + case ModuleType.IsoRegTest: + Module.Requeriments.Add(Project.Modules.GetByName("cdmake")); + Module.Requeriments.Add(Project.Modules.GetByName("cabman")); + Module.Requeriments.Add(Project.Modules.GetByName("sysreg")); + break; + case ModuleType.LiveIso: + Module.Requeriments.Add(Project.Modules.GetByName("cdmake")); + Module.Requeriments.Add(Project.Modules.GetByName("mkhive")); + break; + case ModuleType.LiveIsoRegTest: + Module.Requeriments.Add(Project.Modules.GetByName("cdmake")); + Module.Requeriments.Add(Project.Modules.GetByName("mkhive")); + Module.Requeriments.Add(Project.Modules.GetByName("sysreg")); + break; + } + } + + private void AddDefaultDependencies() + { + if (Module.Type != ModuleType.BuildTool && + Module.Type != ModuleType.HostStaticLibrary && + Module.Host == false) + { + if (Module.Name != "psdk" && + Module.Name != "dxsdk" && + Module.Name != "errcodes" && + Module.Name != "bugcodes" && + Module.Name != "ntstatus") + { + Module.Dependencies.Add(Project.Modules.GetByName("psdk")); + Module.Dependencies.Add(Project.Modules.GetByName("dxsdk")); + Module.Dependencies.Add(Project.Modules.GetByName("errcodes")); + Module.Dependencies.Add(Project.Modules.GetByName("bugcodes")); + Module.Dependencies.Add(Project.Modules.GetByName("ntstatus")); + } + } + } + + //public RBuildFolder Folder + //{ + // get { return null; } + //} + + private void AddModuleLibraryDependencies() + { + // Add mingw and msvcrt implicit libraries only if it's + // a Win32 target. + + if ((Module.Type == ModuleType.Win32CUI) || + (Module.Type == ModuleType.Win32DLL) || + (Module.Type == ModuleType.Win32GUI) || + (Module.Type == ModuleType.Win32OCX) || + (Module.Type == ModuleType.Win32SCR)) + { + if (!Module.IsDefaultEntryPoint) + { + if (Module.NoEntryPoint) + { + if (Module.LinksToCRuntimeLibrary == false) + { + Module.Libraries.Add(0, Project.Modules.GetByName("mingw_common")); + } + } + } + else + { + if (!Module.IsDLL) + { + if (Unicode) + { + Module.Libraries.Add(0, Project.Modules.GetByName("mingw_wmain")); + } + else + { + Module.Libraries.Add(0, Project.Modules.GetByName("mingw_main")); + } + } + + //Is it correct ? + if (Module.Libraries.Count > 0) + { + Module.Libraries.Add(1, Project.Modules.GetByName("mingw_common")); + } + else + { + Module.Libraries.Add(0, Project.Modules.GetByName("mingw_common")); + } + } + } + } + + private void AddCRuntimeLibrary() + { + if ((Module.Type == ModuleType.Win32CUI) || + (Module.Type == ModuleType.Win32DLL) || + (Module.Type == ModuleType.Win32GUI) || + (Module.Type == ModuleType.Win32OCX) || + (Module.Type == ModuleType.Win32SCR)) + { + if (Module.IsDefaultEntryPoint || Module.NoEntryPoint) + { + if (Module.LinksToCRuntimeLibrary == false) + { + if (Module.Name != "msvcrt") + { + // Link msvcrt to get the basic routines + Module.Libraries.Add(Project.Modules.GetByName("msvcrt")); + } + } + } + } + } + + private void AddModuleAssemblyFlags() + { + if (Type == ModuleType.BootSector) + { + Module.AssemblyFlags.Add("-f bin"); + } + } + + private void AddModuleIncludeFolders() + { + if (Module.Type == ModuleType.RpcClient || + Module.Type == ModuleType.RpcServer || + Module.Type == ModuleType.RpcProxy || + Module.Type == ModuleType.EmbeddedTypeLib) + { + Module.IncludeFolders.Add(new RBuildFolder(PathRoot.Intermediate, Module.Folder.FullPath)); //Hace falta? + Module.IncludeFolders.Add(new RBuildFolder(PathRoot.SourceCode, Module.Folder.FullPath)); + } + } + + private void AddModuleProperties() + { + Project.Properties.Add(string.Format("SysGen.Module.{0}.Enabled", Module.Name), Module.Enabled.ToString(), true, true); + Project.Properties.Add(string.Format("SysGen.Module.{0}.BasePath", Module.Name), Module.Base, true, true); + Project.Properties.Add(string.Format("SysGen.Module.{0}.RBuildFile", Module.Name), Module.RBuildFile, true, true); + } + + protected override void PostExecuteTask() + { + if (m_Module.RBuildFile == "mstask.rbuild") + { + int i = 0; + } + + AddModuleLibraryDependencies(); + AddCRuntimeLibrary(); + AddDebugSupportLibraries(); + AddDefaultDependencies(); + AddModuleProperties(); + + if (m_Module.Host) + { + if (m_Module.CPlusPlus) + { + m_Module.CompilerFlags.Add("$(HOST_CPPFLAGS)"); + } + else + { + m_Module.CompilerFlags.Add("$(HOST_CFLAGS)"); + m_Module.CompilerFlags.Add("-Wno-strict-aliasing"); + } + } + else + { + if (m_Module.CPlusPlus) + { + m_Module.CompilerFlags.Add("$(HOST_CPPFLAGS)"); + } + else + { + m_Module.CompilerFlags.Add("-nostdinc"); + } + } + + //Sort source code files only when necessary + if (Module.SourceFiles.ContainsASM) + Module.SourceFiles.Sort(new SourceCodePreferenceComparer()); + } + + protected override void ExecuteTask() + { + Module.Enabled = true; + + //AddModuleLibraryDependencies(); + AddModuleDefines(); + AddModuleLinkerFlags(); + AddModuleCompilerFlags(); + AddModuleIncludeFolders(); + AddModuleAssemblyFlags(); + AddRequiredBuildTools(); + + //if (Type == ModuleType.Alias) + //{ + // if (Module.Name == "halupalias") + // { + // int i = 10; + // } + + // RBuildModule alisedModule = Project.Modules.GetByName(AliasOf); + + // if (alisedModule == null) + // throw new BuildException("module '" + ModuleName + "' trying to alias non-existant module '" + AliasOf + "'", Location); + + // if (Module.Name == AliasOf) + // throw new BuildException("Module '" + ModuleName + "' cannot link against itself", Location); + + // alisedModule = Module; + // alisedModule.Enabled = true; + + // Module.Enabled = false; + //} + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/BuildTool.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/BuildTool.cs new file mode 100644 index 00000000000..67d0755580d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/BuildTool.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("buildtool")] + public class BuildTool : ModuleTask + { + public BuildTool() + { + Type = ModuleType.BuildTool; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Cabinet.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Cabinet.cs new file mode 100644 index 00000000000..715fbcc4952 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Cabinet.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("cabinet")] + public class Cabinet : ModuleTask + { + public Cabinet() + { + Type = ModuleType.Cabinet; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Kernel.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Kernel.cs new file mode 100644 index 00000000000..7cafd130411 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Kernel.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("kernel")] + public class Kernel : ModuleTask + { + public Kernel() + { + Type = ModuleType.Kernel; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDLL.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDLL.cs new file mode 100644 index 00000000000..22d238b739e --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDLL.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("kernelmodell")] + public class KernelModeDLL : ModuleTask + { + public KernelModeDLL() + { + Type = ModuleType.KernelModeDLL; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDriver.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDriver.cs new file mode 100644 index 00000000000..b223cf5897b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/KernelModeDriver.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("kernelmodedriver")] + public class KernelModeDriver : ModuleTask + { + public KernelModeDriver() + { + Type = ModuleType.KernelModeDriver; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeCUI.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeCUI.cs new file mode 100644 index 00000000000..ac9e84a3d82 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeCUI.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("nativecui")] + public class NativeCUI : ModuleTask + { + public NativeCUI() + { + Type = ModuleType.NativeCUI; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeDLL.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeDLL.cs new file mode 100644 index 00000000000..bdaabee1bfc --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/NativeDLL.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("nativedll")] + public class NativeDLL : ModuleTask + { + public NativeDLL() + { + Type = ModuleType.NativeDLL; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/ObjectLibrary.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/ObjectLibrary.cs new file mode 100644 index 00000000000..a34279d68a7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/ObjectLibrary.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("objectlibrary")] + public class ObjectLibrary : ModuleTask + { + public ObjectLibrary() + { + Type = ModuleType.ObjectLibrary; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Package.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Package.cs new file mode 100644 index 00000000000..68bdbcb0212 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Package.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("package")] + public class Package : ModuleTask + { + public Package() + { + Type = ModuleType.Package; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/StaticLibrary.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/StaticLibrary.cs new file mode 100644 index 00000000000..0abe2820982 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/StaticLibrary.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("staticlibrary")] + public class StaticLibrary : ModuleTask + { + public StaticLibrary() + { + Type = ModuleType.StaticLibrary; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32CUI.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32CUI.cs new file mode 100644 index 00000000000..5fba4c1bc44 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32CUI.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("win32cui")] + public class Win32CUI : ModuleTask + { + public Win32CUI() + { + Type = ModuleType.Win32CUI; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32Dll.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32Dll.cs new file mode 100644 index 00000000000..320e1a00ebe --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32Dll.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("win32dll")] + public class Win32DLL : ModuleTask + { + public Win32DLL() + { + Type = ModuleType.Win32DLL; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32GUI.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32GUI.cs new file mode 100644 index 00000000000..9bffa1ba55e --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32GUI.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("win32gui")] + public class Win32GUI : ModuleTask + { + public Win32GUI() + { + Type = ModuleType.Win32GUI; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32OCX.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32OCX.cs new file mode 100644 index 00000000000..2b8051591fa --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32OCX.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("win32ocx")] + public class Win32OCX : ModuleTask + { + public Win32OCX() + { + Type = ModuleType.Win32OCX; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32SCR.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32SCR.cs new file mode 100644 index 00000000000..5199e32fab6 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Modules/Win32SCR.cs @@ -0,0 +1,17 @@ +using System; +using System.IO; + +using SysGen.RBuild.Framework; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("win32scr")] + public class Win32SCR : ModuleTask + { + public Win32SCR() + { + Type = ModuleType.Win32SCR; + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/OverrideModuleTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/OverrideModuleTask.cs new file mode 100644 index 00000000000..612d4e6dc02 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/OverrideModuleTask.cs @@ -0,0 +1,52 @@ +using System; +using System.Xml; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("overridemodule")] + public class OverrideModuleTask : ModuleTask + { + public OverrideModuleTask() + { + m_FailOnMissingRequired = false; + } + + protected override void OnLoad() + { + //Evitamos actualizar la información del módulo de verdad + } + + protected override void PostExecuteTask() + { + //Evitamos actualizar la información del módulo de verdad + } + + protected override void PreExecuteTask() + { + //Evitamos actualizar la información del módulo de verdad + } + + protected override void ExecuteTask() + { + //Evitamos actualizar la información del módulo de verdad + } + + protected override void InitializeTask(XmlNode taskNode) + { + base.InitializeTask(taskNode); + + if (taskNode.Attributes["name"] == null) + throw new BuildException("Missing 'name' attribute"); + + string moduleName = taskNode.Attributes["name"].Value; + + m_Module = Project.Modules.GetByName(moduleName); + + if (m_Module == null) + throw new BuildException("Overrided module '{0}' not found" , moduleName); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PCHTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PCHTask.cs new file mode 100644 index 00000000000..c7700d7018f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PCHTask.cs @@ -0,0 +1,43 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + /// + /// PreCompiled Header task + /// + [TaskName("pch")] + public class PCHTask : FileTask + { + /// + /// Creates a new instance of the class. + /// + public PCHTask() + { + } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildSourceFile(); + } + + public RBuildSourceFile SourceFile + { + get { return m_FileSystemInfo as RBuildSourceFile; } + } + + protected override void ExecuteTask() + { + if (Module.PreCompiledHeader != null) + throw new BuildException("Only one is allowed per module", Location); + + //Call the base class + base.ExecuteTask(); + + //Add the folder where the PCH is present as a include folder + Module.IncludeFolders.Add(new RBuildFolder(PathRoot.Intermediate, Base)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformAutorunTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformAutorunTask.cs new file mode 100644 index 00000000000..a298818f62c --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformAutorunTask.cs @@ -0,0 +1,21 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformautorun")] + public class PlatformAutorunTask : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildModule module = Project.Platform.Modules.GetByName(Value); + + if (module == null) + throw new BuildException("Unknown module '{0}' referenced by ", Value); + + Project.Platform.AutorunModules.Add(module); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDebugChannelTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDebugChannelTask.cs new file mode 100644 index 00000000000..3a6bd35f029 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDebugChannelTask.cs @@ -0,0 +1,66 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformdebugchannel")] + public class PlatformDebugChannelTask : ValueBaseTask + { + //private RBuildDebugChannel m_DebugChannel = null; + + //[TaskAttribute("name")] + //public string ChannelName + //{ + // get { return m_DebugChannel.Name; } + // set { m_DebugChannel.Name = value; } + //} + + //[TaskAttribute("warning")] + //public bool Warning + //{ + // get { return m_DebugChannel.Warn; } + // set { m_DebugChannel.Warn = value; } + //} + + //[TaskAttribute("trace")] + //public bool Trace + //{ + // get { return m_DebugChannel.Trace; } + // set { m_DebugChannel.Trace = value; } + //} + + //[TaskAttribute("fixme")] + //public bool Fixme + //{ + // get { return m_DebugChannel.Fixme; } + // set { m_DebugChannel.Fixme = value; } + //} + + //[TaskAttribute("error")] + //public bool Error + //{ + // get { return m_DebugChannel.Error; } + // set { m_DebugChannel.Error = value; } + //} + + //protected override void PreExecuteTask() + //{ + // m_DebugChannel = Project.DebugChannels.GetByName(ChannelName); + //} + + protected override void ExecuteTask() + { + RBuildDebugChannel channel = Project.DebugChannels.GetByName(Value); + + if (channel == null) + throw new BuildException("Unknown debug channel '{0}' referenced by ", Value); + + if (Project.Platform.DebugChannels.Contains(channel)) + throw new BuildException("Only one debug channel '{0}' can be present per ", Value); + + Project.Platform.DebugChannels.Add(channel); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDescriptionTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDescriptionTask.cs new file mode 100644 index 00000000000..ee5d8f1cdfc --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformDescriptionTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformdescription")] + public class PlatformDescriptionTask : ValueBaseTask + { + protected override void ExecuteTask() + { + Project.Platform.Description = Value; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformLanguageTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformLanguageTask.cs new file mode 100644 index 00000000000..8362e09be64 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformLanguageTask.cs @@ -0,0 +1,25 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformlanguage")] + public class PlatformLanguageTask : ValueBaseTask + { + public PlatformLanguageTask() + { + } + + protected override void ExecuteTask() + { + RBuildLanguage language = Project.Languages.GetByName(Value); + + if (language == null) + throw new BuildException("Unknown language '{0}' referenced by ", Value); + + Project.Platform.Languages.Add(language); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformModuleTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformModuleTask.cs new file mode 100644 index 00000000000..3bb3190f0bb --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformModuleTask.cs @@ -0,0 +1,25 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformmodule")] + public class PlatformModuleTask : ValueBaseTask + { + public PlatformModuleTask() + { + } + + protected override void ExecuteTask() + { + RBuildModule module = Project.Modules.GetByName(Value); + + if (module == null) + throw new BuildException("Unknown module '{0}' referenced by ", Value); + + Project.Platform.Modules.Add(module); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformNameTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformNameTask.cs new file mode 100644 index 00000000000..88890e81e88 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformNameTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformname")] + public class PlatformNameTask : ValueBaseTask + { + protected override void ExecuteTask() + { + Project.Platform.Name = Value; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformScreenSaverTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformScreenSaverTask.cs new file mode 100644 index 00000000000..e396774a3e7 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformScreenSaverTask.cs @@ -0,0 +1,28 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformscreensaver")] + public class PlatformScreenSaverTask : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildModule module = Project.Modules.GetByName(Value); + + if (module == null) + throw new BuildException("Unknown module '{0}' referenced by ", Value); + + if (module.Type != ModuleType.Win32SCR) + throw new BuildException("Shell can only be of type win32scr"); + + if (Project.Platform.Screensaver != null) + throw new BuildException("Only one screensaver can be set per platform"); + + /* set the shell to use */ + Project.Platform.Screensaver = module; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformShellTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformShellTask.cs new file mode 100644 index 00000000000..b97c9f5b469 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformShellTask.cs @@ -0,0 +1,29 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformshell")] + public class PlatformShellTask : ValueBaseTask + { + protected override void ExecuteTask() + { + RBuildModule module = Project.Modules.GetByName(Value); + + if (module == null) + throw new BuildException("Unknown module '{0}' referenced by ", Value); + + if (module.Type != ModuleType.Win32CUI && + module.Type != ModuleType.Win32GUI) + throw new BuildException("Shell can only be of type win32gui"); + + if (Project.Platform.Shell != null) + throw new BuildException("Only one shell can be set per platform"); + + /* set the shell to use */ + Project.Platform.Shell = module; + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformWallpaperTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformWallpaperTask.cs new file mode 100644 index 00000000000..fc7776062aa --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/Platform/PlatformWallpaperTask.cs @@ -0,0 +1,37 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("platformwallpaper")] + public class PlatformWallpaperTask : ValueBaseTask + { + protected override void PostExecuteTask() + { + if (Project.Platform.Wallpaper != null) + throw new BuildException("Only one wallpaper can be set per platform"); + + foreach (RBuildModule module in Project.Modules) + { + foreach (RBuildFile file in module.Files) + { + RBuildWallpaperFile wallpaper = file as RBuildWallpaperFile; + + if (wallpaper != null) + { + if (wallpaper.ID.ToLower() == Value.ToLower()) + { + /* set the shell to use */ + Project.Platform.Wallpaper = wallpaper; + } + } + } + } + + if (Project.Platform.Wallpaper == null) + throw new BuildException("Unknown wallpaper '{0}' referenced by ", Value); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ProjectTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ProjectTask.cs new file mode 100644 index 00000000000..bb09d9342a1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ProjectTask.cs @@ -0,0 +1,70 @@ +using System; +using System.Xml; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("project")] + public class ProjectTask : TaskContainer, ISysGenObject + { + RBuildProject _project = new RBuildProject(); + + public ProjectTask() + { + } + + [TaskAttribute("name", Required = true)] + public string Name + { + get { return _project.Name; } + set { _project.Name = value; } + } + + [TaskAttribute("makefile", Required = true)] + public string MakeFile + { + get { return _project.MakeFile; } + set { _project.MakeFile = value; } + } + + public RBuildProject Project + { + get { return _project; } + } + + public RBuildElement RBuildElement + { + get { return _project; } + } + + protected override void OnInit() + { + SysGen.Project = Project; + SysGen.RootTask = this; + Project.RBuildFile = RBuildFile; + + + Project.Properties.Add("ARCH", "i386");/* + Project.Defines.Add("_M_IX86"); + Project.Defines.Add("_X86_"); + Project.Defines.Add("__i386__");*/ + } + + protected override void OnLoad() + { + base.OnLoad(); + + Project.Folder = new RBuildFolder(PathRoot.SourceCode , ""); + } + + protected override void PreExecuteTask() + { + ///Project.Base = string.Empty; + Project.Path = SysGen.BaseDirectory; + Project.XmlFile = XmlFile; + } + } +} + diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PropertyTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PropertyTask.cs new file mode 100644 index 00000000000..1b143c0dd16 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/PropertyTask.cs @@ -0,0 +1,24 @@ +using System; +using System.Xml; + +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + /// Sets a property in the current project. + /// + /// NAnt uses a number of predefined properties. + /// + /// + /// Define a debug property with the value true. + /// ]]> + /// Use the user-defined debug property. + /// ]]> + /// Define a Read-Only property.This is just like passing in the param on the command line. + /// ]]> + /// + [TaskName("property")] + public class PropertyTask : PropertyBaseTask + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RBuildTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RBuildTask.cs new file mode 100644 index 00000000000..12feafedce4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RBuildTask.cs @@ -0,0 +1,10 @@ +using System; +using SysGen.BuildEngine.Attributes; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("rbuild")] + public class RBuildTask : TaskContainer + { + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ReDefineTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ReDefineTask.cs new file mode 100644 index 00000000000..f41f0aae4ce --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/ReDefineTask.cs @@ -0,0 +1,16 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("redefine")] + public class ReDefineTask : Task + { + protected override void ExecuteTask() + { +// RBuildElement.Defines.Add(new RBuildDefine(DefineName, DefineValue)); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RequiresTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RequiresTask.cs new file mode 100644 index 00000000000..f68ffe5f00d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/RequiresTask.cs @@ -0,0 +1,27 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("requires")] + public class RequiresTask : ValueBaseTask + { + /// + /// The define value. + /// + [TaskValue(Required = true)] + public virtual string Value { get { return _value; } set { _value = value; } } + + protected override void ExecuteTask() + { + RBuildModule requeriment = Project.Modules.GetByName(Value); + + if (requeriment == null) + throw new BuildException("Unknown requeriment '{0}' referenced by module '{1}'", Value, Module.Name); + + Module.Requeriments.Add(requeriment); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/SetupTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/SetupTask.cs new file mode 100644 index 00000000000..83d2056b8f4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/SetupTask.cs @@ -0,0 +1,45 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("setup")] + public class SetupTask : PlatformFileBaseTask + { + [TaskAttribute("installsection", Required = true)] + public string InstallSection { get { return Setup.InstallSection; } set { Setup.InstallSection = value; } } + + [TaskAttribute("type")] + public SetupType SetupType { get { return Setup.SetupType; } set { Setup.SetupType = value; } } + + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildSetupFile(); + } + + /// + /// Get the underlying . + /// + public RBuildSetupFile Setup + { + get { return m_FileSystemInfo as RBuildSetupFile; } + } + + protected override void ExecuteTask() + { + base.ExecuteTask(); + + if (Module.IsInstallable || Module.Type == ModuleType.Package) + { + if (Module.Setup != null) + throw new BuildException("There can be only one element for a module", Location); + + Module.Setup = Setup; + } + else + throw new BuildException(" is not applicable for this module type", Location); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/TargetTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/TargetTask.cs new file mode 100644 index 00000000000..15b1c70d212 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/TargetTask.cs @@ -0,0 +1,18 @@ +using System; +using SysGen.BuildEngine.Attributes; + +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("target")] + public class TargetTask : Task + { + protected RBuildTarget m_Target = new RBuildTarget(); + + protected override void ExecuteTask() + { + SysGen.Targets.Add(m_Target); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/WallPaperTask.cs b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/WallPaperTask.cs new file mode 100644 index 00000000000..31ea0d9930d --- /dev/null +++ b/reactos/tools/sysgen/SysGen.BuildEngine/Tasks/RBuild/WallPaperTask.cs @@ -0,0 +1,26 @@ +using System; + +using SysGen.BuildEngine.Attributes; +using SysGen.RBuild.Framework; + +namespace SysGen.BuildEngine.Tasks +{ + [TaskName("wallpaper")] + public class WallPaperTask : PlatformFileBaseTask + { + protected override void CreateFileSystemObject() + { + m_FileSystemInfo = new RBuildWallpaperFile(); + } + + protected override void ExecuteTask() + { + if (Module != null) + { + base.ExecuteTask(); + } + else + throw new BuildException(" is only applicable for modules", Location); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.Make/Program.cs b/reactos/tools/sysgen/SysGen.Make/Program.cs new file mode 100644 index 00000000000..de3ba818cd9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/Program.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using SysGen.BuildEngine; +using SysGen.BuildEngine.Framework; + +namespace SysGen.Make +{ + class Program + { + static void Main(string[] args) + { + SysGenEngine engine = new SysGenEngine(@"C:\ros\trunk\reactos\ReactOS-i386.rbuild"); + + engine.ReadBuildFiles(); + + /* + Console.WriteLine("Generates project files for buildsystems\n\n"); + Console.WriteLine(" rbuild [switches] -r{rootfile.rbuild} buildsystem\n\n"); + Console.WriteLine("Switches:\n"); + Console.WriteLine(" -v Be verbose.\n"); + Console.WriteLine(" -c Clean as you go. Delete generated files as soon as they are not\n"); + Console.WriteLine(" needed anymore.\n"); + Console.WriteLine(" -dd Disable automatic dependencies.\n"); + Console.WriteLine(" -dm{module} Check only automatic dependencies for this module.\n"); + Console.WriteLine(" -ud Disable multiple source files per compilation unit.\n"); + Console.WriteLine(" -mi Let make handle creation of install directories. Rbuild will\n"); + Console.WriteLine(" not generate the directories.\n"); + Console.WriteLine(" -ps Generate proxy makefiles in source tree instead of the output.\n"); + Console.WriteLine(" tree.\n"); + Console.WriteLine(" -vs{version} Version of MS VS project files. Default is %s.\n", MS_VS_DEF_VERSION); + Console.WriteLine(" -vo{version|configuration} Adds subdirectory path to the default Intermediate-Outputdirectory.\n"); + Console.WriteLine(" -Dvar=val Set the value of 'var' variable to 'val'.\n"); + Console.WriteLine("\n"); + Console.WriteLine(" buildsystem Target build system. Can be one of:\n"); + */ + + Console.ReadLine(); + } + } +} diff --git a/reactos/tools/sysgen/SysGen.Make/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/SysGen.Make/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..9012ef9b0c1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("SysGen.Make")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("SysGen.Make")] +[assembly: AssemblyCopyright("Copyright © Sand 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00432ce1-5d82-4afb-9a3a-dc2ce95edc4e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj new file mode 100644 index 00000000000..89de06851a4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj @@ -0,0 +1,58 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {8B1229C7-6188-4621-A648-843CB9B5C72E} + Exe + Properties + SysGen.Make + SysGen.Make + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {8F5F8375-4097-4952-B860-784EB9961ABE} + SysGen.Framework + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj.user b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj.user new file mode 100644 index 00000000000..1a4ff357ca6 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.csproj.user @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make.sln b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.sln new file mode 100644 index 00000000000..d9d1e258355 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysGen.Make", "SysGen.Make\SysGen.Make.csproj", "{8B1229C7-6188-4621-A648-843CB9B5C72E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make.suo b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.suo new file mode 100644 index 00000000000..b55bbbea00f Binary files /dev/null and b/reactos/tools/sysgen/SysGen.Make/SysGen.Make.suo differ diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Program.cs b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Program.cs new file mode 100644 index 00000000000..30ccf9bb40f --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Program.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.Make +{ + class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..9012ef9b0c1 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("SysGen.Make")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("SysGen.Make")] +[assembly: AssemblyCopyright("Copyright © Sand 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00432ce1-5d82-4afb-9a3a-dc2ce95edc4e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/SysGen.Make/SysGen.Make/SysGen.Make.csproj b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/SysGen.Make.csproj new file mode 100644 index 00000000000..7e429ac88d9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.Make/SysGen.Make/SysGen.Make.csproj @@ -0,0 +1,47 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {8B1229C7-6188-4621-A648-843CB9B5C72E} + Exe + Properties + SysGen.Make + SysGen.Make + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Collections/CommandCollection.cs b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Collections/CommandCollection.cs new file mode 100644 index 00000000000..28740e67d2e --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Collections/CommandCollection.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.IRCBot +{ + class CommandCollection : List + { + } +} diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/Base/Command.cs b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/Base/Command.cs new file mode 100644 index 00000000000..5d1bc8380d4 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/Base/Command.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.IRCBot +{ + public abstract class Command + { + //public abstract bool CanProcessCommand (string commandName); + public abstract string Name { get; } + + protected void Say(string message) + { + } + } +} diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/WhoIsCommand.cs b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/WhoIsCommand.cs new file mode 100644 index 00000000000..7389508409b --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Commands/WhoIsCommand.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SysGen.RBuild.IRCBot +{ + public class WhoIsCommand : Command + { + public override string Name { get { return "whois"; } } + } +} diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Properties/AssemblyInfo.cs b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..b41f434ce58 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("SysGen.RBuild.IRCBot")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Sand")] +[assembly: AssemblyProduct("SysGen.RBuild.IRCBot")] +[assembly: AssemblyCopyright("Copyright © Sand 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bb394e0e-2885-49d5-b388-80be41207d29")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/SysGen.RBuild.IRCBot.csproj b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/SysGen.RBuild.IRCBot.csproj new file mode 100644 index 00000000000..a00f422c215 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/SysGen.RBuild.IRCBot.csproj @@ -0,0 +1,64 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {0629E569-D4A3-46F5-9367-F1EB14B02500} + Exe + Properties + SysGen.RBuild.IRCBot + SysGen.RBuild.IRCBot + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\Documents and Settings\Joan Marc\Desktop\SmartIrc4net-0.4.0.src\SmartIrc4net-0.4.0-src\bin\debug\Meebey.SmartIrc4net.dll + + + + + + + + + + + + + + + {8F5F8375-4097-4952-B860-784EB9961ABE} + SysGen.Framework + + + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + SysGen.RBuild.Framework + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.RBuild.IRCBot/cIRC.cs b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/cIRC.cs new file mode 100644 index 00000000000..41239b32aa9 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.RBuild.IRCBot/cIRC.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; + +using Meebey.SmartIrc4net; + +namespace SysGen.RBuild.IRCBot +{ + class ClientDemo + { + private CommandCollection m_Commands = new CommandCollection(); + private IrcClient m_IrcClient = new IrcClient(); + private string m_Server = "chat.freenode.net"; + private int m_Port = 7000; + + private static void Main() + { + ClientDemo demo = new ClientDemo(); + } + + public ClientDemo() + { + m_Commands.Add(new WhoIsCommand()); + + m_IrcClient.OnConnected += new EventHandler(OnConnected); + m_IrcClient.OnJoin += new JoinEventHandler(irc_OnJoin); + m_IrcClient.OnChannelMessage += new IrcEventHandler(OnChannelMessage); + m_IrcClient.OnError += new ErrorEventHandler(irc_OnError); + m_IrcClient.OnRawMessage += new IrcEventHandler(irc_OnRawMessage); + + try + { + m_IrcClient.Connect(m_Server, m_Port); + } + catch (Exception e) + { + Console.Write("Failed to connect: {0}", e.Message); + Console.ReadKey(); + } + } + + private void irc_OnRawMessage(object sender, IrcEventArgs e) + { + Console.WriteLine("Received: " + e.Data.RawMessage); + } + + private void irc_OnError(object sender, ErrorEventArgs e) + { + Console.WriteLine("Error: " + e.ErrorMessage); + } + + private void OnChannelMessage(object sender, IrcEventArgs e) + { + Console.WriteLine(e.Data.Type + ":"); + Console.WriteLine("(" + e.Data.Channel + ") <" + e.Data.Nick + "> " + e.Data.Message); + + m_IrcClient.SendMessage(SendType.Message, e.Data.Nick, "test"); + } + + private void irc_OnJoin(object sender, JoinEventArgs e) + { + } + + private void OnConnected(object sender, EventArgs e) + { + m_IrcClient.Login("RBuildBot", "RBuild Info BOT"); + m_IrcClient.RfcJoin("#testchannel"); + m_IrcClient.Listen(); + } + } +} \ No newline at end of file diff --git a/reactos/tools/sysgen/SysGen.sln b/reactos/tools/sysgen/SysGen.sln new file mode 100644 index 00000000000..fdc7d1dbe82 --- /dev/null +++ b/reactos/tools/sysgen/SysGen.sln @@ -0,0 +1,66 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TriStateTreeView", "TriStateTreeView\TriStateTreeView.csproj", "{99CEE41D-B76D-4102-B0AD-C81069509D17}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysGen.Designer", "RosBuilder\SysGen.Designer.csproj", "{78A0F196-A5BD-469A-B901-B269671AFB0A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysGen.RBuild.Framework", "RosFramework\SysGen.RBuild.Framework.csproj", "{88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysGen.Framework", "SysGen.BuildEngine\SysGen.Framework.csproj", "{8F5F8375-4097-4952-B860-784EB9961ABE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysGen.Make", "SysGen.Make\SysGen.Make.csproj", "{8B1229C7-6188-4621-A648-843CB9B5C72E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Main NAnt BuildFile|Any CPU = Debug Main NAnt BuildFile|Any CPU + Debug NAnt Tests|Any CPU = Debug NAnt Tests|Any CPU + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Release|Any CPU.Build.0 = Release|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Release|Any CPU.Build.0 = Release|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Release|Any CPU.Build.0 = Release|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug NAnt Tests|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Release|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Release|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1229C7-6188-4621-A648-843CB9B5C72E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/reactos/tools/sysgen/TriStateTreeView/AssemblyInfo.cs b/reactos/tools/sysgen/TriStateTreeView/AssemblyInfo.cs new file mode 100644 index 00000000000..192fff970c0 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/AssemblyInfo.cs @@ -0,0 +1,55 @@ +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("TriStateTreeView control")] +[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 +// +[assembly: AssemblyVersion("1.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\. 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("")] diff --git a/reactos/tools/sysgen/TriStateTreeView/LICENSING.txt b/reactos/tools/sysgen/TriStateTreeView/LICENSING.txt new file mode 100644 index 00000000000..ae57c7eda0a --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/LICENSING.txt @@ -0,0 +1,41 @@ + Copyright 1999-2004, SIL International + All rights reserved. + + This library is free software; you can redistribute it and/or modify + it under the terms of either: + + a) the Common Public License as published by the "Agreement + Steward" for that license (currently IBM); either version 0.5 + of the License, or (at your option) any later version, + + or + + b) the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2.1 of License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + the Common Public License or the GNU Lesser General Public License + for more details. + + You should have received a plain text copy of the Common Public License + Version 0.5 with this distribution in the file named "License_CPLv05.txt". + That text came from http://www.opensource.org/licenses/cpl.html. The + initial "Agreement Steward" for the CPL displays currently the license at + http://www-124.ibm.com/developerworks/oss/license-cpl.html. + + You should also have received a copy of the GNU Lesser General Public + License along with this library in the file named "License_LGPLv21.txt". + If not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307, USA or visit their web page on the + internet at http://www.fsf.org/licenses/lgpl.html. + + The GNU General Public License to which the GNU Lesser General Public + License refers can be found at http://www.gnu.org/copyleft/gpl.html. + For convenient reference, a text version has been included with this + distribution in the file named "License_GPLv2.txt". All of the licenses + mentioned above can also be found at http://www.opensource.org/licenses/. + +-------------------------------------------------------------------------- diff --git a/reactos/tools/sysgen/TriStateTreeView/License_CPLv05.txt b/reactos/tools/sysgen/TriStateTreeView/License_CPLv05.txt new file mode 100644 index 00000000000..4cac5dfe069 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/License_CPLv05.txt @@ -0,0 +1,86 @@ +Common Public License Version 0.5 +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/reactos/tools/sysgen/TriStateTreeView/License_GPLv2.txt b/reactos/tools/sysgen/TriStateTreeView/License_GPLv2.txt new file mode 100644 index 00000000000..1bcc46f53a6 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/License_GPLv2.txt @@ -0,0 +1,342 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + + diff --git a/reactos/tools/sysgen/TriStateTreeView/License_LGPLv21.txt b/reactos/tools/sysgen/TriStateTreeView/License_LGPLv21.txt new file mode 100644 index 00000000000..807db791666 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/License_LGPLv21.txt @@ -0,0 +1,506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + + diff --git a/reactos/tools/sysgen/TriStateTreeView/SysGen.sln b/reactos/tools/sysgen/TriStateTreeView/SysGen.sln new file mode 100644 index 00000000000..ef92c17aa73 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/SysGen.sln @@ -0,0 +1,75 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TriStateTreeViewDemo", "TriStateTreeViewDemo\TriStateTreeViewDemo.csproj", "{6E9E72B6-B523-424F-B409-BA5357BB7B50}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TriStateTreeView", "TriStateTreeView.csproj", "{99CEE41D-B76D-4102-B0AD-C81069509D17}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosBuilder", "..\RosBuilder\RosBuilder.csproj", "{78A0F196-A5BD-469A-B901-B269671AFB0A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosFramework", "..\RosFramework\RosFramework.csproj", "{88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.Core", "..\NAnt.Core\NAnt.Core.csproj", "{8F5F8375-4097-4952-B860-784EB9961ABE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.Console", "..\NAnt.Console\NAnt.Console.csproj", "{859696F8-F405-4018-A155-D34561498A3E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Main NAnt BuildFile|Any CPU = Debug Main NAnt BuildFile|Any CPU + Debug NAnt Tests|Any CPU = Debug NAnt Tests|Any CPU + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E9E72B6-B523-424F-B409-BA5357BB7B50}.Release|Any CPU.Build.0 = Release|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99CEE41D-B76D-4102-B0AD-C81069509D17}.Release|Any CPU.Build.0 = Release|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78A0F196-A5BD-469A-B901-B269671AFB0A}.Release|Any CPU.Build.0 = Release|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug NAnt Tests|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26}.Release|Any CPU.Build.0 = Release|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug NAnt Tests|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Release|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {8F5F8375-4097-4952-B860-784EB9961ABE}.Release|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug Main NAnt BuildFile|Any CPU.ActiveCfg = Debug Main NAnt BuildFile|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug Main NAnt BuildFile|Any CPU.Build.0 = Debug Main NAnt BuildFile|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug NAnt Tests|Any CPU.ActiveCfg = Debug NAnt Tests|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug NAnt Tests|Any CPU.Build.0 = Debug NAnt Tests|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Release|Any CPU.ActiveCfg = Debug NAnt Tests|Any CPU + {859696F8-F405-4018-A155-D34561498A3E}.Release|Any CPU.Build.0 = Debug NAnt Tests|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/reactos/tools/sysgen/TriStateTreeView/SysGen.suo b/reactos/tools/sysgen/TriStateTreeView/SysGen.suo new file mode 100644 index 00000000000..5ffb0f9a16d Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/SysGen.suo differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.cs new file mode 100644 index 00000000000..873d0afcbbd --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.cs @@ -0,0 +1,458 @@ +// --------------------------------------------------------------------------------------------- +#region // Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Distributable under the terms of either the Common Public License or the +// GNU Lesser General Public License, as specified in the LICENSING.txt file. +// +#endregion +// +// File: TriStateTreeView.cs +// Responsibility: Eberhard Beilharz/Tim Steenwyk +// +// +// +// --------------------------------------------------------------------------------------------- +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using Skybound.VisualStyles; + +namespace SIL.FieldWorks.Common.Controls +{ + /// ---------------------------------------------------------------------------------------- + /// + /// A tree view with tri-state check boxes + /// + /// + /// REVIEW: If we want to have icons in addition to the check boxes, we probably have to + /// set the icons for the check boxes in a different way. The windows tree view control + /// can have a separate image list for states. + /// + /// ---------------------------------------------------------------------------------------- + public class TriStateTreeView : TreeView + { + private System.Windows.Forms.ImageList m_TriStateImages; + private System.ComponentModel.IContainer components; + /// + /// The check state + /// + /// The states corresponds to image index + public enum CheckState + { + /// greyed out + GreyChecked = 0, + /// Unchecked + Unchecked = 1, + /// Checked + Checked = 2, + } + + #region Redefined Win-API structs and methods + /// + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TV_HITTESTINFO + { + /// Client coordinates of the point to test. + public Point pt; + /// Variable that receives information about the results of a hit test. + public TVHit flags; + /// Handle to the item that occupies the point. + public IntPtr hItem; + } + + /// Hit tests for tree view + [Flags] + public enum TVHit + { + /// In the client area, but below the last item. + NoWhere = 0x0001, + /// On the bitmap associated with an item. + OnItemIcon = 0x0002, + /// On the label (string) associated with an item. + OnItemLabel = 0x0004, + /// In the indentation associated with an item. + OnItemIndent = 0x0008, + /// On the button associated with an item. + OnItemButton = 0x0010, + /// In the area to the right of an item. + OnItemRight = 0x0020, + /// On the state icon for a tree-view item that is in a user-defined state. + OnItemStateIcon = 0x0040, + /// On the bitmap or label associated with an item. + OnItem = (OnItemIcon | OnItemLabel | OnItemStateIcon), + /// Above the client area. + Above = 0x0100, + /// Below the client area. + Below = 0x0200, + /// To the right of the client area. + ToRight = 0x0400, + /// To the left of the client area. + ToLeft = 0x0800 + } + + /// + public enum TreeViewMessages + { + /// + TV_FIRST = 0x1100, // TreeView messages + /// + TVM_HITTEST = (TV_FIRST + 17), + } + + /// + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern int SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TV_HITTESTINFO lParam); + #endregion + + #region Constructor and destructor + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public TriStateTreeView() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + + if (ThemeInformation.VisualStylesEnabled) + { + Bitmap bmp = new Bitmap(m_TriStateImages.ImageSize.Width, m_TriStateImages.ImageSize.Height); + Rectangle rc = new Rectangle(0, 0, bmp.Width, bmp.Height); + Graphics graphics = Graphics.FromImage(bmp); + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxCheckedDisabled, rc, rc); + m_TriStateImages.Images[0] = bmp; + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxUncheckedNormal, rc, rc); + m_TriStateImages.Images[1] = bmp; + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxCheckedNormal, rc, rc); + m_TriStateImages.Images[2] = bmp; + } + + ImageList = m_TriStateImages; + ImageIndex = (int)CheckState.Unchecked; + SelectedImageIndex = (int)CheckState.Unchecked; + } + + /// ----------------------------------------------------------------------------------- + /// + /// Clean up any resources being used. + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + /// ----------------------------------------------------------------------------------- + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + #endregion + + #region Component Designer generated code + /// ----------------------------------------------------------------------------------- + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + /// ----------------------------------------------------------------------------------- + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TriStateTreeView)); + this.m_TriStateImages = new System.Windows.Forms.ImageList(this.components); + // + // m_TriStateImages + // + this.m_TriStateImages.ImageSize = new System.Drawing.Size(16, 16); + this.m_TriStateImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_TriStateImages.ImageStream"))); + this.m_TriStateImages.TransparentColor = System.Drawing.Color.Magenta; + + } + #endregion + + #region Hide no longer appropriate properties from Designer + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new bool CheckBoxes + { + get { return base.CheckBoxes; } + set { base.CheckBoxes = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new int ImageIndex + { + get { return base.ImageIndex; } + set { base.ImageIndex = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new ImageList ImageList + { + get { return base.ImageList; } + set { base.ImageList = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new int SelectedImageIndex + { + get { return base.SelectedImageIndex; } + set { base.SelectedImageIndex = value; } + } + #endregion + + #region Overrides + /// ------------------------------------------------------------------------------------ + /// + /// Called when the user clicks on an item + /// + /// + /// ------------------------------------------------------------------------------------ + protected override void OnClick(EventArgs e) + { + base.OnClick(e); + + TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); + hitTestInfo.pt = PointToClient(Control.MousePosition); + + SendMessage(Handle, TreeViewMessages.TVM_HITTEST, + 0, ref hitTestInfo); + if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) + { + TreeNode node = GetNodeAt(hitTestInfo.pt); + if (node != null) + ChangeNodeState(node); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Toggle item if user presses space bar + /// + /// + /// ------------------------------------------------------------------------------------ + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (e.KeyCode == Keys.Space) + ChangeNodeState(SelectedNode); + } + #endregion + + #region Private methods + /// ------------------------------------------------------------------------------------ + /// + /// Checks or unchecks all children + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void CheckNode(TreeNode node, CheckState state) + { + InternalSetChecked(node, state); + + foreach (TreeNode child in node.Nodes) + CheckNode(child, state); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Called after a node changed its state. Has to go through all direct children and + /// set state based on children's state. + /// + /// Parent node + /// ------------------------------------------------------------------------------------ + private void ChangeParent(TreeNode node) + { + if (node == null) + return; + + CheckState state = GetChecked(node.FirstNode); + foreach (TreeNode child in node.Nodes) + state &= GetChecked(child); + + if (InternalSetChecked(node, state)) + ChangeParent(node.Parent); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles changing the state of a node + /// + /// + /// ------------------------------------------------------------------------------------ + protected void ChangeNodeState(TreeNode node) + { + BeginUpdate(); + CheckState newState; + if (node.ImageIndex == (int)CheckState.Unchecked || node.ImageIndex < 0) + newState = CheckState.Checked; + else + newState = CheckState.Unchecked; + CheckNode(node, newState); + ChangeParent(node.Parent); + EndUpdate(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the checked state of a node, but doesn't deal with children or parents + /// + /// Node + /// The new checked state + /// true if checked state was set to the requested state, otherwise + /// false. + /// ------------------------------------------------------------------------------------ + private bool InternalSetChecked(TreeNode node, CheckState state) + { + TreeViewCancelEventArgs args = + new TreeViewCancelEventArgs(node, false, TreeViewAction.Unknown); + OnBeforeCheck(args); + if (args.Cancel) + return false; + + node.ImageIndex = (int)state; + node.SelectedImageIndex = (int)state; + + OnAfterCheck(new TreeViewEventArgs(node, TreeViewAction.Unknown)); + return true; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Build a list of all of the tag data for checked items in the tree. + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void BuildTagDataList(TreeNode node, ArrayList list) + { + if (GetChecked(node) == CheckState.Checked && node.Tag != null) + list.Add(node.Tag); + + foreach (TreeNode child in node.Nodes) + BuildTagDataList(child, list); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Look through the tree nodes to find the node that has given tag data and check it. + /// + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void FindAndCheckNode(TreeNode node, object tag, CheckState state) + { + if (node.Tag != null && node.Tag.Equals(tag)) + { + SetChecked(node, state); + return; + } + + foreach (TreeNode child in node.Nodes) + FindAndCheckNode(child, tag, state); + } + #endregion + + #region Public methods + /// ------------------------------------------------------------------------------------ + /// + /// Gets the checked state of a node + /// + /// Node + /// The checked state + /// ------------------------------------------------------------------------------------ + public CheckState GetChecked(TreeNode node) + { + if (node.ImageIndex < 0) + return CheckState.Unchecked; + else + return (CheckState)node.ImageIndex; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the checked state of a node + /// + /// Node + /// The new checked state + /// ------------------------------------------------------------------------------------ + public void SetChecked(TreeNode node, CheckState state) + { + if (!InternalSetChecked(node, state)) + return; + CheckNode(node, state); + ChangeParent(node.Parent); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Find a node in the tree that matches the given tag data and set its checked state + /// + /// + /// + /// ------------------------------------------------------------------------------------ + public void CheckNodeByTag(object tag, CheckState state) + { + if (tag == null) + return; + foreach (TreeNode node in Nodes) + FindAndCheckNode(node, tag, state); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Return a list of the tag data for all of the checked items in the tree + /// + /// + /// ------------------------------------------------------------------------------------ + public ArrayList GetCheckedTagData() + { + ArrayList list = new ArrayList(); + + foreach (TreeNode node in Nodes) + BuildTagDataList(node, list); + return list; + } + #endregion + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.csproj b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.csproj new file mode 100644 index 00000000000..f53282f62f5 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.csproj @@ -0,0 +1,116 @@ + + + Local + 8.0.50727 + 2.0 + {99CEE41D-B76D-4102-B0AD-C81069509D17} + Debug + AnyCPU + + + + + TriStateTreeView + + + JScript + Grid + IE50 + false + Library + TriStateTreeView + OnBuildSuccess + + + + + + + 2.0 + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + skybound.visualstyles + skybound.visualstyles.dll + + + System + + + System.Data + + + System.Drawing + + + System.Windows.Forms + + + System.XML + + + + + Code + + + Component + + + TriStateTreeView.cs + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.resx b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.resx new file mode 100644 index 00000000000..aabb39ec3c5 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeView.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + Private + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuNTAw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA + AAB0CQAAAk1TRnQBSQFMAgEBAwEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQC + AAEoAwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB + 3AHAAQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IB + AAM5AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8B + MwMAAWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYC + AAFmAZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMC + AAHMAWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQAB + ZgEAATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8B + AAEzAWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQAB + MwGZAWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQAB + MwLMAQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQAB + MwEAAWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMB + mQEAAWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQAB + ZgGZAWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYB + zAH/AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMB + mQEAAZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgAB + mQFmATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwB + AAKZAf8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB + /wEzAQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQAB + mQEAAcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYC + AAHMAWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYB + AAHMApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8C + AAHMAf8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQAB + mQEAAcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMB + AAHMAmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB + /wGZAcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC + /wEzAQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC + /wFmAQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gB + AAHwAfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/4MAAQcL8wQAAQcL + 8wQAAQcL8xQAAQcB7AH/AfMB/wHzAf8B8wH/AfMB/wHzBAABBwHsCf8B8wQAAQcB7An/AfMUAAEHAewB + 8wH/AfMBBwHzAf8B8wH/AvMEAAEHAewJ/wHzBAABBwHsA/8BAAX/AfMUAAEHAewB/wHzAwcB8wH/AfMB + /wHzBAABBwHsCf8B8wQAAQcB7AL/AwAE/wHzFAABBwHsAfMFBwHzAf8C8wQAAQcB7An/AfMEAAEHAewB + /wUAA/8B8xQAAQcB7AH/AgcB8wMHAfMB/wHzBAABBwHsCf8B8wQAAQcB7AH/AgAB/wMAAv8B8xQAAQcB + 7AHzAQcB8wH/AfMDBwLzBAABBwHsCf8B8wQAAQcB7AH/AQAD/wMAAf8B8xQAAQcB7AH/AfMB/wHzAf8B + 8wIHAf8B8wQAAQcB7An/AfMEAAEHAewG/wIAAf8B8xQAAQcB7AHzAf8B8wH/AfMB/wHzAQcC8wQAAQcB + 7An/AfMEAAEHAewH/wEAAf8B8xQAAQcB7AH/AfMB/wHzAf8B8wH/AfMB/wHzBAABBwHsCf8B8wQAAQcB + 7An/AfMUAAEHCuwB8wQAAQcK7AHzBAABBwrsAfMUAAwHBAAMBwQADAeSAAFCAU0BPgcAAT4DAAEoAwAB + QAMAARADAAEBAQABAQUAAYAXAAP/AQAG/wIABv8CAAHAAQMBwAEDAcABAwIAAcABAwHAAQMBwAEDAgAB + wAEDAcABAwHAAQMCAAHAAQMBwAEDAcABAwIAAcABAwHAAQMBwAEDAgABwAEDAcABAwHAAQMCAAHAAQMB + wAEDAcABAwIAAcABAwHAAQMBwAEDAgABwAEDAcABAwHAAQMCAAHAAQMBwAEDAcABAwIAAcABAwHAAQMB + wAEDAgABwAEDAcABAwHAAQMCAAb/AgAG/wIACw== + + + + Private + + + TriStateTreeView + + + False + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/App.ico b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/App.ico new file mode 100644 index 00000000000..3a5525fd794 Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/App.ico differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/App.ico b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/App.ico new file mode 100644 index 00000000000..3a5525fd794 Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/App.ico differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.cs new file mode 100644 index 00000000000..e30691824bb --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.cs @@ -0,0 +1,117 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace TriStateTreeView +{ + /// ---------------------------------------------------------------------------------------- + /// + /// Summary description for Form1. + /// + /// ---------------------------------------------------------------------------------------- + public class Form1 : System.Windows.Forms.Form + { + private SIL.FieldWorks.Common.Controls.TriStateTreeView triStateTreeView1; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + + triStateTreeView1.ExpandAll(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Clean up any resources being used. + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + /// ------------------------------------------------------------------------------------ + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// ------------------------------------------------------------------------------------ + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + /// ------------------------------------------------------------------------------------ + private void InitializeComponent() + { + this.triStateTreeView1 = new SIL.FieldWorks.Common.Controls.TriStateTreeView(); + this.SuspendLayout(); + // + // triStateTreeView1 + // + this.triStateTreeView1.ImageIndex = 1; + this.triStateTreeView1.Location = new System.Drawing.Point(16, 16); + this.triStateTreeView1.Name = "triStateTreeView1"; + this.triStateTreeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + new System.Windows.Forms.TreeNode("Node0", new System.Windows.Forms.TreeNode[] { + new System.Windows.Forms.TreeNode("Node1", new System.Windows.Forms.TreeNode[] { + new System.Windows.Forms.TreeNode("Node2"), + new System.Windows.Forms.TreeNode("Node10", new System.Windows.Forms.TreeNode[] { + new System.Windows.Forms.TreeNode("Node11")})}), + new System.Windows.Forms.TreeNode("Node3", new System.Windows.Forms.TreeNode[] { + new System.Windows.Forms.TreeNode("Node4"), + new System.Windows.Forms.TreeNode("Node7"), + new System.Windows.Forms.TreeNode("Node8"), + new System.Windows.Forms.TreeNode("Node9")})})}); + this.triStateTreeView1.SelectedImageIndex = 1; + this.triStateTreeView1.Size = new System.Drawing.Size(256, 232); + this.triStateTreeView1.TabIndex = 0; + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.triStateTreeView1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + #endregion + + /// ------------------------------------------------------------------------------------ + /// + /// The main entry point for the application. + /// + /// ------------------------------------------------------------------------------------ + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.resx b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.resx new file mode 100644 index 00000000000..74f7e7a9db5 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/Form1.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + Private + + + False + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + Form1 + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/TriStateTreeViewDemo.csproj b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/TriStateTreeViewDemo.csproj new file mode 100644 index 00000000000..17c20075c38 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup/TriStateTreeViewDemo.csproj @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/AssemblyInfo.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/AssemblyInfo.cs new file mode 100644 index 00000000000..192fff970c0 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/AssemblyInfo.cs @@ -0,0 +1,55 @@ +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("TriStateTreeView control")] +[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 +// +[assembly: AssemblyVersion("1.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\. 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("")] diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.cs new file mode 100644 index 00000000000..ba016abad0d --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.cs @@ -0,0 +1,458 @@ +// --------------------------------------------------------------------------------------------- +#region // Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Distributable under the terms of either the Common Public License or the +// GNU Lesser General Public License, as specified in the LICENSING.txt file. +// +#endregion +// +// File: TriStateTreeView.cs +// Responsibility: Eberhard Beilharz/Tim Steenwyk +// +// +// +// --------------------------------------------------------------------------------------------- +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using Skybound.VisualStyles; + +namespace SIL.FieldWorks.Common.Controls +{ + /// ---------------------------------------------------------------------------------------- + /// + /// A tree view with tri-state check boxes + /// + /// + /// REVIEW: If we want to have icons in addition to the check boxes, we probably have to + /// set the icons for the check boxes in a different way. The windows tree view control + /// can have a separate image list for states. + /// + /// ---------------------------------------------------------------------------------------- + public class TriStateTreeView : TreeView + { + private System.Windows.Forms.ImageList m_TriStateImages; + private System.ComponentModel.IContainer components; + /// + /// The check state + /// + /// The states corresponds to image index + public enum CheckState + { + /// greyed out + GreyChecked = 0, + /// Unchecked + Unchecked = 1, + /// Checked + Checked = 2, + } + + #region Redefined Win-API structs and methods + /// + [StructLayout(LayoutKind.Sequential, Pack=1)] + public struct TV_HITTESTINFO + { + /// Client coordinates of the point to test. + public Point pt; + /// Variable that receives information about the results of a hit test. + public TVHit flags; + /// Handle to the item that occupies the point. + public IntPtr hItem; + } + + /// Hit tests for tree view + [Flags] + public enum TVHit + { + /// In the client area, but below the last item. + NoWhere = 0x0001, + /// On the bitmap associated with an item. + OnItemIcon = 0x0002, + /// On the label (string) associated with an item. + OnItemLabel = 0x0004, + /// In the indentation associated with an item. + OnItemIndent = 0x0008, + /// On the button associated with an item. + OnItemButton = 0x0010, + /// In the area to the right of an item. + OnItemRight = 0x0020, + /// On the state icon for a tree-view item that is in a user-defined state. + OnItemStateIcon = 0x0040, + /// On the bitmap or label associated with an item. + OnItem = (OnItemIcon | OnItemLabel | OnItemStateIcon), + /// Above the client area. + Above = 0x0100, + /// Below the client area. + Below = 0x0200, + /// To the right of the client area. + ToRight = 0x0400, + /// To the left of the client area. + ToLeft = 0x0800 + } + + /// + public enum TreeViewMessages + { + /// + TV_FIRST = 0x1100, // TreeView messages + /// + TVM_HITTEST = (TV_FIRST + 17), + } + + /// + [DllImport("user32.dll", CharSet=CharSet.Auto)] + public static extern int SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TV_HITTESTINFO lParam); + #endregion + + #region Constructor and destructor + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public TriStateTreeView() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + + if (ThemeInformation.VisualStylesEnabled) + { + Bitmap bmp = new Bitmap(m_TriStateImages.ImageSize.Width, m_TriStateImages.ImageSize.Height); + Rectangle rc = new Rectangle(0, 0, bmp.Width, bmp.Height); + Graphics graphics = Graphics.FromImage(bmp); + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxCheckedDisabled, rc, rc); + m_TriStateImages.Images[0] = bmp; + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxUncheckedNormal, rc, rc); + m_TriStateImages.Images[1] = bmp; + + ThemePaint.Draw(graphics, this, ThemeClasses.Button, ThemeParts.ButtonCheckBox, + ThemeStates.CheckBoxCheckedNormal, rc, rc); + m_TriStateImages.Images[2] = bmp; + } + + ImageList = m_TriStateImages; + ImageIndex = (int)CheckState.Unchecked; + SelectedImageIndex = (int)CheckState.Unchecked; + } + + /// ----------------------------------------------------------------------------------- + /// + /// Clean up any resources being used. + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + /// ----------------------------------------------------------------------------------- + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + #endregion + + #region Component Designer generated code + /// ----------------------------------------------------------------------------------- + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + /// ----------------------------------------------------------------------------------- + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TriStateTreeView)); + this.m_TriStateImages = new System.Windows.Forms.ImageList(this.components); + // + // m_TriStateImages + // + this.m_TriStateImages.ImageSize = new System.Drawing.Size(16, 16); + this.m_TriStateImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_TriStateImages.ImageStream"))); + this.m_TriStateImages.TransparentColor = System.Drawing.Color.Magenta; + + } + #endregion + + #region Hide no longer appropriate properties from Designer + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new bool CheckBoxes + { + get { return base.CheckBoxes; } + set { base.CheckBoxes = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new int ImageIndex + { + get { return base.ImageIndex; } + set { base.ImageIndex = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new ImageList ImageList + { + get { return base.ImageList; } + set { base.ImageList = value; } + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + [Browsable(false)] + public new int SelectedImageIndex + { + get { return base.SelectedImageIndex; } + set { base.SelectedImageIndex = value; } + } + #endregion + + #region Overrides + /// ------------------------------------------------------------------------------------ + /// + /// Called when the user clicks on an item + /// + /// + /// ------------------------------------------------------------------------------------ + protected override void OnClick(EventArgs e) + { + base.OnClick (e); + + TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); + hitTestInfo.pt = PointToClient(Control.MousePosition); + + SendMessage(Handle, TreeViewMessages.TVM_HITTEST, + 0, ref hitTestInfo); + if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) + { + TreeNode node = GetNodeAt(hitTestInfo.pt); + if (node != null) + ChangeNodeState(node); + } + } + + /// ------------------------------------------------------------------------------------ + /// + /// Toggle item if user presses space bar + /// + /// + /// ------------------------------------------------------------------------------------ + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown (e); + + if (e.KeyCode == Keys.Space) + ChangeNodeState(SelectedNode); + } + #endregion + + #region Private methods + /// ------------------------------------------------------------------------------------ + /// + /// Checks or unchecks all children + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void CheckNode(TreeNode node, CheckState state) + { + InternalSetChecked(node, state); + + foreach (TreeNode child in node.Nodes) + CheckNode(child, state); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Called after a node changed its state. Has to go through all direct children and + /// set state based on children's state. + /// + /// Parent node + /// ------------------------------------------------------------------------------------ + private void ChangeParent(TreeNode node) + { + if (node == null) + return; + + CheckState state = GetChecked(node.FirstNode); + foreach (TreeNode child in node.Nodes) + state &= GetChecked(child); + + if (InternalSetChecked(node, state)) + ChangeParent(node.Parent); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Handles changing the state of a node + /// + /// + /// ------------------------------------------------------------------------------------ + protected void ChangeNodeState(TreeNode node) + { + BeginUpdate(); + CheckState newState; + if (node.ImageIndex == (int)CheckState.Unchecked || node.ImageIndex < 0) + newState = CheckState.Checked; + else + newState = CheckState.Unchecked; + CheckNode(node, newState); + ChangeParent(node.Parent); + EndUpdate(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the checked state of a node, but doesn't deal with children or parents + /// + /// Node + /// The new checked state + /// true if checked state was set to the requested state, otherwise + /// false. + /// ------------------------------------------------------------------------------------ + private bool InternalSetChecked(TreeNode node, CheckState state) + { + TreeViewCancelEventArgs args = + new TreeViewCancelEventArgs(node, false, TreeViewAction.Unknown); + OnBeforeCheck(args); + if (args.Cancel) + return false; + + node.ImageIndex = (int)state; + node.SelectedImageIndex = (int)state; + + OnAfterCheck(new TreeViewEventArgs(node, TreeViewAction.Unknown)); + return true; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Build a list of all of the tag data for checked items in the tree. + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void BuildTagDataList(TreeNode node, ArrayList list) + { + if (GetChecked(node) == CheckState.Checked && node.Tag != null) + list.Add(node.Tag); + + foreach (TreeNode child in node.Nodes) + BuildTagDataList(child, list); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Look through the tree nodes to find the node that has given tag data and check it. + /// + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void FindAndCheckNode(TreeNode node, object tag, CheckState state) + { + if (node.Tag != null && node.Tag.Equals(tag)) + { + SetChecked(node, state); + return; + } + + foreach (TreeNode child in node.Nodes) + FindAndCheckNode(child, tag, state); + } + #endregion + + #region Public methods + /// ------------------------------------------------------------------------------------ + /// + /// Gets the checked state of a node + /// + /// Node + /// The checked state + /// ------------------------------------------------------------------------------------ + public CheckState GetChecked(TreeNode node) + { + if (node.ImageIndex < 0) + return CheckState.Unchecked; + else + return (CheckState)node.ImageIndex; + } + + /// ------------------------------------------------------------------------------------ + /// + /// Sets the checked state of a node + /// + /// Node + /// The new checked state + /// ------------------------------------------------------------------------------------ + public void SetChecked(TreeNode node, CheckState state) + { + if (!InternalSetChecked(node, state)) + return; + CheckNode(node, state); + ChangeParent(node.Parent); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Find a node in the tree that matches the given tag data and set its checked state + /// + /// + /// + /// ------------------------------------------------------------------------------------ + public void CheckNodeByTag(object tag, CheckState state) + { + if (tag == null) + return; + foreach (TreeNode node in Nodes) + FindAndCheckNode(node, tag, state); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Return a list of the tag data for all of the checked items in the tree + /// + /// + /// ------------------------------------------------------------------------------------ + public ArrayList GetCheckedTagData() + { + ArrayList list = new ArrayList(); + + foreach (TreeNode node in Nodes) + BuildTagDataList(node, list); + return list; + } + #endregion + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.csproj b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.csproj new file mode 100644 index 00000000000..f87c6247744 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.csproj @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.resx b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.resx new file mode 100644 index 00000000000..aabb39ec3c5 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Backup1/TriStateTreeView.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + Private + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuNTAw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA + AAB0CQAAAk1TRnQBSQFMAgEBAwEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQC + AAEoAwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB + 3AHAAQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IB + AAM5AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8B + MwMAAWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYC + AAFmAZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMC + AAHMAWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQAB + ZgEAATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8B + AAEzAWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQAB + MwGZAWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQAB + MwLMAQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQAB + MwEAAWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMB + mQEAAWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQAB + ZgGZAWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYB + zAH/AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMB + mQEAAZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgAB + mQFmATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwB + AAKZAf8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB + /wEzAQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQAB + mQEAAcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYC + AAHMAWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYB + AAHMApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8C + AAHMAf8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQAB + mQEAAcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMB + AAHMAmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB + /wGZAcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC + /wEzAQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC + /wFmAQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gB + AAHwAfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/4MAAQcL8wQAAQcL + 8wQAAQcL8xQAAQcB7AH/AfMB/wHzAf8B8wH/AfMB/wHzBAABBwHsCf8B8wQAAQcB7An/AfMUAAEHAewB + 8wH/AfMBBwHzAf8B8wH/AvMEAAEHAewJ/wHzBAABBwHsA/8BAAX/AfMUAAEHAewB/wHzAwcB8wH/AfMB + /wHzBAABBwHsCf8B8wQAAQcB7AL/AwAE/wHzFAABBwHsAfMFBwHzAf8C8wQAAQcB7An/AfMEAAEHAewB + /wUAA/8B8xQAAQcB7AH/AgcB8wMHAfMB/wHzBAABBwHsCf8B8wQAAQcB7AH/AgAB/wMAAv8B8xQAAQcB + 7AHzAQcB8wH/AfMDBwLzBAABBwHsCf8B8wQAAQcB7AH/AQAD/wMAAf8B8xQAAQcB7AH/AfMB/wHzAf8B + 8wIHAf8B8wQAAQcB7An/AfMEAAEHAewG/wIAAf8B8xQAAQcB7AHzAf8B8wH/AfMB/wHzAQcC8wQAAQcB + 7An/AfMEAAEHAewH/wEAAf8B8xQAAQcB7AH/AfMB/wHzAf8B8wH/AfMB/wHzBAABBwHsCf8B8wQAAQcB + 7An/AfMUAAEHCuwB8wQAAQcK7AHzBAABBwrsAfMUAAwHBAAMBwQADAeSAAFCAU0BPgcAAT4DAAEoAwAB + QAMAARADAAEBAQABAQUAAYAXAAP/AQAG/wIABv8CAAHAAQMBwAEDAcABAwIAAcABAwHAAQMBwAEDAgAB + wAEDAcABAwHAAQMCAAHAAQMBwAEDAcABAwIAAcABAwHAAQMBwAEDAgABwAEDAcABAwHAAQMCAAHAAQMB + wAEDAcABAwIAAcABAwHAAQMBwAEDAgABwAEDAcABAwHAAQMCAAHAAQMBwAEDAcABAwIAAcABAwHAAQMB + wAEDAgABwAEDAcABAwHAAQMCAAb/AgAG/wIACw== + + + + Private + + + TriStateTreeView + + + False + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Controls/FileSystemTriStateTreeView.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Controls/FileSystemTriStateTreeView.cs new file mode 100644 index 00000000000..aa09cab37be --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Controls/FileSystemTriStateTreeView.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Windows.Forms; + +using SysGen.RBuild.Framework; + +using SIL.FieldWorks.Common.Controls; + +namespace TriStateTreeViewDemo +{ + public class FileSystemTriStateTreeView : TriStateTreeView + { + RBuildModule m_Module = null; + + public void Load(RBuildModule module) + { + m_Module = module; + + if (Directory.Exists(module.ModulePath) == false) + throw new DirectoryNotFoundException("Directory Not Found"); + + Nodes.Clear(); + + DirectoryNode node = new DirectoryNode(this, new DirectoryInfo(module.ModulePath)); + + node.Expand(); + } + + public RBuildModule Module + { + get { return m_Module; } + } + + protected override void OnAfterCheck(TreeViewEventArgs e) + { + base.OnAfterCheck(e); + + if (e.Node is FileNode) + { + FileNode fileNode = e.Node as FileNode; + + if (GetChecked(e.Node) == CheckState.Checked) + { + if (fileNode.IsInclude) + { + //if (m_Module.Includes.Contains(fileNode.RelativeDirectory) == false) + // m_Module.Includes.Add(fileNode.RelativeDirectory); + } + else + { + //if (m_Module.Files.Contains(fileNode.RelativePath) == false) + // m_Module.Files.Add(fileNode.RelativePath); + } + } + else if (GetChecked(e.Node) == CheckState.Unchecked) + { + if (fileNode.IsInclude == false) + { + //if (m_Module.Files.Contains(fileNode.RelativePath) == true) + // m_Module.Files.Remove(fileNode.RelativePath); + } + } + } + } + + public class DirectoryNode : TreeNode + { + private DirectoryInfo m_DirectoryInfo; + + public DirectoryNode(DirectoryNode parent, DirectoryInfo directoryInfo) + : base(directoryInfo.Name) + { + m_DirectoryInfo = directoryInfo; + + parent.Nodes.Add(this); + + LoadDirectory(); + LoadFiles(); + } + + public DirectoryNode(FileSystemTriStateTreeView treeView, DirectoryInfo directoryInfo) + : base(directoryInfo.Name) + { + m_DirectoryInfo = directoryInfo; + + treeView.Nodes.Add(this); + + LoadDirectory(); + LoadFiles(); + + } + + public void LoadDirectory() + { + foreach (DirectoryInfo directoryInfo in m_DirectoryInfo.GetDirectories()) + { + new DirectoryNode(this, directoryInfo); + } + } + + public void LoadFiles() + { + foreach (FileInfo file in m_DirectoryInfo.GetFiles()) + { + if (file.Extension.ToLower() == ".c" || + file.Extension.ToLower() == ".cpp" || + file.Extension.ToLower() == ".cxx" || + file.Extension.ToLower() == ".h") + { + new FileNode(this, file); + } + } + } + + public new FileSystemTriStateTreeView TreeView + { + get { return (FileSystemTriStateTreeView)base.TreeView; } + } + } + + public class FileNode : TreeNode + { + private FileInfo m_FileInfo; + private DirectoryNode m_DirectoryNode; + + public FileNode(DirectoryNode directoryNode, FileInfo fileInfo) + : base(fileInfo.Name) + { + m_DirectoryNode = directoryNode; + m_FileInfo = fileInfo; + + m_DirectoryNode.Nodes.Add(this); + } + + public string FilePath + { + get { return m_FileInfo.FullName; } + } + + public string RelativePath + { + get { return FilePath.Replace(((FileSystemTriStateTreeView)TreeView).Module.ModulePath, string.Empty); } + } + + public string RelativeDirectory + { + get { return RelativePath.Replace(@"\" + m_FileInfo.Name , string.Empty); } + } + + public bool IsInclude + { + get { return (m_FileInfo.Extension.ToLower() == ".h"); } + } + } + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.cs new file mode 100644 index 00000000000..2197865e7a7 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.cs @@ -0,0 +1,213 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + /// ---------------------------------------------------------------------------------------- + /// + /// Summary description for Form1. + /// + /// ---------------------------------------------------------------------------------------- + public class Form1 : System.Windows.Forms.Form + { + private FileSystemTriStateTreeView triStateTreeView1; + private TextBox textBox1; + private Button btnProcess; + private Button btnGenerateRBuildFile; + private PropertyGrid propertyGrid1; + private IContainer components; + + /// ------------------------------------------------------------------------------------ + /// + /// Initializes a new instance of the class. + /// + /// ------------------------------------------------------------------------------------ + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + + triStateTreeView1.ExpandAll(); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Clean up any resources being used. + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + /// ------------------------------------------------------------------------------------ + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// ------------------------------------------------------------------------------------ + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + /// ------------------------------------------------------------------------------------ + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Node2"); + System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Node11"); + System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Node10", new System.Windows.Forms.TreeNode[] { + treeNode2}); + System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Node1", new System.Windows.Forms.TreeNode[] { + treeNode1, + treeNode3}); + System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Node4"); + System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("Node7"); + System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("Node8"); + System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("Node9"); + System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("Node3", new System.Windows.Forms.TreeNode[] { + treeNode5, + treeNode6, + treeNode7, + treeNode8}); + System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Node0", new System.Windows.Forms.TreeNode[] { + treeNode4, + treeNode9}); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.btnProcess = new System.Windows.Forms.Button(); + this.btnGenerateRBuildFile = new System.Windows.Forms.Button(); + this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); + this.triStateTreeView1 = new TriStateTreeViewDemo.FileSystemTriStateTreeView(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(340, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(432, 20); + this.textBox1.TabIndex = 1; + this.textBox1.Text = "C:\\Ros\\Trunk\\reactos\\salamander\\lib\\sdl"; + // + // btnProcess + // + this.btnProcess.Location = new System.Drawing.Point(687, 38); + this.btnProcess.Name = "btnProcess"; + this.btnProcess.Size = new System.Drawing.Size(85, 28); + this.btnProcess.TabIndex = 2; + this.btnProcess.Text = "button1"; + this.btnProcess.UseVisualStyleBackColor = true; + this.btnProcess.Click += new System.EventHandler(this.btnProcess_Click); + // + // btnGenerateRBuildFile + // + this.btnGenerateRBuildFile.Location = new System.Drawing.Point(701, 517); + this.btnGenerateRBuildFile.Name = "btnGenerateRBuildFile"; + this.btnGenerateRBuildFile.Size = new System.Drawing.Size(75, 23); + this.btnGenerateRBuildFile.TabIndex = 3; + this.btnGenerateRBuildFile.Text = "button1"; + this.btnGenerateRBuildFile.UseVisualStyleBackColor = true; + this.btnGenerateRBuildFile.Click += new System.EventHandler(this.btnGenerateRBuildFile_Click); + // + // propertyGrid1 + // + this.propertyGrid1.Location = new System.Drawing.Point(340, 75); + this.propertyGrid1.Name = "propertyGrid1"; + this.propertyGrid1.Size = new System.Drawing.Size(431, 426); + this.propertyGrid1.TabIndex = 4; + // + // triStateTreeView1 + // + this.triStateTreeView1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.triStateTreeView1.ImageIndex = 1; + this.triStateTreeView1.Location = new System.Drawing.Point(12, 12); + this.triStateTreeView1.Name = "triStateTreeView1"; + treeNode1.Name = ""; + treeNode1.Text = "Node2"; + treeNode2.Name = ""; + treeNode2.Text = "Node11"; + treeNode3.Name = ""; + treeNode3.Text = "Node10"; + treeNode4.Name = ""; + treeNode4.Text = "Node1"; + treeNode5.Name = ""; + treeNode5.Text = "Node4"; + treeNode6.Name = ""; + treeNode6.Text = "Node7"; + treeNode7.Name = ""; + treeNode7.Text = "Node8"; + treeNode8.Name = ""; + treeNode8.Text = "Node9"; + treeNode9.Name = ""; + treeNode9.Text = "Node3"; + treeNode10.Name = ""; + treeNode10.Text = "Node0"; + this.triStateTreeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + treeNode10}); + this.triStateTreeView1.SelectedImageIndex = 1; + this.triStateTreeView1.Size = new System.Drawing.Size(322, 528); + this.triStateTreeView1.TabIndex = 0; + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(788, 556); + this.Controls.Add(this.propertyGrid1); + this.Controls.Add(this.btnGenerateRBuildFile); + this.Controls.Add(this.btnProcess); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.triStateTreeView1); + this.Name = "Form1"; + this.Text = "RBuild Port Maker"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + /// ------------------------------------------------------------------------------------ + /// + /// The main entry point for the application. + /// + /// ------------------------------------------------------------------------------------ + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + RBuildModule module = new RBuildModule(); + private void btnProcess_Click(object sender, EventArgs e) + { + + + module.GenerateFromPath(textBox1.Text); + + this.triStateTreeView1.Load(module); + this.propertyGrid1.SelectedObject = module; + + + } + + private void btnGenerateRBuildFile_Click(object sender, EventArgs e) + { +module.SaveAs (@"c:\module.rbuild"); + } + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.resx b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.resx new file mode 100644 index 00000000000..19dc0dd8b39 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RBuildModule.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RBuildModule.cs new file mode 100644 index 00000000000..7e121105791 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RBuildModule.cs @@ -0,0 +1,61 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; + +namespace TriStateTreeViewDemo +{ + public enum TargetType + { + Win32CUI = 0, + } + + [DefaultPropertyAttribute("Name")] + public class RBuildModule + { + private string m_Path = null; + private TargetType m_Type = TargetType.Win32CUI; + + public void GenerateFromPath(string path) + { + m_Path = path; + } + + public string ModulePath + { + get { return m_Path; } + } + + public string Name + { + get { return Path.GetFileName(m_Path); } + } + + public string SourcePath + { + get { return Path.Combine(m_Path, "src"); } + } + + public string ResourceFile + { + get { return Path.Combine(ModulePath, Name + ".rc"); } + } + + public string CompiledFilename + { + get { return ""; } + } + + public string Description + { + get { return ""; } + } + + public TargetType Type + { + get { return m_Type; } + set { m_Type = value; } + } + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RCWriter.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RCWriter.cs new file mode 100644 index 00000000000..e53f8f54c55 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/RCWriter.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; + +using SysGen.RBuild.Framework; + +namespace TriStateTreeViewDemo +{ + public class RCWriter + { + RBuildModule m_Module = null; + + /// + /// Creates a new instance of the class. + /// + /// + public RCWriter(RBuildModule module) + { + //Set the module + m_Module = module; + } + + public RBuildModule Module + { + get { return m_Module; } + } + + public void Generate() + { + //using (FileStream fs = new FileStream(Module.ResourceFile, FileMode.Append)) + //{ + // using (StreamWriter objWriter = new StreamWriter(fs)) + // { + // objWriter.WriteLine("; Autogenerated"); + // objWriter.WriteLine("#include "); + // objWriter.WriteLine(); + // objWriter.WriteLine("LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL"); + // objWriter.WriteLine(); + // objWriter.WriteLine("#define REACTOS_STR_FILE_DESCRIPTION \"{0}\0\"", Module.Description); + // objWriter.WriteLine("#define REACTOS_STR_INTERNAL_NAME \"{0}\0\"", Module.Name); + // objWriter.WriteLine("#define REACTOS_STR_ORIGINAL_FILENAME \"{0}\0\"", Module.CompiledFilename); + // objWriter.WriteLine(); + // objWriter.WriteLine("LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL"); + // } + //} + } + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj new file mode 100644 index 00000000000..3ab6641a37a --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj @@ -0,0 +1,124 @@ + + + Local + 8.0.50727 + 2.0 + {6E9E72B6-B523-424F-B409-BA5357BB7B50} + Debug + AnyCPU + + + + + TriStateTreeViewDemo + + + JScript + Grid + IE50 + false + WinExe + TriStateTreeViewDemo + OnBuildSuccess + + + + + + + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.Drawing + + + System.Windows.Forms + + + System.XML + + + + + + Component + + + + Form + + + Form1.cs + Designer + + + + + {88D9BED7-30C5-4683-A6C6-6F2EB55B8F26} + SysGen.RBuild.Framework + + + {99CEE41D-B76D-4102-B0AD-C81069509D17} + TriStateTreeView + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj.user b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj.user new file mode 100644 index 00000000000..a1d742b1c46 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.csproj.user @@ -0,0 +1,5 @@ + + + ProjectFiles + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.suo b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.suo new file mode 100644 index 00000000000..eb2fb45d07b Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/TriStateTreeViewDemo.suo differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog.XML b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog.XML new file mode 100644 index 00000000000..bd033a586de --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog.XML @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog2.XML b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog2.XML new file mode 100644 index 00000000000..8133cb6b4e5 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/UpgradeLog2.XML @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.css b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.css new file mode 100644 index 00000000000..fae98af0a86 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,207 @@ +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px +} +P +{ + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 70%; + LINE-HEIGHT: 12pt; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 10px +} +.note +{ + BACKGROUND-COLOR: #ffffff; + COLOR: #336699; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px; + PADDING-RIGHT: 10px +} +.infotable +{ + BACKGROUND-COLOR: #f0f0e0; + BORDER-BOTTOM: #ffffff 0px solid; + BORDER-COLLAPSE: collapse; + BORDER-LEFT: #ffffff 0px solid; + BORDER-RIGHT: #ffffff 0px solid; + BORDER-TOP: #ffffff 0px solid; + FONT-SIZE: 70%; + MARGIN-LEFT: 10px +} +.issuetable +{ + BACKGROUND-COLOR: #ffffe8; + BORDER-COLLAPSE: collapse; + COLOR: #000000; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 10px; + MARGIN-LEFT: 13px; + MARGIN-TOP: 0px +} +.issuetitle +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px; + COLOR: #003366; + FONT-WEIGHT: normal +} +.header +{ + BACKGROUND-COLOR: #cecf9c; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + COLOR: #000000; + FONT-WEIGHT: bold +} +.issuehdr +{ + BACKGROUND-COLOR: #E0EBF5; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + COLOR: #000000; + FONT-WEIGHT: normal +} +.issuenone +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: 0px; + BORDER-LEFT: 0px; + BORDER-RIGHT: 0px; + BORDER-TOP: 0px; + COLOR: #000000; + FONT-WEIGHT: normal +} +.content +{ + BACKGROUND-COLOR: #e7e7ce; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + PADDING-LEFT: 3px +} +.issuecontent +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + PADDING-LEFT: 3px +} +A:link +{ + COLOR: #cc6633; + TEXT-DECORATION: underline +} +A:visited +{ + COLOR: #cc6633; +} +A:active +{ + COLOR: #cc6633; +} +A:hover +{ + COLOR: #cc3300; + TEXT-DECORATION: underline +} +H1 +{ + BACKGROUND-COLOR: #003366; + BORDER-BOTTOM: #336699 6px solid; + COLOR: #ffffff; + FONT-SIZE: 130%; + FONT-WEIGHT: normal; + MARGIN: 0em 0em 0em -20px; + PADDING-BOTTOM: 8px; + PADDING-LEFT: 30px; + PADDING-TOP: 16px +} +H2 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 3px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px; + PADDING-LEFT: 0px +} +H3 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: -5px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px +} +H4 +{ + COLOR: #000000; + FONT-SIZE: 70%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 0px; + MARGIN-TOP: 15px; + PADDING-BOTTOM: 0px +} +UL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +OL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +LI +{ + LIST-STYLE: square; + MARGIN-LEFT: 0px +} +.expandable +{ + CURSOR: hand +} +.expanded +{ + color: black +} +.collapsed +{ + DISPLAY: none +} +.foot +{ +BACKGROUND-COLOR: #ffffff; +BORDER-BOTTOM: #cecf9c 1px solid; +BORDER-TOP: #cecf9c 2px solid +} +.settings +{ +MARGIN-LEFT: 25PX; +} +.help +{ +TEXT-ALIGN: right; +margin-right: 10px; +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.xslt b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100644 index 00000000000..83f4304ab60 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Solution: + Project: + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + +
FilenameStatusErrorsWarnings
+ javascript:document.images[''].click()src + + + + Converted + + + + Converted + +
+ + files + + + 1 file + + + Converted:
+ Not converted +
+
+
+ + + + : + + + + + + + + + Conversion Report + <xsl:if test="Properties/Property[@Name='LogNumber']"> + <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> + </xsl:if> + + + + +

Conversion Report -

+ +

+ Time of Conversion:
+

+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ Conversion Settings +

+ + +
+
diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Minus.gif b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Minus.gif new file mode 100644 index 00000000000..17751cb2fd5 Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Minus.gif differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Plus.gif b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Plus.gif new file mode 100644 index 00000000000..f6009ca3f6b Binary files /dev/null and b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewDemo/_UpgradeReport_Files/UpgradeReport_Plus.gif differ diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/NUnit/.gitignore b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/NUnit/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.cs b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.cs new file mode 100644 index 00000000000..ee9bb2603bc --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.cs @@ -0,0 +1,258 @@ +// --------------------------------------------------------------------------------------------- +#region // Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Copyright (c) 2004-2005, SIL International. All Rights Reserved. +// +// Distributable under the terms of either the Common Public License or the +// GNU Lesser General Public License, as specified in the LICENSING.txt file. +// +#endregion +// +// File: TriStateTreeViewTests.cs +// Responsibility: TE Team +// +// +// +// --------------------------------------------------------------------------------------------- +using System; +using System.Windows.Forms; +using NUnit.Framework; + +namespace SIL.FieldWorks.Common.Controls +{ + #region DummyTriStateTreeView + /// ---------------------------------------------------------------------------------------- + /// + /// + /// + /// ---------------------------------------------------------------------------------------- + public class DummyTriStateTreeView: TriStateTreeView + { + /// ------------------------------------------------------------------------------------ + /// + /// Exposes ChangeNodeState for testing + /// + /// + /// ------------------------------------------------------------------------------------ + public void CallChangeNodeState(TreeNode node) + { + ChangeNodeState(node); + } + } + #endregion + + /// ---------------------------------------------------------------------------------------- + /// + /// Tests for TriStateTreeView control. + /// + /// ---------------------------------------------------------------------------------------- + [TestFixture] + public class TriStateTreeViewTests + { + private DummyTriStateTreeView m_treeView; + private TreeNode m_aNode; + private TreeNode m_bNode; + private TreeNode m_c1Node; + private TreeNode m_c2Node; + private TreeNode m_dNode; + private bool m_fBeforeCheck; + private bool m_fCancelInBeforeCheck; + private bool m_fAfterCheck; + + /// ------------------------------------------------------------------------------------ + /// + /// Initialize a test + /// + /// ------------------------------------------------------------------------------------ + [SetUp] + public void Init() + { + m_fBeforeCheck = false; + m_fAfterCheck = false; + m_fCancelInBeforeCheck = false; + m_treeView = new DummyTriStateTreeView(); + + m_dNode = new TreeNode("d"); + m_c1Node = new TreeNode("c1", new TreeNode[] { m_dNode }); + m_c2Node = new TreeNode("c2"); + m_bNode = new TreeNode("b", new TreeNode[] { m_c1Node, m_c2Node}); + m_aNode = new TreeNode("a", new TreeNode[] { m_bNode }); + m_treeView.Nodes.Add(m_aNode); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that all nodes in the tree view are initially unchecked + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void InitiallyUnchecked() + { + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_aNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_bNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c1Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c2Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_dNode)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that changing a node changes all children + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void ChangeNodeChangesAllChildren_Check() + { + // Check a node -> should check all children + m_treeView.SetChecked(m_bNode, TriStateTreeView.CheckState.Checked); + + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_bNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c1Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c2Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_dNode)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that changing a node changes all children + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void ChangeNodeChangesAllChildren_Uncheck() + { + // uncheck a node -> should uncheck all children + m_treeView.SetChecked(m_bNode, TriStateTreeView.CheckState.Unchecked); + + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_bNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c1Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c2Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_dNode)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that parent get greyed out if children are not all in same state + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void ChangeParent_CheckOneChild() + { + // check child -> grey check all parents + m_treeView.SetChecked(m_c2Node, TriStateTreeView.CheckState.Checked); + + Assert.AreEqual(TriStateTreeView.CheckState.GreyChecked, m_treeView.GetChecked(m_aNode)); + Assert.AreEqual(TriStateTreeView.CheckState.GreyChecked, m_treeView.GetChecked(m_bNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c1Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c2Node)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that parent get greyed out if children are not all in same state + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void ChangeParent_CheckAllChildren() + { + // check second child -> check all parents + m_treeView.SetChecked(m_c2Node, TriStateTreeView.CheckState.Checked); + m_treeView.SetChecked(m_c1Node, TriStateTreeView.CheckState.Checked); + + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_aNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_bNode)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c1Node)); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c2Node)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that the BeforeCheck event is raised + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void BeforeCheckCalled() + { + m_treeView.BeforeCheck += new TreeViewCancelEventHandler(OnBeforeCheck); + + m_treeView.SetChecked(m_c1Node, TriStateTreeView.CheckState.Checked); + + Assert.IsTrue(m_fBeforeCheck); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c1Node)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that the BeforeCheck event is raised if first node is changed + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void BeforeCheckCalled_FirstNode() + { + m_treeView.BeforeCheck += new TreeViewCancelEventHandler(OnBeforeCheck); + + m_treeView.CallChangeNodeState(m_aNode); + + Assert.IsTrue(m_fBeforeCheck); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_aNode)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// Tests that the AfterCheck event is raised + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void AfterCheckCalled() + { + m_treeView.AfterCheck += new TreeViewEventHandler(OnAfterCheck); + + m_treeView.SetChecked(m_c1Node, TriStateTreeView.CheckState.Checked); + + Assert.IsTrue(m_fAfterCheck); + Assert.AreEqual(TriStateTreeView.CheckState.Checked, m_treeView.GetChecked(m_c1Node)); + } + + /// ------------------------------------------------------------------------------------ + /// + /// When the cancel flag in BeforeCheck returns true we don't want to change the + /// state of the node. + /// + /// ------------------------------------------------------------------------------------ + [Test] + public void StateNotChangedIfBeforeCheckCancels() + { + m_treeView.BeforeCheck += new TreeViewCancelEventHandler(OnBeforeCheck); + m_treeView.AfterCheck += new TreeViewEventHandler(OnAfterCheck); + m_fCancelInBeforeCheck = true; + + m_treeView.SetChecked(m_c1Node, TriStateTreeView.CheckState.Checked); + + Assert.IsTrue(m_fBeforeCheck); + Assert.IsFalse(m_fAfterCheck); + Assert.AreEqual(TriStateTreeView.CheckState.Unchecked, m_treeView.GetChecked(m_c1Node)); + } + + #region Helper methods + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void OnBeforeCheck(object sender, TreeViewCancelEventArgs e) + { + e.Cancel = m_fCancelInBeforeCheck; + m_fBeforeCheck = true; + } + + /// ------------------------------------------------------------------------------------ + /// + /// + /// + /// ------------------------------------------------------------------------------------ + private void OnAfterCheck(object sender, TreeViewEventArgs e) + { + m_fAfterCheck = true; + } + #endregion + } +} diff --git a/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.csproj b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.csproj new file mode 100644 index 00000000000..77e5081d520 --- /dev/null +++ b/reactos/tools/sysgen/TriStateTreeView/TriStateTreeViewTests/TriStateTreeViewTests.csproj @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reactos/tools/sysgen/style.css b/reactos/tools/sysgen/style.css new file mode 100644 index 00000000000..1bae53d2185 --- /dev/null +++ b/reactos/tools/sysgen/style.css @@ -0,0 +1,105 @@ +body +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + background: white; + color: black; +} + +div.header +{ + border: 1px dashed #333; + background-color: #FFFBCB; + padding: 10px; +} + +div.footer +{ + border: 1px dashed #333; + background-color: #FFFBCB; + padding: 5px; +} + +h1, h2, h3, h4, h5, h6 { + font: 22px Verdana, Arial, Helvetica, sans-serif; +} + +td a { + font: 10px Verdana, Arial, Helvetica, sans-serif; +} + +td p { + font: 12px Verdana, Arial, Helvetica, sans-serif; + text-align: left; + border-right: 1px solid #FFF798; + border-bottom: 1px solid #FFF798; + padding: 6px; + background: #FFFBCB; +} + +.table td { + font: 10px Verdana, Arial, Helvetica, sans-serif; + text-align: left; + border-right: 1px solid #FFF798; + border-bottom: 1px solid #FFF798; + padding: 6px; + background: #FFFBCB; + vertical-align: top; +} + +.table td.Red { + font: 10px Verdana, Arial, Helvetica, sans-serif; + text-align: left; + border-right: 1px solid #FFF798; + border-bottom: 1px solid #FFF798; + padding: 6px; + background: #FF9999; +} + +.table td.Green { + font: 10px Verdana, Arial, Helvetica, sans-serif; + text-align: left; + border-right: 1px solid #FFF798; + border-bottom: 1px solid #FFF798; + padding: 6px; + background: #CCFF66; +} + +.table th { + font: 10px Verdana, Arial, Helvetica, sans-serif; + text-align: left; + padding: 6px; + background: black; + color : white; +} + +/* Status colors */ +.hdr { background-color: #000000; color: #ffffff; } +.pct0 { background-color: #ff5050; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct5 { background-color: #ff5d4f; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct10 { background-color: #ff694e; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct15 { background-color: #ff764d; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct20 { background-color: #ff824b; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct25 { background-color: #ff8f4a; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct30 { background-color: #ff9b49; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct35 { background-color: #ffa848; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct40 { background-color: #ffb447; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct45 { background-color: #ffc146; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct50 { background-color: #ffcd45; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct55 { background-color: #ffda43; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct60 { background-color: #ffe642; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct65 { background-color: #fff341; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct70 { background-color: #ffff40; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct75 { background-color: #dcff48; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct80 { background-color: #c8ff50; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct85 { background-color: #b4ff58; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct90 { background-color: #a0ff60; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct95 { background-color: #8cff60; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.pct100 { background-color: #60ff60; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.nonexistent { background-color: #ff5050; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.poor { background-color: #ff8f4a; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.outdated { background-color: #ffcd45; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.outdadeq { background-color: #ffff40; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.adequate { background-color: #dcff48; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.adeqgood { background-color: #c0ff54; font: 10px Verdana, Arial, Helvetica, sans-serif;} +.good { background-color: #60ff60; font: 10px Verdana, Arial, Helvetica, sans-serif;} \ No newline at end of file