public static IEnumerable <CodeValuePair> EnumerateStdSourceParams(ISourceRef source) { if ((source != null) && !string.IsNullOrEmpty(source.SourcePath)) { string tmp = source.SourcePath; yield return(new CodeValuePair() { Code = TemplParams.FilePath, Value = tmp }); yield return(new CodeValuePair() { Code = TemplParams.DirPath, Value = TemplParams.GetDirPath(tmp) }); yield return(new CodeValuePair() { Code = TemplParams.FileName, Value = TemplParams.GetFileName(tmp) }); yield return(new CodeValuePair() { Code = TemplParams.FileExt, Value = TemplParams.GetFileExt(tmp) }); } }
/// <summary> /// Checks if this command can be applied to the target media file. /// <paramref name="srf"/> must implement <see cref="ISourceRef"/>. /// </summary> /// <param name="srf">Must implement <see cref="ISourceRef"/></param> /// <returns></returns> public virtual bool CanExecute(ISourceRef srf) { if (srf == null) { return(false); } if (this.ApplicableFileExtensions != null) { if (!this.ApplicableFileExtensions.Contains(TemplParams.GetFileExt(srf.SourcePath))) { return(false); } } return(true); }