private void mnuProperty_Click(object sender, RoutedEventArgs e) { TGIRecord record = new TGIRecord(); ViewPropertyRegistryRecord window = new ViewPropertyRegistryRecord(record); window.ShowDialog(); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { TGIRecord record = (TGIRecord)((MenuItem)sender).DataContext; ViewPropertyRegistryRecord window = new ViewPropertyRegistryRecord(record); window.ShowDialog(); dataGrid1.Items.Refresh(); }
public bool TextFilter(object o) { DatabaseIndex p = (o as DatabaseIndex); if (comboboxInstances.SelectedItem == null) { if (!string.IsNullOrEmpty(comboboxInstances.Text)) { if (!IsMatchRegex(p.InstanceId.ToHex(), comboboxInstances.Text)) { return(false); } } } else { TGIRecord entry = (TGIRecord)comboboxInstances.SelectedItem; if (p.InstanceId != entry.Id) { return(false); } } if (comboboxGroups.SelectedItem == null) { if (!string.IsNullOrEmpty(comboboxGroups.Text)) { if (!IsMatchRegex(p.GroupContainer.ToHex(), comboboxGroups.Text)) { return(false); } } } else { TGIRecord entry = (TGIRecord)comboboxGroups.SelectedItem; if (p.GroupId != entry.Id) { return(false); } } if (comboboxTypes.SelectedItem != null) { TGIRecord entry = (TGIRecord)comboboxTypes.SelectedItem; if (p.TypeId != entry.Id) { return(false); } } return(true); }
private void _LoadFromDatabase(SQLiteConnection dbConn) { SQLiteCommand query = dbConn.CreateCommand(); query.CommandText = "select * from " + _tableName; SQLiteDataReader reader = query.ExecuteReader(); while (reader.Read()) { TGIRecord newRecord; newRecord = new TGIRecord(); uint currentId = (uint)(System.Convert.ToInt64(reader["id"]) & 0xFFFFFFFF); // masking required because SQLite uses dynamically sized int's for (int i = 0; i < reader.FieldCount; i++) { string keyName = reader.GetName(i).ToString(); string keyValue = reader.GetValue(i).ToString(); if (_tableKeys.Contains(keyName)) // if we found a valid column.. { if (newRecord.Keys.ContainsKey(keyName)) // dupe check { newRecord.Keys.Remove(keyName); } newRecord.Keys.Add(keyName, keyValue); } } if (_cache.ContainsKey(currentId)) // check if we're going to override a existing value from the main DB { _cache.Remove(currentId); // if so update the original record (could contain more info) with the user's name & comments } _cache.Add(currentId, newRecord); } reader.Dispose(); }
public void InsertRecord(TGIRecord newRecord) { if (_cache.ContainsKey(newRecord.Id)) { _cache.Remove(newRecord.Id); } _cache.Add(newRecord.Id, newRecord); string queryString = "insert or replace into " + _tableName + " (" + newRecord.FormatSqlKeys() + ") values ('" + newRecord.FormatSqlValues() + "')"; SQLiteCommand query = _dbUserConn.CreateCommand(); query.CommandText = queryString; query.ExecuteNonQuery(); if (RegistryChanged != null) // updates display names { try // nasty, triggers a non-vital thread violation sometimes when FNV importing... { this.RegistryChanged(this, newRecord); } catch { } } }
public PropertyModel(uint id, Property property, bool isArray, int arrayIndex) { Id = id; Value = property; _isArray = isArray; _arrayIndex = arrayIndex; //check if a record exists for this property. If not, create it. if (TGIRegistry.Instance.Properties.Cache.TryGetValue(Id, out _propertyDetails) == false) { _propertyDetails = new TGIRecord() { Id = id }; } object[] attributes = property.GetType().GetCustomAttributes(typeof(PropertyDefinitionAttribute), false); if (attributes.Length > 0) { PropertyDefinitionAttribute attribute = (PropertyDefinitionAttribute)attributes[0]; _propertyType = attribute.Name; } }