using System;
using UnityEngine;
namespace Funique
{
///
/// Image data structure
/// ------------------------------------------------
/// 圖片資料結構
///
[Serializable]
public sealed class PhotoInfo : InfoBase
{
///
/// Specified the stereo type of the video
/// ------------------------------------------------
/// 立體聲模式
///
public string StereoMode;
///
/// Extension string
/// ------------------------------------------------
/// 格式
///
public string Format;
///
/// Video path in client
/// This can leave it empty, it won't effect much
/// ------------------------------------------------
/// 影片在客戶端的路徑
/// 可留白, 不會有太多影響
///
public string Path;
public string Type;
public event Action OnCheck;
public static PhotoInfo GenerateVideoBySourceName(string sourceName)
{
PhotoInfo photoInfo = new PhotoInfo();
photoInfo.PlayableType = 1;
photoInfo.SourceName = sourceName.Replace("\r", "");
photoInfo.Check();
return photoInfo;
}
///
/// After apply the source name, this will filter out the rest of field
/// ------------------------------------------------
/// 在套用 原始名稱 後, 這會過濾出剩下的字串欄位
///
public void Check()
{
FilterName = Tool.Instance.FilterVideoName(SourceName);
StereoMode = Tool.Instance.DetectStereoMode(FilterName);
BtnName = Tool.Instance.FilterBtnName(SourceName);
Format = System.IO.Path.GetExtension(SourceName);
Debug.Log(SourceName);
Debug.Log(BtnName);
if (OnCheck != null) OnCheck.Invoke();
}
public override string ToString()
{
string v = string.Empty;
v += $"Source Name: {SourceName}\n";
v += $"Filter Name: {FilterName}\n";
v += $"StereoMode: {StereoMode}\n";
v += $"Format: {Format}\n";
v += $"Path: {Path}";
return v;
}
}
}