Changeset 1488


Ignore:
Timestamp:
01/09/10 04:10:17 (5 years ago)
Author:
lowjoel
Message:

Fixed crash when editing a pass that was temporary created in the same Settings session. Also, when editing a pass, be sure to update the passes list-view control.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.DefaultPlugins/SettingsForm.cs

    r1484 r1488  
    9595                //Remove the old definition of the erasure method 
    9696                CustomErasureMethod method = editorForm.Method; 
    97                 if (removeCustomMethods.IndexOf(method.Guid) == -1) 
     97                if (customMethods.ContainsKey(method.Guid) && 
     98                    removeCustomMethods.IndexOf(method.Guid) == -1) 
     99                { 
    98100                    removeCustomMethods.Add(method.Guid); 
     101                } 
    99102 
    100103                //Add the new definition 
    101104                foreach (CustomErasureMethod addMethod in addCustomMethods) 
     105                { 
    102106                    if (addMethod.Guid == method.Guid) 
    103107                    { 
     
    105109                        break; 
    106110                    } 
    107  
    108                 customMethods[method.Guid] = method; 
     111                } 
     112 
    109113                addCustomMethods.Add(method); 
    110114                item.Tag = method; 
     115                UpdateMethod(item); 
    111116            } 
    112117        } 
     
    185190        } 
    186191 
     192        /// <summary> 
     193        /// Updates the UI which represents the given custom erasure method. 
     194        /// </summary> 
     195        /// <param name="item">The method to update.</param> 
     196        private void UpdateMethod(ListViewItem item) 
     197        { 
     198            CustomErasureMethod method = (CustomErasureMethod)item.Tag; 
     199            item.Text = method.Name; 
     200            item.SubItems[1].Text = method.Passes.Length.ToString(CultureInfo.CurrentCulture); 
     201        } 
     202 
    187203        private Dictionary<Guid, CustomErasureMethod> customMethods; 
    188204        private List<CustomErasureMethod> addCustomMethods = new List<CustomErasureMethod>(); 
Note: See TracChangeset for help on using the changeset viewer.