// Close this key and flush any modifications to disk. public void Close() { if(provider != null) { provider.Close(writable); provider = null; } }
// Close this key and flush any modifications to disk. public void Close() { if (provider != null) { provider.Close(writable); provider = null; } }
// Delete this key entry and all of its descendents. public void DeleteTree() { // Collect up all of the children. IRegistryKeyProvider[] children; lock (this) { if (deleted) { // Ignore the operation if we are already deleted. return; } if (subkeys != null) { children = new IRegistryKeyProvider [subkeys.Count]; IDictionaryEnumerator e = subkeys.GetEnumerator(); int index = 0; while (e.MoveNext()) { children[index++] = (IRegistryKeyProvider)(e.Value); } } else { children = null; } } // Recursively delete the children. if (children != null) { int posn; for (posn = 0; posn < children.Length; ++posn) { children[posn].DeleteTree(); } } // Delete this key entry. If new subkeys were // added in the meantime, then simply ignore them. lock (this) { deleted = true; if (subkeys != null && subkeys.Count != 0) { subkeys.Clear(); } subkeys = null; if (values != null && values.Count != 0) { values.Clear(); } values = null; } }
// Constructor. private RegistryKey(IRegistryKeyProvider provider, bool writable) { this.name = provider.Name; this.provider = provider; this.writable = writable; }
// Delete this key entry and all of its descendents. public void DeleteTree() { // Collect up all of the children. IRegistryKeyProvider[] children; lock(this) { if(deleted) { // Ignore the operation if we are already deleted. return; } if(subkeys != null) { children = new IRegistryKeyProvider [subkeys.Count]; IDictionaryEnumerator e = subkeys.GetEnumerator(); int index = 0; while(e.MoveNext()) { children[index++] = (IRegistryKeyProvider)(e.Value); } } else { children = null; } } // Recursively delete the children. if(children != null) { int posn; for(posn = 0; posn < children.Length; ++posn) { children[posn].DeleteTree(); } } // Delete this key entry. If new subkeys were // added in the meantime, then simply ignore them. lock(this) { deleted = true; if(subkeys != null && subkeys.Count != 0) { subkeys.Clear(); } subkeys = null; if(values != null && values.Count != 0) { values.Clear(); } values = null; } }