コード例 #1
0
 public Clone(FileDescriptor root, MessageDescriptor message, string destNS, string protoNS)
 {
     this.root           = root;
     this.message        = message;
     this.Doc            = JsonDoc.Files[root.Name].Messages[message.Name];
     this.nameSpace      = destNS;
     this.protoNameSpace = protoNS;
 }
コード例 #2
0
        public FieldDoc(Proto.Doc.field field)
        {
            this.field = field;
            string base0;

            this.Comments = MessageDoc.GetComments(field.Name, field.Description, out this.Attributes, out base0);
            if (!string.IsNullOrEmpty(base0))
            {
                throw new Exception("Base class name is unexpected for field:" + field.Name);
            }
        }
コード例 #3
0
 //bool isSpecial = false;
 public Property(FileDescriptor root, MessageDescriptor message, FieldDescriptor field)
 {
     this.root      = root;
     this.message   = message;
     this.field     = field;
     this.Doc       = JsonDoc.Files[root.Name].Messages[message.Name].Fields[field.Name];
     this.DocMes    = JsonDoc.Files[root.Name].Messages[message.Name];
     this.ClassName = message.Name.ToNameCs();
     this.FieldName = field.Name.ToNameCs();
     this.FieldType = field.ToTypeCs();
 }
コード例 #4
0
        public EnumDoc(Proto.Doc.enums enums)
        {
            this.enums = enums;
            foreach (var t in enums.Values)
            {
                Values[t.Name] = new ValueDoc(t);
            }
            string base0;

            this.Comments = MessageDoc.GetComments(enums.Name, enums.Description, out this.Attributes, out base0);
            if (!string.IsNullOrEmpty(base0))
            {
                throw new Exception("Base class name is unexpected for enum value:" + enums.Name);
            }
        }
コード例 #5
0
 public MessageDoc(Proto.Doc.message message)
 {
     this.message = message;
     foreach (var t in message.Fields)
     {
         Fields[t.Name] = new FieldDoc(t);
     }
     this.Comments = MessageDoc.GetComments(message.Name, message.Description, out this.Attributes, out this.BaseClass);
     if (!string.IsNullOrEmpty(this.BaseClass))
     {
         this.IsDefaultBase = false;
         string s = this.BaseClass.Substring(this.BaseClass.IndexOf(':') + 1).TrimStart();
         if (s.Contains("VmBindable"))
         {
             this.IsBindableBase = true;
         }
         if (s.Contains("VmEditable"))
         {
             this.IsBindableBase = true;
             this.IsEditableBase = true;
         }
         if (s.Contains("VmValidatable") || s.Contains("VmValidatableWithSeverityAndAttributes") ||
             s.Contains("VmValidatableWithSeverity"))
         {
             this.IsBindableBase    = true;
             this.IsEditableBase    = true;
             this.IsValidatableBase = true;
         }
         if (s.Contains("ConfigObjectCommonBase"))
         {
             this.IsConfigObjectBase = true;
             this.IsBindableBase     = true;
             this.IsEditableBase     = true;
             this.IsValidatableBase  = true;
         }
         if (s.Contains("ConfigObjectVmBase"))
         {
             this.IsConfigObjectBase = true;
             this.IsBindableBase     = true;
             this.IsEditableBase     = true;
             this.IsValidatableBase  = true;
         }
         if (s.Contains("ConfigObjectVmGenSettings"))
         {
             this.IsConfigObjectBase = true;
             this.IsGenSettings      = true;
             this.IsDefaultBase      = true;
             this.IsBindableBase     = true;
             this.IsEditableBase     = true;
             this.IsValidatableBase  = true;
         }
     }
     else
     {
         this.IsDefaultBase      = true;
         this.IsConfigObjectBase = true;
         this.IsGenSettings      = true;
         this.IsBindableBase     = true;
         this.IsEditableBase     = true;
         this.IsValidatableBase  = true;
     }
 }
コード例 #6
0
 public AcceptValidator(FileDescriptor root, MessageDescriptor message)
 {
     this.root    = root;
     this.message = message;
     this.Doc     = JsonDoc.Files[root.Name].Messages[message.Name];
 }
コード例 #7
0
        public Class(FileDescriptor root, MessageDescriptor message, Dictionary <string, List <MessageDescriptor> > dicParents,
                     string destNS, string protoNS, string defaultBaseClass)
        {
            var _logger = Logger.CreateLogger(this);

            this.root           = root;
            this.message        = message;
            this.dicParents     = dicParents;
            this.nameSpace      = destNS;
            this.protoNameSpace = protoNS;
            //_logger.LogInformation("Message {Name}".CallerInfo(), message.Name);
            _logger.LogInformation("Message {0}".CallerInfo(), message.Name);
            if (!JsonDoc.Files.ContainsKey(root.Name))
            {
            }
            if (!JsonDoc.Files[root.Name].Messages.ContainsKey(message.Name))
            {
            }
            this.Doc = JsonDoc.Files[root.Name].Messages[message.Name];
            _logger.LogInformation("Base class from doc '{Name}'".CallerInfo(), this.Doc.BaseClass);
            if (this.Doc.BaseClass == "")
            {
                this.Doc.BaseClass = " : " + defaultBaseClass + "<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>, IComparable<" + message.Name.ToNameCs() + ">, I" + root.Package.ToNameCs() + "AcceptVisitor";
            }
            else if (this.Doc.BaseClass == "VmBindable")
            {
                //this.Doc.BaseClass = " : " + this.Doc.BaseClass + "<" + message.Name.ToNameCs() + ">";
                this.Doc.BaseClass = " : VmBindable";
            }
            else if (this.Doc.BaseClass == "VmEditable")
            {
                this.Doc.BaseClass = " : VmEditable<" + message.Name.ToNameCs() + ">";
            }
            else if (this.Doc.BaseClass == "VmValidatable")
            {
                this.Doc.BaseClass = " : VmValidatable<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>";
            }
            else if (this.Doc.BaseClass == "VmValidatableWithSeverity")
            {
                this.Doc.BaseClass = " : VmValidatableWithSeverity<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>";
            }
            else if (this.Doc.BaseClass == "VmValidatableWithSeverityAndAttributes")
            {
                this.Doc.BaseClass = " : VmValidatableWithSeverityAndAttributes<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>";
            }
            else if (this.Doc.BaseClass == "ConfigObjectCommonBase")
            {
                this.Doc.BaseClass = " : ConfigObjectCommonBase<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>, IComparable<" + message.Name.ToNameCs() + ">, I" + root.Package.ToNameCs() + "AcceptVisitor";
            }
            else if (this.Doc.BaseClass == "ConfigObjectVmBase")
            {
                this.Doc.BaseClass = " : ConfigObjectVmBase<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>, IComparable<" + message.Name.ToNameCs() + ">, I" + root.Package.ToNameCs() + "AcceptVisitor";
            }
            else if (this.Doc.BaseClass == "ConfigObjectVmGenSettings")
            {
                this.Doc.BaseClass = " : ConfigObjectVmGenSettings<" + message.Name.ToNameCs() + ", " +
                                     message.Name.ToNameCs() + "Validator>, IComparable<" + message.Name.ToNameCs() + ">, I" + root.Package.ToNameCs() + "AcceptVisitor";
            }
            else
            {
            }
        }