Commit 11310f24 authored by IMJoyJ's avatar IMJoyJ

try to fix linux crash

parent 56b9bfa1
...@@ -77,6 +77,9 @@ public static string subString(string content, string tag) ...@@ -77,6 +77,9 @@ public static string subString(string content, string tag)
public static Dictionary<long, string> Read(string content) public static Dictionary<long, string> Read(string content)
{ {
string text = reReturn(content); string text = reReturn(content);
//MacOS & Linux适配(?)
text = text.Replace("\r", "\n");
text = text.Replace("\n\n", "\n");
return Read(text.Split('\n')); return Read(text.Split('\n'));
} }
/// <summary> /// <summary>
...@@ -90,9 +93,10 @@ public static string subString(string content, string tag) ...@@ -90,9 +93,10 @@ public static string subString(string content, string tag)
long lkey; long lkey;
foreach (string line in lines) foreach (string line in lines)
{ {
if (line.StartsWith("#")) string l = line.Trim();
if (l.StartsWith("#"))
continue; continue;
string[] words = line.Split(SEP_LINE); string[] words = l.Split(SEP_LINE);
if (words.Length < 2) if (words.Length < 2)
continue; continue;
if (words[0].StartsWith("0x")) if (words[0].StartsWith("0x"))
......
...@@ -367,7 +367,11 @@ void InitComboBox(ComboBox cb, List<long> keys, string[] values) ...@@ -367,7 +367,11 @@ void InitComboBox(ComboBox cb, List<long> keys, string[] values)
cb.Items.Clear(); cb.Items.Clear();
cb.Tag = keys; cb.Tag = keys;
cb.Items.AddRange(values); cb.Items.AddRange(values);
cb.SelectedIndex = 0; //姑且Crash对策
if(cb.Items.Count > 0)
{
cb.SelectedIndex = 0;
}
} }
//计算list最大行数 //计算list最大行数
void InitListRows() void InitListRows()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment