goomatt33 205b3d8014 Modified how attachments are pushed to the API.
Added support for BMP and GIF image types.
2024-03-25 13:21:14 -04:00

44 lines
1.1 KiB
C#

using PWAPPv2.Source.Attachments;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
public class PWPdf : PWFile
{
public string path;
public PWPdf(string path)
{
this.path = path;
}
public string GetBase64String()
{
byte[] bytes = File.ReadAllBytes(path);
return Convert.ToBase64String(bytes);
}
public List<PWFileUpload> GetFileUploads(string attToken, string ContentId)
{
List<PWFileUpload> fileUploads = new List<PWFileUpload>();
PWFileUpload file = new PWFileUpload();
file.Base64Content = GetBase64String();
file.ContentId = ContentId;
file.AttToken = attToken;
fileUploads.Add(file);
return fileUploads;
}
public string ShortFileName()
{
return path.Substring(path.LastIndexOf("\\") + 1);
}
}
}