本文整理汇总了C#中UPnP.Infrastructure.Dv.CallContext类的典型用法代码示例。如果您正苦于以下问题:C# CallContext类的具体用法?C# CallContext怎么用?C# CallContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallContext类属于UPnP.Infrastructure.Dv命名空间,在下文中一共展示了CallContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLoad
private UPnPError OnLoad(DvAction action, IList<object> inParams, out IList<object> outParams, CallContext context)
{
string settingsTypeName = (string) inParams[0];
object result = Load(settingsTypeName);
string serialized = SettingsSerializer.Serialize(result);
outParams = new List<object> { serialized };
return null;
}
示例2: OnSave
private UPnPError OnSave(DvAction action, IList<object> inParams, out IList<object> outParams, CallContext context)
{
string settingsTypeName = (string) inParams[0];
string settings = (string) inParams[1];
Save(settingsTypeName, settings);
outParams = new List<object> { };
return null;
}
示例3: OnGetFanArt
private UPnPError OnGetFanArt(DvAction action, IList<object> inParams, out IList<object> outParams, CallContext context)
{
outParams = new List<object>();
IFanArtService fanArtService = ServiceRegistration.Get<IFanArtService>();
if (fanArtService == null)
return new UPnPError(500, "FanArt service not available");
FanArtConstants.FanArtMediaType fanArtMediaType = (FanArtConstants.FanArtMediaType) Enum.Parse(typeof(FanArtConstants.FanArtMediaType), inParams[0].ToString());
FanArtConstants.FanArtType fanArtType = (FanArtConstants.FanArtType) Enum.Parse(typeof(FanArtConstants.FanArtType), inParams[1].ToString());
string name = inParams[2].ToString();
int maxWidth = (int) inParams[3];
int maxHeight = (int) inParams[4];
bool singleRandom = (bool) inParams[5];
IList<FanArtImage> fanArtImages = fanArtService.GetFanArt(fanArtMediaType, fanArtType, name, maxWidth, maxHeight, singleRandom) ?? new List<FanArtImage>();
outParams = new List<object> { fanArtImages };
return null;
}
示例4: OnClearAllUserData
// Cleanup user data
static UPnPError OnClearAllUserData(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid profileId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
bool success = ServiceRegistration.Get<IUserProfileDataManagement>().ClearAllUserData(profileId);
outParams = new List<object> {success};
return null;
}
示例5: OnGetUserMediaItemData
// User media item data
static UPnPError OnGetUserMediaItemData(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid profileId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
Guid mediaItemId = MarshallingHelper.DeserializeGuid((string) inParams[1]);
string key = (string) inParams[2];
string data;
bool success;
if (!(success = ServiceRegistration.Get<IUserProfileDataManagement>().GetUserMediaItemData(profileId, mediaItemId, key, out data)))
data = null;
outParams = new List<object> {data, success};
return null;
}
示例6: OnGetProfileByName
static UPnPError OnGetProfileByName(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
string profileName = (string) inParams[0];
UserProfile profile;
if (!ServiceRegistration.Get<IUserProfileDataManagement>().GetProfileByName(profileName, out profile))
profile = null;
outParams = new List<object> {profile};
return null;
}
示例7: OnGetProfiles
// User profiles management
static UPnPError OnGetProfiles(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
ICollection<UserProfile> profiles = ServiceRegistration.Get<IUserProfileDataManagement>().GetProfiles();
outParams = new List<object> {profiles};
return null;
}
示例8: OnGetHomeServerSystemId
static UPnPError OnGetHomeServerSystemId(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
outParams = new List<object> {ServiceRegistration.Get<IServerConnectionManager>().HomeServerSystemId};
return null;
}
示例9: OnTextSearch
static UPnPError OnTextSearch(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
string searchText = (string) inParams[0];
IEnumerable<Guid> necessaryMIATypes = MarshallingHelper.ParseCsvGuidCollection((string) inParams[1]);
IEnumerable<Guid> optionalMIATypes = MarshallingHelper.ParseCsvGuidCollection((string) inParams[2]);
IFilter filter = (IFilter) inParams[3];
string searchModeStr = (string) inParams[4];
string onlineStateStr = (string) inParams[5];
string capitalizationMode = (string) inParams[6];
bool excludeCLOBs;
bool all = false;
bool caseSensitive = true;
UPnPError error = ParseSearchMode("SearchMode", searchModeStr, out excludeCLOBs) ??
ParseOnlineState("OnlineState", onlineStateStr, out all) ??
ParseCapitalizationMode("CapitalizationMode", capitalizationMode, out caseSensitive);
if (error != null)
{
outParams = null;
return error;
}
IMediaLibrary mediaLibrary = ServiceRegistration.Get<IMediaLibrary>();
MediaItemQuery query = mediaLibrary.BuildSimpleTextSearchQuery(searchText, necessaryMIATypes, optionalMIATypes,
filter, !excludeCLOBs, caseSensitive);
IList<MediaItem> mediaItems = mediaLibrary.Search(query, !all);
outParams = new List<object> {mediaItems};
return null;
}
示例10: OnReImportShare
static UPnPError OnReImportShare(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid shareId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
Share share = ServiceRegistration.Get<IMediaLibrary>().GetShare(shareId);
ServiceRegistration.Get<IImporterWorker>().ScheduleRefresh(share.BaseResourcePath, share.MediaCategories, true);
outParams = null;
return null;
}
示例11: OnGetShare
static UPnPError OnGetShare(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid shareId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
Share result = ServiceRegistration.Get<IMediaLibrary>().GetShare(shareId);
outParams = new List<object> {result};
return null;
}
示例12: OnGetShares
static UPnPError OnGetShares(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
string systemId = (string) inParams[0];
string sharesFilterStr = (string) inParams[1];
bool all;
UPnPError error = ParseOnlineState("SharesFilter", sharesFilterStr, out all);
if (error != null)
{
outParams = null;
return error;
}
IDictionary<Guid, Share> shares = ServiceRegistration.Get<IMediaLibrary>().GetShares(systemId);
ICollection<Share> result;
if (all)
result = shares.Values;
else
{
ICollection<string> connectedClientsIds = ServiceRegistration.Get<IClientManager>().ConnectedClients.Select(
connection => connection.Descriptor.MPFrontendServerUUID).ToList();
result = new List<Share>();
foreach (Share share in shares.Values)
if (connectedClientsIds.Contains(share.SystemId))
result.Add(share);
}
outParams = new List<object> {result};
return null;
}
示例13: OnUpdateShare
static UPnPError OnUpdateShare(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid shareId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
ResourcePath baseResourcePath = ResourcePath.Deserialize((string) inParams[1]);
string shareName = (string) inParams[2];
string[] mediaCategories = ((string) inParams[3]).Split(',');
string relocateMediaItemsStr = (string) inParams[4];
RelocationMode relocationMode;
UPnPError error = ParseRelocationMode("RelocateMediaItems", relocateMediaItemsStr, out relocationMode);
if (error != null)
{
outParams = null;
return error;
}
IMediaLibrary mediaLibrary = ServiceRegistration.Get<IMediaLibrary>();
int numAffected = mediaLibrary.UpdateShare(shareId, baseResourcePath, shareName, mediaCategories, relocationMode);
outParams = new List<object> {numAffected};
return null;
}
示例14: OnRegisterShare
static UPnPError OnRegisterShare(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Share share = (Share) inParams[0];
ServiceRegistration.Get<IMediaLibrary>().RegisterShare(share);
outParams = null;
return null;
}
示例15: OnNotifyPlayback
static UPnPError OnNotifyPlayback(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
IMediaLibrary mediaLibrary = ServiceRegistration.Get<IMediaLibrary>();
Guid mediaItemId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
mediaLibrary.NotifyPlayback(mediaItemId);
outParams = null;
return null;
}