Ejemplo n.º 1
0
 public SimpleMemberPattern(IEnumerable <IMarshalValueRule> marshallingRules, NameLookup nameLookup, Dictionary <string, TypeDeclaration> typeData, CommentGenerator commentGenerator)
 {
     this.marshallingRules = marshallingRules;
     this.nameLookup       = nameLookup;
     this.typeData         = typeData;
     this.commentGenerator = commentGenerator;
 }
Ejemplo n.º 2
0
 public ArrayMemberPattern(IEnumerable <IMarshalValueRule> marshallingRules, NameLookup nameLookup, ParsedExpressionBuilder expressionBuilder, CommentGenerator commentGenerator)
 {
     this.marshallingRules  = marshallingRules;
     this.nameLookup        = nameLookup;
     this.expressionBuilder = expressionBuilder;
     this.commentGenerator  = commentGenerator;
 }
Ejemplo n.º 3
0
 public CommentGenerator ReadXml(string filePath, CommentGenerator content)
 {
     using (XmlReader reader = XmlReader.Create(filePath))
     {
         return(content.ReadComponentsXml(reader));
     }
 }
Ejemplo n.º 4
0
        public void WriteXML(string filePath, CommentGenerator content)
        {
            string fileName = Path.GetFileName(filePath);
            // We want some non-default settings for our XML writer.
            // Specifically, use indentation to make it more readable.
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("  ");

            // Create an XmlWriter inside this block, and automatically Dispose() it at the end.
            try
            {
                using (XmlWriter writer = XmlWriter.Create(filePath, settings))
                {
                    writer.WriteStartDocument();
                    writer.WriteStartElement(content.Type); //<First>
                    writer.WriteAttributeString("version", content.Version);

                    content.WriteAllcommentsXml(writer);

                    //writer.WriteEndAttribute(); // Ends the spreadsheet block TODO: will this say </spreadsheet> ?
                    writer.WriteEndDocument();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 5
0
 public VerbInfoMemberPattern(Dictionary <string, TypeDeclaration> typeData, NameLookup nameLookup, NamespaceMap namespaceMap, IServiceProvider provider, CommentGenerator commentGenerator)
 {
     this.typeData         = typeData;
     this.nameLookup       = nameLookup;
     this.namespaceMap     = namespaceMap;
     this.provider         = provider;
     this.commentGenerator = commentGenerator;
 }
Ejemplo n.º 6
0
 public FixedLengthMemberPattern(Dictionary <string, TypeDeclaration> typeData, NameLookup nameLookup, IEnumerable <ConstantDeclaration> constants, IEnumerable <IMarshalValueRule> marshallingRules, CommentGenerator commentGenerator)
 {
     this.typeData         = typeData;
     this.nameLookup       = nameLookup;
     this.constantsLookup  = constants.ToDictionary(x => x.VkName);
     this.marshallingRules = marshallingRules;
     this.commentGenerator = commentGenerator;
 }
 public ArraySingularMemberPattern(IEnumerable <IMarshalValueRule> marshallingRules, NameLookup nameLookup, ParsedExpressionEqualityCheck expressionEqualityCheck, CommentGenerator commentGenerator, IServiceProvider provider)
 {
     this.marshallingRules        = marshallingRules;
     this.nameLookup              = nameLookup;
     this.expressionEqualityCheck = expressionEqualityCheck;
     this.commentGenerator        = commentGenerator;
     this.provider = provider;
 }
Ejemplo n.º 8
0
 private Question GenerateQuestion(Guid?userId = null, string title = null, string question = null, IEnumerable <Tag> tags = null)
 {
     return(new Question
     {
         Id = Guid.NewGuid(),
         Author = userId.HasValue ? Users.Single(u => u.Id == userId.Value) : Users[Random.Next(0, Users.Count - 1)],
         Tags = tags == null?Tags.OrderBy(t => Random.Next(0, 100)).Take(Random.Next(1, 4)).OrderBy(t => t.Name).ToList() : tags.ToList(),
                    Text = string.IsNullOrEmpty(question) ? WaffleEngine.Text(Random.Next(1, 3), false) : question,
                    Title = string.IsNullOrEmpty(title) ? WaffleEngine.Title() : title,
                    Votes = VoteGenerator.GenerateForever().Take(Random.Next(0, 50)).ToList(),
                    Timestamp = string.IsNullOrEmpty(title) ? new Faker().Date.Past(1, DateTime.Now) : DateTime.Now,
                    Comments = CommentGenerator.GenerateForever().Take(Random.Next(0, 10)).ToList(),
                    Answers = AnswerGenerator.GenerateForever().Take(Random.Next(0, 5)).ToList()
     });
 }
        /// <summary>
        /// Opens an exisiting cg file.
        /// </summary>
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //is user has unsaved changes, prompt to save them.
            if (unsavedChanges == true)
            {
                Save();
            }

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.DefaultExt = CG_EXT;
            dlg.Filter     = DEFAULT_FILTER;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                currentFileName = dlg.FileName;
                cg = cg.ReadXml(currentFileName);
                UpdateDisplay();
            }
        }
 public CommentGeneratorGUI()
 {
     cg = new CommentGenerator();
     InitializeComponent();
     UpdateDisplay();
 }
Ejemplo n.º 11
0
 public ArrayLenMemberPattern(ParsedExpressionTokenCheck tokenCheck, NameLookup nameLookup, CommentGenerator commentGenerator)
 {
     this.tokenCheck       = tokenCheck;
     this.nameLookup       = nameLookup;
     this.commentGenerator = commentGenerator;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Register a program entity which can be bound to comments.
        /// </summary>
        /// <param name="cx">Extractor context.</param>
        /// <param name="entity">Program entity.</param>
        /// <param name="l">Location of the entity.</param>
        public void BindComments(IEntity entity, Microsoft.CodeAnalysis.Location l)
        {
            var duplicationGuardKey = tagStack.Count > 0 ? tagStack.Peek() : null;

            CommentGenerator.AddElement(entity.Label, duplicationGuardKey, l);
        }
Ejemplo n.º 13
0
 public VersionMemberPattern(NameLookup nameLookup, CommentGenerator commentGenerator)
 {
     this.nameLookup       = nameLookup;
     this.commentGenerator = commentGenerator;
 }