public static string ToFriendlyFileType(this SearchIndex input)
        {
            switch (input.DataType)
            {
            case "Object": return(input.Model.Split('.')?.Last());

            case "image/jpeg": return("Image (jpg)");

            case "image/png": return("Image (png)");

            case "image/gif": return("Image (gif)");

            case "application/pdf": return("PDF");

            case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return("Word");

            case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return("Powerpoint");

            case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return("Excel");

            case "video/mp4": return("Video (mp4)");

            case "text/html": return("HTML");

            default: return(input.DataType);
            }
        }
 public static string ToDetails(this SearchIndex item)
 {
     if (!string.IsNullOrWhiteSpace(item.Url))
     {
         return(item.Url);
     }
     else if (item.DataType == "Object")
     {
         return(item.MergedText);
     }
     else
     {
         return(item.Name);
     }
 }
Ejemplo n.º 3
0
        private List <SearchIndex> GetData()
        {
            var models = new List <SearchIndex>();

            var mediaFolders = Directory.EnumerateDirectories($"{mediaOutputFolder}", "*.*", SearchOption.TopDirectoryOnly);

            foreach (var media in mediaFolders)
            {
                var model = new SearchIndex
                {
                    Name       = Path.GetFileName(media),
                    Url        = $"{Path.GetFileName(media)}.mp4",
                    Id         = ConvertToAlphaNumeric(Path.GetFileName(media)).ToLower().Replace(" ", ""),
                    MergedText = ParseTTML($"{media}{Path.DirectorySeparatorChar}transcript.ttml"),
                    DataType   = "Media"
                };
                models.Add(model);
            }
            return(models);
        }