private void ReadFields(BracketsNode node) { var fields = new List <Field>(); for (int i = 1; i < node.Count; i++) { var field = new Field(); field.Read(node[i]); if (field.Type == FieldType.RowVersion) { fields.Insert(0, field); } else { fields.Add(field); } MaxRowSize += field.MaxSize; } // add "free row" mark length MaxRowSize++; // add "short version" data length if (fields.Count > 0 && fields[0].Type == FieldType.RowVersion && RecordLock) { MaxRowSize += 8; } Fields = fields.AsReadOnly(); }
internal void Read(BracketsNode node) { Name = node[0]; var type = (string)node[1]; Type = type switch { "B" => FieldType.Binary, "L" => FieldType.Logical, "N" => FieldType.Numeric, "NC" => FieldType.NChar, "NVC" => FieldType.NVarChar, "RV" => FieldType.RowVersion, "NT" => FieldType.NText, "I" => FieldType.Image, "DT" => FieldType.DateTime, _ => throw new Exception($"{type} is unknown field type"), }; Nullable = node[2]; Length = node[3]; Precision = node[4]; CaseSensitive = node[5]; CalculateRealSize(); }
private static string GetData(BracketsNode node) { var dataType = (string)node[0]; switch (dataType) { case "R": // Reference return(node[1]); case "U": // Undefined return(""); case "S": // String return(node[1]); case "B": // Boolean return((string)node[1] == "0" ? "false" : "true"); case "P": // Complex data var str = new StringBuilder(); var subDataNode = node[1]; //var subDataType = (int)subDataNode[0]; // What's known (subDataNode): // 1 - additional data of "Authentication (Windows auth) in thin or thick client" // 2 - additional data of "Authentication in COM connection" event // 6 - additional data of "Authentication in thin or thick client" event // 11 - additional data of "Access denied" event // I hope this is temporarily method var subDataCount = subDataNode.Count - 1; if (subDataCount > 0) { for (var i = 1; i <= subDataCount; i++) { var value = GetData(subDataNode[i]); if (value != string.Empty) { str.AppendLine($"Item {i}: {value}"); } } } return(str.ToString()); default: return(""); } }
internal void Read(BracketsNode node) { var fields = new List <IndexField>(); Name = (string)node[0]; for (int i = 2; i < node.Count; i++) { var indexField = new IndexField(); indexField.Read(node[i]); fields.Add(indexField); } Fields = fields.AsReadOnly(); }
private void ReadIndexes(BracketsNode node) { var indexes = new List <Index>(); if (node.Count > 1) { for (int i = 1; i < node.Count; i++) { var index = new Index(); index.Read(node[i]); indexes.Add(index); } } Indexes = indexes.AsReadOnly(); }
internal Table(FileDatabaseStream stream, BracketsNode node) { Name = node[0]; for (int i = 2; i < node.Count; i++) { var currentNode = node[i]; string nodeName = currentNode[0]; switch (nodeName) { case "Fields": ReadFields(currentNode); break; case "Indexes": ReadIndexes(currentNode); break; case "Recordlock": RecordLock = currentNode[1]; break; case "Files": DataFilePage = currentNode[1]; UnlimitedLengthDataFilePage = currentNode[2]; IndexFilePage = currentNode[3]; break; default: throw new Exception($"{nodeName} is unknown table description node"); } } Rows = new TableRows(stream, this); }
internal void Read(BracketsNode node) { Name = node[0]; Length = node[1]; }