Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Cosmos.Build.MSBuild;
- using Cosmos.Debug.Common;
- using Microsoft.Build.Framework;
- using Microsoft.Build.Utilities;
- namespace IL2CPU
- {
- internal class Program
- {
- public const string CosmosRoot = "";//@"e:\OpenSource\Cosmos";
- private const string KernelFile = CosmosRoot + "";// @"\Users\Sentinel209\SentinelKernel\bin\Debug\SentinelKernel.dll";
- private const string OutputFile = CosmosRoot + "";//@"\Users\Sentinel209\SentinelKernel\bin\Debug\SentinelKernelBoot.asm";
- private static Dictionary<string, string> CmdOptions = new Dictionary<string, string>();
- private static List<ITaskItem> References = new List<ITaskItem>();
- private static void Main(string[] args)
- {
- foreach (var s in args)
- {
- string[] s1 = s.Split(':');
- string argID = s1[0].ToLower();
- string argValue = s1[1];
- if (argID != "References".ToLower())
- {
- CmdOptions.Add(argID, argValue);
- }
- else
- {
- References.Add(new TaskItemImpl(argValue));
- }
- }
- try
- {
- var xTask = new IL2CPUTask();
- xTask.DebugEnabled = Convert.ToBoolean(CmdOptions["DebugEnabled"].ToLower());
- xTask.StackCorruptionDetectionEnabled = Convert.ToBoolean(CmdOptions["StackCorruptionDetectionEnabled".ToLower()]);
- xTask.DebugMode = CmdOptions["DebugMode".ToLower()];
- xTask.TraceAssemblies = CmdOptions["TraceAssemblies".ToLower()];
- xTask.DebugCom = Convert.ToByte(CmdOptions["DebugCom".ToLower()]);
- xTask.UseNAsm = Convert.ToBoolean(CmdOptions["UseNAsm".ToLower()]);
- xTask.OutputFilename = CmdOptions["OutputFilename".ToLower()]; ;
- xTask.EnableLogging = Convert.ToBoolean(CmdOptions["EnableLogging"].ToLower()); ;
- xTask.EmitDebugSymbols = Convert.ToBoolean(CmdOptions["EmitDebugSymbols"].ToLower()); ;
- xTask.IgnoreDebugStubAttribute = Convert.ToBoolean(CmdOptions["IgnoreDebugStubAttribute"].ToLower());
- xTask.References = References.ToArray();
- xTask.OnLogError = (m) => Console.WriteLine("Error: {0}", m);
- xTask.OnLogWarning = (m) => Console.WriteLine("Warning: {0}", m);
- xTask.OnLogMessage = (m) =>
- {
- Console.WriteLine("Message: {0}", m);
- };
- xTask.OnLogException = (m) => Console.WriteLine("Exception: {0}", m.ToString());
- if (xTask.Execute())
- {
- Console.WriteLine("Executed OK");
- }
- else
- {
- Console.WriteLine("Errorred");
- }
- }
- catch (Exception E)
- {
- Console.Out.Flush();
- Console.WriteLine(E.ToString());
- return;
- }
- Console.Out.Flush();
- }
- private static ITaskItem[] GetReferences()
- {
- return new ITaskItem[]
- {
- new TaskItemImpl(KernelFile),
- new TaskItemImpl(CosmosRoot + @"\source\Cosmos.Core.Plugs\bin\x86\Debug\Cosmos.Core.Plugs.dll"),
- new TaskItemImpl(CosmosRoot + @"\source\Cosmos.Debug.Kernel.Plugs\bin\x86\Debug\Cosmos.Debug.Kernel.Plugs.dll"),
- new TaskItemImpl(CosmosRoot + @"\source\Cosmos.HAL\bin\x86\Debug\Cosmos.HAL.dll"),
- new TaskItemImpl(CosmosRoot + @"\source\Cosmos.System.Plugs\bin\x86\Debug\Cosmos.System.Plugs.dll"),
- new TaskItemImpl(CosmosRoot + @"\Users\Sentinel209\SentinelSystemLib\bin\Debug\SentinelSystemLib.dll"),
- };
- }
- private class TaskItemImpl : ITaskItem
- {
- private string path;
- public TaskItemImpl(string path)
- {
- this.path = path;
- }
- public System.Collections.IDictionary CloneCustomMetadata()
- {
- throw new NotImplementedException();
- }
- public void CopyMetadataTo(ITaskItem destinationItem)
- {
- throw new NotImplementedException();
- }
- public string GetMetadata(string metadataName)
- {
- if (metadataName == "FullPath")
- {
- return path;
- }
- throw new NotImplementedException();
- }
- public string ItemSpec
- {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
- public int MetadataCount
- {
- get { return MetadataNames.Count; }
- }
- public System.Collections.ICollection MetadataNames
- {
- get { return new String[] {"FullPath"}; }
- }
- public void RemoveMetadata(string metadataName)
- {
- throw new NotImplementedException();
- }
- public void SetMetadata(string metadataName, string metadataValue)
- {
- throw new NotImplementedException();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement