public unsafe ObsSource(ObsSourceType type, string id, string name, ObsData settings) { instance = libobs.obs_source_create(/*(libobs.obs_source_type)type,*/ id, name, settings.GetPointer(), IntPtr.Zero); if (instance == null) throw new ApplicationException("obs_source_create failed"); }
public unsafe ObsSource(ObsSourceType type, string id, string name, ObsData settings) { instance = libobs.obs_source_create(/*(libobs.obs_source_type)type,*/ id, name, settings.GetPointer(), IntPtr.Zero); if (instance == null) { throw new ApplicationException("obs_source_create failed"); } }
internal IntPtr instance; //pointer to unmanaged object public unsafe ObsSource(ObsSourceType type, string id, string name) { instance = libobs.obs_source_create((libobs.obs_source_type)type, id, name, IntPtr.Zero, IntPtr.Zero); if (instance == null) { throw new ApplicationException("obs_source_create failed"); } }
/// <summary> Returns default settings of source. </summary> /// <param name="type"> Type of source, context where the source is used. </param> /// <param name="id"> /// Source identifier, registered by source plugins. /// Another kind of type for sources. /// </param> public static ObsData GetDefaults(ObsSourceType type, string id) { var ptr = libobs.obs_get_source_defaults(/*(libobs.obs_source_type) type,*/ id); if (ptr == IntPtr.Zero) { return(null); } return(new ObsData(ptr)); }
public unsafe static ObsProperties GetProperties(ObsSourceType type, string id) { IntPtr ptr = libobs.obs_get_source_properties(/*(libobs.obs_source_type)type,*/ id); if (ptr == IntPtr.Zero) { return(null); } return(new ObsProperties(ptr)); }
private bool CanDeserializeSourceType(ObsSourceType sourceType, ReadOnlyMemory <char> settingsJson, out object deserialisedObject) { Type modelType = ObsWsSourceType.GetType(sourceType); if (modelType == null) { JsonException je = new JsonException(String.Format(CultureInfo.CurrentCulture, Properties.Resources.exception_source_type_not_implemented_inner_format, settingsJson)); NotImplementedException ex = new NotImplementedException(String.Format(CultureInfo.CurrentCulture, Properties.Resources.exception_source_type_not_implemented_format, sourceType), je); OnErrorState(ex, -1); deserialisedObject = null; return(false); } else { Span <byte> span = ArrayPool <byte> .Shared.Rent(Encoding.UTF8.GetByteCount(settingsJson.Span)); int length = Encoding.UTF8.GetBytes(settingsJson.Span, span); deserialisedObject = JsonSerializer.Deserialize(span.Slice(0, length), modelType); ArrayPool <byte> .Shared.Return(span.ToArray()); return(true); } }
public static object GetInstanceOfType(ObsSourceType sourceType) { return(sourceTypeSettingsDictionary.TryGetValue(sourceType, out Type value) ? Activator.CreateInstance(value) : null); }
public static Type GetType(ObsSourceType sourceType) { return(sourceTypeSettingsDictionary.TryGetValue(sourceType, out Type value) ? value : null); }
public static unsafe ObsProperties GetProperties(ObsSourceType type, string id) { IntPtr ptr = libobs.obs_get_source_properties(/*(libobs.obs_source_type)type,*/ id); if (ptr == IntPtr.Zero) return null; return new ObsProperties(ptr); }
/// <summary> Returns default settings of source. </summary> /// <param name="type"> Type of source, context where the source is used. </param> /// <param name="id"> /// Source identifier, registered by source plugins. /// Another kind of type for sources. /// </param> public static ObsData GetDefaults(ObsSourceType type, string id) { var ptr = libobs.obs_get_source_defaults(/*(libobs.obs_source_type) type,*/ id); if (ptr == IntPtr.Zero) return null; return new ObsData(ptr); }
public static string GetSourceTypeDisplayName(ObsSourceType type, string id) { return(libobs.obs_source_get_display_name((libobs.obs_source_type)type, id)); }