Exemplo n.º 1
0
        private void btnLightsEditor_Click(object sender, RoutedEventArgs e)
        {
            if (this.DataContext != null && this.DataContext.GetType() == typeof(DatabaseIndexData))
            {
                DatabaseIndexData index = (DatabaseIndexData)this.DataContext;

                ViewLotEditor editor = new ViewLotEditor(index.Index, FlattenToPropertiesDictionary());
                if (editor.ShowDialog().GetValueOrDefault(false))
                {
                    //     displayProperties = editor.Properties;
                    //Value_PropertyChanged(this, new EventArgs());

                    //if the text has been changed, create a new modifiedIndex
                    DatabaseIndex originalIndex = DatabaseManager.Instance.Find(i => i.TypeId == index.Index.TypeId &&
                                                                                i.GroupContainer == index.Index.GroupContainer &&
                                                                                i.InstanceId == index.Index.InstanceId);
                    originalIndex.IsModified = true;
                    ModifiedPropertyFile newpropertyFile = new ModifiedPropertyFile();
                    newpropertyFile.PropertyFile               = new PropertyFile();
                    newpropertyFile.PropertyFile.Values        = editor.UnitFileEntry.Save();
                    newpropertyFile.PropertyFile.PropertyCount = (uint)newpropertyFile.PropertyFile.Values.Count;
                    originalIndex.ModifiedData = newpropertyFile;

                    ReloadDisplayProperties(newpropertyFile.PropertyFile.Values);
                }
            }
        }
Exemplo n.º 2
0
 void Value_PropertyChanged(object sender, EventArgs e)
 {
     if (this.DataContext.GetType() == typeof(DatabaseIndexData))
     {
         DatabaseIndexData index = (DatabaseIndexData)this.DataContext;
         //if the text has been changed, create a new modifiedIndex
         DatabaseIndex originalIndex = DatabaseManager.Instance.Find(i => i.TypeId == index.Index.TypeId &&
                                                                     i.GroupContainer == index.Index.GroupContainer &&
                                                                     i.InstanceId == index.Index.InstanceId);
         originalIndex.IsModified = true;
         ModifiedPropertyFile propertyFile = new ModifiedPropertyFile();
         propertyFile.PropertyFile               = new PropertyFile();
         propertyFile.PropertyFile.Values        = FlattenToPropertiesDictionary();
         propertyFile.PropertyFile.PropertyCount = (uint)propertyFile.PropertyFile.Values.Count;
         originalIndex.ModifiedData              = propertyFile;
     }
 }
Exemplo n.º 3
0
        private void btnDebug_Click(object sender, RoutedEventArgs e)
        {
            if (this.DataContext.GetType() == typeof(DatabaseIndexData))
            {
                DatabaseIndexData index = (DatabaseIndexData)this.DataContext;
                //if the text has been changed, create a new modifiedIndex

                DatabaseIndex originalIndex = DatabaseManager.Instance.Find(i => i.TypeId == index.Index.TypeId &&
                                                                            i.GroupContainer == index.Index.GroupContainer &&
                                                                            i.InstanceId == index.Index.InstanceId);
                //  originalIndex.IsModified = true;
                ModifiedPropertyFile propertyFile = new ModifiedPropertyFile();
                propertyFile.PropertyFile        = new PropertyFile();
                propertyFile.PropertyFile.Values = new Dictionary <uint, Property>();
                foreach (PropertyModel prop in displayProperties)
                {
                    if (prop.IsArray)
                    {
                        if (prop.ArrayIndex == 0)
                        {
                            ArrayProperty arrayProp = new ArrayProperty();
                            arrayProp.PropertyType = prop.Value.GetType();
                            arrayProp.Values.Add(prop.Value);

                            propertyFile.PropertyFile.Values.Add(prop.Id, arrayProp);
                        }
                        else
                        {
                            ArrayProperty arrayProp = (ArrayProperty)propertyFile.PropertyFile.Values[prop.Id];
                            arrayProp.Values.Add(prop.Value);
                        }
                    }
                    else
                    {
                        propertyFile.PropertyFile.Values.Add(prop.Id, prop.Value);
                    }
                }
                propertyFile.PropertyFile.PropertyCount = (uint)propertyFile.PropertyFile.Values.Count;
                //
                // originalIndex.ModifiedData = propertyFile;

                ViewHexDiff diff = new ViewHexDiff(index.Data, propertyFile.GetData());
                diff.ShowDialog();
            }
        }
Exemplo n.º 4
0
 private void UpdateFile()
 {
     //update properties
     if (this.DataContext.GetType() == typeof(DatabaseIndexData))
     {
         DatabaseIndexData index = (DatabaseIndexData)this.DataContext;
         //if the text has been changed, create a new modifiedIndex
         DatabaseIndex originalIndex = DatabaseManager.Instance.Find(i => i.TypeId == index.Index.TypeId &&
                                                                     i.GroupContainer == index.Index.GroupContainer &&
                                                                     i.InstanceId == index.Index.InstanceId);
         originalIndex.IsModified = true;
         ModifiedPropertyFile propertyFile = new ModifiedPropertyFile();
         propertyFile.PropertyFile               = new PropertyFile();
         propertyFile.PropertyFile.Values        = PathFileEntry.Save();
         propertyFile.PropertyFile.PropertyCount = (uint)propertyFile.PropertyFile.Values.Count;
         originalIndex.ModifiedData              = propertyFile;
         originalIndex.Compressed = false;
     }
 }