Skip to content

Commit 601bbdb

Browse files
committed
Gets the same button implemented. Also fixes the kill button.
1 parent f6622b9 commit 601bbdb

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

FRC-Extension/Buttons/SaveMonoButton.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using System.Windows.Forms;
67
using Microsoft.VisualStudio.Shell;
78
using RobotDotNet.FRC_Extension.MonoCode;
89

@@ -20,7 +21,7 @@ public SaveMonoButton(Frc_ExtensionPackage package, MonoFile monoFile)
2021

2122
public override async void ButtonCallback(object sender, EventArgs e)
2223
{
23-
//TODO Do This
24+
m_monoFile.SaveMonoFile();
2425
}
2526

2627
public override void QueryCallback(object sender, EventArgs e)

FRC-Extension/FRC-Extension.vsct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<Parent guid="guidFRC_ExtensionCmdSet" id="FRCMainMenuGroup"/>
117117
<CommandFlag>DynamicVisibility</CommandFlag>
118118
<Strings>
119-
<ButtonText>Restart Robot Code</ButtonText>
119+
<ButtonText>Kill Robot Code</ButtonText>
120120
</Strings>
121121
</Button>
122122

FRC-Extension/MonoCode/MonoFile.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,35 @@ public static string SelectMonoFile()
7575
return null;
7676
}
7777

78+
public void SaveMonoFile()
79+
{
80+
if (!CheckFileValid()) return;
81+
82+
using (SaveFileDialog dialog = new SaveFileDialog())
83+
{
84+
dialog.Filter = "Zip Files(*.zip)|*.zip|All files (*.*)|*.*";
85+
86+
if (dialog.ShowDialog() == DialogResult.OK)
87+
{
88+
string fileName = dialog.FileName;
89+
try
90+
{
91+
if (File.Exists(fileName))
92+
{
93+
File.Delete(fileName);
94+
}
95+
File.Copy(FileName, fileName, true);
96+
97+
}
98+
catch
99+
{
100+
MessageBox.Show("File not saved successfully.");
101+
}
102+
MessageBox.Show("File saved successfully.");
103+
}
104+
}
105+
}
106+
78107
public bool CheckFileValid()
79108
{
80109
string fileSum = Md5Sum();

FRC-Extension/RoboRIOCode/DeployProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static class DeployProperties
1616
". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;",
1717
};
1818

19-
public const string KillOnlyCommand = "/usr/local/frc/bin/frcKillRobot.sh";
19+
public const string KillOnlyCommand = "/usr/local/frc/bin/frcKillRobot.sh -t";
2020

2121
public const string DebugFlagDir = "/tmp/";
2222

0 commit comments

Comments
 (0)