PredictiveCodeSuggestions.AutoTemplates.AutoTemplateBuilder.Build C# (CSharp) Method

Build() private method

Saves the workset.
private Build ( ) : void
return void
    private void Build()
    {
      var tempFileName = AutoTemplateManager.GetTempFileName();
      using (var output = new XmlTextWriter(tempFileName, Encoding.UTF8))
      {
        output.Formatting = Formatting.Indented;

        output.WriteStartElement("i");

        string key = null;
        var records = new List<Record>();

        var total = this.templates.Count;
        var count = 0;
        foreach (var record in this.templates.OrderBy(d => d.Key))
        {
          if (count % 25 == 0 || count == total - 1)
          {
            var progressIndicator = this.ProgressIndicator;
            if (progressIndicator != null)
            {
              progressIndicator.Text = string.Format("{0} of {1}", count, total);
            }
          }

          count++;

          if (record.Key != key)
          {
            key = record.Key;

            this.Build(output, records);
            records.Clear();
          }

          records.Add(record);
        }

        this.Build(output, records);

        output.WriteEndElement();
        output.Flush();
      }

      var fileName = AutoTemplateManager.GetAutoTemplatesFileName();

      lock (AutoTemplateManager.FileLock)
      {
        File.Delete(fileName);
        File.Move(tempFileName, fileName);
      }
    }

Same methods

AutoTemplateBuilder::Build ( XmlTextWriter output, List records ) : void
AutoTemplateBuilder::Build ( XmlTextWriter output, List records, int total ) : void