public override int GetHashCode() { return(ProgramPath.GetHashCode() + Delay.GetHashCode() + Arguments.GetHashCode() + StartIn.GetHashCode() + (CreateNoWindow ? 7 : 13) + (UseShellExecute ? 9 : 27)); }
public bool ShouldDiscard() { if (IsEmpty()) { return(true); } if (ProgramName.Contains("Microsoft® Windows® Operating System")) { return(true); } if (ProgramPath.ToLower().Trim().EndsWith("explorer.exe")) { return(true); } if (ProgramPath.ToLower().Trim().EndsWith("windows-app.exe")) { return(true); } return(false); }
/// <summary> /// 扫描目录内所有 Program 插件; /// </summary> /// <param name="ProgramDirectory">插件目录</param> /// <param name="Extension">文件扩展名</param> /// <returns></returns> public static IEnumerable <ProgramTemplateClass> ScanProgramPlugins(string ProgramDirectory, string Extension = ".dll") { LogController.Debug("扫描 Program 插件 : {0}", ProgramDirectory); if (!Directory.Exists(ProgramDirectory)) { yield break; } foreach (string ProgramPath in Directory.GetFiles(ProgramDirectory).Where(ProgramPath => ProgramPath.ToLower().EndsWith(Extension))) { LogController.Debug("发现 Program 插件 dll 文件 : {0}", ProgramPath); Assembly ProgramAssembly = AssemblyController <ProgramTemplateClass> .CreateAssembly(ProgramPath); if (ProgramAssembly == null) { continue; } foreach (ProgramTemplateClass ProgramInstance in AssemblyController <ProgramTemplateClass> .CreateTypeInstance(ProgramAssembly)) { LogController.Info("创建 Program 实例 : {0} ({1})", ProgramInstance.Name, ProgramInstance.Description); yield return(ProgramInstance); } } }