forked from CosmosOS/XSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,322 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" /> | ||
</packageSources> | ||
<activePackageSource> | ||
<add key="All" value="(Aggregate source)" /> | ||
</activePackageSource> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Reflection; | ||
|
||
namespace XSharp.Build | ||
{ | ||
public enum DeploymentType | ||
{ | ||
[Description("ISO Image")] | ||
ISO, | ||
[Description("USB Device")] | ||
USB, | ||
[Description("PXE Network Boot")] | ||
PXE, | ||
BinaryImage | ||
} | ||
|
||
public enum LaunchType | ||
{ | ||
[Description("None")] | ||
None, | ||
[Description("VMware")] | ||
VMware, | ||
[Description("Attached Slave (CanaKit)")] | ||
Slave, | ||
[Description("Bochs")] | ||
Bochs, | ||
[Description("Intel Edison")] | ||
IntelEdison, | ||
[Description("Hyper-V")] | ||
HyperV | ||
} | ||
|
||
public enum VMwareEdition | ||
{ | ||
Workstation, | ||
Player | ||
} | ||
|
||
public enum Architecture | ||
{ | ||
x86 //, x64 | ||
} | ||
|
||
public enum Framework | ||
{ | ||
[Description("Microsoft .NET")] | ||
MicrosoftNET, | ||
Mono | ||
} | ||
|
||
public enum LogSeverityEnum : byte | ||
{ | ||
Warning = 0, | ||
Error = 1, | ||
Informational = 2, | ||
Performance = 3 | ||
} | ||
|
||
public enum TraceAssemblies | ||
{ | ||
None = 0, | ||
User = 1, | ||
Cosmos = 2, | ||
All = 3 | ||
}; | ||
|
||
public enum DebugMode | ||
{ | ||
IL, | ||
Source | ||
} | ||
|
||
public enum StackCorruptionDetectionLevel | ||
{ | ||
[Description("All Instructions")] | ||
AllInstructions, | ||
[Description("Method Footers Only")] | ||
MethodFooters | ||
} | ||
|
||
public static class EnumHelper | ||
{ | ||
public static string GetDescription(this Enum value) | ||
{ | ||
FieldInfo field = value.GetType().GetRuntimeField(value.ToString()); | ||
DescriptionAttribute attribute = field.GetCustomAttribute<DescriptionAttribute>(); | ||
return attribute == null ? value.ToString() : attribute.Description; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
|
||
namespace XSharp.Build.Launch | ||
{ | ||
public partial class Bochs | ||
{ | ||
private Dictionary<string, string> defaultConfigs = new Dictionary<string, string>(); | ||
|
||
private string mDefaultConfiguration; | ||
protected string DefaultConfiguration | ||
{ | ||
get | ||
{ | ||
if (mDefaultConfiguration == null) | ||
{ | ||
mDefaultConfiguration = GetDefaultConfiguration(); | ||
} | ||
|
||
return mDefaultConfiguration; | ||
} | ||
} | ||
|
||
private void GenerateConfiguration(string aFilePath) | ||
{ | ||
var xConfiguration = DefaultConfiguration; | ||
|
||
xConfiguration = xConfiguration.Replace("$DISPLAY_LIBRARY$", DisplayLibrary); | ||
xConfiguration = xConfiguration.Replace("$DISPLAY_LIBRARY_OPTIONS$", GetDisplayLibraryOptionsAsString()); | ||
xConfiguration = xConfiguration.Replace("$DEBUG_SYMBOLS_PATH$", mDebugSymbolsPath); | ||
xConfiguration = xConfiguration.Replace("$ROM_IMAGE$", Path.Combine(mBochsDirectory, "BIOS-bochs-latest")); | ||
xConfiguration = xConfiguration.Replace("$VGA_ROM_IMAGE$", Path.Combine(mBochsDirectory, "VGABIOS-lgpl-latest")); | ||
xConfiguration = xConfiguration.Replace("$CDROM_BOOT_PATH", mIsoFile); | ||
xConfiguration = xConfiguration.Replace("$HARD_DISK_PATH", mHardDiskFile); | ||
xConfiguration = xConfiguration.Replace("$PIPE_SERVER_NAME", mPipeServerName); | ||
|
||
using (var xStream = File.Create(aFilePath)) | ||
{ | ||
using (var xWriter = new StreamWriter(xStream)) | ||
{ | ||
xWriter.WriteAsync(xConfiguration); | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Reads the Bochs configuration file from manifest and returns it. | ||
/// </summary> | ||
/// <returns>Returns the Bochs configuration file.</returns> | ||
private string GetDefaultConfiguration() | ||
{ | ||
var xConfiguration = ""; | ||
|
||
using (var xStream = GetType().Assembly.GetManifestResourceStream(GetType(), "Cosmos.bxrc")) | ||
{ | ||
using (var xReader = new StreamReader(xStream)) | ||
{ | ||
xConfiguration = xReader.ReadToEnd(); | ||
} | ||
} | ||
|
||
return xConfiguration; | ||
} | ||
|
||
private string GetDisplayLibraryOptionsAsString() | ||
{ | ||
return mDisplayLibraryOptions.ToString().ToLower().Replace("guidebug", "gui_debug"); | ||
} | ||
} | ||
} |
Oops, something went wrong.