/// <summary> /// Add or removes path from the folderList_. /// </summary> /// <param name="path"></param> /// <param name="add"></param> protected virtual void ExchangePath(string path, bool add) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } // if (add) { if (!_folderList.Contains(path)) { _folderList.Add(path); // notfiy add OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Checked)); } } else { if (_folderList.Contains(path)) { _folderList.Remove(path); // notfiy remove OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Unchecked)); } } }
private static void GetDotNetVersion(Microsoft.Win32.RegistryKey parentKey, string subVersionName, System.Collections.ObjectModel.Collection <Version> versions) { if (parentKey != null) { string installed = Convert.ToString(parentKey.GetValue("Install")); if (installed == "1") { string version = Convert.ToString(parentKey.GetValue("Version")); if (string.IsNullOrEmpty(version)) { if (subVersionName.StartsWith("v")) { version = subVersionName.Substring(1); } else { version = subVersionName; } } Version ver = new Version(version); if (!versions.Contains(ver)) { versions.Add(ver); } } } }
// Returns number of colors in bitmap public static int ColorCount(Bitmap bmp) { System.Collections.ObjectModel.Collection <int> palette = new System.Collections.ObjectModel.Collection <int>(); int currcolor; for (int y = 0; y <= bmp.Height - 1; y++) { for (int x = 0; x <= bmp.Width - 1; x++) { currcolor = bmp.GetPixel(x, y).ToArgb(); if (!palette.Contains(currcolor)) { palette.Add(currcolor); } } } return(palette.Count); }
public System.Collections.ObjectModel.Collection <string> HeaderNames(System.Collections.ObjectModel.Collection <string> list) { if (Identification != null) { for (int i = 0; i <= Identification.Length - 1; i++) { if (Identification[i] == null) { continue; } if (Identification[i].Group == "header") { if (list.Contains(Identification[i].Name) == false) { list.Add(Identification[i].Name); } } } } if (Capture != null) { for (int i = 0; i <= Capture.Length - 1; i++) { if (Capture[i] == null) { continue; } if (Capture[i].Group == "header") { if (list.Contains(Capture[i].Name) == false) { list.Add(Capture[i].Name); } } } } for (int i = 0; i <= DefaultChildren.Count - 1; i++) { string key = (string)DefaultChildrenKeys[i]; Node node = DefaultChildren[key]; if (node.NameType == nBrowser.NodeType.DefaultBrowser) { list = node.HeaderNames(list); } } for (int i = 0; i <= Children.Count - 1; i++) { string key = (string)ChildrenKeys[i]; Node node = Children[key]; if (node.NameType == nBrowser.NodeType.Gateway) { list = node.HeaderNames(list); } } for (int i = 0; i <= Children.Count - 1; i++) { string key = (string)ChildrenKeys[i]; Node node = Children[key]; if (node.NameType == nBrowser.NodeType.Browser) { list = node.HeaderNames(list); } } return(list); }