using System;
using System.Linq;
using JD.SceneExplorer.Utils;
namespace JD.SceneExplorer.ViewModels
{
public class Frise : ObjectWithRef
{
private ResourcePath m_config;
///
/// Constructor
///
public Frise(uint objectRef, SceneTree parent)
: base(objectRef, parent, parent != null ? parent.PropertyChangedHandler : null)
{
m_config = new ResourcePath("");
m_friendlyName = "";
}
public override ObjectWithRefType Type { get { return ObjectWithRefType.Frise; } }
protected override int GetChildrenCount()
{
return 0;
}
protected override void LoadChildren()
{
}
public ResourcePath Config
{
get { return m_config; }
set
{
if (m_config != value)
{
m_config = value;
FilePath = m_config.Directory + "\\" + m_config.Filename;
RaisePropertyChanged("Config");
}
}
}
///
/// fill in data from blob
///
///
public static Frise LoadFromBlob(JD.Remoting.IBlob _blob, SceneTree parent)
{
uint objectRef = _blob.ExtractUInt();
Frise newFrise = new Frise(objectRef, parent);
newFrise.FriendlyName = _blob.ExtractString();
string configPath = _blob.ExtractPath();
newFrise.Config = new ResourcePath(configPath);
if (newFrise.FriendlyName == configPath)
newFrise.FriendlyName = newFrise.Config.Filename;
newFrise.Active = _blob.ExtractBool();
newFrise.Visible = !_blob.ExtractBool();
uint tagsCount = _blob.ExtractUInt();
for (int i = 0; i < tagsCount; i++)
{
newFrise.Tags.Add(_blob.ExtractString());
}
newFrise.IconSource = EditorIconsManager.Instance.GetIconLocationFromTags(newFrise.Tags);
return newFrise;
}
}
}