Ejemplo n.º 1
0
        public static string NormalizeIndentation(string s)
        {
            var first = FirstNonEmptyLineOf(s);

            if (first.Length == 0)
            {
                return(s);
            }
            string indent = reg.Match(first).Value;

            if (indent.Length == 0)
            {
                return(s);
            }

            var result = new StringBuilder();

            foreach (string line in TextReaderEnumerator.lines(new StringReader(s)))
            {
                if (line.StartsWith(indent))
                {
                    result.AppendLine(line.Substring(RuntimeServices.NormalizeStringIndex(line, indent.Length)));
                }
                else
                {
                    result.AppendLine(line);
                }
            }
            return(result.ToString().Trim());
        }
Ejemplo n.º 2
0
 public static string SimplifyUnityTypeName(string typeName)
 {
     return((!typeName.StartsWith("UnityEngine.")) ? typeName : typeName.Substring(RuntimeServices.NormalizeStringIndex(typeName, "UnityEngine.".Length)));
 }