12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace InABox.Core
- {
- public class DFLayoutVideoFieldProperties : DFLayoutFieldProperties<byte[]>
- {
- public override string FormatValue(object? value)
- {
- return value != null ? "Yes" : "";
- }
- public override object? ParseValue(object? value)
- {
- if (value is byte[])
- return value;
- if (value is string str)
- {
- if (Guid.TryParse(str, out var id))
- {
- return Array.Empty<byte>();
- }
- try
- {
- return Convert.FromBase64String(str);
- }
- catch (Exception e)
- {
- Logger.Send(LogType.Error, "", $"Error in video data; invalid Base-64: {e.Message}");
- return null;
- }
- }
- return null;
- }
- }
- }
|