本文整理汇总了C#中UPnP.Infrastructure.Dv.DeviceTree.DvAction类的典型用法代码示例。如果您正苦于以下问题:C# DvAction类的具体用法?C# DvAction怎么用?C# DvAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DvAction类属于UPnP.Infrastructure.Dv.DeviceTree命名空间,在下文中一共展示了DvAction类的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: UPnPClientControllerServiceImpl
public UPnPClientControllerServiceImpl() : base(
UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_TYPE, UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_TYPE_VERSION,
UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_ID)
{
// Used for a system ID string
DvStateVariable A_ARG_TYPE_SystemId = new DvStateVariable("A_ARG_TYPE_SystemId", new DvStandardDataType(UPnPStandardDataType.String))
{
SendEvents = false
};
AddStateVariable(A_ARG_TYPE_SystemId);
// Used to transport a resource path expression
DvStateVariable A_ARG_TYPE_ResourcePath = new DvStateVariable("A_ARG_TYPE_ResourcePath", new DvStandardDataType(UPnPStandardDataType.String))
{
SendEvents = false
};
AddStateVariable(A_ARG_TYPE_ResourcePath);
// CSV of media category strings
DvStateVariable A_ARG_TYPE_MediaCategoryEnumeration = new DvStateVariable("A_ARG_TYPE_MediaCategoryEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
{
SendEvents = false
};
AddStateVariable(A_ARG_TYPE_MediaCategoryEnumeration);
// Used to transport the import modes "Import" and "Refresh" for the ImportLocation action
DvStateVariable A_ARG_TYPE_ImportMode = new DvStateVariable("A_ARG_TYPE_ImportMode", new DvStandardDataType(UPnPStandardDataType.String))
{
SendEvents = false
};
AddStateVariable(A_ARG_TYPE_ImportMode);
// More state variables go here
DvAction getHomeServerSystemIdAction = new DvAction("GetHomeServerSystemId", OnGetHomeServerSystemId,
new DvArgument[] {
},
new DvArgument[] {
new DvArgument("HomeServerSystemId", A_ARG_TYPE_SystemId, ArgumentDirection.Out),
});
AddAction(getHomeServerSystemIdAction);
DvAction importLocationAction = new DvAction("ImportLocation", OnImportLocation,
new DvArgument[] {
new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
new DvArgument("MediaCategories", A_ARG_TYPE_MediaCategoryEnumeration, ArgumentDirection.In),
new DvArgument("ImportMode", A_ARG_TYPE_ImportMode, ArgumentDirection.In),
},
new DvArgument[] {
});
AddAction(importLocationAction);
// More actions go here
}
示例4: 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;
}
示例5: FanArtServiceImpl
public FanArtServiceImpl()
: base(Consts.FANART_SERVICE_TYPE, Consts.FANART_SERVICE_TYPE_VERSION, Consts.FANART_SERVICE_ID)
{
DvStateVariable A_ARG_TYPE_MediaType = new DvStateVariable("A_ARG_TYPE_MediaType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_MediaType);
DvStateVariable A_ARG_TYPE_FanArtType = new DvStateVariable("A_ARG_TYPE_FanArtType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_FanArtType);
DvStateVariable A_ARG_TYPE_Name = new DvStateVariable("A_ARG_TYPE_Name", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_Name);
DvStateVariable A_ARG_TYPE_Width = new DvStateVariable("A_ARG_TYPE_Width", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_Width);
DvStateVariable A_ARG_TYPE_Height = new DvStateVariable("A_ARG_TYPE_Height", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_Height);
DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_Bool);
DvStateVariable A_ARG_TYPE_ImgCollection = new DvStateVariable("A_ARG_TYPE_ImgCollection", new DvExtendedDataType(UPnPDtImageCollection.Instance)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_ImgCollection);
DvAction getFanArt = new DvAction("GetFanArt", OnGetFanArt,
new[]
{
new DvArgument("MediaType", A_ARG_TYPE_MediaType, ArgumentDirection.In),
new DvArgument("FanArtType", A_ARG_TYPE_FanArtType, ArgumentDirection.In),
new DvArgument("Name", A_ARG_TYPE_Name, ArgumentDirection.In),
new DvArgument("MaxWidth", A_ARG_TYPE_Width, ArgumentDirection.In),
new DvArgument("MaxHeight", A_ARG_TYPE_Height, ArgumentDirection.In),
new DvArgument("SingleRandom", A_ARG_TYPE_Bool, ArgumentDirection.In)
},
new[]
{
new DvArgument("FanArts", A_ARG_TYPE_ImgCollection, ArgumentDirection.Out, true)
});
AddAction(getFanArt);
}
示例6: ServerSettingsImpl
public ServerSettingsImpl()
: base(Consts.SERVERSETTINGS_SERVICE_TYPE, Consts.SERVERSETTINGS_SERVICE_TYPE_VERSION, Consts.SERVERSETTINGS_SERVICE_ID)
{
DvStateVariable A_ARG_TYPE_SettingsType = new DvStateVariable("A_ARG_TYPE_SettingsType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_SettingsType);
DvStateVariable A_ARG_TYPE_SettingsValue = new DvStateVariable("A_ARG_TYPE_SettingsValue", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
AddStateVariable(A_ARG_TYPE_SettingsValue);
DvAction loadAction = new DvAction(Consts.ACTION_LOAD, OnLoad,
new DvArgument[] { new DvArgument("SettingsTypeName", A_ARG_TYPE_SettingsType, ArgumentDirection.In) },
new DvArgument[] { new DvArgument("Result", A_ARG_TYPE_SettingsValue, ArgumentDirection.Out, true) });
AddAction(loadAction);
DvAction saveAction = new DvAction(Consts.ACTION_SAVE, OnSave,
new DvArgument[]
{
new DvArgument("SettingsTypeName", A_ARG_TYPE_SettingsType, ArgumentDirection.In),
new DvArgument("Settings", A_ARG_TYPE_SettingsValue, ArgumentDirection.In)
},
new DvArgument[] { });
AddAction(saveAction);
}
示例7: 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;
}
示例8: OnGetValueGroups
static UPnPError OnGetValueGroups(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid aspectId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
string attributeName = (string) inParams[1];
IFilter selectAttributeFilter = (IFilter) inParams[2];
string projectionFunctionStr = (string) inParams[3];
IEnumerable<Guid> necessaryMIATypes = MarshallingHelper.ParseCsvGuidCollection((string) inParams[4]);
IFilter filter = (IFilter) inParams[5];
string onlineStateStr = (string) inParams[6];
IMediaItemAspectTypeRegistration miatr = ServiceRegistration.Get<IMediaItemAspectTypeRegistration>();
MediaItemAspectMetadata miam;
outParams = null;
ProjectionFunction projectionFunction;
bool all = true;
UPnPError error = ParseProjectionFunction("ProjectionFunction", projectionFunctionStr, out projectionFunction) ??
ParseOnlineState("OnlineState", onlineStateStr, out all);
if (error != null)
return error;
if (!miatr.LocallyKnownMediaItemAspectTypes.TryGetValue(aspectId, out miam))
return new UPnPError(600, string.Format("Media item aspect type '{0}' is unknown", aspectId));
MediaItemAspectMetadata.AttributeSpecification attributeType;
if (!miam.AttributeSpecifications.TryGetValue(attributeName, out attributeType))
return new UPnPError(600, string.Format("Media item aspect type '{0}' doesn't contain an attribute of name '{1}'",
aspectId, attributeName));
HomogenousMap values = ServiceRegistration.Get<IMediaLibrary>().GetValueGroups(attributeType, selectAttributeFilter,
projectionFunction, necessaryMIATypes, filter, !all);
outParams = new List<object> {values};
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: OnSearch
static UPnPError OnSearch(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
MediaItemQuery query = (MediaItemQuery) inParams[0];
string onlineStateStr = (string) inParams[1];
bool all;
UPnPError error = ParseOnlineState("OnlineState", onlineStateStr, out all);
if (error != null)
{
outParams = null;
return error;
}
IList<MediaItem> mediaItems = ServiceRegistration.Get<IMediaLibrary>().Search(query, !all);
outParams = new List<object> {mediaItems};
return null;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: OnRemoveMediaItemAspectStorage
static UPnPError OnRemoveMediaItemAspectStorage(DvAction action, IList<object> inParams, out IList<object> outParams,
CallContext context)
{
Guid aspectId = MarshallingHelper.DeserializeGuid((string) inParams[0]);
ServiceRegistration.Get<IMediaLibrary>().RemoveMediaItemAspectStorage(aspectId);
outParams = null;
return null;
}
示例15: 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;
}