public IconManagerEventArgs(string value) { this.Style = IconType.None; this.Value = value; if (Directory.Exists(value)) { this.Style = IconType.Directory; string str = value; int startIndex = str.LastIndexOf('\\') + 1; if (startIndex >= str.Length) { startIndex = 0; } this.Name = value.Substring(startIndex); this.Image = GetIcon.GetDirectoryIcon().ToBitmap(); } if (System.IO.File.Exists(value)) { this.Style = IconType.File; this.Name = Path.GetFileNameWithoutExtension(value); this.Image = GetIcon.GetFileIcon(value).ToBitmap(); } if (Regex.IsMatch(value, @"^(https?://)?([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$")) { if (!Regex.IsMatch(value, "^http://")) { value = "http://" + value; } this.Value = value; this.Style = IconType.Url; this.SetUrl(value); } }
public void LoadIcon(string name, IconDock control) { bool flag = false; XmlElement userNode = this.GetUserNode(name); if (userNode != null) { foreach (XmlNode node in userNode.SelectNodes("IconDock/Icon")) { XmlElement element2 = node as XmlElement; if (element2 == null) { continue; } string attribute = element2.GetAttribute("style"); string str2 = element2.GetAttribute("title"); string str3 = element2.GetAttribute("icon"); string path = element2.GetAttribute("value"); string str5 = element2.GetAttribute("row"); string str6 = element2.GetAttribute("column"); ButtonControl control2 = new ButtonControl(control) { DockRow = this.ToInt(str5), DockColumn = this.ToInt(str6), IconName = str3 }; string str7 = attribute; if (str7 != null) { if (!(str7 == "exe")) { if (str7 == "system") { goto Label_015B; } if (str7 == "url") { goto Label_01A6; } if (str7 == "add") { goto Label_01BC; } } else { control2.ClickStyle = ButtonClickStyle.Exe; if (File.Exists(path)) { control2.Icon = GetIcon.GetFileIcon(control2.ClickText).ToBitmap(); } if (Directory.Exists(path)) { control2.Icon = GetIcon.GetDirectoryIcon().ToBitmap(); } } } goto Label_01D5; Label_015B: control2.ClickStyle = ButtonClickStyle.System; if (str3 != string.Empty) { control2.Icon = ResourceUtil.GetBitmap(str3); } List <string> list2 = UserInfo.get_Gnqx(); if ((!UserInfo.get_IsAdmin() && (list2 != null)) && !list2.Contains(path)) { control.DeleteButton(control2); } goto Label_01D5; Label_01A6: control2.ClickStyle = ButtonClickStyle.URL; control2.Icon = Resources.net; goto Label_01D5; Label_01BC: if (!flag) { control2.ClickStyle = ButtonClickStyle.Add; control2.Icon = Resources.addIcon; flag = true; } Label_01D5: control2.Title = str2; control2.ClickText = path; } if (!flag) { ButtonControl control3 = new ButtonControl(control) { ClickStyle = ButtonClickStyle.Add, ClickText = "添加", Icon = Resources.addIcon }; } } }