diff --git a/source/Cosmos.Build.Windows.Config/MainWindow.xaml.cs b/source/Cosmos.Build.Windows.Config/MainWindow.xaml.cs index 9b7dacbdc..64069caef 100644 --- a/source/Cosmos.Build.Windows.Config/MainWindow.xaml.cs +++ b/source/Cosmos.Build.Windows.Config/MainWindow.xaml.cs @@ -13,37 +13,28 @@ using System.Windows.Navigation; using System.Windows.Shapes; namespace Cosmos.Build.Windows.Config { - /// - /// Interaction logic for Window1.xaml - /// - public partial class Window1 : Window { - public Window1() - { - InitializeComponent(); + /// + /// Interaction logic for Window1.xaml + /// + public partial class Window1: Window { + public Window1() { + InitializeComponent(); - } + } - void q_Status(object sender, Cosmos.Build.Windows.Config.Tasks.TaskStatusEventArgs e) - { - EventHandler del = new EventHandler(q_Status_Invoke); - this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, del, sender, e); - } + void q_Status(object sender, Cosmos.Build.Windows.Config.Tasks.TaskStatusEventArgs e) { + taskLabel.Content = new Bold(new Run(e.TaskName)); + statusLabel.Content = new Run(e.Message); + progressBar.Value = e.Percentage; + } - void q_Status_Invoke(object sender, Cosmos.Build.Windows.Config.Tasks.TaskStatusEventArgs e) - { - taskLabel.Content = new Bold(new Run(e.TaskName)); - statusLabel.Content = new Run(e.Message); - progressBar.Value = e.Percentage; - } - - private void beginButton_Click(object sender, RoutedEventArgs e) - { - beginButton.Visibility = Visibility.Hidden; + private void beginButton_Click(object sender, RoutedEventArgs e) { + beginButton.Visibility = Visibility.Hidden; Tasks.TaskQueue q = new Cosmos.Build.Windows.Config.Tasks.TaskQueue(); - q.Add(new Tasks.InstallAssembliesTask()); + q.Add(new Tasks.InstallAssembliesTask()); q.Add(new Tasks.InstallTemplateTask()); - q.Status += new EventHandler(q_Status); - q.BeginExecute(); - } - } + q.Status += new EventHandler(q_Status); + q.Execute(); + } + } } diff --git a/source/Cosmos.Build.Windows.Config/Tasks/InstallAssembliesTask.cs b/source/Cosmos.Build.Windows.Config/Tasks/InstallAssembliesTask.cs index e578c90db..55c808f3f 100644 --- a/source/Cosmos.Build.Windows.Config/Tasks/InstallAssembliesTask.cs +++ b/source/Cosmos.Build.Windows.Config/Tasks/InstallAssembliesTask.cs @@ -17,18 +17,23 @@ namespace Cosmos.Build.Windows.Config.Tasks { string xBaseDir = Tools.Dir("GAC"); string xTargetDir; OnStatus(0, "Installing Cosmos Assemblies"); - using (var xKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false)) { - xTargetDir = (string)xKey.GetValue("InstallDir"); - xTargetDir = Path.Combine(xTargetDir, "PublicAssemblies"); - } + var xKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false); + xTargetDir = (string)xKey.GetValue("InstallDir"); + xTargetDir = Path.Combine(xTargetDir, "PublicAssemblies"); string[] xItems = Directory.GetFiles(xBaseDir); int xCurrent = 1; foreach (string xFile in Directory.GetFiles(xBaseDir)) { - OnStatus(100 - (xItems.Length / xCurrent), "Copying " + Path.GetFileNameWithoutExtension(xFile)); + OnStatus(100 - ((xItems.Length + 1) / xCurrent), "Copying " + Path.GetFileNameWithoutExtension(xFile)); File.Copy(xFile, Path.Combine(xTargetDir, Path.GetFileName(xFile)), true); xCurrent++; OnStatus(100 - (xItems.Length / xCurrent), "Copying " + Path.GetFileNameWithoutExtension(xFile)); } + xKey = Registry.CurrentUser.OpenSubKey(@"Software\Cosmos", true); + if (xKey == null) { + xKey = Registry.CurrentUser.CreateSubKey(@"Software\Cosmos"); + } + xKey.SetValue("Build Path", Path.GetDirectoryName(typeof(InstallAssembliesTask).Assembly.Location)); + xKey.Flush(); OnStatus(100, "Installing Cosmos Assemblies"); } } diff --git a/source/Cosmos.Build.Windows.Config/Tasks/InstallTemplateTask.cs b/source/Cosmos.Build.Windows.Config/Tasks/InstallTemplateTask.cs index 5431fb104..0a5c60e46 100644 --- a/source/Cosmos.Build.Windows.Config/Tasks/InstallTemplateTask.cs +++ b/source/Cosmos.Build.Windows.Config/Tasks/InstallTemplateTask.cs @@ -21,7 +21,7 @@ namespace Cosmos.Build.Windows.Config.Tasks { xVSTemplateFolder = (string)xKey.GetValue("UserProjectTemplatesLocation"); xVSTemplateFolder = Path.Combine(xVSTemplateFolder, "Visual C#"); } - File.Copy(xTemplateFile, Path.Combine(xVSTemplateFolder, "CosmosBoot.zip")); + File.Copy(xTemplateFile, Path.Combine(xVSTemplateFolder, "CosmosBoot.zip"), true); this.OnStatus(100, "Installing Template"); } } diff --git a/source/Cosmos.Build.Windows.Config/Tasks/TaskQueue.cs b/source/Cosmos.Build.Windows.Config/Tasks/TaskQueue.cs index bd137f1ac..f8a44d623 100644 --- a/source/Cosmos.Build.Windows.Config/Tasks/TaskQueue.cs +++ b/source/Cosmos.Build.Windows.Config/Tasks/TaskQueue.cs @@ -22,12 +22,6 @@ namespace Cosmos.Build.Windows.Config.Tasks get { return _name; } } - public void BeginExecute() - { - ThreadStart start = new ThreadStart(Execute); - start.BeginInvoke(null, null); - } - public override void Execute() { lock (_tasks) @@ -45,6 +39,7 @@ namespace Cosmos.Build.Windows.Config.Tasks } OnStatus(100, "Done"); } catch (Exception E) { + System.Windows.Clipboard.SetText(E.ToString()); OnStatus(100, "Error: " + E.Message); } } diff --git a/source/Cosmos.Build.Windows/Builder.cs b/source/Cosmos.Build.Windows/Builder.cs index 22f24bdc1..9145e4ae3 100644 --- a/source/Cosmos.Build.Windows/Builder.cs +++ b/source/Cosmos.Build.Windows/Builder.cs @@ -16,12 +16,19 @@ namespace Cosmos.Build.Windows { protected string mAsmPath; public static string GetBuildPath() { - var xKey = Registry.CurrentUser.OpenSubKey(@"Software\Cosmos"); - var xResult = (string)xKey.GetValue("Build Path"); - if (!xResult.EndsWith(@"\")) { - xResult = xResult + @"\"; - } - return xResult; + try { + var xKey = Registry.CurrentUser.OpenSubKey(@"Software\Cosmos"); + var xResult = (string)xKey.GetValue("Build Path"); + if (String.IsNullOrEmpty(xResult)) { + throw new Exception(); + } + if (!xResult.EndsWith(@"\")) { + xResult = xResult + @"\"; + } + return xResult; + } catch (Exception E) { + throw new Exception("Error while getting Cosmos Build Path!", E); + } } public Builder() { diff --git a/source/IL2CPU/Program.cs b/source/IL2CPU/Program.cs index 40f431423..d53ef4f8e 100644 --- a/source/IL2CPU/Program.cs +++ b/source/IL2CPU/Program.cs @@ -25,7 +25,7 @@ namespace IL2CPU { private Type nativeType = typeof(NativeOpCodeMap); private static bool ParseArguments(IEnumerable aArgs) { - Console.WriteLine("Indy IL2CPU"); + Console.WriteLine("Initializing IL2CPU... This may take a minute so please wait for further status..."); Console.WriteLine(); foreach (string x in aArgs) { // MtW: Slash added for powershell compatibility diff --git a/source/PrepareUserKit.bat b/source/PrepareUserKit.bat index 9bbafe3d0..eb033305d 100644 --- a/source/PrepareUserKit.bat +++ b/source/PrepareUserKit.bat @@ -11,5 +11,10 @@ del /Q "..\Build\setup.pdb" del /Q "..\Build\ISO\output.bin" del /Q "..\Build\Tools\asm\*.*" del /Q "..\Build\Tools\Cosmos.Kernel.Plugs\*.pdb" -"..\Tools\7zip\7z.exe" a -tzip Test.zip "..\Build\*.*" -r +rmdir /S /Q "..\Pack" +mkdir "..\Pack" +mkdir "..\Pack\Cosmos" +xcopy /S "..\Build\*.*" "..\Pack\Cosmos" +"..\Tools\7zip\7z.exe" a -tzip Test.zip "..\Pack\*.*" -r +rmdir /S /Q "..\Pack" pause \ No newline at end of file