public void SetFromLdf()

in src/IdFix/Controls/IdFixGrid.cs [459:517]


        public void SetFromLdf(StreamReader reader, bool isUndo = false)
        {
            this.Reset();
            this._filledFromResults = false;
            this._pageCount = 1;

            string line;
            int lineIndex = 0;
            while ((line = reader.ReadLine()) != null)
            {
                if (line.IndexOf(": ", StringComparison.CurrentCulture) > -1)
                {
                    switch (line.Substring(0, line.IndexOf(": ", StringComparison.CurrentCulture)))
                    {
                        case "distinguishedName":
                            lineIndex = this.Rows.Add();
                            this.Rows[lineIndex].Cells[StringLiterals.DistinguishedName].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "commonName":
                            lineIndex = this.Rows.Add();
                            this.Rows[lineIndex].Cells[StringLiterals.CommonName].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "objectClass":
                            this.Rows[lineIndex].Cells[StringLiterals.ObjectClass].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "attribute":
                            this.Rows[lineIndex].Cells[StringLiterals.Attribute].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "error":
                            this.Rows[lineIndex].Cells[StringLiterals.Error].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "value":
                            this.Rows[lineIndex].Cells[StringLiterals.Value].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                        case "update":
                            this.Rows[lineIndex].Cells[StringLiterals.Update].Value = line.Substring(line.IndexOf(": ", StringComparison.CurrentCulture) + 2);
                            break;
                    }
                }
            }

            if (isUndo)
            {
                for (var i = 0; i < this.Rows.Count; i++)
                {
                    // auto fill the proposed action to undo so if they accept it will fill the drop downs as expected
                    this.Rows[i].Cells[StringLiterals.ProposedAction].Value = StringLiterals.Undo;
                }
            }

            this.Sort(this.Columns[StringLiterals.DistinguishedName], ListSortDirection.Ascending);
            if (this.RowCount >= 1)
            {
                this.CurrentCell = this.Rows[0].Cells[StringLiterals.DistinguishedName];
            }

            // record the total number of rows added
            this._totalResults = lineIndex + 1;
        }