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

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem;
using VSPropertyPages; using VSPropertyPages;
@ -8,32 +9,17 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
{ {
internal class CosmosPropertyPageViewModel : PropertyPageViewModel internal class CosmosPropertyPageViewModel : PropertyPageViewModel
{ {
public CosmosPropertyPageViewModel( #region Static Items
IPropertyManager propertyManager,
IProjectThreadingService projectThreadingService)
: base(propertyManager, projectThreadingService)
{
}
public bool DebugEnabled private static readonly List<int> DebugComItemsList = new List<int>() { 1, 2, 3, 4 };
{
get => String.Equals(GetProperty(nameof(DebugEnabled)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(DebugEnabled), value.ToString(), nameof(DebugEnabled));
}
public Dictionary<string, string> DebugModeItems { get; } = new Dictionary<string, string>() private static readonly Dictionary<string, string> DebugModeItemsDictionary = new Dictionary<string, string>()
{ {
["IL"] = "IL", ["IL"] = "IL",
["Source"] = "Source" ["Source"] = "Source"
}; };
public string DebugMode private static readonly Dictionary<string, string> TraceModeItemsDictionary = new Dictionary<string, string>()
{
get => GetProperty(nameof(DebugMode));
set => SetProperty(nameof(DebugMode), value);
}
public Dictionary<string, string> TraceModeItems { get; } = new Dictionary<string, string>()
{ {
["None"] = "None", ["None"] = "None",
["User"] = "User", ["User"] = "User",
@ -41,23 +27,57 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
["All"] = "All" ["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 public string TraceMode
{ {
get => GetProperty(nameof(TraceMode)); get => GetProperty(nameof(TraceMode));
set => SetProperty(nameof(TraceMode), value); 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 public bool StackCorruptionDetectionEnabled
{ {
get => String.Equals(GetProperty(nameof(StackCorruptionDetectionEnabled)), "True", StringComparison.OrdinalIgnoreCase); get => String.Equals(GetProperty(nameof(StackCorruptionDetectionEnabled)), "True", StringComparison.OrdinalIgnoreCase);
set => SetProperty(nameof(StackCorruptionDetectionEnabled), value.ToString(), nameof(StackCorruptionDetectionEnabled)); set => SetProperty(nameof(StackCorruptionDetectionEnabled), value.ToString(), nameof(StackCorruptionDetectionEnabled));
} }
public Dictionary<string, string> StackCorruptionDetectionLevelItems { get; } = new Dictionary<string, string>() public Dictionary<string, string> StackCorruptionDetectionLevelItems => StackCorruptionDetectionLevelItemsDictionary;
{
["AllInstructions"] = "All Instructions",
["MethodFooters"] = "Method Footers"
};
public string StackCorruptionDetectionLevel public string StackCorruptionDetectionLevel
{ {
@ -77,10 +97,20 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels
set => SetProperty(nameof(VisualStudioDebugPort), value); 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,6 +17,19 @@
Padding="12" Padding="12"
Header="IL2CPU"> Header="IL2CPU">
<StackPanel>
<CheckBox x:Name="checkBoxDebugEnabled"
Grid.Column="0"
Grid.Row="0"
IsChecked="{Binding DebugEnabled}"
Margin="0,0,0,12"
Content="Enable debug" />
<GroupBox Padding="12"
Header="Debug Settings"
IsEnabled="{Binding ElementName=checkBoxDebugEnabled}">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@ -35,10 +48,13 @@
</Style> </Style>
</Grid.Resources> </Grid.Resources>
<CheckBox Grid.Column="0" <StackPanel Grid.Column="0"
Grid.Row="0" Grid.Row="0">
IsChecked="{Binding DebugEnabled}" <Label Content="Debug COM port:" />
Content="Enable debug" /> <ComboBox Margin="0,8,0,0"
ItemsSource="{Binding DebugComItems}"
SelectedItem="{Binding DebugCom}" />
</StackPanel>
<StackPanel Grid.Column="0" <StackPanel Grid.Column="0"
Grid.Row="1"> Grid.Row="1">
@ -70,10 +86,15 @@
Text="{Binding VisualStudioDebugPort}" /> Text="{Binding VisualStudioDebugPort}" />
</StackPanel> </StackPanel>
<CheckBox Grid.Column="2" <StackPanel Grid.Column="2"
Grid.Row="0" 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" Content="Enable stack corruption detection"
IsChecked="{Binding StackCorruptionDetectionEnabled}" /> IsChecked="{Binding StackCorruptionDetectionEnabled}" />
</StackPanel>
<StackPanel Grid.Column="2" <StackPanel Grid.Column="2"
Grid.Row="1"> Grid.Row="1">
@ -94,16 +115,14 @@
Text="{Binding CosmosDebugPort}" /> Text="{Binding CosmosDebugPort}" />
</StackPanel> </StackPanel>
<CheckBox Grid.Column="2"
Grid.Row="3"
Margin="0,18,0,0"
Content="Ignore debug stub attribute"
IsChecked="{Binding IgnoreDebugStubAttribute}" />
</Grid> </Grid>
</GroupBox> </GroupBox>
</StackPanel>
</GroupBox>
</Grid> </Grid>
</propertypages:WpfPropertyPageUI> </propertypages:WpfPropertyPageUI>