Horizon
/Horizon/Snapshots/TransferSnapshot.cs |
@@ -0,0 +1,70 @@ |
using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Drawing; |
using System.Drawing.Imaging; |
using System.Globalization; |
using System.IO; |
using System.Linq; |
using System.Runtime.InteropServices; |
using System.Text; |
using System.Threading.Tasks; |
using Org.BouncyCastle.Utilities; |
|
namespace Horizon.Snapshots |
{ |
public class TransferSnapshot |
{ |
private DateTime _time; |
|
public string Note { get; set; } |
public byte[] Data { get; set; } |
|
public int Color { get; set; } |
|
public string Name { get; set; } |
|
public string Path { get; set; } |
|
public string Time |
{ |
get => _time.ToString(CultureInfo.InvariantCulture); |
set |
{ |
if (DateTime.TryParse(value, out var dateTime)) |
{ |
_time = dateTime; |
} |
} |
} |
|
public byte[] Shot { get; set; } |
|
public string Hash { get; set; } |
|
public TransferSnapshot() |
{ |
|
} |
|
public TransferSnapshot(string name, string path, string time, string hash, Color color, Bitmap shot, string note, byte[] data) |
{ |
Name = name; |
Path = path; |
Time = time; |
Hash = hash; |
|
Color = color.ToArgb(); |
|
using (var memoryStream = new MemoryStream()) |
{ |
shot.Save(memoryStream, ImageFormat.Bmp); |
memoryStream.Position = 0L; |
Shot = memoryStream.ToArray(); |
} |
|
Note = note; |
Data = data; |
} |
} |
} |