Example #1
0
 public void UploadToOnlineService(string contentFilePath)
 {
     byte[] bytes;
     try
     {
         bytes = File.ReadAllBytes(contentFilePath);
     }
     catch (Exception)
     {
         Logger.Warning("Unable to read bytes for uploading to the server : " +
             Path.GetFileName(contentFilePath));
         return;
     }
     if (bytes.Length > MaximumFileSize)
     {
         Logger.Warning("The file you added is too large, the maximum file size is 16MB");
         return;
     }
     var fileNameAndBytes = new Dictionary<string, byte[]>();
     fileNameAndBytes.Add(Path.GetFileName(contentFilePath), bytes);
     var metaDataCreator = new ContentMetaDataCreator();
     var contentMetaData = metaDataCreator.CreateMetaDataFromFile(contentFilePath);
     UploadContent(contentMetaData, fileNameAndBytes);
 }
		//ncrunch: no coverage start
		protected virtual ContentMetaData CreateContentMetaData(string contentFilePath)
		{
			var metaDataCreator = new ContentMetaDataCreator();
			ContentMetaData contentMetaData = metaDataCreator.CreateMetaDataFromFile(contentFilePath);
			return contentMetaData;
		} //ncrunch: no coverage end