static void Main(string[] args) { string[] manifestItems = File.ReadAllLines(manifestLocation); iMedia media = new MediaItem(mediaLocation); for (int i = 0; i < manifestItems.Length; i++) { string[] props = manifestItems[i].Split('|'); if (props.Length != 3) { continue; } MetaDataItem metaData = new MetaDataItem() { title = props[0], contentType = props[1], sourcePath = props[2] }; media.AddItem(metaData); } // print everything out. foreach (MetaDataItem data in media.GetAll()) { printMetaData(data); } }
/// <summary> /// AddItem: /// <para>AddItem will add a meta data item to the inner data structure. A GUID will be assigned to /// the item in the method and then returned. </para> /// </summary> /// <param name="item">A meta data description of some item.</param> /// <returns>An identifier to the item.</returns> public Guid AddItem(MetaDataItem item) { Guid identifer = new Guid(); item.itemId = identifer; item.thumbnailPath = this.findThumbnailPath(item); items.Add(item); return identifer; }
/// <summary> /// AddItem: /// <para>AddItem will add a meta data item to the inner data structure. A GUID will be assigned to /// the item in the method and then returned. </para> /// </summary> /// <param name="item">A meta data description of some item.</param> /// <returns>An identifier to the item.</returns> public Guid AddItem(MetaDataItem item) { Guid identifer = new Guid(); item.itemId = identifer; item.thumbnailPath = this.findThumbnailPath(item); items.Add(item); return(identifer); }
public static void printMetaData(MetaDataItem item) { string output = String.Format("Title: {0}\tType: {1}\tSource: {2}\tThumbnail: {3}", item.title, item.contentType, item.sourcePath, item.thumbnailPath); Console.WriteLine(output); File.AppendAllText(outputLocation, output); File.AppendAllText(outputLocation, Environment.NewLine); }
public static void printMetaData(MetaDataItem item) { string output = String.Format("Title: {0}\tType: {1}\tSource: {2}\tThumbnail: {3}", item.title, item.contentType, item.sourcePath, item.thumbnailPath); Console.WriteLine(output); File.AppendAllText(outputLocation, output); File.AppendAllText(outputLocation, Environment.NewLine); }
/// <summary> /// findThumbnailPath /// <para>Method will correlate a media item to a .png file. It is assumed that a media item /// thumbnail may exist with the file name in it somewhere.</para> /// </summary> /// <param name="item">The item to find a .png file for.</param> /// <returns>The path to the thumbnail file.</returns> private string findThumbnailPath(MetaDataItem item) { string filePath = ""; if (item.sourcePath.Contains('\\')) filePath = item.sourcePath.Split('\\').Last(); if (item.sourcePath.Contains('_')) { filePath = item.sourcePath.Split('_').First(); filePath = this.pngs.FirstOrDefault(x => x.Contains(filePath)); } return filePath; }
/// <summary> /// findThumbnailPath /// <para>Method will correlate a media item to a .png file. It is assumed that a media item /// thumbnail may exist with the file name in it somewhere.</para> /// </summary> /// <param name="item">The item to find a .png file for.</param> /// <returns>The path to the thumbnail file.</returns> private string findThumbnailPath(MetaDataItem item) { string filePath = ""; if (item.sourcePath.Contains('\\')) { filePath = item.sourcePath.Split('\\').Last(); } if (item.sourcePath.Contains('_')) { filePath = item.sourcePath.Split('_').First(); filePath = this.pngs.FirstOrDefault(x => x.Contains(filePath)); } return(filePath); }
static void Main(string[] args) { string[] manifestItems = File.ReadAllLines(manifestLocation); iMedia media = new MediaItem(mediaLocation); for (int i = 0; i < manifestItems.Length; i++) { string[] props = manifestItems[i].Split('|'); if (props.Length != 3) continue; MetaDataItem metaData = new MetaDataItem() { title = props[0], contentType = props[1], sourcePath = props[2] }; media.AddItem(metaData); } // print everything out. foreach (MetaDataItem data in media.GetAll()) { printMetaData(data); } }