Skip to content

Commit 5a704db

Browse files
committed
Adds Capabilities for Mono save button
Tired so still need to implement the saving, but the button is there and works.
1 parent 7303223 commit 5a704db

File tree

6 files changed

+64
-3
lines changed

6 files changed

+64
-3
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Microsoft.VisualStudio.Shell;
7+
using RobotDotNet.FRC_Extension.MonoCode;
8+
9+
namespace RobotDotNet.FRC_Extension.Buttons
10+
{
11+
public class SaveMonoButton : ButtonBase
12+
{
13+
private readonly MonoFile m_monoFile;
14+
15+
public SaveMonoButton(Frc_ExtensionPackage package, MonoFile monoFile)
16+
: base(package, true, GuidList.guidFRC_ExtensionCmdSet, (int) PkgCmdIDList.cmdidSaveMonoFile)
17+
{
18+
m_monoFile = monoFile;
19+
}
20+
21+
public override async void ButtonCallback(object sender, EventArgs e)
22+
{
23+
//TODO Do This
24+
}
25+
26+
public override void QueryCallback(object sender, EventArgs e)
27+
{
28+
var menuCommand = sender as OleMenuCommand;
29+
if (menuCommand == null)
30+
{
31+
return;
32+
}
33+
34+
try
35+
{
36+
bool fileExistsAndValid = m_monoFile.CheckFileValid();
37+
menuCommand.Enabled = fileExistsAndValid;
38+
}
39+
catch (Exception ex)
40+
{
41+
OutputWriter.Instance.WriteLine(ex.StackTrace);
42+
}
43+
}
44+
}
45+
}

FRC-Extension/FRC-Extension.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
<Compile Include="Buttons\InstallMonoButton.cs" />
168168
<Compile Include="Buttons\KillButton.cs" />
169169
<Compile Include="Buttons\NetConsoleButton.cs" />
170+
<Compile Include="Buttons\SaveMonoButton.cs" />
170171
<Compile Include="Buttons\SettingsButton.cs" />
171172
<Compile Include="MonoCode\MonoDeploy.cs" />
172173
<Compile Include="MonoCode\MonoFile.cs" />

FRC-Extension/FRC-Extension.vsct

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
priority="0x1000" type="Menu">
4747
<Parent guid="guidFRC_ExtensionCmdSet" id="FRCMainMenuGroup"/>
4848
<Strings>
49-
<ButtonText>Mono Tool</ButtonText>
50-
<CommandName>Mono Tool</CommandName>
49+
<ButtonText>Mono Tools</ButtonText>
50+
<CommandName>Mono Tools</CommandName>
5151
</Strings>
5252
</Menu>
5353
</Menus>
@@ -156,6 +156,17 @@
156156
</Strings>
157157
</Button>
158158

159+
<Button guid="guidFRC_ExtensionCmdSet"
160+
id="cmdidSaveMonoFile" priority="0x0000"
161+
type="Button">
162+
<Parent guid="guidFRC_ExtensionCmdSet" id="MonoSubMenuGroup" />
163+
<CommandFlag>DynamicVisibility</CommandFlag>
164+
<CommandFlag>DefaultInvisible</CommandFlag>
165+
<Strings>
166+
<CommandName>cmdidSaveMonoFile</CommandName>
167+
<ButtonText>Save Mono File</ButtonText>
168+
</Strings>
169+
</Button>
159170

160171

161172
</Buttons>
@@ -190,6 +201,7 @@
190201
<IDSymbol name="cmdidSettings" value="0x0102" />
191202
<IDSymbol name="cmdidDebugCode" value="0x0106"/>
192203
<IDSymbol name="cmdidKillCode" value="0x0107"/>
204+
<IDSymbol name="cmdidSaveMonoFile" value="0x0108"/>
193205
<IDSymbol name="cmdidAboutButton" value="0x0220"/>
194206
<IDSymbol name="MonoSubMenu" value="0x1100"/>
195207
<IDSymbol name="MonoSubMenuGroup" value="0x1150"/>

FRC-Extension/FRC-ExtensionPackage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ internal DialogPage PublicGetDialogPage(Type dialogPageType)
7979
//private MonoButtons m_monoButtons;
8080
private DownloadMonoButton m_downloadMonoButton;
8181
private InstallMonoButton m_installMonoButton;
82+
private SaveMonoButton m_saveMonoButton;
8283

8384
private AboutButton m_aboutButton;
8485
private NetConsoleButton m_netConsoleButton;
@@ -114,6 +115,7 @@ protected override void Initialize()
114115

115116
m_installMonoButton = new InstallMonoButton(this, m_monoFile);
116117
m_downloadMonoButton = new DownloadMonoButton(this, m_monoFile, m_installMonoButton);
118+
m_saveMonoButton = new SaveMonoButton(this, m_monoFile);
117119

118120

119121
m_aboutButton = new AboutButton(this);

FRC-Extension/MonoCode/MonoFile.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public static string SelectMonoFile()
7878
public bool CheckFileValid()
7979
{
8080
string fileSum = Md5Sum();
81-
OutputWriter.Instance.WriteLine(fileSum);
8281

8382
return fileSum != null && fileSum.Equals(DeployProperties.MonoMd5);
8483
}

FRC-Extension/PkgCmdID.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ static class PkgCmdIDList
2323

2424
public const uint cmdidKillButton = 0x107;
2525

26+
public const uint cmdidSaveMonoFile = 0x108;
27+
2628
};
2729
}

0 commit comments

Comments
 (0)