// Copyright (c) Arlo Godfrey. All Rights Reserved.
// Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms.
// See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information.
using System;
using System.Threading.Tasks;
using OwlCore.Remoting;
using StrixMusic.Sdk.CoreModels;
namespace StrixMusic.Sdk.Plugins.CoreRemote
{
///
/// An external, remotely synchronized implementation of
///
public sealed class RemoteCoreImage : ICoreImage
{
///
/// Creates a new instance of . Interacts with a remote core, identified by the given parameters.
///
/// The ID of the core that created this instance.
/// Uniquely identifies the instance being remoted.
internal RemoteCoreImage(string sourceCoreInstanceId, string id)
{
SourceCore = RemoteCore.GetInstance(sourceCoreInstanceId, RemotingMode.Client);
Uri = new Uri("https://strixmusic.com/favicon.ico");
}
///
/// Creates a new instance of . Wraps around the given for remote interaction.
///
/// The image to control remotely.
internal RemoteCoreImage(ICoreImage image)
{
SourceCore = RemoteCore.GetInstance(image.SourceCore.InstanceId, RemotingMode.Host);
Uri = image.Uri;
Height = image.Height;
Width = image.Width;
}
///
public ICore SourceCore { get; }
///
[RemoteProperty]
public Uri Uri { get; set; }
///
[RemoteProperty]
public double Height { get; set; }
///
[RemoteProperty]
public double Width { get; set; }
///
public ValueTask DisposeAsync() => new ValueTask(Task.Run(() =>
{
return Task.CompletedTask;
}));
}
}