diff --git a/Clovershell/ClovershellConnection.cs b/Clovershell/ClovershellConnection.cs index 682333f7a..1ca67883f 100644 --- a/Clovershell/ClovershellConnection.cs +++ b/Clovershell/ClovershellConnection.cs @@ -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) diff --git a/ConfigIni.cs b/ConfigIni.cs index 95780610b..132f6d619 100644 --- a/ConfigIni.cs +++ b/ConfigIni.cs @@ -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() { @@ -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": @@ -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]"); diff --git a/MainForm.cs b/MainForm.cs index c9c23d303..2b8aa4e19 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -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) { @@ -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; } @@ -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; } } diff --git a/NesMenuCollection.cs b/NesMenuCollection.cs index 39ff3fe97..a82a9c57b 100644 --- a/NesMenuCollection.cs +++ b/NesMenuCollection.cs @@ -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; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 9a52e3952..615e0a95c 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -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")]