示例#1
0
        private void LoadPropertyGroup(TextReader rdr, Atom a)
        {
            while (true)
            {
                string propName = ReaderUtils.ReadUntil(rdr, '=').Trim(); // blah =
                char   lc;
                string propValue = ReaderUtils.ReadScriptUntil(rdr, "\"'", "\\", ";}", out lc).Trim();

                if (propValue.Contains('"'))
                {
                    a.SetProperty <string>(propName, propValue.Substring(1, propValue.Length - 2));
                }
                else if (REGEX_FLOAT.IsMatch(propValue))
                {
                    a.SetProperty <double>(propName, double.Parse(propValue, System.Globalization.NumberStyles.Any));
                }
                else if (propValue == "null")
                {
                    a.Properties[propName] = new BYONDNull();
                }
                else if (REGEX_INTEGER.IsMatch(propValue))
                {
                    a.SetProperty <int>(propName, int.Parse(propValue));
                }
                else // lolidk
                {
                    a.Properties[propName] = new BYONDUnhandledValue(propValue);
                }

                if (lc == '}')
                {
                    return;
                }
            }
        }