public string GetDescription(bool AlwaysMake = false) { if (Description != null && Description.Length > 0 && !AlwaysMake) { return(Description); } string DescrStr = ""; switch (Action) { case FirewallRule.Actions.Allow: DescrStr += Translate.fmt("str_allow") + " "; break; case FirewallRule.Actions.Block: DescrStr += Translate.fmt("str_block") + " "; break; } switch (Direction) { case FirewallRule.Directions.Inbound: DescrStr += Translate.fmt("str_inbound") + " "; break; case FirewallRule.Directions.Outboun: DescrStr += Translate.fmt("str_outbound") + " "; break; } DescrStr += ProgID.FormatString(); // todo: add more info return(DescrStr); }
public void Register() { if (DefaultIcon.IsNullOrWhiteSpace()) { DefaultIcon = "{0},{1}".FormatString(ChoPath.ToShortFileName(ChoApplication.EntryAssemblyLocation), DefaultIconIndex); } Registry.ClassesRoot.CreateSubKey(Extension, RegistryKeyPermissionCheck.ReadWriteSubTree).SetValue("", ProgID); if (!ProgID.IsNullOrWhiteSpace()) { using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(ProgID)) { if (Description != null) { key.SetValue("", Description); } if (DefaultIcon != null) { key.CreateSubKey("DefaultIcon").SetValue("", DefaultIcon); } if (Application != null) { key.CreateSubKey(@"Shell\Open\Command").SetValue("", "{0} {1}\"%1\" {2}".FormatString(Application, DefaultArgSwitch, AdditionalArguments)); } } } }
public void Unregister() { Registry.ClassesRoot.DeleteSubKeyTree(Extension, false); if (!ProgID.IsNullOrWhiteSpace()) { Registry.ClassesRoot.DeleteSubKeyTree(ProgID, false); } }
public override int GetHashCode() { return(ProgID.GetSafeHashCode() ^ Name.GetSafeHashCode() ^ Clsid.GetHashCode() ^ Source.GetHashCode()); }