Skip to content

Commit

Permalink
Last minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ClusterM committed Apr 17, 2017
1 parent 90b1573 commit 245c07d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Clovershell/ClovershellConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,16 @@ void killAll()
buff[1] = 0;
buff[2] = 0;
buff[3] = 0;
epWriter.Write(buff, 0, buff.Length, 1000, out tLen);
var r = epWriter.Write(buff, 0, buff.Length, 1000, out tLen);
if (tLen != buff.Length)
throw new ClovershellException("kill all shell: write error");
throw new ClovershellException("kill all shell: write error - " + r.ToString());
buff[0] = (byte)ClovershellCommand.CMD_EXEC_KILL_ALL;
buff[1] = 0;
buff[2] = 0;
buff[3] = 0;
epWriter.Write(buff, 0, buff.Length, 1000, out tLen);
r= epWriter.Write(buff, 0, buff.Length, 1000, out tLen);
if (tLen != buff.Length)
throw new ClovershellException("kill all exec: write error");
throw new ClovershellException("kill all exec: write error - "+r.ToString());
}

internal void writeUsb(ClovershellCommand cmd, byte arg, byte[] data = null, int pos = 0, int l = -1)
Expand Down
10 changes: 10 additions & 0 deletions ConfigIni.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class ConfigIni
public static bool Compress = true;
public const string ConfigDir = "config";
public const string ConfigFile = "config.ini";
public static bool FtpServer = false;
public static bool TelnetServer = false;

public static void Load()
{
Expand Down Expand Up @@ -108,6 +110,12 @@ public static void Load()
case "compress":
Compress = !value.ToLower().Equals("false");
break;
case "ftpserver":
FtpServer = !value.ToLower().Equals("false");
break;
case "telnetserver":
TelnetServer = !value.ToLower().Equals("false");
break;
}
break;
case "presets":
Expand Down Expand Up @@ -139,6 +147,8 @@ public static void Save()
configLines.Add(string.Format("FoldersMode={0}", (byte)FoldersMode));
configLines.Add(string.Format("MaxGamesPerFolder={0}", MaxGamesPerFolder));
configLines.Add(string.Format("Compress={0}", Compress));
configLines.Add(string.Format("FtpServer={0}", FtpServer));
configLines.Add(string.Format("TelnetServer={0}", TelnetServer));

configLines.Add("");
configLines.Add("[Presets]");
Expand Down
18 changes: 16 additions & 2 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ public MainForm()
ftpServer.FileSystemHandler = new mooftpserv.NesMiniFileSystemHandler(Clovershell);
ftpServer.LogHandler = new mooftpserv.DebugLogHandler();
ftpServer.LocalPort = 1021;

if (ConfigIni.FtpServer)
{
FTPToolStripMenuItem.Checked = true;
FTPToolStripMenuItem_Click(null, null);
}
if (ConfigIni.TelnetServer)
{
shellToolStripMenuItem.Checked = true;
shellToolStripMenuItem_Click(null, null);
}
}
catch (Exception ex)
{
Expand Down Expand Up @@ -1339,17 +1350,20 @@ private void FTPToolStripMenuItem_Click(object sender, EventArgs e)
}
});
ftpThread.Start();
ConfigIni.FtpServer = true;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message + ex.StackTrace);
MessageBox.Show(this, ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
FTPToolStripMenuItem.Checked = false;
ConfigIni.FtpServer = false;
}
}
else
{
ftpServer.Stop();
ConfigIni.FtpServer = false;
}
openFTPInExplorerToolStripMenuItem.Enabled = FTPToolStripMenuItem.Checked;
}
Expand All @@ -1358,13 +1372,13 @@ private void shellToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
openTelnetToolStripMenuItem.Enabled = Clovershell.ShellEnabled = shellToolStripMenuItem.Checked;
ConfigIni.TelnetServer = openTelnetToolStripMenuItem.Enabled = Clovershell.ShellEnabled = shellToolStripMenuItem.Checked;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message + ex.StackTrace);
MessageBox.Show(this, ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
shellToolStripMenuItem.Checked = false;
ConfigIni.TelnetServer = openTelnetToolStripMenuItem.Enabled = shellToolStripMenuItem.Checked = false;
}
}

Expand Down
3 changes: 2 additions & 1 deletion NesMenuCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void Split(SplitStyle style, int maxElements = 35)
case SplitStyle.Original_FoldersEqual:
case SplitStyle.Original_PagesEqual:
style--;
originalToRoot = true;
if (this.Where(o => o is NesDefaultGame).Count() > 0)
originalToRoot = true;
break;
}
if (style == SplitStyle.NoSplit && !originalToRoot) return;
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.16.3")]
[assembly: AssemblyFileVersion("2.0.16.3")]
[assembly: AssemblyVersion("2.0.16.10")]
[assembly: AssemblyFileVersion("2.0.16.10")]

0 comments on commit 245c07d

Please sign in to comment.