Skip to content

Commit 3ed299c

Browse files
committed
Adds debug option in the settings
If this is set, the startup project will be the forced project. In addition, verbose mode will be force turned on.
1 parent 2fed2cb commit 3ed299c

File tree

4 files changed

+52
-15
lines changed

4 files changed

+52
-15
lines changed

FRC-Extension/Buttons/DeployDebugButton.cs

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,53 @@ public override void QueryCallback(object sender, EventArgs e)
9292
bool visable = false;
9393
m_robotProject = null;
9494

95-
foreach (Project project in dte.Solution.Projects)
95+
SettingsPageGrid grid = (SettingsPageGrid) m_package.PublicGetDialogPage(typeof (SettingsPageGrid));
96+
97+
if (grid.DebugMode)
9698
{
97-
if (project.Globals.VariableExists["RobotProject"])
98-
{
99-
var vsproject = project.Object as VSLangProj.VSProject;
99+
var sb = (SolutionBuild2) dte.Solution.SolutionBuild;
100100

101-
if (vsproject != null)
101+
if (sb.StartupProjects != null)
102+
{
103+
if (sb.StartupProjects != null)
104+
{
105+
string project = ((Array) sb.StartupProjects).Cast<string>().First();
106+
Project startupProject = dte.Solution.Item(project);
107+
var vsproject = startupProject.Object as VSLangProj.VSProject;
108+
if (vsproject != null)
109+
{
110+
//If we are an assembly, and its named WPILib, enable the deploy
111+
if (
112+
(from Reference reference in vsproject.References
113+
where reference.SourceProject == null
114+
select reference.Name).Any(name => name.Contains("WPILib")))
115+
{
116+
visable = true;
117+
}
118+
}
119+
}
120+
}
121+
}
122+
else
123+
{
124+
foreach (Project project in dte.Solution.Projects)
125+
{
126+
if (project.Globals.VariableExists["RobotProject"])
102127
{
103-
//If we are an assembly, and its named WPILib, enable the deploy
104-
if ((from Reference reference in vsproject.References where reference.SourceProject == null select reference.Name).Any(name => name.Contains("WPILib")))
128+
var vsproject = project.Object as VSLangProj.VSProject;
129+
130+
if (vsproject != null)
105131
{
106-
visable = true;
107-
m_robotProject = project;
108-
break;
132+
//If we are an assembly, and its named WPILib, enable the deploy
133+
if (
134+
(from Reference reference in vsproject.References
135+
where reference.SourceProject == null
136+
select reference.Name).Any(name => name.Contains("WPILib")))
137+
{
138+
visable = true;
139+
m_robotProject = project;
140+
break;
141+
}
109142
}
110143
}
111144
}

FRC-Extension/RoboRIOCode/DeployManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
6666
return;
6767
}
6868
OutputWriter.Instance.WriteLine("Mono correctly installed");
69+
6970
OutputWriter.Instance.WriteLine("Checking RoboRIO Image");
7071
if (!(await CheckRoboRioImage()))
7172
{

FRC-Extension/RoboRIOCode/RoboRIOConnection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static async Task<Dictionary<string, SshCommand>> RunCommands(string[] co
172172
return null;
173173
}
174174
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
175-
bool verbose = settings.Verbose;
175+
bool verbose = settings.Verbose || settings.DebugMode;
176176
foreach (string s in commands)
177177
{
178178
if (verbose)
@@ -216,7 +216,7 @@ public static async Task<SshCommand> RunCommand(string command, ConnectionUser u
216216
return null;
217217
}
218218
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
219-
bool verbose = settings.Verbose;
219+
bool verbose = settings.Verbose || settings.DebugMode;
220220
if (verbose)
221221
{
222222
OutputWriter.Instance.WriteLine($"Running command: {command}");
@@ -252,7 +252,7 @@ public static async Task<bool> DeployFiles(IEnumerable files, string deployLocat
252252
return false;
253253
}
254254
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
255-
bool verbose = settings.Verbose;
255+
bool verbose = settings.Verbose || settings.DebugMode;
256256
foreach (FileInfo fileInfo in from string s in files where File.Exists(s) select new FileInfo(s))
257257
{
258258
if (verbose)

FRC-Extension/Settings.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ public class SettingsPageGrid : DialogPage
1919
[Category("Team Options"), DisplayName("Team Number"), Description("Enter your team number here.")]
2020
public int TeamNumber { get; set; }
2121

22-
[Category("Team Options"), DisplayName("Auto Start Netconsole?"), Description("Auto start the netconsole viewer when running code?")]
22+
[Category("Team Options"), DisplayName("Auto Start Netconsole"), Description("Auto start the netconsole viewer when running code")]
2323
public bool Netconsole { get; set; }
2424

25-
[Category("Extension Options"), DisplayName("Enable Verbose Output?"), Description("Enables verbose output during the deploy process?")]
25+
[Category("Extension Options"), DisplayName("Enable Verbose Output"), Description("Enables verbose output during the deploy process")]
2626
public bool Verbose { get; set; }
27+
28+
[Category("Extension Options"), DisplayName("Enable Extension Debug Mode"), Description("Enables debug mode for the extension. Make sure this is off for normal operation.")]
29+
public bool DebugMode { get; set; }
2730
}
2831
}

0 commit comments

Comments
 (0)