using System; using System.Collections.Generic; using System.IO; namespace Wox.Plugin { public class Result { public string Title { get; set; } public string SubTitle { get; set; } public string IcoPath { get; set; } public string FullIcoPath { get { if (string.IsNullOrEmpty(IcoPath)) return string.Empty; if (IcoPath.StartsWith("data:")) { return IcoPath; } return Path.Combine(PluginDirectory, IcoPath); } } /// /// return true to hide wox after select result /// public Func Action { get; set; } public int Score { get; set; } /// /// Only resulsts that originQuery match with curren query will be displayed in the panel /// internal Query OriginQuery { get; set; } /// /// Plugin directory /// public string PluginDirectory { get; internal set; } public override bool Equals(object obj) { Result r = obj as Result; if (r != null) { return string.Equals(r.Title, Title) && string.Equals(r.SubTitle, SubTitle); } else { return false; } } public override int GetHashCode() { var hashcode = (Title?.GetHashCode() ?? 0) ^ (SubTitle?.GetHashCode() ?? 0); return hashcode; } public override string ToString() { return Title + SubTitle; } public Result() { } public Result(string Title = null, string IcoPath = null, string SubTitle = null) { this.Title = Title; this.IcoPath = IcoPath; this.SubTitle = SubTitle; } [Obsolete("Use IContextMenu instead")] /// /// Context menus associate with this result /// public List ContextMenu { get; set; } /// /// Additional data associate with this result /// public object ContextData { get; set; } /// /// Plugin ID that generate this result /// public string PluginID { get; set; } } }