当前位置: 首页>>代码示例>>C#>>正文


C# StateSet类代码示例

本文整理汇总了C#中StateSet的典型用法代码示例。如果您正苦于以下问题:C# StateSet类的具体用法?C# StateSet怎么用?C# StateSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StateSet类属于命名空间,在下文中一共展示了StateSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StateAgro

 public StateAgro(NavMeshAgent _agent, Vector3 _point, Transform _transform, ref StateSet _set)
 {
     set = _set;
     transform = _transform;
     agent = _agent;
     point = _point;
 }
开发者ID:OSW-team,项目名称:Project-4,代码行数:7,代码来源:StateMachine.cs

示例2: GetDocumentAnalysisDataAsync

            /// <summary>
            /// Return all local diagnostics (syntax, semantic) that belong to given document for the given StateSet (analyzer) either from cache or by calculating them
            /// </summary>
            public async Task<DocumentAnalysisData> GetDocumentAnalysisDataAsync(
                CompilationWithAnalyzers analyzerDriverOpt, Document document, StateSet stateSet, AnalysisKind kind, CancellationToken cancellationToken)
            {
                try
                {
                    var version = await GetDiagnosticVersionAsync(document.Project, cancellationToken).ConfigureAwait(false);
                    var state = stateSet.GetActiveFileState(document.Id);
                    var existingData = state.GetAnalysisData(kind);

                    if (existingData.Version == version)
                    {
                        return existingData;
                    }

                    // perf optimization. check whether analyzer is suppressed and avoid getting diagnostics if suppressed.
                    // REVIEW: IsAnalyzerSuppressed call seems can be quite expensive in certain condition. is there any other way to do this?
                    if (_owner.Owner.IsAnalyzerSuppressed(stateSet.Analyzer, document.Project))
                    {
                        return new DocumentAnalysisData(version, existingData.Items, ImmutableArray<DiagnosticData>.Empty);
                    }

                    var nullFilterSpan = (TextSpan?)null;
                    var diagnostics = await ComputeDiagnosticsAsync(analyzerDriverOpt, document, stateSet.Analyzer, kind, nullFilterSpan, cancellationToken).ConfigureAwait(false);

                    // we only care about local diagnostics
                    return new DocumentAnalysisData(version, existingData.Items, diagnostics.ToImmutableArrayOrEmpty());
                }
                catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
                {
                    throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:Eyas,项目名称:roslyn,代码行数:35,代码来源:DiagnosticIncrementalAnalyzer.Executor.cs

示例3: GetDocumentBodyAnalysisDataAsync

            public async Task<AnalysisData> GetDocumentBodyAnalysisDataAsync(
                StateSet stateSet, VersionArgument versions, DiagnosticAnalyzerDriver analyzerDriver,
                SyntaxNode root, SyntaxNode member, int memberId, bool supportsSemanticInSpan, MemberRangeMap.MemberRanges ranges)
            {
                try
                {
                    var document = analyzerDriver.Document;
                    var cancellationToken = analyzerDriver.CancellationToken;

                    var state = stateSet.GetState(StateType.Document);
                    var existingData = await state.TryGetExistingDataAsync(document, cancellationToken).ConfigureAwait(false);

                    ImmutableArray<DiagnosticData> diagnosticData;
                    if (supportsSemanticInSpan && CanUseRange(memberId, ranges.Ranges) && CanUseDocumentState(existingData, ranges.TextVersion, versions.DataVersion))
                    {
                        var memberDxData = await GetSemanticDiagnosticsAsync(analyzerDriver, stateSet.Analyzer).ConfigureAwait(false);

                        diagnosticData = _owner.UpdateDocumentDiagnostics(existingData, ranges.Ranges, memberDxData.AsImmutableOrEmpty(), root.SyntaxTree, member, memberId);
                        ValidateMemberDiagnostics(stateSet.Analyzer, document, root, diagnosticData);
                    }
                    else
                    {
                        // if we can't re-use existing document state, only option we have is updating whole document state here.
                        var dx = await GetSemanticDiagnosticsAsync(analyzerDriver, stateSet.Analyzer).ConfigureAwait(false);
                        diagnosticData = dx.AsImmutableOrEmpty();
                    }
                    return new AnalysisData(versions.TextVersion, versions.DataVersion, GetExistingItems(existingData), diagnosticData);
                }
                catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
                {
                    throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:noahfalk,项目名称:roslyn,代码行数:33,代码来源:DiagnosticIncrementalAnalyzer.AnalyzerExecutor.cs

示例4: StatesEqualityTests

        public void StatesEqualityTests()
        {
            var s1 = new StateSet
            {
                new State(1),
                new State(2),
                new State(438783),
                new State(4),
                new State(10010),
            };

            var s2 = new StateSet
            {
                new State(1),
                new State(2),
                new State(438783),
                new State(4),
                new State(10010),
            };

            var s3 = new StateSet
            {
                new State(1),
                new State(2),
                new State(438783),
                new State(5),
                new State(10010),
            };

            Assert.That(s1.GetHashCode(), Is.EqualTo(s2.GetHashCode()));
            Assert.That(s1, Is.EqualTo(s2));
            Assert.That(s1.GetHashCode(), Is.Not.EqualTo(s3.GetHashCode()));
            Assert.That(s1, Is.Not.EqualTo(s3));
        }
开发者ID:surenkov,项目名称:UCP,代码行数:34,代码来源:StateMachineTests.cs

示例5: DiagnosticAnalyzerMap

                    public DiagnosticAnalyzerMap(HostAnalyzerManager analyzerManager, string language, ImmutableDictionary<DiagnosticAnalyzer, StateSet> analyzerMap)
                    {
                        // hold directly on to compiler analyzer
                        _compilerAnalyzer = analyzerManager.GetCompilerDiagnosticAnalyzer(language);

                        // in test case, we might not have the compiler analyzer.
                        if (_compilerAnalyzer == null)
                        {
                            _map = analyzerMap;
                            return;
                        }

                        _compilerStateSet = analyzerMap[_compilerAnalyzer];

                        // hold rest of analyzers
                        _map = analyzerMap.Remove(_compilerAnalyzer);
                    }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs

示例6: GetDocumentAnalysisDataAsync

            public async Task<AnalysisData> GetDocumentAnalysisDataAsync(DiagnosticAnalyzerDriver analyzerDriver, StateSet stateSet, VersionArgument versions)
            {
                try
                {
                    var document = analyzerDriver.Document;
                    var cancellationToken = analyzerDriver.CancellationToken;

                    var state = stateSet.GetState(StateType.Document);
                    var existingData = await state.TryGetExistingDataAsync(document, cancellationToken).ConfigureAwait(false);

                    if (CheckSemanticVersions(document, existingData, versions))
                    {
                        return existingData;
                    }

                    var diagnosticData = await GetSemanticDiagnosticsAsync(analyzerDriver, stateSet.Analyzer).ConfigureAwait(false);
                    return new AnalysisData(versions.TextVersion, versions.DataVersion, GetExistingItems(existingData), diagnosticData.AsImmutableOrEmpty());
                }
                catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
                {
                    throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:noahfalk,项目名称:roslyn,代码行数:23,代码来源:DiagnosticIncrementalAnalyzer.AnalyzerExecutor.cs

示例7: RaiseDocumentDiagnosticsIfNeeded

        private void RaiseDocumentDiagnosticsIfNeeded(
            Document document, StateSet stateSet, AnalysisKind kind,
            ImmutableArray<DiagnosticData> oldItems, ImmutableArray<DiagnosticData> newItems,
            Action<DiagnosticsUpdatedArgs> raiseEvents)
        {
            if (oldItems.IsEmpty && newItems.IsEmpty)
            {
                // there is nothing to update
                return;
            }

            RaiseDiagnosticsCreated(document, stateSet, kind, newItems, raiseEvents);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs

示例8: SkipRunningAnalyzer

        private bool SkipRunningAnalyzer(
            CompilationOptions compilationOptions,
            DiagnosticAnalyzerDriver userDiagnosticDriver,
            bool openedDocument,
            bool skipClosedFileChecks,
            StateSet stateSet)
        {
            if (Owner.IsAnalyzerSuppressed(stateSet.Analyzer, userDiagnosticDriver.Project))
            {
                return true;
            }

            if (skipClosedFileChecks)
            {
                return false;
            }

            if (ShouldRunAnalyzerForClosedFile(compilationOptions, openedDocument, stateSet.Analyzer))
            {
                return false;
            }

            return true;
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:24,代码来源:DiagnosticIncrementalAnalyzer.cs

示例9: RaiseProjectDiagnosticsRemoved

        private void RaiseProjectDiagnosticsRemoved(StateSet stateSet, ProjectId projectId, IEnumerable<DocumentId> documentIds, bool handleActiveFile, Action<DiagnosticsUpdatedArgs> raiseEvents)
        {
            Solution nullSolution = null;
            foreach (var documentId in documentIds)
            {
                RaiseDiagnosticsRemoved(documentId, nullSolution, stateSet, AnalysisKind.NonLocal, raiseEvents);

                // we don't raise events for active file. it will be taken cared by active file analysis
                if (!handleActiveFile && stateSet.IsActiveFile(documentId))
                {
                    continue;
                }

                RaiseDiagnosticsRemoved(documentId, nullSolution, stateSet, AnalysisKind.Syntax, raiseEvents);
                RaiseDiagnosticsRemoved(documentId, nullSolution, stateSet, AnalysisKind.Semantic, raiseEvents);
            }

            RaiseDiagnosticsRemoved(projectId, nullSolution, stateSet, raiseEvents);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:19,代码来源:DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs

示例10: SetupStateSet

 public void SetupStateSet(Vector3 pointDown, Vector3 pointDeploy, Vector3 pointMarch, GameObject enemySF)
 {
     agent = GetComponentInChildren<NavMeshAgent>();
     targetSeeker = GetComponent<TargetSeek>();
     stateSet = new StateSet();
     //Debug.Log(pointDown);
     stateSet.down = new StateDown(agent, pointDown, transform, ref stateSet);
     stateSet.deploy = new StateDeploy(agent, pointDeploy, transform, ref stateSet);
     stateSet.marsh = new StateMarsh(agent, pointMarch, transform, ref stateSet);
     stateSet.assault = new StateAssault(agent, enemySF.transform.position, transform, ref stateSet);
     stateSet.agro = new StateAgro(agent, enemySF.transform.position, transform, ref stateSet);
     stateSet.agro.optimalDistance = optimalDistance;
     stateSet.agro.chaseDistance = chaseDistance;
     stateSet.agro.fearDistance = fearDistance;
     stateSet.currentState = stateSet.down;
 }
开发者ID:OSW-team,项目名称:Project-4,代码行数:16,代码来源:StateMachine.cs

示例11: ClearDocumentState

        private void ClearDocumentState(Document document, StateSet stateSet, StateType type, bool raiseEvent)
        {
            var state = stateSet.GetState(type);

            // remove saved info
            state.Remove(document.Id);

            if (raiseEvent)
            {
                // raise diagnostic updated event
                var documentId = document.Id;
                var solutionArgs = new SolutionArgument(document);

                RaiseDiagnosticsUpdated(type, document.Id, stateSet, solutionArgs, ImmutableArray<DiagnosticData>.Empty);
            }
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:16,代码来源:DiagnosticIncrementalAnalyzer.cs

示例12: GetDiagnosticAnalysisDataAsync

 protected abstract Task<AnalysisData> GetDiagnosticAnalysisDataAsync(Solution solution, DiagnosticAnalyzerDriver analyzerDriver, StateSet stateSet, StateType stateType, VersionArgument versions);
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:1,代码来源:DiagnosticIncrementalAnalyzer_GetDiagnostics.cs

示例13: RaiseProjectDiagnosticsUpdated

        private void RaiseProjectDiagnosticsUpdated(Project project, StateSet stateSet, ImmutableArray<DiagnosticData> diagnostics)
        {
            var group = diagnostics.GroupBy(d => d.DocumentId);
            foreach (var kv in group)
            {
                if (kv.Key == null)
                {
                    RaiseDiagnosticsUpdated(StateType.Project, project.Id, stateSet, new SolutionArgument(project), kv.ToImmutableArrayOrEmpty());
                    continue;
                }

                RaiseDiagnosticsUpdated(StateType.Project, kv.Key, stateSet, new SolutionArgument(project.GetDocument(kv.Key)), kv.ToImmutableArrayOrEmpty());
            }
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:14,代码来源:DiagnosticIncrementalAnalyzer.cs

示例14: RaiseDiagnosticsUpdated

        private void RaiseDiagnosticsUpdated(
            StateType type, object key, StateSet stateSet, SolutionArgument solution, ImmutableArray<DiagnosticData> diagnostics)
        {
            if (Owner == null)
            {
                return;
            }

            // get right arg id for the given analyzer
            var id = stateSet.ErrorSourceName != null ?
                (object)new HostAnalyzerKey(stateSet.Analyzer, type, key, stateSet.ErrorSourceName) : (object)new ArgumentKey(stateSet.Analyzer, type, key);

            Owner.RaiseDiagnosticsUpdated(this,
                new DiagnosticsUpdatedArgs(id, Workspace, solution.Solution, solution.ProjectId, solution.DocumentId, diagnostics));
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:15,代码来源:DiagnosticIncrementalAnalyzer.cs

示例15: RaiseProjectDiagnosticsRemovedIfNeeded

        private void RaiseProjectDiagnosticsRemovedIfNeeded(
            Project project, StateSet stateSet, ImmutableArray<DiagnosticData> existingItems, ImmutableArray<DiagnosticData> newItems)
        {
            if (existingItems.Length == 0)
            {
                return;
            }

            var removedItems = existingItems.GroupBy(d => d.DocumentId).Select(g => g.Key).Except(newItems.GroupBy(d => d.DocumentId).Select(g => g.Key));
            foreach (var documentId in removedItems)
            {
                if (documentId == null)
                {
                    RaiseDiagnosticsUpdated(StateType.Project, project.Id, stateSet, new SolutionArgument(project), ImmutableArray<DiagnosticData>.Empty);
                    continue;
                }

                var document = project.GetDocument(documentId);
                var argument = documentId == null ? new SolutionArgument(null, documentId.ProjectId, documentId) : new SolutionArgument(document);
                RaiseDiagnosticsUpdated(StateType.Project, documentId, stateSet, argument, ImmutableArray<DiagnosticData>.Empty);
            }
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:22,代码来源:DiagnosticIncrementalAnalyzer.cs


注:本文中的StateSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。