private static DictionaryEntry GetSeperators(string code)
{
string start = null, end = null;
foreach (DictionaryEntry entry in Seperators)
{
if (code.IndexOf(entry.Key as string, 0) != -1)
{
if (start != null && code.IndexOf(entry.Key as string) != -1)
continue; //handle a shorthanded seperator.
// handle long seperator
if (start != null && entry.Key.ToString().IndexOf(start as string) == -1)
{
throw new RailsException("Can't mix seperators in one file. Found both " + start + " and " + entry.Key);
}
start = entry.Key.ToString();
end = entry.Value.ToString();
}
}
if (start == null) //default, doesn't really matter, since it won't be used.
{
foreach (DictionaryEntry entry in Seperators)
{
return entry;
}
}
return new DictionaryEntry(start, end);
}