Skip to content

Commit

Permalink
Fix: Cannot open COM Port when COM port is greater than 10.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiashuo Li committed May 12, 2015
1 parent 2a51a4f commit 00cb6f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion UI/Connector/EmulatorConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public static void TranslateToC(HLProgram program)
string mainTemplateFullPath = System.IO.Path.Combine(emulatorPath, "MCEmulator", MainTemplate);
string mainOutputFullPath = System.IO.Path.Combine(emulatorPath, "MCEmulator", MainOutput);
string mainStr = File.ReadAllText(mainTemplateFullPath);
mainStr = mainStr.Replace("/**change_com_port**/", (Properties.Settings.Default.EmulatorComPort[3] - '0' - 1).ToString());

// COM1 is the 0th
int comNo = Int32.Parse(Properties.Settings.Default.EmulatorComPort.Substring(3)) - 1;
mainStr = mainStr.Replace("/**change_com_port**/", (comNo.ToString()));
File.WriteAllText(mainOutputFullPath, mainStr);
}
}
Expand Down

0 comments on commit 00cb6f3

Please sign in to comment.