Exemplo n.º 1
0
        private void CommonHandle(Message message)
        {
            if (BlockWriter && !(message is SystemMessage.StateChangeMessage))
            {
                Log.Verbose("Blocking message {message} in StorageWriterService. Message:", message.GetType().Name);
                Log.Verbose("{message}", message);
                return;
            }

            if (_vnodeState != VNodeState.Leader && _vnodeState != VNodeState.ResigningLeader && message is StorageMessage.ILeaderWriteMessage)
            {
                Log.Fatal("{message} appeared in StorageWriter during state {vnodeStrate}.", message.GetType().Name,
                          _vnodeState);
                var msg = String.Format("{0} appeared in StorageWriter during state {1}.", message.GetType().Name,
                                        _vnodeState);
                Application.Exit(ExitCode.Error, msg);
                return;
            }

            try {
                _writerBus.Handle(message);
            } catch (Exception exc) {
                BlockWriter = true;
                Log.Fatal(exc, "Unexpected error in StorageWriterService. Terminating the process...");
                Application.Exit(ExitCode.Error,
                                 string.Format("Unexpected error in StorageWriterService: {0}", exc.Message));
            }
        }
Exemplo n.º 2
0
        //public EditorState GetActiveEditorState() {
        //	return GetActiveEditorState(out IVsTextView textView);
        //}

        // someday, this can return...
        //public bool QueryExtensions(string author, params string[] names)
        //{
        //    if (_extensionManager == null)
        //    {
        //        Log.Debug($"{nameof(_extensionManager)} is null");
        //        return false;
        //    }

        //    foreach (var extension in _extensionManager.GetInstalledExtensions())
        //    {
        //        IExtensionHeader header = extension.Header;
        //        if (!header.SystemComponent &&
        //            header.Author.EqualsIgnoreCase(author) && names.Any(_ => _.EqualsIgnoreCase(header.Name)))
        //        {
        //            return true;
        //        }
        //    }
        //    return false;
        //}

        /// <summary>
        /// Tries to get an active text view for a file that may have just opened.
        /// Uses a naive exponential backoff algorithm against the IsDocumentOpen VSShell utility
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <remarks>https://stackoverflow.com/a/7373385/208022</remarks>
        internal IWpfTextView TryGetPendingWpfTextView(string filePath)
        {
            var            editorAdapterFactoryService = _componentModel.GetService <IVsEditorAdaptersFactoryService>();
            IVsUIHierarchy uiHierarchy;
            uint           itemID;
            IVsWindowFrame windowFrame = null;

            if (Retry.WithExponentialBackoff(() => {
                if (VsShellUtilities.IsDocumentOpen(
                        _serviceProvider,
                        filePath,
                        Guid.Empty,
                        out uiHierarchy,
                        out itemID,
                        out windowFrame))
                {
                    return(true);
                }
                return(false);
            }))
            {
                if (windowFrame == null)
                {
                    return(null);
                }

                IVsTextView view = VsShellUtilities.GetTextView(windowFrame);
                Log.Verbose($"{nameof(TryGetPendingWpfTextView)} found for {filePath}");
                return(editorAdapterFactoryService.GetWpfTextView(view));
            }

            return(null);
        }
Exemplo n.º 3
0
        internal void Start(TApplication instance)
        {
            Application = instance;
            var bits = IntPtr.Size == 4 ? 32 : 64;

            Log.Verbose($"{bits} Bit System detected. (Pointer Size: {IntPtr.Size} Bytes)");
            Log.Verbose("OS: {OSVersion}", Environment.OSVersion);

            if (Config.UseGtkUI)
            {
                Log.Verbose("Init GtkUI");
                ui = CreateGtkUI();
                ui.Start();
                Log.Verbose("GtkUI initialized");
            }

            if (Config.UseConsole)
            {
                Log.Verbose("Configure for console session");
                th = new Thread(UIThreadMain);
                th.Start();

                ConsoleLoop();

                Application.Stop();
                Application.Dispose();
                th.Abort();
                Environment.Exit(0);
            }
            else
            {
                UIThreadMain();
                Environment.Exit(0);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Dumps a type as script, if the script is not already existing.
        /// </summary>
        /// <param name="type">Type that should be dumped.</param>
        /// <param name="guids">
        /// Dictionary of types and guids that have been dumped.
        /// If the return value is <see langword="false"/>, this will be <see langword="null" />
        /// </param>
        /// <returns><see langword="true"/> if the type was dumped, <see langword="false"/> otherwise.</returns>
        public bool DumpIfNotExists(Type type, out Dictionary <Type, string> guids)
        {
            type = type.DeArray().GetRoot();

            if (type.IsGenericType)
            {
                foreach (var arg in type.GetGenericArguments())
                {
                    if (arg.IsGenericParameter)
                    {
                        continue;
                    }

                    referencedTypes.Enqueue(arg);
                }

                type = type.GetGenericTypeDefinition();
            }

            if (!dumpedTypes.Add(type) || !ShouldDumpType(type))
            {
                logger.Verbose("Do not dump {Type} (ShouldDump: {Bool})", type.FullName, ShouldDumpType(type));
                guids = null;
                return(false);
            }

            guids       = new Dictionary <Type, string>();
            guids[type] = DumpType(type);

            // Dump all referenced types
            while (referencedTypes.Count > 0)
            {
                var childType = referencedTypes.Dequeue().DeArray().GetRoot();

                if (childType.IsGenericType)
                {
                    foreach (var arg in childType.GetGenericArguments())
                    {
                        if (arg.IsGenericParameter)
                        {
                            continue;
                        }

                        referencedTypes.Enqueue(arg);
                    }

                    childType = childType.GetGenericTypeDefinition();
                }

                if (!dumpedTypes.Add(childType) || !ShouldDumpType(childType))
                {
                    continue;
                }

                guids[childType] = DumpType(childType);
            }

            return(true);
        }
Exemplo n.º 5
0
        public void Handle(ReplicationMessage.RawChunkBulk message)
        {
            if (_subscriptionId != message.SubscriptionId)
            {
                return;
            }
            if (_activeChunk == null)
            {
                ReplicationFail(
                    "Physical chunk bulk received, but we do not have active chunk.",
                    "Physical chunk bulk received, but we do not have active chunk.");
            }

            if (_activeChunk.ChunkHeader.ChunkStartNumber != message.ChunkStartNumber ||
                _activeChunk.ChunkHeader.ChunkEndNumber != message.ChunkEndNumber)
            {
                Log.Error(
                    "Received RawChunkBulk for TFChunk {chunkStartNumber}-{chunkEndNumber}, but active chunk is {activeChunk}.",
                    message.ChunkStartNumber, message.ChunkEndNumber, _activeChunk);
                return;
            }

            if (_activeChunk.RawWriterPosition != message.RawPosition)
            {
                Log.Error(
                    "Received RawChunkBulk at raw pos {rawPosition} (0x{rawPosition:X}) while current writer raw pos is {rawWriterPosition} (0x{rawWriterPosition:X}).",
                    message.RawPosition, message.RawPosition, _activeChunk.RawWriterPosition,
                    _activeChunk.RawWriterPosition);
                return;
            }

            if (!_activeChunk.TryAppendRawData(message.RawBytes))
            {
                ReplicationFail(
                    "Could not append raw bytes to chunk {0}-{1}, raw pos: {2} (0x{3:X}), bytes length: {4} (0x{5:X}). Chunk file size: {6} (0x{7:X}).",
                    "Could not append raw bytes to chunk {chunkStartNumber}-{chunkEndNumber}, raw pos: {rawPosition} (0x{rawPosition:X}), bytes length: {rawBytesLength} (0x{rawBytesLength:X}). Chunk file size: {chunkFileSize} (0x{chunkFileSize:X}).",
                    message.ChunkStartNumber, message.ChunkEndNumber, message.RawPosition, message.RawPosition,
                    message.RawBytes.Length, message.RawBytes.Length, _activeChunk.FileSize, _activeChunk.FileSize);
            }

            _subscriptionPos += message.RawBytes.Length;

            if (message.CompleteChunk)
            {
                Log.Verbose("Completing raw chunk {chunkStartNumber}-{chunkEndNumber}...", message.ChunkStartNumber,
                            message.ChunkEndNumber);
                Writer.CompleteReplicatedRawChunk(_activeChunk);

                _subscriptionPos = _activeChunk.ChunkHeader.ChunkEndPosition;
                _framer.Reset();
                _activeChunk = null;
            }

            if (message.CompleteChunk || _subscriptionPos > _ackedSubscriptionPos)
            {
                _ackedSubscriptionPos = _subscriptionPos;
                Bus.Publish(new ReplicationMessage.AckLogPosition(_subscriptionId, _ackedSubscriptionPos));
            }
        }
Exemplo n.º 6
0
        private void AddRef()
        {
            // if (ObjectLabel.IsUnset())
            //     throw new Exception("ObjectLabel not set!");

            Log.Verbose("Alloc Texture #{Handle} {ObjectLabel}", Handle, ObjectLabel);
            InternalTextureManager.AddRef(this);
        }
Exemplo n.º 7
0
        public void Intercept(IInvocation invocation)
        {
            _logger.Verbose("Calling method: {0} with parameters: {1}... ",
                            invocation.Method.Name,
                            string.Join(", ", invocation.Arguments.Select(a => (a ?? "").ToString()).ToArray()));

            invocation.Proceed();
            _logger.Verbose("The method: {methodName} return value was {@Return}.", invocation.Method.Name, invocation.ReturnValue);
        }
Exemplo n.º 8
0
        public TestBase()
        {
            DebugHelper.LogThreadInfo("UnitTestThread");

            Log.Verbose("Waiting for {Name}", nameof(AppWaiter));
            AppWaiter.WaitOne();
            Log.Verbose("Waiting {Name} done", nameof(AppWaiter));
            App = new TestsApplication();
            App.Run();
            Console.WriteLine("Ready for tests");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Logs the specified log event.
        /// </summary>
        /// <param name="logEvent">The <see cref="T:Swan.LogMessageReceivedEventArgs" /> instance containing the event data.</param>
        public void Log(LogMessageReceivedEventArgs logEvent)
        {
            switch (logEvent.MessageType)
            {
            case LogLevel.None:
                break;

            case LogLevel.Info:
                _logger.Information("{@logEvent}", logEvent);
                break;

            case LogLevel.Trace:
                _logger.Verbose("{@logEvent}", logEvent);
                break;

            case LogLevel.Debug:
                _logger.Debug("{@logEvent}", logEvent);
                break;

            case LogLevel.Warning:
                _logger.Warning("{@logEvent}", logEvent);
                break;

            case LogLevel.Error:
                _logger.Error("{@logEvent}", logEvent);
                break;

            case LogLevel.Fatal:
                _logger.Fatal("{@logEvent}", logEvent);
                break;
            }
        }
Exemplo n.º 10
0
        public void Publish(Message message)
        {
            //if (message == null) throw new ArgumentNullException("message");

            var handlers = _handlers[message.MsgTypeId];

            for (int i = 0, n = handlers.Count; i < n; ++i)
            {
                var handler = handlers[i];
                if (_watchSlowMsg)
                {
                    var start = DateTime.UtcNow;

                    handler.TryHandle(message);

                    var elapsed = DateTime.UtcNow - start;
                    if (elapsed > _slowMsgThreshold)
                    {
                        Log.Verbose("SLOW BUS MSG [{bus}]: {message} - {elapsed}ms. Handler: {handler}.",
                                    Name, message.GetType().Name, (int)elapsed.TotalMilliseconds, handler.HandlerName);
                        if (elapsed > QueuedHandler.VerySlowMsgThreshold && !(message is SystemMessage.SystemInit))
                        {
                            Log.Error("---!!! VERY SLOW BUS MSG [{bus}]: {message} - {elapsed}ms. Handler: {handler}.",
                                      Name, message.GetType().Name, (int)elapsed.TotalMilliseconds, handler.HandlerName);
                        }
                    }
                }
                else
                {
                    handler.TryHandle(message);
                }
            }
        }
Exemplo n.º 11
0
        private static void AttachTraceLogToCrashReport(ILogger log)
        {
            var info      = new DirectoryInfo(FileSystem.AppDataDirectory);
            var textFiles = info.EnumerateFiles("*.txt");
            var lastFile  = textFiles.OrderByDescending(t => t.LastWriteTime).FirstOrDefault();

            if (lastFile == null)
            {
                log.Verbose("Log file was not found");
                return;
            }

            try
            {
                var logFilePath = lastFile.FullName;
                var tempPath    = Path.Combine(FileSystem.CacheDirectory, lastFile.Name + "-temp");
                if (File.Exists(tempPath))
                {
                    File.Delete(tempPath);
                }
                File.Copy(logFilePath, tempPath);
                var traceLog = File.ReadAllText(tempPath);
                Crashes.GetErrorAttachments = report => new[]
                {
                    ErrorAttachmentLog.AttachmentWithText(traceLog, "traceLog.txt")
                };
            }
            catch (Exception e)
            {
                log.Error(e, "Failed to parse text in traceLog");
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 启动数据库运行
        /// </summary>
        /// <param name="dataBasePath">数据库路径</param>
        public void Start(string dataBasePath = null)
        {
            if (dataBasePath != null)
            {
                this.DataBasePath = dataBasePath;
            }
            _db = new SQLiteConnectionWithLock(new SQLiteConnectionString(
                                                   DataBasePath,
                                                   SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.FullMutex, true))
            {
                // debug log
                Trace         = true,
                TimeExecution = true,
                Tracer        = s => Log?.Verbose(" [pid={0}] {1}", Thread.CurrentThread.ManagedThreadId, s),
                BusyTimeout   = TimeSpan.FromMilliseconds(5000),
                SkipLock      = false
            };

            // 创建表,这个库会自动处理数据结构变更和重复创建
            foreach (var type in _createTableList)
            {
                _db.CreateTable(type);
            }

            updateTableDelegates[DataBaseType.GunDevelop]        = new UpdateTableDelegate(UpdateGunDevelopTotal);
            updateTableDelegates[DataBaseType.GunDevelopHeavy]   = new UpdateTableDelegate(UpdateGunDevelopHeavyTotal);
            updateTableDelegates[DataBaseType.EquipDevelop]      = new UpdateTableDelegate(UpdateEquipDevelopTotal);
            updateTableDelegates[DataBaseType.EquipProduce]      = new UpdateTableDelegate(UpdateEquipProduceTotal);
            updateTableDelegates[DataBaseType.EquipDevelopHeavy] = new UpdateTableDelegate(UpdateEquipDevelopHeavyTotal);
            updateTableDelegates[DataBaseType.MissionBattle]     = new UpdateTableDelegate(UpdateMissionBattleTotal);
            updateTableDelegates[DataBaseType.MissionFinish]     = new UpdateTableDelegate(UpdateMissionFinishTotal);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Write a message with the given severity to the logs. Takes a StringBuilder to allow for minimal allocation.
        /// </summary>
        /// <param name="logLevel">The severity level of the log message.</param>
        /// <param name="logMessage">The log message itself in StringBuilder form for manipulation.</param>
        /// <param name="callerName">The name of the calling method.</param>
        /// <param name="callerSourceFile">The name of the source file of the caller.</param>
        /// <param name="callerLineNumber">The line number where the log is being called.</param>
        private void Write(
            LogLevel logLevel,
            StringBuilder logMessage,
            [CallerMemberName] string callerName     = null,
            [CallerFilePath] string callerSourceFile = null,
            [CallerLineNumber] int callerLineNumber  = 0)
        {
            string indentedLogMsg = IndentMsg(logMessage);
            string logLevelName   = logLevel.ToString().ToUpper();

            int threadId = Thread.CurrentThread.ManagedThreadId;

            switch (logLevel)
            {
            case LogLevel.Diagnostic:
                _logger.Verbose(s_logMessageTemplate, logLevelName, threadId, callerName, callerSourceFile, callerLineNumber, indentedLogMsg);
                return;

            case LogLevel.Verbose:
                _logger.Debug(s_logMessageTemplate, logLevelName, threadId, callerName, callerSourceFile, callerLineNumber, indentedLogMsg);
                return;

            case LogLevel.Normal:
                _logger.Information(s_logMessageTemplate, logLevelName, threadId, callerName, callerSourceFile, callerLineNumber, indentedLogMsg);
                return;

            case LogLevel.Warning:
                _logger.Warning(s_logMessageTemplate, logLevelName, threadId, callerName, callerSourceFile, callerLineNumber, indentedLogMsg);
                return;

            case LogLevel.Error:
                _logger.Error(s_logMessageTemplate, logLevelName, threadId, callerName, callerSourceFile, callerLineNumber, indentedLogMsg);
                return;
            }
        }
Exemplo n.º 14
0
        public void Log(LogEntry entry)
        {
            switch (entry.Severity)
            {
            case LoggingEventType.Verbose:
                _logger.Verbose(entry.Exception, entry.Message, entry.Args);
                break;

            case LoggingEventType.Debug:
                _logger.Debug(entry.Exception, entry.Message, entry.Args);
                break;

            case LoggingEventType.Information:
                _logger.Information(entry.Exception, entry.Message, entry.Args);
                break;

            case LoggingEventType.Warning:
                _logger.Warning(entry.Exception, entry.Message, entry.Args);
                break;

            case LoggingEventType.Error:
                _logger.Error(entry.Exception, entry.Message, entry.Args);
                break;

            case LoggingEventType.Fatal:
                _logger.Fatal(entry.Exception, entry.Message, entry.Args);
                break;

            default:
                throw new ArgumentException($"Severity {entry.Severity} is not supported by SerilogAdapter", "Severity");
            }
        }
Exemplo n.º 15
0
        public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func <object, Exception, string> formatter)
        {
            var log = new OwinContextLog(eventId, formatter(state, exception));

            switch (eventType)
            {
            case TraceEventType.Critical:
                _logger.Fatal(exception, SerilogMessage, log);
                return(true);

            case TraceEventType.Error:
                _logger.Error(exception, SerilogMessage, log);
                return(true);

            case TraceEventType.Information:
                _logger.Information(exception, SerilogMessage, log);
                return(true);

            case TraceEventType.Warning:
                _logger.Warning(exception, SerilogMessage, log);
                return(true);

            case TraceEventType.Verbose:
                _logger.Verbose(exception, SerilogMessage, log);
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 16
0
        private static void CheckCache()
        {
            var cacheVersionFile = Path.Combine(GlobalCacheDir, "cacheinfo.json");
            var assemblyVersion  = typeof(AssetManager).Assembly.GetName().Version.ToString();

            if (Directory.Exists(GlobalCacheDir))
            {
                var deleteDir = true;
                try
                {
                    if (File.Exists(cacheVersionFile))
                    {
                        var versionInfo = JsonConvert.DeserializeObject <CacheInfo>(File.ReadAllText(cacheVersionFile));
                        if (versionInfo.AssemblyVersion == assemblyVersion)
                        {
                            deleteDir = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }

                if (deleteDir)
                {
                    Log.Verbose("Delete Cache directory: {Path}", GlobalCacheDir);
                    Directory.Delete(GlobalCacheDir, true);

                    var n = 10;
                    while (Directory.Exists(GlobalCacheDir) && n-- > 0)
                    {
                        Thread.Sleep(1000);
                    }
                }
            }

            if (!Directory.Exists(GlobalCacheDir))
            {
                Log.Verbose("Create Cache directory: {Path}", GlobalCacheDir);
                Directory.CreateDirectory(GlobalCacheDir);
                var versionInfo = new CacheInfo {
                    AssemblyVersion = assemblyVersion
                };
                File.WriteAllText(cacheVersionFile, JsonConvert.SerializeObject(versionInfo));
            }
        }
Exemplo n.º 17
0
        public void RegisterControllerActions(IHttpService service)
        {
            var pattern = _localWebRootPath + "/{*remaining_path}";

            Logger.Verbose("Binding MiniWeb to {path}", pattern);
            service.RegisterAction(
                new ControllerAction(pattern, HttpMethod.Get, Codec.NoCodecs, new ICodec[] { Codec.ManualEncoding }, new Operation(Operations.Node.StaticContent)),
                OnStaticContent);
        }
Exemplo n.º 18
0
        private void OnSessionCreated(object sender, SessionEventArgs e)
        {
            e.Context.CommandExecuting += (o, args) =>
            {
                _logger.Verbose("SMTP Command {@SmtpCommand}", args.Command);
            };

            _logger.Information("New SMTP connection from {EndpointAddress}", e.Context.EndpointDefinition.Endpoint.Address.ToString());
        }
Exemplo n.º 19
0
 public void Handle(StorageMessage.AlreadyCommitted message)
 {
     if (Interlocked.Read(ref _complete) == 1 || _allEventsWritten)
     {
         return;
     }
     Log.Verbose("IDEMPOTENT WRITE TO STREAM ClientCorrelationID {clientCorrelationId}, {message}.", ClientCorrId,
                 message);
     ReturnCommitAt(message.LogPosition, message.FirstEventNumber, message.LastEventNumber);
 }
Exemplo n.º 20
0
        internal override void DoDeallocation()
        {
            if (!HasDeallocation)
            {
                return;
            }

            if (RendererTexture == null)
            {
                return;
            }

            Log.Verbose("Set InternalTexture.Orphaned");

            RendererTexture.Orphaned = true;
            RendererTexture          = null;

            base.DoDeallocation();
        }
Exemplo n.º 21
0
        public QueueStats[] GetStats()
        {
            var stats = _queues.Keys.OrderBy(x => x.Name).Select(queue => queue.GetStatistics()).ToArray();

            if (Application.IsDefined(Application.DumpStatistics))
            {
                Log.Verbose(Environment.NewLine + string.Join(Environment.NewLine, stats.Select(x => x.ToString())));
            }
            return(stats);
        }
Exemplo n.º 22
0
        protected override void OnMouseDown(MouseButtonArgs e)
        {
            if (CurrentMouseWorldPositionIsValid)
            {
                var translatedPos = (new Vector4(CurrentMouseWorldPosition, 1) * BoardTranslationMatrix).Xyz;
                Console.WriteLine(translatedPos);
                var pos = translatedPos.Round().Xy.ToVector2i();

                if (!Board.PositionInMap(pos))
                {
                    return;
                }

                //ScaleAnim.Start();
                var selector = BoardActor.GetComponent <SceneComponent>("MarbleSelector");

                if (MoveTween.Enabled || RemoveTween.Enabled || CreateTween.Enabled)
                {
                    return;
                }

                if (Board[pos]?.Color == MarbleColor.BombJoker)
                {
                    return;
                }

                var marble = Board[pos];
                Log.Verbose("Clicked: {position}. Marble: {marble}", pos, marble);
                if (marble != null)
                {
                    SelectedMarble = marble;
                    selector.RelativeTranslation = new Vector3(pos.X, pos.Y, selector.RelativeTranslation.Z);
                    selector.Visible             = true;
                    AudioManager.Default.PlayAsync("Sounds/marble-select.wav");
                }
                else
                {
                    if (SelectedMarble != null)
                    {
                        var path = Board.FindPath(SelectedMarble, pos);
                        if (path != null && path.Count > 0)
                        {
                            CurrentPath = path;
                            var moveStepDuration = TimeSpan.FromSeconds(0.1);
                            //var moveStepDuration = TimeSpan.FromSeconds(2);
                            MoveTween.Duration = moveStepDuration.Multiply(path.Count);
                            MoveTween.Start();
                            AudioManager.Default.PlayAsync("Sounds/marble-moving.wav");
                            selector.Visible = false;
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
        public IActionResult Serilog()
        {
            _serilogLogger.Verbose("Serilog Verbose");
            _serilogLogger.Debug("Serilog Debug");
            _serilogLogger.Information("Serilog Information");
            _serilogLogger.Warning("Serilog Warning");
            _serilogLogger.Error("Serilog Error");
            _serilogLogger.Fatal("Serilog Fatal");

            return(Ok());
        }
        public HydrogenApplicationContext(ApplicationTenant tenant, bool migrate, Serilog.ILogger log)
        {
            _tenant = tenant;
            _log    = log;

            if (_tenant == null)
            {
                throw new Exception("Unable to identify database connection for tenant.");
            }
            this.LogToConsole();
            log.Verbose("Using {tenant} database.", tenant.Name);
            InitializeDatabase(migrate);
        }
Exemplo n.º 25
0
        private void OnRenderFrameInternal(FrameEventArgs e)
        {
            if (!RenderInitialized)
            {
                Log.Verbose("Init OpenGL Bindings");
                Log.Verbose("Grab Context");
                Window.MakeCurrent();

                Log.Verbose("Load OpenGL Bindings");
                GL.LoadBindings(new GLFWBindingsContext());
                var vendor  = GL.GetString(StringName.Vendor);
                var version = GL.GetString(StringName.Version);
                var shadingLanguageVersion = GL.GetString(StringName.ShadingLanguageVersion);
                var renderer = GL.GetString(StringName.Renderer);

                Log.Info($"Vendor: {vendor}, version: {version}, shadinglangVersion: {shadingLanguageVersion}, renderer: {renderer}");

                EnableDebugCallback();

                RenderInitialized = true;
            }

            if (!RenderThreadHasContext)
            {
                Window.MakeCurrent();
                RenderThreadHasContext = true;
            }

            SetRenderThread();
            RenderReady = true;

            if (Enabled)
            {
                RenderFrame?.Invoke(e);
            }
        }
Exemplo n.º 26
0
        public static bool IsPresent(int pid)
        {
            var mutexName = string.Format("ESCLUSTERNODE:{0}", pid);

            try {
                using (Mutex.OpenExisting(mutexName)) {
                    return(true);
                }
            } catch (WaitHandleCannotBeOpenedException) {
                return(false);
            } catch (Exception exc) {
                Log.Verbose(exc, "Exception while trying to open Cluster Node mutex '{mutex}': {e}.", mutexName,
                            exc.Message);
            }

            return(false);
        }
Exemplo n.º 27
0
        internal override void DoDeallocation()
        {
            if (!HasDeallocation)
            {
                return;
            }

            if (RenderableObject == null)
            {
                return;
            }

            Log.Verbose("Set RenderableObject.Orphaned");

            RenderableObject.Orphaned = true;
            RenderableObject          = null;

            base.DoDeallocation();
        }
Exemplo n.º 28
0
        public void Handle(ClientMessage.WriteEventsCompleted message)
        {
            if (message.CorrelationId != _streamMetadataWriteCorrId)
            {
                return;
            }
            switch (message.Result)
            {
            case OperationResult.Success:
            case OperationResult.WrongExpectedVersion:                     // already created
            {
                Log.Verbose("Created stats stream '{stream}', code = {result}", _nodeStatsStream, message.Result);
                _statsStreamCreated = true;
                break;
            }

            case OperationResult.PrepareTimeout:
            case OperationResult.CommitTimeout:
            case OperationResult.ForwardTimeout: {
                Log.Debug("Failed to create stats stream '{stream}'. Reason : {e}({message}). Retrying...",
                          _nodeStatsStream, message.Result, message.Message);
                SetStatsStreamMetadata();
                break;
            }

            case OperationResult.AccessDenied: {
                // can't do anything about that right now
                break;
            }

            case OperationResult.StreamDeleted:
            case OperationResult.InvalidTransaction:                     // should not happen at all
            {
                Log.Error(
                    "Monitoring service got unexpected response code when trying to create stats stream ({e}).",
                    message.Result);
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 29
0
        //Automerge only
        private void TryProcessAwaitingTables(long commitPos, long prepareCheckpoint)
        {
            lock (_awaitingTablesLock) {
                var newTables = new List <TableItem> {
                    new TableItem(_memTableFactory(), -1, -1, 0)
                };
                newTables.AddRange(_awaitingMemTables.Select(
                                       (x, i) => i == 0 ? new TableItem(x.Table, prepareCheckpoint, commitPos, x.Level) : x));

                Log.Verbose("Switching MemTable, currently: {awaitingMemTables} awaiting tables.", newTables.Count);

                _awaitingMemTables = newTables;
                if (_inMem)
                {
                    return;
                }
                TryProcessAwaitingTables();

                if (_additionalReclaim)
                {
                    ThreadPool.QueueUserWorkItem(x => ReclaimMemoryIfNeeded(_awaitingMemTables));
                }
            }
        }
Exemplo n.º 30
0
        public RenderWindow(ApplicationConfig config)
            : base(new GameWindowSettings {
            IsMultiThreaded = config.IsMultiThreaded, UpdateFrequency = config.UpdateFrequency, RenderFrequency = config.RenderFrequency
        }, new NativeWindowSettings {
            Size = config.WindowSize
        })
        {
            Log.Verbose("Created window");
            Config = config;
            Title  = Config.WindowTitle;
            if (Config.WindowLocation != null)
            {
                Location = (Vector2i)Config.WindowLocation;
            }

            var vsync = Config.VSync;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT && IsMultiThreaded && Config.VSync == VSyncMode.Adaptive)
            {
                Log.Warn("BUG: OSVersion=mswin, IsMultiThreaded=true Config.VSync=VSyncMode.Adaptive: Force VSyncMode.On");
                vsync = VSyncMode.On;
            }

            VSync = vsync;

            if (Config.HideTitleBar && Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                Win32Native.HideTitleBar();
            }

            Size = Config.WindowSize;
            var diff = Size - Config.WindowSize;

            if (diff != Vector2i.Zero)
            {
                Size = Config.WindowSize - diff;
            }
        }