Autodesk.Workspaces.Utilities.ReplaceTypeDeclarations C# (CSharp) Method

ReplaceTypeDeclarations() private static method

Strips $type references from the generated json, replacing them with type names matching those expected by the server.
private static ReplaceTypeDeclarations ( string json, bool fromServer = false ) : string
json string The json to parse.
fromServer bool A flag indicating whether this json is coming from the server, and thus /// needs to be converted back to its Json.net friendly format.
return string
        private static string ReplaceTypeDeclarations(string json, bool fromServer = false)
        {
            var result = json;

            if (fromServer)
            {
                var rgx2 = new Regex(@"ConcreteType");
                result = rgx2.Replace(result, "$type");
            }
            else
            {
                var rgx2 = new Regex(@"\$type");
                result = rgx2.Replace(result, "ConcreteType");
            }

            return result;
        }
    }