public IcoListData(string id, string name, string group, string icofile, string exec, int order, bool ShellEx, IcoListRegType t) { Type = t; ID = id; Name = name; Group = group; IcoFile = icofile; Execute = exec; Order = order; UseShellEx = ShellEx; InitSuccess = true; try { string FullPath = FileTools.GetFullPath(Environment.ExpandEnvironmentVariables(IcoFile)); if (FullPath != null) { Ico = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables(FullPath)); } else { Ico = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables(IcoFile)); } if (Ico == null) { Ico = Resources.exec; } } catch { Ico = Resources.exec; } }
public IcoListData(string id, IcoListRegType t, RegistryKey reg) { Type = t; ID = id; Name = Convert.ToString(reg.GetValue("Name", "")); if (Name == "") { return; } Group = Convert.ToString(reg.GetValue("Group", "")); if (Group == "") { return; } IcoFile = Convert.ToString(reg.GetValue("IcoFile", "")); if (IcoFile == "") { return; } Execute = Convert.ToString(reg.GetValue("Execute", "")); if (Execute == "") { return; } try { Order = Convert.ToInt32(reg.GetValue("Order")); } catch { return; } try { UseShellEx = Convert.ToInt32(reg.GetValue("UseShellEx")) == 1 ? true : false; } catch { } InitSuccess = true; try { string FullPath = FileTools.GetFullPath(Environment.ExpandEnvironmentVariables(IcoFile)); if (FullPath != null) { Ico = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables(FullPath)); } else { Ico = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables(IcoFile)); } if (Ico == null) { Ico = Resources.exec; } } catch { Ico = Resources.exec; } }