Reassert some changes lost in rebasing in MiniYaml.cs.
This commit is contained in:
@@ -84,19 +84,19 @@ namespace OpenRA
|
|||||||
public class MiniYaml
|
public class MiniYaml
|
||||||
{
|
{
|
||||||
const int SpacesPerLevel = 4;
|
const int SpacesPerLevel = 4;
|
||||||
static Func<string, string> stringIdentity = s => s;
|
static readonly Func<string, string> StringIdentity = s => s;
|
||||||
static Func<MiniYaml, MiniYaml> miniYamlIdentity = my => my;
|
static readonly Func<MiniYaml, MiniYaml> MiniYamlIdentity = my => my;
|
||||||
public string Value;
|
public string Value;
|
||||||
public List<MiniYamlNode> Nodes;
|
public List<MiniYamlNode> Nodes;
|
||||||
|
|
||||||
public Dictionary<string, MiniYaml> ToDictionary()
|
public Dictionary<string, MiniYaml> ToDictionary()
|
||||||
{
|
{
|
||||||
return ToDictionary(miniYamlIdentity);
|
return ToDictionary(MiniYamlIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, TElement> ToDictionary<TElement>(Func<MiniYaml, TElement> elementSelector)
|
public Dictionary<string, TElement> ToDictionary<TElement>(Func<MiniYaml, TElement> elementSelector)
|
||||||
{
|
{
|
||||||
return ToDictionary(stringIdentity, elementSelector);
|
return ToDictionary(StringIdentity, elementSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(
|
public Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(
|
||||||
@@ -155,8 +155,9 @@ namespace OpenRA
|
|||||||
var line = ll;
|
var line = ll;
|
||||||
++lineNo;
|
++lineNo;
|
||||||
|
|
||||||
if (line.Contains('#'))
|
var commentIndex = line.IndexOf('#');
|
||||||
line = line.Substring(0, line.IndexOf('#')).TrimEnd(' ', '\t');
|
if (commentIndex != -1)
|
||||||
|
line = line.Substring(0, commentIndex).TrimEnd(' ', '\t');
|
||||||
if (line.Length == 0)
|
if (line.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
var cp = 0;
|
var cp = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user