Ejemplo n.º 1
0
 protected virtual void WriteClassName(ObjectDef obj, StringBuilder sb, string suffix, bool includeInheritance)
 {
     if (obj.Name.Equals("Document"))
     {
         sb.AppendLine($"\t{WriterUtils.GetClass($"{obj.Name}{suffix}")} {(includeInheritance ? ": DocumentWrapper" : "")}");
     }
     else
     {
         sb.AppendLine($"\t{WriterUtils.GetClass($"{obj.Name}{suffix}")} {(includeInheritance ? ": RDOWrapper" : "")}");
     }
 }
Ejemplo n.º 2
0
        public string WriteTabGuids(Application app)
        {
            var str = new StringBuilder();

            str.AppendLine($"\t{WriterUtils.GetClass("TabGuids")}");
            str.AppendLine("\t{");
            foreach (var tab in app.Tabs)
            {
                str.AppendLine($"\t\t{WriterUtils.GetString(tab)}");
            }
            str.AppendLine("\t}");
            return(str.ToString());
        }
Ejemplo n.º 3
0
        public string WriteScripts(Application app)
        {
            var sb = new StringBuilder();

            sb.AppendLine($"\t {WriterUtils.GetClass("RelativityScripts")}");
            sb.AppendLine("\t{");
            foreach (var obj in app.Scripts)
            {
                sb.AppendLine("\t\t" + WriterUtils.GetString(obj));
            }
            sb.AppendLine("\t}");
            sb.AppendLine();
            return(sb.ToString());
        }
Ejemplo n.º 4
0
        public string WriteObjectRules(IEnumerable <ObjectDef> objs)
        {
            var sb = new StringBuilder();

            foreach (var obj in objs.Where(x => (x.ObjectRules?.ToList() ?? new List <ObjectRule>()).Any()))
            {
                sb.AppendLine($"\t{WriterUtils.GetClass(obj.Name)}ObjectRules");
                sb.AppendLine("\t{");
                foreach (var rule in obj.ObjectRules)
                {
                    sb.AppendLine($"\t\t{WriterUtils.GetString(rule)}");
                }
                sb.AppendLine("\t}");
            }
            return(sb.ToString());
        }
        /// <summary>
        /// Writes out all choice guids for all fields and object types
        /// output for Document with field 'Choice Type' would look similar to:
        /// public class DocumentChoiceTypeChoiceGuids
        /// {
        ///     public const string Choice1 = "7b742f38-5d09-49a7-983c-b563ae7a07d2";
        /// }
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public string WriteChoiceGuids(Application app)
        {
            var str = new StringBuilder();

            foreach (var obj in app.Objects)
            {
                foreach (var field in obj.Fields.Where(x => x.Choices.Any()))
                {
                    str.AppendLine($"\t{WriterUtils.GetClass(obj.Name + field.Name + "ChoiceGuids")}");
                    str.AppendLine("\t{");
                    foreach (var choice in field.Choices)
                    {
                        str.AppendLine($"\t\t{WriterUtils.GetString(choice)}");
                    }
                    str.AppendLine("\t}");
                }
            }
            return(str.ToString());
        }
Ejemplo n.º 6
0
        protected virtual void WriteField(ObjectDef objDef, Field field, StringBuilder sb)
        {
            var fieldType = GetFieldType(field);

            //We also need to support ParentArtifact of type Artifact isSystem:true
            sb.Append($"\t\tpublic {fieldType} {field.Name}");
            sb.Append(" {");
            if (field.IsSystem && field.Name.StartsWith("System")) //this might cause a problem but for now I'm lazy
            {
                sb.Append($" get {{ return base.Artifact.{field.Name}; }}");
            }
            else if (field.IsSystem && field.Name.Equals("Name"))
            {
                sb.Append($" get {{ return base.Artifact.TextIdentifier; }}");
                sb.Append($" set {{ base.Artifact.TextIdentifier = value; }}");
            }
            else
            {
                var parseString = $"Guid.Parse({WriterUtils.GetFieldGuidClass(objDef)}.{field.Name})";
                sb.Append($" get {{ return base.Artifact.GetValue<{fieldType}>({parseString}); }}");
                sb.Append($" set {{ base.Artifact.SetValue({parseString}, value); }}");
            }
            sb.AppendLine("\t\t}");
        }