// private Dictionary<string, Filter<TDomainClass>> _filters; /// <summary> /// Sets up the catalog as a paired collection and source /// </summary> /// <param name="collection"> /// In-memory collection of domain objects /// </param> /// <param name="source"></param> /// Source for loading/saving domain objects /// <param name="loadWhenCreated"></param> public CatalogBase(CollectionBase <TDomainClass> collection, SourceBase <TDomainClass> source, bool loadWhenCreated = false) { // Sanity checks, so we don't need null checks elsewhere if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (source == null) { throw new ArgumentNullException(nameof(source)); } _source = source; _collection = collection; _filterManager = new FilterManager <TDomainClass>(); Modified = true; if (loadWhenCreated) { Load(); } }
private void OnLoadComplete(PluginEvents.LoadCompleteEvent e) { foreach (var source_name in Setting.Instance.SourceList.ToString().Split(',')) { SourceBase source = null; switch (source_name.ToLower()) { case "bilibili": source = WrapSourcesFactory.GetBililiveSource(); break; case "twitch": source = WrapSourcesFactory.GetTwitchSource(); break; default: Log.Warn("unknown required source name:" + source_name); break; } if (source != null) { Log.Output("loaded source:" + source_name); wrapper_source.AddSource(source); } else { Log.Warn("loaded source failed:" + source_name); } } }
protected override void OnSourceChange(SourceBase source) { base.OnSourceChange(source); var switcher = ((ARoom)Room).SystemSwitcher; if (switcher == null) { return; } var s = source as ASource; if (s != null && s.SwitcherInputs.ContainsKey(2) && Position == DisplayPosition.Right) { switcher.RouteVideo(s.SwitcherInputs[2], _config.SwitcherOutputIndex); } else if (s != null && s.SwitcherInputs.ContainsKey(1)) { switcher.RouteVideo(s.SwitcherInputs[1], _config.SwitcherOutputIndex); } else if (s == null) { switcher.RouteVideo(0, _config.SwitcherOutputIndex); } }
/// <summary> /// Evaluates the <see cref="SourceBase"/>. /// </summary> /// <param name="expression"> /// The expression to evaluate. /// </param> /// <param name="sideEffects"> /// <c>true</c> if the expression has side effects, <c>false</c> otherwise. /// </param> /// <returns> /// The <see cref="object"/>. /// </returns> private DataSource Evaluate(SourceBase expression, out bool sideEffects) { try { if (this.parsedScript.Context.NodeData.HasSideEffects(expression, variable => this.statements.HasVariableSideEffects(variable))) { sideEffects = true; return(null); } sideEffects = false; var linqExpression = GenericVisitor.Visit( (ExecutionContextExpression e) => Expression.Constant(this.statements), this.parsedScript.Context.NodeData.ConvertToDataSource(expression)); return(Expression.Lambda <Func <DataSource> >(linqExpression).Compile().Invoke()); } catch { sideEffects = true; return(null); } }
private void UpdateSource() { WMSBusinessObject sourcebase = null; if (_notClearInputData) { if (_oldSource != null) { sourcebase = (WMSBusinessObject)_oldSource.Clone(); } } else { if (SourceBase != null) { sourcebase = (WMSBusinessObject)SourceBase.Clone(); sourcebase.AcceptChanges(true); } } if (sourcebase != null) { sourcebase.Validate(); Source = (TModel)((object)sourcebase); } }
/// <summary> /// Adds a source to the current scope. /// </summary> /// <param name="sourceAlias"> /// The source alias. /// </param> /// <param name="source"> /// The source. /// </param> public void AddSource([CanBeNull] string sourceAlias, SourceBase source) { if (sourceAlias != null) { this.sources[sourceAlias] = source; } }
protected override void UIShouldShowSource(SourceBase source) { if (_startInTechMode && !_techPage.Visible) { _techPage.Show(); } }
/// <summary> /// Initializes a new instance of the <see cref="JoinSource"/> class. /// </summary> /// <param name="joinType"> /// The join type. /// </param> /// <param name="first"> /// The first. /// </param> /// <param name="second"> /// The second. /// </param> /// <param name="expression"> /// The expression. /// </param> public JoinSource(JoinType joinType, SourceBase first, SourceBase second, [CanBeNull] SqlExpressionBase expression = null) { this.JoinType = joinType; this.First = first; this.Second = second; this.Expression = expression; }
internal static IEnumerable <TextAsset> GetAssets(this SourceBase source, AssetDeclarationAttributeBase attribute) { if (attribute.GetDeclarationType() == DeclarationType.Single || attribute.GetIsSingleFile()) { if (!source.IsSingle) { yield break; } var singleSource = source as SingleSource; if (singleSource == null) { yield break; } var asset = singleSource.GetAsset(attribute.Group); if (asset != null) { yield return(asset); } } else { var singleSource = source as SingleSource; if (singleSource != null) { var asset = singleSource.GetAsset(attribute.Group); if (asset != null) { yield return(asset); } } else { var folderPath = GetAssetPathFolder(source.GetAssetPath()); var assetPaths = AssetDatabase.FindAssets($"t:{nameof(TextAsset)}", new[] { folderPath }) .Select(AssetDatabase.GUIDToAssetPath) .Where(IsSupportedTextAssetPath) .ToArray(); var multiSource = source as FolderSource; if (multiSource == null) { yield break; } foreach (var assetPath in assetPaths) { if (multiSource.IsRecursive || GetAssetPathFolder(assetPath) == folderPath) { yield return(AssetDatabase.LoadAssetAtPath <TextAsset>(assetPath)); } } } } }
/// <summary> /// Creates a new stream <see cref="Entities.DataSet"/> connected to the data /// file provided. /// </summary> /// <param name="fileName"> /// Valid path to the uncompressed data set file. /// </param> /// <param name="lastModified"> /// Date and time the source data was last modified. /// </param> /// <param name="mode"> /// The mode of operation the data set will be using. /// </param> /// <param name="isTempFile"> /// True if the file should be deleted when the source is disposed. /// </param> internal IndirectDataSet( string fileName, DateTime lastModified, Modes mode, bool isTempFile) : base(lastModified, mode) { Source = new SourceFile(fileName, isTempFile); Pool = new Pool(Source); }
// ******************************************************************* /// <summary> /// This method exposes the <see cref="IBuilderSource.Children"/> property on a /// <see cref="SourceBase"/> object, in order to avoid the need to /// constantly downcast. /// </summary> /// <param name="source">A <see cref="SourceBase"/> reference.</param> /// <returns>A collection of child <see cref="IBuilderSource"/> references.</returns> public static IEnumerable <IBuilderSource> Children( this SourceBase source ) { // Validate the parameter before attempting to use it. new Guard().ThrowIfNull(source, nameof(source)); // Downcast and perform the operation. return(((IBuilderSource)source).Children); }
public void AddSource(SourceBase source) { managed_sources.Add(source); if (Status == SourceStatus.CONNECTED_WORKING) { //他喵的柑橘灰渣 source.Disconnect(); source.Connect(); } }
// ******************************************************************* /// <summary> /// This method exposes the <see cref="IBuilderSource.AddChild(IBuilderSource)"/> method /// on a <see cref="SourceBase"/> object, in order to avoid the need to /// constantly downcast. /// </summary> /// <param name="source">A <see cref="SourceBase"/> reference.</param> /// <param name="child">The source to add as a child.</param> public static void AddChild( this SourceBase source, IBuilderSource child ) { // Validate the parameters before attempting to use them. new Guard().ThrowIfNull(source, nameof(source)) .ThrowIfNull(child, nameof(child)); // Downcast and perform the operation. ((IBuilderSource)source).AddChild(child); }
// ******************************************************************* // Public methods. // ******************************************************************* #region Public methods /// <summary> /// This method exposes the <see cref="IBuilderSource.Build(IBuilder)"/> method on a /// <see cref="SourceBase"/> object, in order to avoid the need to /// constantly downcast. /// </summary> /// <param name="source">A <see cref="SourceBase"/> reference.</param> /// <param name="builder">The builder to use for the operation.</param> /// <returns></returns> public static IBuilderProvider Build( this SourceBase source, IBuilder builder ) { // Validate the parameters before attempting to use them. new Guard().ThrowIfNull(source, nameof(source)) .ThrowIfNull(builder, nameof(builder)); // Downcast and perform the operation. return(((IBuilderSource)source).Build(builder)); }
public bool AddSource(SourceBase src) { if (listSources.Contains(src)) { return(false); } else { listSources.AddLast(src); } return(true); }
/// <summary> /// Sets up the model as a paired collection and source /// </summary> /// <param name="collection"> /// In-memory collection of domain objects /// </param> /// <param name="source"></param> /// Source for loading/saving domain objects /// <param name="loadWhenCreated"></param> public DomainModelBase(CollectionBase <TDomainClass> collection, SourceBase <TDomainClass> source, bool loadWhenCreated = false) { _source = source; _collection = collection; Modified = true; if (loadWhenCreated) { Load(); } }
internal static TextAsset GetSingleAsset(this SourceBase source, string group) { if (source == null) { return(null); } if (string.IsNullOrEmpty(group)) { return(null); } var s = source as SingleSource; return(s == null ? null : s.GetAsset(group)); }
/// <summary> /// Sets up the catalog as a paired collection and source /// </summary> /// <param name="collection"> /// In-memory collection of domain objects /// </param> /// <param name="source"></param> /// Source for loading/saving domain objects public CatalogBase(CollectionBase <TDomainClass> collection, SourceBase <TDomainClass> source) { // Sanity checks, so we don't need null checks elsewhere if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (source == null) { throw new ArgumentNullException(nameof(source)); } _source = source; _collection = collection; _filterManager = new FilterManager <TDomainClass>(); AppConfig.LoadCatalogs += Load; AppConfig.SaveCatalogs += Save; }
protected override void SourceLoadProcess(SourceBase previousSource, SourceBase newSource) { if (newSource != null) { CloudLog.Debug("Loading source \"{0}\" in room \"{1}\"", newSource, this); } if (newSource != null) { if (SystemSwitcher != null && Config.SwitcherOutputCodecContent > 0 && ((ASource)newSource).SwitcherInputs.ContainsKey(1)) { SystemSwitcher.RouteVideo(((ASource)newSource).SwitcherInputs[1], Config.SwitcherOutputCodecContent); SystemSwitcher.RouteAudio(((ASource)newSource).SwitcherInputs[1], Config.SwitcherOutputCodecContent); } Codec.Conference.Presentation.Start(SendingMode.LocalRemote); } else { if (SystemSwitcher != null && Config.SwitcherOutputCodecContent > 0) { SystemSwitcher.RouteVideo(0, Config.SwitcherOutputCodecContent); SystemSwitcher.RouteAudio(0, Config.SwitcherOutputCodecContent); } Codec.Conference.Presentation.Stop(); } try { FusionShouldUpdateCoreParameters(); } catch (Exception e) { CloudLog.Exception(e); } }
protected override void SourceLoadProcess(SourceBase previousSource, SourceBase newSource) { foreach (var display in Displays) { display.Source = newSource; } if (SystemSwitcher == null || Config.PgmAudioSwitcherOutput == 0) { return; } var source = newSource as ASource; if (source != null && source.SwitcherInputs.ContainsKey(1)) { SystemSwitcher.RouteAudio(source.SwitcherInputs[1], Config.PgmAudioSwitcherOutput); } else { SystemSwitcher.RouteAudio(0, Config.PgmAudioSwitcherOutput); } }
/// <summary> /// Gets a factory function for the data source of this. /// </summary> /// <param name="source"> /// The <see cref="SourceBase"/> AST node to generate the factory for. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> private Func <IExecutionContext, Task <DataSource> > GetSourceFactory(SourceBase source) { var context = Expression.Parameter(typeof(IExecutionContext), "context"); var row = Expression.Parameter(typeof(Row), "row"); var replaceContext = new GenericVisitor { (ExecutionContextExpression e) => context, (SourceFieldExpression e) => e.CreateGetter(row), (GenericVisitor visitor, CompareExpression e) => e.CreateComparer(), (UnaryExpression e) => e.NodeType == ExpressionType.Convert && e.Operand is SourceFieldExpression ? ((SourceFieldExpression)e.Operand).CreateGetter(row, e.Type) : null, }; var sourceFactoryLambda = Expression.Lambda(replaceContext.Visit(this.data.ConvertToDataSource(source)), context).RewriteTasksToAsyncExpression(); if (sourceFactoryLambda.ReturnType != typeof(Task <DataSource>)) { sourceFactoryLambda = Expression.Lambda(Expression.Call(((Func <DataSource, Task <DataSource> >)Task.FromResult).GetMethodInfo(), sourceFactoryLambda.Body), sourceFactoryLambda.Parameters); } return(((Expression <Func <IExecutionContext, Task <DataSource> > >)sourceFactoryLambda).Compile()); }
protected override void SourceLoadStarted(SourceBase newSource) { }
/// <summary> /// Creates a new stream data set connected to the byte array /// data source provided. /// </summary> /// <param name="data"> /// Byte array containing uncompressed data set. /// </param> /// <param name="mode"> /// The mode of operation the data set will be using. /// </param> internal DataSet(byte[] data, Modes mode) : base(DateTime.MinValue, mode) { Source = new SourceMemory(data); Pool = new Pool(Source); }
/// <summary> /// Converts the <paramref name="source" /> to a lambda returning a <see cref="DataSource" />. /// </summary> /// <param name="dataProvider"> /// The data provider. /// </param> /// <param name="source"> /// The source to convert. /// </param> /// <param name="messages"> /// The messages. /// </param> /// <returns> /// The <see cref="Expression" />. /// </returns> public static Expression ConvertToDataSource(this INodeDataProvider dataProvider, SourceBase source, [CanBeNull] IMessageWriter messages = null) { new Evaluator(dataProvider, messages ?? new MessageWriter("null")).Visit(source); var factoryExpression = dataProvider.GetFactoryExpression(source); return(factoryExpression.Type == typeof(DataSource) ? factoryExpression : Expression.Convert(factoryExpression, typeof(DataSource))); }
protected override void SourceLoadProcess(SourceBase previousSource, SourceBase newSource) { }
/// <summary> /// Initializes a new instance of the <see cref="ApplySource"/> class. /// </summary> /// <param name="left"> /// The source. /// </param> /// <param name="right"> /// The right. /// </param> /// <param name="isOuterApply"> /// <c>true</c> if this is an OUTER APPLY, false if this is a CROSS APPLY. /// </param> public ApplySource(SourceBase left, SourceBase right, bool isOuterApply) { this.Left = left; this.Right = right; this.IsOuterApply = isOuterApply; }
public ContentSource(ISecurityManager security, SourceBase[] sources) { this.security = security; Sources = sources.OrderBy(s => s.SortOrder).ToList(); }
/// <summary> /// Initializes a new instance of the <see cref="SelectFromStatement"/> class. /// </summary> /// <param name="expressions"> /// The expressions. /// </param> /// <param name="source"> /// The source. /// </param> /// <param name="where"> /// The where. /// </param> /// <param name="groupings"> /// The groupings. /// </param> /// <param name="having"> /// The having. /// </param> /// <param name="orders"> /// The orders. /// </param> public SelectFromStatement(ReadOnlyCollection <AliasedSqlExpression> expressions, SourceBase source, SqlExpressionBase where, ReadOnlyCollection <SqlExpressionBase> groupings, SqlExpressionBase having, ReadOnlyCollection <OrderBySqlExpression> orders) { this.Expressions = expressions; this.Source = source; this.Where = where; this.Groupings = groupings; this.Orders = orders; this.Having = having; }
/// <summary> /// テキストメッセージイベント実行 /// </summary> /// <param name="text">テキスト本文</param> private async Task ExecuteTextMessageEvent( string channelAccessToken, SourceBase source, string replyToken, string text ) { Trace.TraceInformation("Start"); // 引数nullチェック if (channelAccessToken == null) { Trace.TraceInformation("Channel Access Token is Null"); return; } if (source == null) { Trace.TraceWarning("Source is Null"); return; } if (text == null) { Trace.TraceWarning("Text is Null"); return; } switch (text) { case "プロフィールほしい": if (source is GroupSource) { string groupId = (source as GroupSource).groupId; if (groupId == null) { Trace.TraceInformation("Group Id is Null"); return; } string userId = (source as GroupSource).userId; if (userId == null) { Trace.TraceInformation("User Id is Null"); return; } GetUserProfileInGroupOrRoomMemberResponse profilesResponse = await GroupService.GetUserProfileInGroupMember(channelAccessToken, groupId, userId) .ConfigureAwait(false); string messageText = "表示名:" + profilesResponse.displayName + "ID:" + profilesResponse.userId + "画像:" + profilesResponse.pictureUrl + "\n"; await ReplyMessageService.SendReplyMessage( channelAccessToken, replyToken, MessageFactoryService.CreateMessage() .AddTextMessage(messageText) ).ConfigureAwait(false); } else if (source is RoomSource) { string roomId = (source as RoomSource).roomId; if (roomId == null) { Trace.TraceInformation("Room Id is Null"); return; } string userId = (source as RoomSource).userId; if (userId == null) { Trace.TraceInformation("User Id is Null"); return; } GetUserProfileInGroupOrRoomMemberResponse profilesResponse = await RoomService.GetUserProfileInRoomMember(channelAccessToken, roomId, userId) .ConfigureAwait(false); string messageText = "表示名:" + profilesResponse.displayName + "ID:" + profilesResponse.userId + "画像:" + profilesResponse.pictureUrl + "\n"; await ReplyMessageService.SendReplyMessage( channelAccessToken, replyToken, MessageFactoryService.CreateMessage() .AddTextMessage(messageText) ).ConfigureAwait(false); } else if (source is UserSource) { string userId = (source as UserSource).userId; if (userId == null) { Trace.TraceInformation("User Id is Null"); return; } await ReplyMessageService.SendReplyMessage( channelAccessToken, replyToken, MessageFactoryService.CreateMessage() .AddTextMessage("リプライ") ).ConfigureAwait(false); GetProfileResponse profile = await ProfileService.GetProfile(channelAccessToken, userId).ConfigureAwait(false); Trace.TraceInformation("User Id is " + profile?.userId); Trace.TraceInformation("Display Name is " + profile?.displayName); Trace.TraceInformation("Status Message is " + profile?.statusMessage); Trace.TraceInformation("Picture Url is " + profile?.pictureUrl); } break; case "茜ちゃん帰って": if (source is GroupSource) { string groupId = (source as GroupSource).groupId; if (groupId == null) { Trace.TraceInformation("Group Id is Null"); return; } await GroupService.LeaveGroup(channelAccessToken, groupId).ConfigureAwait(false); } else if (source is RoomSource) { string roomId = (source as RoomSource).roomId; if (roomId == null) { Trace.TraceInformation("Room Id is Null"); return; } await RoomService.LeaveRoom(channelAccessToken, roomId).ConfigureAwait(false); } break; default: Trace.TraceInformation("Unexpected Text"); break; } Trace.TraceInformation("End"); return; }
protected abstract void UIShouldShowSource(SourceBase source);
/// <summary> /// Creates a new stream data set connected to the byte array /// data source provided. /// </summary> /// <param name="data"> /// Byte array containing uncompressed data set. /// </param> /// <param name="mode"> /// The mode of operation the data set will be using. /// </param> internal IndirectDataSet(byte[] data, Modes mode) : base(DateTime.MinValue, mode) { Source = new SourceMemory(data); Pool = new Pool(Source); }
/// <summary> /// Constructs a new pool of readers for <see cref="SourceBase"/> /// provided. /// </summary> /// <param name="source"> /// The data source for the list. /// </param> public Pool(SourceBase source) { Source = source; }
/// <summary> /// Creates a new stream <see cref="DataSet"/> connected to the data /// file provided. /// </summary> /// <param name="fileName"> /// Valid path to the uncompressed data set file. /// </param> /// <param name="lastModified"> /// Date and time the source data was last modified. /// </param> /// <param name="mode"> /// The mode of operation the data set will be using. /// </param> /// <param name="isTempFile"> /// True if the file should be deleted when the source is disposed. /// </param> internal DataSet(string fileName, DateTime lastModified, Modes mode, bool isTempFile) : base(lastModified, mode) { Source = new SourceFile(fileName, isTempFile); Pool = new Pool(Source); }
/// <summary> /// Constructs a new pool of readers for <see cref="SourceBase"/> provided. /// </summary> /// <param name="source">The data source for the list</param> internal Pool(SourceBase source) { Source = source; }
protected override void UIShouldShowSource(SourceBase source) { }