/////////////////////////////////////////////////////////////////////// public string GetString( bool nested ) { if (items == null) { return(null); } StringBuilder result = StringOps.NewStringBuilder(); foreach (KeyValuePair <long, object> pair in items) { object value = pair.Value; if (value == null) { continue; } /////////////////////////////////////////////////////////////// // // HACK: Add a command separator to the overall result. This // may have issues if literal strings are mixed in with // the actual commands, especially if they contain any // line-ending characters. Right now, this is not done // if the current value happens to be a string instead // of a string list. // if ((result.Length > 0) && !(value is string)) { result.Append(nested ? Characters.SemiColon : Characters.LineFeed); } /////////////////////////////////////////////////////////////// // // NOTE: Always attempt to normalize the block line-endings to // line-feed only, as required by the script engine. // StringBuilder block = StringOps.NewStringBuilder( (value is IScript) ? ((IScript)value).Text : value.ToString()); StringOps.FixupLineEndings(block); /////////////////////////////////////////////////////////////// result.Append(block); } if (nested && (result.Length > 0)) { result.Insert(0, Characters.OpenBracket); result.Append(Characters.CloseBracket); } return(result.ToString()); }