Cosmos property page.

This commit is contained in:
José Pedro 2018-04-03 19:55:11 +01:00
parent 18202a8654
commit 1df3dc19f5
No known key found for this signature in database
GPG key ID: B8247B9301707B83
3 changed files with 152 additions and 100 deletions

View file

@ -38,6 +38,9 @@
<DebugEnabled Condition="'$(DebugEnabled)' == '' AND '$(Configuration)' == 'Debug'">True</DebugEnabled>
<DebugEnabled Condition="'$(DebugEnabled)' == ''">False</DebugEnabled>
<DebugCom Condition="'$(DebugCom)' == ''">1</DebugCom>
<DebugCom Condition="'$(DebugEnabled)' == 'False'">0</DebugCom>
<BinFormat Condition="'$(BinFormat)' == ''">ELF</BinFormat>
<DebugMode Condition="'$(DebugMode)' == ''">Source</DebugMode>
<TraceMode Condition="'$(TraceMode)' == ''">User</TraceMode>
@ -142,7 +145,7 @@
StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)"
TraceAssemblies="$(TraceAssemblies)"
IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)"
DebugCom="1"
DebugCom="$(DebugCom)"
References="$(TargetPath);@(PlugsReference)"
AssemblySearchDirs="@(AssemblySearchDir)"
OutputFilename="$(Il2cpuOutput)"

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.ProjectSystem;
using VSPropertyPages;
@ -8,32 +9,17 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
{
internal class CosmosPropertyPageViewModel : PropertyPageViewModel
{
public CosmosPropertyPageViewModel(
IPropertyManager propertyManager,
IProjectThreadingService projectThreadingService)
: base(propertyManager, projectThreadingService)
{
}
#region Static Items
public bool DebugEnabled
{
get => String.Equals(GetProperty(nameof(DebugEnabled)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(DebugEnabled), value.ToString(), nameof(DebugEnabled));
}
private static readonly List<int> DebugComItemsList = new List<int>() { 1, 2, 3, 4 };
public Dictionary<string, string> DebugModeItems { get; } = new Dictionary<string, string>()
private static readonly Dictionary<string, string> DebugModeItemsDictionary = new Dictionary<string, string>()
{
["IL"] = "IL",
["Source"] = "Source"
};
public string DebugMode
{
get => GetProperty(nameof(DebugMode));
set => SetProperty(nameof(DebugMode), value);
}
public Dictionary<string, string> TraceModeItems { get; } = new Dictionary<string, string>()
private static readonly Dictionary<string, string> TraceModeItemsDictionary = new Dictionary<string, string>()
{
["None"] = "None",
["User"] = "User",
@ -41,23 +27,57 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
["All"] = "All"
};
private static readonly Dictionary<string, string> StackCorruptionDetectionLevelItemsDictionary = new Dictionary<string, string>()
{
["AllInstructions"] = "All Instructions",
["MethodFooters"] = "Method Footers"
};
#endregion
public bool DebugEnabled
{
get => String.Equals(GetProperty(nameof(DebugEnabled)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(DebugEnabled), value.ToString(), nameof(DebugEnabled));
}
public List<int> DebugComItems => DebugComItemsList;
public int DebugCom
{
get => Int32.Parse(GetProperty(nameof(DebugCom)));
set => SetProperty(nameof(DebugCom), value.ToString());
}
public Dictionary<string, string> DebugModeItems => DebugModeItemsDictionary;
public string DebugMode
{
get => GetProperty(nameof(DebugMode));
set => SetProperty(nameof(DebugMode), value);
}
public Dictionary<string, string> TraceModeItems => TraceModeItemsDictionary;
public string TraceMode
{
get => GetProperty(nameof(TraceMode));
set => SetProperty(nameof(TraceMode), value);
}
public bool IgnoreDebugStubAttribute
{
get => String.Equals(GetProperty(nameof(IgnoreDebugStubAttribute)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(IgnoreDebugStubAttribute), value.ToString(), nameof(IgnoreDebugStubAttribute));
}
public bool StackCorruptionDetectionEnabled
{
get => String.Equals(GetProperty(nameof(StackCorruptionDetectionEnabled)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(StackCorruptionDetectionEnabled), value.ToString(), nameof(StackCorruptionDetectionEnabled));
}
public Dictionary<string, string> StackCorruptionDetectionLevelItems { get; } = new Dictionary<string, string>()
{
["AllInstructions"] = "All Instructions",
["MethodFooters"] = "Method Footers"
};
public Dictionary<string, string> StackCorruptionDetectionLevelItems => StackCorruptionDetectionLevelItemsDictionary;
public string StackCorruptionDetectionLevel
{
@ -77,10 +97,20 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
set => SetProperty(nameof(VisualStudioDebugPort), value);
}
public bool IgnoreDebugStubAttribute
public CosmosPropertyPageViewModel(
IPropertyManager propertyManager,
IProjectThreadingService projectThreadingService)
: base(propertyManager, projectThreadingService)
{
get => String.Equals(GetProperty(nameof(IgnoreDebugStubAttribute)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(IgnoreDebugStubAttribute), value.ToString(), nameof(IgnoreDebugStubAttribute));
}
private void SetAndRaiseIfChanged<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
OnPropertyChanged(propertyName);
}
}
}
}

View file

@ -17,90 +17,109 @@
Padding="12"
Header="IL2CPU">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBox">
<Setter Property="Padding" Value="2" />
</Style>
</Grid.Resources>
<StackPanel>
<CheckBox Grid.Column="0"
<CheckBox x:Name="checkBoxDebugEnabled"
Grid.Column="0"
Grid.Row="0"
IsChecked="{Binding DebugEnabled}"
Margin="0,0,0,12"
Content="Enable debug" />
<StackPanel Grid.Column="0"
Grid.Row="1">
<Label Margin="0,12,0,0"
Content="Debug mode:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding DebugModeItems}"
SelectedValue="{Binding DebugMode}" />
</StackPanel>
<GroupBox Padding="12"
Header="Debug Settings"
IsEnabled="{Binding ElementName=checkBoxDebugEnabled}">
<StackPanel Grid.Column="0"
Grid.Row="2">
<Label Margin="0,12,0,0"
Content="Trace mode:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding TraceModeItems}"
SelectedValue="{Binding TraceMode}" />
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBox">
<Setter Property="Padding" Value="2" />
</Style>
</Grid.Resources>
<StackPanel Grid.Column="0"
Grid.Row="3">
<Label Margin="0,12,0,0"
Content="Visual Studio debug port:" />
<TextBox Margin="0,8,0,0"
Text="{Binding VisualStudioDebugPort}" />
</StackPanel>
<StackPanel Grid.Column="0"
Grid.Row="0">
<Label Content="Debug COM port:" />
<ComboBox Margin="0,8,0,0"
ItemsSource="{Binding DebugComItems}"
SelectedItem="{Binding DebugCom}" />
</StackPanel>
<CheckBox Grid.Column="2"
Grid.Row="0"
Content="Enable stack corruption detection"
IsChecked="{Binding StackCorruptionDetectionEnabled}" />
<StackPanel Grid.Column="0"
Grid.Row="1">
<Label Margin="0,12,0,0"
Content="Debug mode:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding DebugModeItems}"
SelectedValue="{Binding DebugMode}" />
</StackPanel>
<StackPanel Grid.Column="2"
Grid.Row="1">
<Label Margin="0,12,0,0"
Content="Stack corruption detection level:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding StackCorruptionDetectionLevelItems}"
SelectedValue="{Binding StackCorruptionDetectionLevel}" />
</StackPanel>
<StackPanel Grid.Column="0"
Grid.Row="2">
<Label Margin="0,12,0,0"
Content="Trace mode:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding TraceModeItems}"
SelectedValue="{Binding TraceMode}" />
</StackPanel>
<StackPanel Grid.Column="2"
Grid.Row="2">
<Label Margin="0,12,0,0"
Content="Cosmos debug port:" />
<TextBox Margin="0,8,0,0"
Text="{Binding CosmosDebugPort}" />
</StackPanel>
<StackPanel Grid.Column="0"
Grid.Row="3">
<Label Margin="0,12,0,0"
Content="Visual Studio debug port:" />
<TextBox Margin="0,8,0,0"
Text="{Binding VisualStudioDebugPort}" />
</StackPanel>
<CheckBox Grid.Column="2"
Grid.Row="3"
Margin="0,18,0,0"
Content="Ignore debug stub attribute"
IsChecked="{Binding IgnoreDebugStubAttribute}" />
<StackPanel Grid.Column="2"
Grid.Row="0">
<CheckBox Margin="0,4,0,0"
Content="Ignore debug stub attribute"
IsChecked="{Binding IgnoreDebugStubAttribute}" />
<CheckBox Margin="0,18,0,0"
Content="Enable stack corruption detection"
IsChecked="{Binding StackCorruptionDetectionEnabled}" />
</StackPanel>
</Grid>
<StackPanel Grid.Column="2"
Grid.Row="1">
<Label Margin="0,12,0,0"
Content="Stack corruption detection level:" />
<ComboBox Margin="0,8,0,0"
SelectedValuePath="Key"
DisplayMemberPath="Value"
ItemsSource="{Binding StackCorruptionDetectionLevelItems}"
SelectedValue="{Binding StackCorruptionDetectionLevel}" />
</StackPanel>
<StackPanel Grid.Column="2"
Grid.Row="2">
<Label Margin="0,12,0,0"
Content="Cosmos debug port:" />
<TextBox Margin="0,8,0,0"
Text="{Binding CosmosDebugPort}" />
</StackPanel>
</Grid>
</GroupBox>
</StackPanel>
</GroupBox>