private static void ProcessComments(SyntaxNodeAnalysisContext context, List <SyntaxTrivia> comments, Location objectLocation, string objectName)
        {
            const int maxNumberOfLinesForComments = 5;
            var       singleLineComments          = comments.Where(a => a.IsKind(SyntaxKind.SingleLineCommentTrivia)).ToList();
            var       multiLineComments           = comments.Where(a => a.IsKind(SyntaxKind.MultiLineCommentTrivia)).ToList();

            if (singleLineComments.Count > 0 && multiLineComments.Count > 0)
            {
                DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, objectLocation, Rule, $"{objectName} has both multiline and single line comments. Please use only one type of comments.");
            }
            else if (singleLineComments.Count > maxNumberOfLinesForComments)
            {
                DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, objectLocation, Rule, $"{objectName} has more than {maxNumberOfLinesForComments} lines comments. Please use no more than {maxNumberOfLinesForComments} lines of comments.");
            }
            else if (multiLineComments.Count > 1)
            {
                DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, objectLocation, Rule, $"{objectName} has multiple MultiLines comments. Please use no more than 1 MultiLines of comments.");
            }
            else if (multiLineComments.Count == 1)
            {
                var numberOfLines = RegexManager.NumberOfLines(multiLineComments[0].ToFullString());
                if (numberOfLines > maxNumberOfLinesForComments)
                {
                    DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, objectLocation, Rule, $"{objectName} has more than {maxNumberOfLinesForComments} lines comments. Please use no more than {maxNumberOfLinesForComments} lines of comments.");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.Services.AddService(typeof(SpriteBatch), spriteBatch);
            DiagnosticsManager.Initialize(this);
            SpriteBatchHelpers.Initialize(GraphicsDevice);
            Primitives.Initialize(GraphicsDevice);
            Billboard.Initialize(GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding"));

            // TODO: use this.Content to load your game content here
            CreateSpheres();

            ship      = new Ship(this);
            followCam = new FollowCamera(camera, ship);

            lightningTexture = new LightningTexture(GraphicsDevice, 50, 100);

            #region Particles
            pSet = new ParticleSettings()
            {
                BlendState                 = BlendState.Additive,
                MaxParticles               = 10,
                Duration                   = TimeSpan.FromSeconds(0.5),
                DurationRandomness         = 0.1f,
                EmitterVelocitySensitivity = 0,
                MinVelocity                = 1f,
                MaxVelocity                = 2f,
                Gravity        = Vector3.Zero,
                EndVelocity    = 0,
                MinColor       = Color.White,
                MaxColor       = Color.White,
                MinRotateSpeed = -0.1f,
                MaxRotateSpeed = 0.1f,
                MinStartSize   = 0.25f,
                MaxStartSize   = 0.35f,
                MinEndSize     = 0.5f,
                MaxEndSize     = 0.6f
            };

            var pTex = new Texture2D(GraphicsDevice, 5, 5);
            pTex.SetData(Enumerable.Repeat(Color.FromNonPremultiplied(0, 0, 255, 125), 25).ToArray());

            var pEff = Content.Load <Effect>("Shaders/Particles");

            pSys = new ParticleSystem(this, pSet, pTex, pEff, camera);
            pEmi = new ParticleEmitter(pSys)
            {
                Position = Vector3.UnitX, ParticlesPerSecond = 10
            };
            pEmi2 = new ParticleEmitter(pSys)
            {
                Position = -Vector3.UnitX, ParticlesPerSecond = 10
            };
            //pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitY, ParticlesPerSecond = 10 };
            //pEmi = new ParticleEmitter(pSys) { Position = new Vector3(Vector2.One, 0), ParticlesPerSecond = 10 };
            #endregion

            base.LoadContent();
        }
        private void AnalyzeStringLiteralsWithinMethods(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

            var declaration = Cast <MethodDeclarationSyntax>(context.Node);
            var literals    = declaration.Body?.DescendantNodes().OfType <LiteralExpressionSyntax>().Where(x => x.IsKind(SyntaxKind.StringLiteralExpression)).ToList();

            if (literals != null)
            {
                foreach (var literal in literals)
                {
                    if (!literal.Parent.IsKind(SyntaxKind.ArrayInitializerExpression) &&
                        !literal.Parent.IsKind(SyntaxKind.EqualsExpression) &&
                        !literal.Parent.IsKind(SyntaxKind.CaseSwitchLabel) &&
                        !IsParentAnException(literal))
                    {
                        if (ParentDeclarationIsNotConstant(literal))
                        {
                            DiagnosticsManager.CreateHardCodedValueDiagnostic(context, literal.GetLocation(), Rule,
                                                                              literal.GetText().ToString());
                        }
                    }
                }
            }
        }
Esempio n. 4
0
    public void Setup(
        DiagnosticsManager diagnosticsManager,
        UIManager uiManager)
    {
        Debug.Log("Setup has been called");

        uiManager.BindUI(debugText);
        diagnosticsManager.Status();
    }
Esempio n. 5
0
        private void ReceivedMessage(object peer)
        {
            NetIncomingMessage message;

            while ((message = _Client.ReadMessage()) != null)
            {
                try
                {
                    // handle incoming message
                    switch (message.MessageType)
                    {
                    case NetIncomingMessageType.DebugMessage:
                    case NetIncomingMessageType.ErrorMessage:
                    case NetIncomingMessageType.WarningMessage:
                    case NetIncomingMessageType.VerboseDebugMessage:
                        DiagnosticsManager.WriteMessage(message.ReadString());
                        break;

                    case NetIncomingMessageType.StatusChanged:
                        NetConnectionStatus status = (NetConnectionStatus)message.ReadByte();
                        if (status == NetConnectionStatus.Connected)
                        {
                            DiagnosticsManager.WriteMessage("New connection: " + message.SenderEndPoint.ToString());

                            // login
                            WorldHelper.ClientToServerProvider.LoginRequest(_Connection, ClientWorldManager.Instance.Configuration.Network.PlayerName, "<EMPTY>", ClientWorldManager.Instance.Version, ClientWorldManager.Instance.SkinHash);
                        }
                        else if (status == NetConnectionStatus.Disconnected)
                        {
                            DiagnosticsManager.WriteMessage("Disconnected: " + message.SenderEndPoint.ToString());
                            ClientWorldManager.Instance.Stop();
                        }
                        break;

                    case NetIncomingMessageType.Data:
                        if (message.LengthBytes < 3)
                        {
                            break;
                        }
                        byte   messageCode = message.ReadByte();
                        int    length      = BitConverter.ToInt32(message.ReadBytes(4), 0);
                        byte[] data        = message.ReadBytes(length);

                        MultiPlayerProvider.ServerToClientProvider.ProcessReceivedMessage(_Connection, ref messageCode, ref data);
                        break;

                    default:
                        //Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes");
                        break;
                    }
                }
                catch (Exception ex)
                {
                    ExceptionHandler.LogException(ex);
                }
            }
        }
        public GameComponentFactory(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager = manager;
            game.Components.Add(this);

            var description = "Game component commands, for more information, use the \"help\" argument!";
            this.manager.Host.RegisterCommand("comps", description, Command);
            this.manager.Host.RegisterCommand("components", description, Command);
        }
        public GameComponentFactory(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager = manager;
            game.Components.Add(this);

            var description = "Game component commands, for more information, use the \"help\" argument!";

            this.manager.Host.RegisterCommand("comps", description, Command);
            this.manager.Host.RegisterCommand("components", description, Command);
        }
        private static void RaiseWarningDiagnostic(SyntaxNodeAnalysisContext context, int parameterCount, string comparisonText, Location declarationLocation)
        {
            if (parameterCount == MaximumNumberOfParametersWarning)
            {
                comparisonText = "equal to";
            }

            var warningMessage =
                $"Constructor has a total of {parameterCount} Parameters which is {comparisonText} the recommended maximum of {MaximumNumberOfParametersWarning}. Please consider refactoring the constructor / class.";

            DiagnosticsManager.ConstructorParameterDiagnostic(context, declarationLocation, WarningRule, warningMessage);
        }
        private static void ProcessDocumentationComments(SyntaxNodeAnalysisContext context, Location declarationLocation, string declarationName, int threshold)
        {
            var docummentation = CommentsManager.ExtractDocumentationComment(context.Node);

            if (docummentation != null)
            {
                var numberOfLines = RegexManager.NumberOfLines(docummentation.Content.ToFullString());
                if (numberOfLines > threshold)
                {
                    DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, declarationLocation, Rule, declarationName, threshold);
                }
            }
        }
        private void RaiseErrorDiagnostic(SyntaxNodeAnalysisContext context, int parameterCount, string comparisonText,
                                          Location declarationLocation)
        {
            if (parameterCount == MaximumNumberOfParametersError)
            {
                comparisonText = "equal to";
            }

            var warningMessage =
                $"Method has a total of {parameterCount} Parameters which is {comparisonText} the recommended maximum of {MaximumNumberOfParametersError}. Please refactor the method / class.";

            DiagnosticsManager.ConstructorParameterDiagnostic(context, declarationLocation, ErrorRule,
                                                              warningMessage);
        }
Esempio n. 11
0
        private void AnalyzedInterfaceDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

            var declaration = Cast <InterfaceDeclarationSyntax>(context.Node);

            if (!CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
        private void AnalyzedInterfaceDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <InterfaceDeclarationSyntax>(context.Node);

            if (!(IsExternallyVisible(declaration.Modifiers) || declaration.Modifiers.Any(SyntaxKind.PrivateKeyword)))
            {
                DiagnosticsManager.CreateExplicitAccessDiagnostic(context, declaration.Identifier.Text, declaration.GetLocation(), Rule);
            }
        }
Esempio n. 13
0
        private void AnalyzedClassDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

            var declaration = Cast <ClassDeclarationSyntax>(context.Node);

            if (IsExternallyVisibleComments(declaration.Modifiers) && !CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
        private void AnalyzedClassDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <ClassDeclarationSyntax>(context.Node);

            if (!ModifierContains(declaration.Modifiers, new List <SyntaxKind> {
                SyntaxKind.PublicKeyword, SyntaxKind.InternalKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.PrivateKeyword
            }))
            {
                DiagnosticsManager.CreateExplicitAccessDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
        private void AnalyzedMethodDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <MethodDeclarationSyntax>(context.Node);

            // if this method is within an interface then we do not need to process with access qualifier check
            var interfaceDeclaration = Cast <InterfaceDeclarationSyntax>(declaration.Parent);

            if (((interfaceDeclaration == null && IsExternallyVisibleComments(declaration.Modifiers)) || interfaceDeclaration != null) &&
                !CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
        private void AnalyzedConstructorDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <ConstructorDeclarationSyntax>(context.Node);

            if (!declaration.Modifiers.Any(SyntaxKind.StaticKeyword))
            {
                if (!(IsExternallyVisible(declaration.Modifiers) || ModifierContains(declaration.Modifiers, new List <SyntaxKind> {
                    SyntaxKind.PrivateKeyword
                })))
                {
                    DiagnosticsManager.CreateExplicitAccessDiagnostic(context, $"Constructor {declaration.Identifier.Text}", declaration.Identifier.GetLocation(), Rule);
                }
            }
        }
Esempio n. 17
0
        private void AnalysisDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

            var declaration = Cast <ClassDeclarationSyntax>(context.Node);

            if (declaration.Modifiers.Any(SyntaxKind.StaticKeyword))
            {
                var isExtensionClass = IsAnExtensionClass(declaration);

                if (!isExtensionClass)
                {
                    DiagnosticsManager.CreateStaticClassDiagnostic(context, declaration.Identifier.GetLocation(), Rule);
                }
            }
        }
Esempio n. 18
0
        private bool ProcessMultiLineComments(SyntaxNodeAnalysisContext context, List <SyntaxTrivia> multiLineComments)
        {
            var multiLineCommentViolationFound = false;

            if (multiLineComments?.Count > 0)
            {
                foreach (var multiLineComment in multiLineComments)
                {
                    var content = multiLineComment.ToFullString();
                    if (RegexManager.MatchFound($@"\/[*]((.)*\n){{{MaxNoOfLinesForComments},}}", content))
                    {
                        DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, multiLineComment.GetLocation(), Rule, Message);
                        multiLineCommentViolationFound = true;
                        break;
                    }
                }
            }
            return(multiLineCommentViolationFound);
        }
        private void AnalyzedPropertyDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <PropertyDeclarationSyntax>(context.Node);

            // if this property is within an interface then we do not need to process with access qualifier check
            var interfaceDeclaration = declaration.Parent as InterfaceDeclarationSyntax;

            if (interfaceDeclaration == null && !ModifierContains(declaration.Modifiers, new List <SyntaxKind> {
                SyntaxKind.PublicKeyword, SyntaxKind.InternalKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.PrivateKeyword
            }))
            {
                DiagnosticsManager.CreateExplicitAccessDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
Esempio n. 20
0
 private void ProcessSingleLineComments(SyntaxNodeAnalysisContext context, List <SyntaxTrivia> singleLineComments, string declarationBodyText = null)
 {
     if (singleLineComments?.Count > 0)
     {
         if (!string.IsNullOrWhiteSpace(declarationBodyText) && RegexManager.MatchFound($@"((\s)*\/\/(.)*(\n)*){{{MaxNoOfLinesForComments},}}", declarationBodyText))
         {
             foreach (var singleLineComment in singleLineComments)
             {
                 DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, singleLineComment.GetLocation(), Rule, Message);
             }
         }
         else if (singleLineComments.Count > MaxNoOfLinesForComments)
         {
             foreach (var singleLineComment in singleLineComments)
             {
                 DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, singleLineComment.GetLocation(), Rule, Message);
             }
         }
     }
 }
Esempio n. 21
0
        public FPSCounter(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager    = manager;
            this.SampleSpan = TimeSpan.FromSeconds(1);
            sb   = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            font = game.Content.Load <SpriteFont>("Fonts/DebugFont");
            game.Components.Add(this);

            manager.Host.RegisterCommand("fps", "FPS Counter", (host, args) =>
            {
                if (args.Count() == 0)
                {
                    Visible = !Visible;
                }

                foreach (var arg in args)
                {
                    switch (arg.ToLower())
                    {
                    case "on":
                        Visible = true;
                        break;

                    case "off":
                        Visible = false;
                        break;
                    }
                }

                return(0);
            });

            FPS                  = 0;
            fastestFrame         = 1000;
            slowestFrame         = 0;
            sampleFrames         = 0;
            stopwatch            = Stopwatch.StartNew();
            stringBuilder.Length = 0;
        }
        private static void AnalyzeComments(SyntaxNodeAnalysisContext context, SyntaxToken syntaxToken, string message)
        {
            var leadingComments = context.Node.GetLeadingTrivia()
                                  .Where(a => a.IsKind(SyntaxKind.MultiLineCommentTrivia) || a.IsKind(SyntaxKind.SingleLineCommentTrivia))
                                  .ToList();
            var trailingComments = context.Node.GetTrailingTrivia()
                                   .Where(a => a.IsKind(SyntaxKind.MultiLineCommentTrivia) || a.IsKind(SyntaxKind.SingleLineCommentTrivia))
                                   .ToList();

            if (leadingComments.Count > 0 && trailingComments.Count > 0)
            {
                // we don't want a variable to have both leading and trailing comments
                DiagnosticsManager.CreateCommentsTooLongDiagnostic(context, syntaxToken.GetLocation(), Rule, message);
            }
            else if (leadingComments.Count > 0)
            {
                ProcessComments(context, leadingComments, syntaxToken.GetLocation(), syntaxToken.Text);
            }
            else if (trailingComments.Count > 0)
            {
                ProcessComments(context, trailingComments, syntaxToken.GetLocation(), syntaxToken.Text);
            }
        }
Esempio n. 23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws Throwable
            public override void Start()
            {
                DiagnosticsManager diagnosticsManager = outerInstance.ResolveDependency(typeof(DiagnosticsManager));
                Log diagnosticsLog = diagnosticsManager.TargetLog;

                diagnosticsLog.Info("--- SERVER STARTED START ---");
                outerInstance.connectorPortRegister = outerInstance.dependencyResolver.ResolveDependency(typeof(ConnectorPortRegister));
                outerInstance.databaseActions       = outerInstance.CreateDatabaseActions();

                outerInstance.transactionFacade = outerInstance.createTransactionalActions();

                outerInstance.CypherExecutor = new CypherExecutor(outerInstance.DatabaseConflict, outerInstance.UserLogProvider);

                outerInstance.ConfigureWebServer();

                outerInstance.CypherExecutor.start();

                outerInstance.startModules();

                outerInstance.StartWebServer();

                diagnosticsLog.Info("--- SERVER STARTED END ---");
            }
Esempio n. 24
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.Services.AddService(typeof(SpriteBatch), spriteBatch);
            DiagnosticsManager.Initialize(this);
            SpriteBatchHelpers.Initialize(GraphicsDevice);
            Primitives.Initialize(GraphicsDevice);

            Renderer = new Engine.Graphics.Renderer()
            {
                Camera = new PerspectiveCamera()
                {
                    Position    = Vector3.UnitX,
                    Target      = Vector3.Zero,
                    Up          = Vector3.Up,
                    FieldOfView = MathHelper.PiOver4,
                    AspectRatio = GraphicsDevice.Viewport.AspectRatio,
                    NearPlane   = 0.01f,
                    FarPlane    = 5000f
                }
            };

            // TODO: use this.Content to load your game content here
            // TODO: load assets (player string font and player model)

            World = new World(this, Renderer);

            var player      = World.SpawnPlayer("Player1");
            var playerTrans = World.Transformations[player];

            playerTrans.Scale = new Vector3(2);

            // TODO: load world state from data files

            base.LoadContent();
        }
Esempio n. 25
0
        public FPSCounter(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager = manager;
            this.SampleSpan = TimeSpan.FromSeconds(1);
            sb = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            font = game.Content.Load<SpriteFont>("Fonts/DebugFont");
            game.Components.Add(this);

            manager.Host.RegisterCommand("fps", "FPS Counter", (host, args) =>
            {
                if (args.Count() == 0) Visible = !Visible;

                foreach (var arg in args)
                {
                    switch (arg.ToLower())
                    {
                        case "on":
                            Visible = true;
                            break;
                        case "off":
                            Visible = false;
                            break;
                    }
                }

                return 0;
            });

            FPS = 0;
            fastestFrame = 1000;
            slowestFrame = 0;
            sampleFrames = 0;
            stopwatch = Stopwatch.StartNew();
            stringBuilder.Length = 0;
        }
Esempio n. 26
0
        public PlatformModule(File providedStoreDir, Config config, DatabaseInfo databaseInfo, GraphDatabaseFacadeFactory.Dependencies externalDependencies)
        {
            this.DatabaseInfo      = databaseInfo;
            this.DataSourceManager = new DataSourceManager(config);
            Dependencies           = new Dependencies();
            Dependencies.satisfyDependency(databaseInfo);

            Clock = Dependencies.satisfyDependency(CreateClock());
            Life  = Dependencies.satisfyDependency(CreateLife());

            this.StoreLayout = StoreLayout.of(providedStoreDir);

            config.AugmentDefaults(GraphDatabaseSettings.neo4j_home, StoreLayout.storeDirectory().Path);
            this.Config = Dependencies.satisfyDependency(config);

            FileSystem = Dependencies.satisfyDependency(CreateFileSystemAbstraction());
            Life.add(new FileSystemLifecycleAdapter(FileSystem));

            // Component monitoring
            Monitors = externalDependencies.Monitors() == null ? new Monitors() : externalDependencies.Monitors();
            Dependencies.satisfyDependency(Monitors);

            JobScheduler = Life.add(Dependencies.satisfyDependency(CreateJobScheduler()));
            StartDeferredExecutors(JobScheduler, externalDependencies.DeferredExecutors());

            // Cleanup after recovery, used by GBPTree, added to life in NeoStoreDataSource
            RecoveryCleanupWorkCollector = new GroupingRecoveryCleanupWorkCollector(JobScheduler);
            Dependencies.satisfyDependency(RecoveryCleanupWorkCollector);

            // Database system information, used by UDC
            UsageData = new UsageData(JobScheduler);
            Dependencies.satisfyDependency(Life.add(UsageData));

            // If no logging was passed in from the outside then create logging and register
            // with this life
            Logging = Dependencies.satisfyDependency(CreateLogService(externalDependencies.UserLogProvider()));

            config.Logger = Logging.getInternalLog(typeof(Config));

            Life.add(Dependencies.satisfyDependency(new StoreLockerLifecycleAdapter(CreateStoreLocker())));

            (new JvmChecker(Logging.getInternalLog(typeof(JvmChecker)), new JvmMetadataRepository())).checkJvmCompatibilityAndIssueWarning();

            string desiredImplementationName = config.Get(GraphDatabaseSettings.tracer);

            Tracers = Dependencies.satisfyDependency(new Tracers(desiredImplementationName, Logging.getInternalLog(typeof(Tracers)), Monitors, JobScheduler, Clock));
            Dependencies.satisfyDependency(Tracers.pageCacheTracer);
            Dependencies.satisfyDependency(FirstImplementor(typeof(LogRotationMonitor), Tracers.transactionTracer, LogRotationMonitor.NULL));
            Dependencies.satisfyDependency(FirstImplementor(typeof(CheckPointerMonitor), Tracers.checkPointTracer, CheckPointerMonitor.NULL));

            VersionContextSupplier = CreateCursorContextSupplier(config);

            CollectionsFactorySupplier = CreateCollectionsFactorySupplier(config, Life);

            Dependencies.satisfyDependency(VersionContextSupplier);
            PageCache = Dependencies.satisfyDependency(CreatePageCache(FileSystem, config, Logging, Tracers, VersionContextSupplier, JobScheduler));

            Life.add(new PageCacheLifecycle(PageCache));

            DiagnosticsManager = Life.add(Dependencies.satisfyDependency(new DiagnosticsManager(Logging.getInternalLog(typeof(DiagnosticsManager)))));
            SystemDiagnostics.registerWith(DiagnosticsManager);

            Dependencies.satisfyDependency(DataSourceManager);

            KernelExtensionFactories = externalDependencies.KernelExtensions();
            EngineProviders          = externalDependencies.ExecutionEngines();
            GlobalKernelExtensions   = Dependencies.satisfyDependency(new GlobalKernelExtensions(new SimpleKernelContext(StoreLayout.storeDirectory(), databaseInfo, Dependencies), KernelExtensionFactories, Dependencies, KernelExtensionFailureStrategies.fail()));

            UrlAccessRule = Dependencies.satisfyDependency(URLAccessRules.combined(externalDependencies.UrlAccessRules()));

            ConnectorPortRegister = new ConnectorPortRegister();
            Dependencies.satisfyDependency(ConnectorPortRegister);

            EventHandlers       = new KernelEventHandlers(Logging.getInternalLog(typeof(KernelEventHandlers)));
            PanicEventGenerator = new DatabasePanicEventGenerator(EventHandlers);

            PublishPlatformInfo(Dependencies.resolveDependency(typeof(UsageData)));
        }
Esempio n. 27
0
 public override void RegisterDiagnostics(DiagnosticsManager diagnosticsManager)
 {
     _neoStores.registerDiagnostics(diagnosticsManager);
 }
Esempio n. 28
0
        public TimeRuler(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager = manager;
            sb = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            game.Components.Add(this);

            MaxBars = 8;
            MaxSamples = 256;
            MaxNestCalls = 32;
            MaxSampleFrames = 4;
            LogSnapDuration = 120;
            BarHeight = 8;
            BarPadding = 2;
            AutoAdjustDelay = 30;

            Position = new Vector2(10, 4);
            Width = GraphicsDevice.PresentationParameters.BackBufferWidth - 20;

            manager.Host.RegisterCommand("tr", "TimeRuler subsystem, use the \"help\" arg to get more info!", (host, args) =>
                {
                    bool previousVisible = Visible;
                    if (args.Count() == 0) Visible = !Visible;

                    char[] subArgSeparator = new[] { ':' };
                    foreach (var orgArg in args)
                    {
                        string arg = orgArg.ToLower();
                        string[] subArgs = arg.Split(subArgSeparator);
                        switch (subArgs[0])
                        {
                            case "on":
                                Visible = true;
                                break;
                            case "off":
                                Visible = false;
                                break;
                            case "reset":
                                ResetLog();
                                break;
                            case "log":
                                if (subArgs.Length > 1)
                                {
                                    if (string.Compare(subArgs[1], "on") == 0)
                                        ShowLog = true;
                                    if (string.Compare(subArgs[1], "off") == 0)
                                        ShowLog = false;
                                }
                                else
                                {
                                    ShowLog = !ShowLog;
                                }
                                break;
                            case "frame":
                                int a = Int32.Parse(subArgs[1]);
                                a = Math.Max(a, 1);
                                a = Math.Min(a, MaxSampleFrames);
                                TargetSampleFrames = a;
                                break;
                            case "/?":
                            case "help":
                                manager.UI.Echo("tr [log|on|off|reset|frame]");
                                manager.UI.Echo("Options:");
                                manager.UI.Echo("   on      Shows TimeRuler");
                                manager.UI.Echo("   off     Hides TimeRuler");
                                manager.UI.Echo("   log     Shows/Hides marker log");
                                manager.UI.Echo("   reset   Resets marker log");
                                manager.UI.Echo("   frame:sampleFrames");
                                manager.UI.Echo("           Changes target sample frame count");
                                break;
                        }
                    }

                    if (Visible != previousVisible)
                    {
                        System.Threading.Interlocked.Exchange(ref updateCount, 0);
                    }

                    return 0;
                });

            Initialize();
        }
Esempio n. 29
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: DiagnosticsImpl(org.neo4j.jmx.impl.ManagementData management) throws javax.management.NotCompliantMBeanException
            internal DiagnosticsImpl(ManagementData management) : base(management)
            {
                Config           = management.ResolveDependency(typeof(Config));
                this.Diagnostics = management.ResolveDependency(typeof(DiagnosticsManager));
            }
Esempio n. 30
0
        public TimeRuler(Game game, DiagnosticsManager manager)
            : base(game)
        {
            this.manager = manager;
            sb           = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            game.Components.Add(this);

            MaxBars         = 8;
            MaxSamples      = 256;
            MaxNestCalls    = 32;
            MaxSampleFrames = 4;
            LogSnapDuration = 120;
            BarHeight       = 8;
            BarPadding      = 2;
            AutoAdjustDelay = 30;

            Position = new Vector2(10, 4);
            Width    = GraphicsDevice.PresentationParameters.BackBufferWidth - 20;

            manager.Host.RegisterCommand("tr", "TimeRuler subsystem, use the \"help\" arg to get more info!", (host, args) =>
            {
                bool previousVisible = Visible;
                if (args.Count() == 0)
                {
                    Visible = !Visible;
                }

                char[] subArgSeparator = new[] { ':' };
                foreach (var orgArg in args)
                {
                    string arg       = orgArg.ToLower();
                    string[] subArgs = arg.Split(subArgSeparator);
                    switch (subArgs[0])
                    {
                    case "on":
                        Visible = true;
                        break;

                    case "off":
                        Visible = false;
                        break;

                    case "reset":
                        ResetLog();
                        break;

                    case "log":
                        if (subArgs.Length > 1)
                        {
                            if (string.Compare(subArgs[1], "on") == 0)
                            {
                                ShowLog = true;
                            }
                            if (string.Compare(subArgs[1], "off") == 0)
                            {
                                ShowLog = false;
                            }
                        }
                        else
                        {
                            ShowLog = !ShowLog;
                        }
                        break;

                    case "frame":
                        int a = Int32.Parse(subArgs[1]);
                        a     = Math.Max(a, 1);
                        a     = Math.Min(a, MaxSampleFrames);
                        TargetSampleFrames = a;
                        break;

                    case "/?":
                    case "help":
                        manager.UI.Echo("tr [log|on|off|reset|frame]");
                        manager.UI.Echo("Options:");
                        manager.UI.Echo("   on      Shows TimeRuler");
                        manager.UI.Echo("   off     Hides TimeRuler");
                        manager.UI.Echo("   log     Shows/Hides marker log");
                        manager.UI.Echo("   reset   Resets marker log");
                        manager.UI.Echo("   frame:sampleFrames");
                        manager.UI.Echo("           Changes target sample frame count");
                        break;
                    }
                }

                if (Visible != previousVisible)
                {
                    System.Threading.Interlocked.Exchange(ref updateCount, 0);
                }

                return(0);
            });

            Initialize();
        }
Esempio n. 31
0
 public virtual void RegisterDiagnostics(DiagnosticsManager diagnosticsManager)
 {
     diagnosticsManager.RegisterAll(typeof(NeoStoresDiagnostics), this);
 }