/// <summary> /// Setup debugger. Needs to be called /// after the OpenGL context was created. /// </summary> public static void Instantiate() { // debug resources definitions DbgBufKey = "__dbgbuf__"; DbgTexKey = "__dbgtex__"; // allocate arrays for texture and image units texUnits = new TexUnit[GL.GetInteger((GetPName)All.MaxTextureImageUnits)]; imgUnits = new ImgUnit[GL.GetInteger((GetPName)All.MaxImageUnits)]; passes = new Dictionary<int, Uniforms>(); Settings = new DebugSettings(); }
private static void DrawPlaybackSettings([NotNull] DebugSettings settings) { settings.EnablePlaybackDiagnostics = EditorGUILayout.BeginToggleGroup("Playback Diagnostics", settings.EnablePlaybackDiagnostics); GUI.enabled = settings.EnablePlaybackDiagnostics; EditorGUI.indentLevel++; settings.RecordDecodedAudio = EditorGUILayout.Toggle("Record Decoded Audio", settings.RecordDecodedAudio); settings.RecordFinalAudio = EditorGUILayout.Toggle("Record Final Audio", settings.RecordFinalAudio); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.EndToggleGroup(); }
/// <summary> /// The default constructor. /// </summary> public DynamoLogger(DebugSettings debugSettings, string logDirectory) { lock (guardMutex) { this.debugSettings = debugSettings; _isDisposed = false; WarningLevel = WarningLevel.Mild; Warning = ""; StartLogging(logDirectory); } }
protected override void OnUpdate(SAMTime gameTime, InputState istate) { #if DEBUG DebugDisp.IsEnabled = DebugSettings.Get("DebugTextDisplay"); DebugDisp.Scale = 0.75f; #endif if (!IsPaused && !HasFinished) { LevelTime += gameTime.RealtimeElapsedSeconds; } TestForGameEndingCondition(); }
private static void DrawRecordingSettings([NotNull] DebugSettings settings) { settings.EnableRecordingDiagnostics = EditorGUILayout.BeginToggleGroup("Recording Diagnostics", settings.EnableRecordingDiagnostics); GUI.enabled = settings.EnableRecordingDiagnostics; EditorGUI.indentLevel++; settings.RecordMicrophoneRawAudio = EditorGUILayout.Toggle("Record Microphone", settings.RecordMicrophoneRawAudio); settings.RecordPreprocessorOutput = EditorGUILayout.Toggle("Record Preprocessor Output", settings.RecordPreprocessorOutput); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.EndToggleGroup(); }
private static void DrawRecordingSettings(DebugSettings settings) { settings.EnableRecordingDiagnostics = EditorGUILayout.BeginToggleGroup("Recording Diagnostics", settings.EnableRecordingDiagnostics); GUI.enabled = settings.EnableRecordingDiagnostics; EditorGUI.indentLevel++; settings.RecordMicrophoneRawAudio = EditorGUILayout.Toggle("Record Microphone", settings.RecordMicrophoneRawAudio); settings.RecordEncoderPipelineInputAudio = EditorGUILayout.Toggle("Record Encoder Input", settings.RecordEncoderPipelineInputAudio); settings.RecordEncoderPipelineOutputAudio = EditorGUILayout.Toggle("Record Encoder Output", settings.RecordEncoderPipelineOutputAudio); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.EndToggleGroup(); }
protected override void OnDraw(IBatchRenderer sbatch) { CommonWallRenderer.DrawVoidWall_BG(sbatch, _length, _rotation, _rectsUnrotated); #if DEBUG if (DebugSettings.Get("DebugEntityBoundaries")) { foreach (var r in _rectsUnrotated) { sbatch.DrawRectangleRot(r, Color.Cyan, _rotation); } } #endif }
public static void SetUp() { IConfiguration config = LoadConfiguration(); DebugSettings debugSettings = new DebugSettings(); config.Bind(nameof(DebugSettings), debugSettings); serviceProvider = new ServiceCollection() .AddSingleton(debugSettings) .AddSingleton <ILogger, Logger>() .AddSingleton <IF660Configurator, F660Configurator>() .BuildServiceProvider(); }
public override void OnInspectorGUI() { DebugSettings settings = (DebugSettings)target; EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); for (int i = 0; i < settings._debugToggles.Length; ++i) { settings._debugToggles[i] = EditorGUILayout.ToggleLeft(((DebugKit)i).ToString(), settings._debugToggles[i]); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); }
protected virtual void OnDrawGizmos() { if (!Application.isPlaying) { UpdateBoundsOfCollider(); } Color colorToDraw = Color.green; DebugSettings.DrawLine(bounds.bottomLeft, bounds.bottomRight, colorToDraw); DebugSettings.DrawLine(bounds.bottomRight, bounds.topRight, colorToDraw); DebugSettings.DrawLine(bounds.topRight, bounds.topLeft, colorToDraw); DebugSettings.DrawLine(bounds.topLeft, bounds.bottomLeft, colorToDraw); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { DebugSettings settings = SettingsFile.Default.GetSettings <DebugSettings>(); if (settings != null) { ExecutionControl.BreakpointAddress = settings.BreakpointAddress; UpdateBreakpointAddress(); } } }
private IEnumerator SelectTilesCoroutine(DebugSettings settings) { WaitForSeconds delayBetweenMoves = new WaitForSeconds(1f / settings.playBackSpeed); int[] moves = settings.tileSelections; for (int i = 0; i < moves.Length; i++) { TileSelectedMsg msg = new TileSelectedMsg(); msg.SelectedIndex = moves[i]; Messenger.GetInstance().BroadCastMessage(msg); yield return(delayBetweenMoves); } }
static IConfiguration LoadConfiguration() { dataSettings = new DataSettings(); debugSettings = new DebugSettings(); IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .Build(); config.Bind(nameof(DataSettings), dataSettings); config.Bind(nameof(DebugSettings), debugSettings); return(config); }
private void OpenNode() { AbortAllOperations(p => p.Name == "LevelNode::Center"); AbortAllOperations(p => p.Name == "LevelNode::CenterShake"); #if DEBUG if (!NodeEnabled && DebugSettings.Get("UnlockNode")) { NodeEnabled = true; } #endif if (!NodeEnabled) { MainGame.Inst.GDSound.PlayEffectError(); AddEntityOperation(new ScreenShakeAndCenterOperation(this, GDOwner)); Owner.HUD.ShowToast("LN::LOCKED", L10N.T(L10NImpl.STR_GLOB_LEVELLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f); return; } ((GDWorldHUD)Owner.HUD).SelectNode(this); var progress = FindFirstOperationProgress(p => p.Name == "LevelNode::Close::root"); AbortAllOperations(p => p.Name == "LevelNode::Close::root"); var o = AddEntityOperation(new SimpleGameEntityOperation <LevelNode>("LevelNode::Open::root", TOTAL_EXPANSION_TIME, (n, p) => RootExpansionProgress = p)); if (progress != null) { o.ForceSetProgress(1 - progress.Value); } if (Blueprint.UniqueID == Levels.LEVELID_1_1 && !LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0)) { OpenExtender(FractionDifficulty.DIFF_0); } else { OpenExtender(FractionDifficulty.DIFF_0); OpenExtender(FractionDifficulty.DIFF_1); OpenExtender(FractionDifficulty.DIFF_2); OpenExtender(FractionDifficulty.DIFF_3); } AddEntityOperation(new CenterNodeOperation(GDOwner)); MainGame.Inst.GDSound.PlayEffectOpen(); }
protected override void OnDrawGame(IBatchRenderer sbatch) { #if DEBUG if (DebugSettings.Get("DebugBackground")) { sbatch.DrawRectangle(Graph.BoundingRect, Color.OrangeRed, 3f); sbatch.DrawRectangle(Graph.BoundingViewport, Color.Purple, 3f); } #endif if (ColorOverdraw > 0) { sbatch.FillRectangle(CompleteMapViewport, FlatColors.Background * ColorOverdraw); } }
protected override void OnDrawGame(IBatchRenderer sbatch) { if (!MainGame.Inst.Profile.EffectsEnabled) { var hh = 4.5f * GDConstants.TILE_WIDTH; sbatch.DrawCentered(Textures.TexLogo, _banner.TargetRect.Center, hh * Textures.TexLogo.Width / Textures.TexLogo.Height, hh, Color.White); } #if DEBUG if (DebugSettings.Get("DebugEntityBoundaries")) { sbatch.DrawRectangle(_banner.TargetRect, Color.DodgerBlue, 3f); } #endif }
public void Draw(IBatchRenderer sbatch) { OnDraw(sbatch); #if DEBUG if (DebugSettings.Get("DebugEntityBoundaries")) { using (sbatch.BeginDebugDraw()) DrawDebugBorders(sbatch); } if (DebugSettings.Get("DebugEntityMouseAreas")) { using (sbatch.BeginDebugDraw()) DrawDebugAreas(sbatch); } #endif }
/// <summary> /// The default constructor. /// </summary> public DynamoLogger(DebugSettings debugSettings, string logDirectory) { lock (guardMutex) { this.debugSettings = debugSettings; _isDisposed = false; WarningLevel = WarningLevel.Mild; Warning = ""; UpdateManager.UpdateManager.Instance.Log += UpdateManager_Log; StartLogging(logDirectory); } }
/// <summary> /// Initializes a new instance of <see cref="DynamoLogger"/> class /// with specified debug settings and directory where to write logs /// </summary> /// <param name="debugSettings">Debug settings</param> /// <param name="logDirectory">Directory path where log file will be written</param> public DynamoLogger(DebugSettings debugSettings, string logDirectory) { lock (guardMutex) { this.debugSettings = debugSettings; _isDisposed = false; WarningLevel = WarningLevel.Mild; Warning = ""; notifications = new List <NotificationMessage>(); StartLogging(logDirectory); } }
private void DrawLogSettings([NotNull] DebugSettings settings) { _showLogSettings = EditorGUILayout.Foldout(_showLogSettings, "Log Levels"); if (_showLogSettings) { EditorGUI.indentLevel++; for (int i = 0; i < _categoryNames.Length; i++) { settings.SetLevel(_categoryValues[i], (LogLevel)EditorGUILayout.EnumPopup(_categoryNames[i], settings.GetLevel(_categoryValues[i]))); } EditorGUI.indentLevel--; } }
/// <summary> /// Gets a list of all colliders that intersect the line that passes through /// </summary> /// <param name="origin"></param> /// <param name="direction"></param> /// <param name="distance"></param> /// <param name="collidersHit"></param> /// <returns></returns> public bool CheckLineIntersectWithCollider(Vector2 origin, Vector2 direction, float distance, out List <CustomCollider2D> collidersHit) { collidersHit = new List <CustomCollider2D>(); foreach (CustomCollider2D coll in nonStaticColliderList) { if (coll.enabled) { DebugSettings.DrawLineDirection(origin, direction, distance, Color.red); if (coll.LineIntersectWithCollider(origin, direction, distance)) { collidersHit.Add(coll); } } } return(collidersHit.Count >= 1); }
protected override void OnUpdate(SAMTime gameTime, InputState istate) { #if DEBUG DebugDisp.IsEnabled = DebugSettings.Get("DebugTextDisplay"); DebugDisp.Scale = 0.75f; #endif // #if DEBUG if (DebugSettings.Get("LeaveScreen")) { MainGame.Inst.SetOverworldScreen(); } #endif }
protected override void OnBeforeUpdate(SAMTime gameTime, InputState state) { #if DEBUG debugView.DebugPanelPosition = new Vector2(55, Owner.VAdapterGame.RealTotalHeight - 180); debugView.PerformancePanelBounds = new Rectangle(450, (int)(Owner.VAdapterGame.RealTotalHeight - 180), 200, 100); debugView.Enabled = DebugSettings.Get("PhysicsDebugView"); #endif #if DEBUG DebugUtils.TIMING_PHYSICS.Start(); PhysicsWorld.Step(gameTime.ElapsedSeconds); DebugUtils.TIMING_PHYSICS.Stop(); #else PhysicsWorld.Step(gameTime.ElapsedSeconds); #endif }
protected void Page_Load(object sender, EventArgs e) { // Get the debug settings var name = QueryHelper.GetString("name", ""); Settings = DebugHelper.GetSettings(name); if (Settings == null) { btnClear.Visible = false; chkCompleteContext.Visible = false; return; } ReloadData(); }
Action ResetAdvancedPanel(Widget panel) { var ds = Game.Settings.Debug; var ss = Game.Settings.Server; var dds = new DebugSettings(); var dss = new ServerSettings(); return(() => { ss.DiscoverNatDevices = dss.DiscoverNatDevices; ss.VerboseNatDiscovery = dss.VerboseNatDiscovery; ds.PerfText = dds.PerfText; ds.PerfGraph = dds.PerfGraph; ds.SanityCheckUnsyncedCode = dds.SanityCheckUnsyncedCode; ds.BotDebug = dds.BotDebug; }); }
protected override void OnDraw(IBatchRenderer sbatch) { sbatch.DrawCentered( Textures.TexBullet, BulletPosition, Scale * BulletExtraScale * BULLET_DIAMETER, Scale * BulletExtraScale * BULLET_DIAMETER, Fraction.Color * BulletAlpha, BulletRotation); #if DEBUG if (DebugSettings.Get("DebugMultiplayer")) { sbatch.DrawCircle(LastRemotePosition, Scale * BulletExtraScale * BULLET_DIAMETER / 2f, 6, ClientPredictionMiss ? Color.Crimson : Color.DeepSkyBlue, 2 * Owner.PixelWidth); sbatch.DrawLine(LastRemotePosition, BulletPosition, Color.DeepSkyBlue, Owner.PixelWidth); } #endif }
protected override void OnUpdate(SAMTime gameTime, InputState istate) { #if DEBUG DebugDisp.IsEnabled = DebugSettings.Get("DebugTextDisplay"); DebugDisp.Scale = 0.75f; #endif if (ZoomState == BistateProgress.Expanded && istate.IsRealJustDown && PreventZoomInCtr != MonoSAMGame.GameCycleCounter && istate.SwallowConsumer != InputConsumer.HUDElement) { ZoomIn(istate.GamePointerPositionOnMap); } if (ZoomState == BistateProgress.Normal && istate.IsGesturePinchComplete && istate.LastPinchPower < -10) { ZoomOut(); } if (ZoomState == BistateProgress.Expanded && istate.IsGesturePinchComplete && istate.LastPinchPower > +10) { ZoomIn(istate.GamePointerPositionOnMap); } bool trigger = false; if (istate.IsKeyExclusiveJustDown(SKeys.AndroidBack)) { istate.SwallowKey(SKeys.AndroidBack, InputConsumer.ScreenAgent); trigger = true; } else if (istate.IsKeyExclusiveJustDown(SKeys.Backspace)) { istate.SwallowKey(SKeys.Backspace, InputConsumer.ScreenAgent); trigger = true; } if (trigger) { MainGame.Inst.SetOverworldScreen(); } #if DEBUG if (DebugSettings.Get("LeaveScreen")) { MainGame.Inst.SetOverworldScreen(); } #endif }
protected override void OnDraw(IBatchRenderer sbatch) { sbatch.DrawStretched(Textures.TexPortalDropEnd1, _rectDropTop, Color.White, Normal); sbatch.DrawStretched(Textures.TexPortalDropMid, _rectDropMid, Color.White, Normal); sbatch.DrawStretched(Textures.TexPortalDropEnd2, _rectDropBot, Color.White, Normal); sbatch.DrawStretched(Textures.TexGradient, _rectGradient, Color, Normal - FloatMath.RAD_POS_090); sbatch.DrawStretched(Textures.TexPixel, _rectFull, FlatColors.Clouds, Normal - FloatMath.RAD_POS_090); sbatch.DrawStretched(Textures.TexPixel, _rectHorizon, Color, Normal - FloatMath.RAD_POS_090); #if DEBUG if (DebugSettings.Get("DebugEntityBoundaries")) { sbatch.FillCircle(Position, 4, 16, Color.Turquoise); sbatch.DrawLine(Position, Position + Vector2.UnitX.RotateWithLength(Normal, 32), Color.Turquoise, 2); } #endif }
static IConfiguration LoadConfiguration() { botSettings = new BotSettings(); cacheSettings = new CacheSettings(); debugSettings = new DebugSettings(); loggerSettings = new NuciLoggerSettings(); IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .Build(); config.Bind(nameof(BotSettings), botSettings); config.Bind(nameof(CacheSettings), cacheSettings); config.Bind(nameof(DebugSettings), debugSettings); config.Bind(nameof(NuciLoggerSettings), loggerSettings); return(config); }
private void BChange_Click(object sender, RoutedEventArgs e) { BreakpointSetForm dialog = new BreakpointSetForm(); dialog.BreakpointAddress = ExecutionControl.BreakpointAddress; if (dialog.ShowDialog() ?? false) { ExecutionControl.BreakpointAddress = dialog.BreakpointAddress; UpdateBreakpointAddress(); DebugSettings settings = SettingsFile.Default.GetSettings <DebugSettings>(); settings.BreakpointAddress = dialog.BreakpointAddress; SettingsFile.Default.SetSettings(settings); SettingsFile.Default.Save(); } }
private void OnClick(GameEntityMouseArea sender, SAMTime gameTime, InputState istate) { if (GDOwner.ZoomState != BistateProgress.Normal && GDOwner.ZoomState != BistateProgress.Expanded) { return; } #if DEBUG if (!NodeEnabled && DebugSettings.Get("UnlockNode")) { NodeEnabled = true; } #endif if (!NodeEnabled) { MainGame.Inst.GDSound.PlayEffectError(); if (GDOwner.ZoomState == BistateProgress.Expanded) { AddEntityOperation(new ScreenShakeOperation2(this, GDOwner)); } else { AddEntityOperation(new ScreenShakeAndCenterOperation2(this, GDOwner)); } Owner.HUD.ShowToast("WN::LOCKED", L10N.T(L10NImpl.STR_GLOB_WORLDLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f); return; } if (UnlockManager.IsUnlocked(Blueprint.TargetWorld, true) == WorldUnlockState.OpenAndUnlocked) { Owner.AddAgent(new LeaveTransitionWorldMapAgent(GDOwner, GDOwner.ZoomState == BistateProgress.Expanded, this, Target)); MainGame.Inst.GDSound.PlayEffectZoomOut(); } else { Owner.AddAgent(new LeaveTransitionOverworldAgent(GDOwner, GDOwner.ZoomState == BistateProgress.Expanded)); MainGame.Inst.GDSound.PlayEffectZoomOut(); } }
private void Initialize() { _inputMgr = References.InputManager; _gameMgr = References.GameManager; _debugSettings = DebugSettings.Instance; }
/// <summary> /// Get the debugger settings. Custom settings can be specified on a object/method /// basis using the DebugOptions attribute. /// </summary> /// <returns> /// The debug settings attached to the calling method. /// </returns> private static DebugSettings GetSettings() { // find the Method that called the debugger StackFrame topFrame; MethodBase topMethod = null; bool debugAttributeFound = false; DebugOptions options = new DebugOptions(); DebugSettings settings = new DebugSettings(); topFrame = GetTopMethod(); if(topFrame != null) { topMethod = topFrame.GetMethod(); } // get the attributes if(topMethod != null) { object[] attributes = topMethod.GetCustomAttributes(typeof(DebugOptions), false); foreach(Attribute a in attributes) { // extract the options DebugOptions attributeOptions = (DebugOptions)a; if(attributeOptions.isDebugSet) { options.Debug = attributeOptions.Debug; } if(attributeOptions.isAssertSet) { options.Assert = attributeOptions.Assert; } if(attributeOptions.isStoreSet) { options.Store = attributeOptions.Store; } if(attributeOptions.isSaveStackSet) { settings.SaveStack = attributeOptions.SaveStack; } if(attributeOptions.isLogToDebuggerSet) { settings.LogToDebugger = attributeOptions.LogToDebugger; } if(attributeOptions.isSendToListnersSet) { settings.SendToListners = attributeOptions.SendToListners; } if(attributeOptions.isSendToNotifierSet) { settings.SendToNotifier = attributeOptions.SendToNotifier; } debugAttributeFound = true; } if(!debugAttributeFound) { // check if the base class has the debug attribute attributes = topMethod.DeclaringType.GetCustomAttributes(typeof(DebugOptions), false); foreach(Attribute a in attributes) { // extract the options DebugOptions attributeOptions = (DebugOptions)a; if(attributeOptions.isDebugSet) { options.Debug = attributeOptions.Debug; } if(attributeOptions.isAssertSet) { options.Assert = attributeOptions.Assert; } if(attributeOptions.isStoreSet) { options.Store = attributeOptions.Store; } if(attributeOptions.isSaveStackSet) { options.SaveStack = attributeOptions.SaveStack; } if(attributeOptions.isLogToDebuggerSet) { options.LogToDebugger = attributeOptions.LogToDebugger; } if(attributeOptions.isSendToListnersSet) { options.SendToListners = attributeOptions.SendToListners; } if(attributeOptions.isSendToNotifierSet) { options.SendToNotifier = attributeOptions.SendToNotifier; } debugAttributeFound = true; } } if(debugAttributeFound) { settings.Debug = options.isDebugSet ? options.Debug : _debuggerEnabled; settings.Assert = options.isAssertSet ? options.Assert : _breakOnFailedAssertion; settings.Store = options.isStoreSet ? options.Store : _storeMessages; settings.SaveStack = options.isSaveStackSet ? options.SaveStack : _saveStackInfo; settings.LogToDebugger = options.isLogToDebuggerSet ? options.LogToDebugger : _logToDebugger; settings.SendToListners = options.isSendToListnersSet ? options.SendToListners : true; settings.SendToNotifier = options.isSendToNotifierSet ? options.SendToNotifier : true; } } if(!debugAttributeFound) { settings.Debug = _debuggerEnabled; settings.Assert = _breakOnFailedAssertion; settings.Store = _storeMessages; settings.SaveStack = _saveStackInfo; settings.LogToDebugger = _logToDebugger; settings.SendToListners = true; settings.SendToNotifier = true; } return settings; }
/// <summary> /// Initializes a new instance of <see cref="DynamoLogger"/> class /// with specified debug settings and directory where to write logs /// </summary> /// <param name="debugSettings">Debug settings</param> /// <param name="logDirectory">Directory path where log file will be written</param> public DynamoLogger(DebugSettings debugSettings, string logDirectory) { lock (guardMutex) { this.debugSettings = debugSettings; _isDisposed = false; WarningLevel = WarningLevel.Mild; Warning = ""; StartLogging(logDirectory); } }
Action ResetAdvancedPanel(Widget panel) { var ds = Game.Settings.Debug; var ss = Game.Settings.Server; var dds = new DebugSettings(); var dss = new ServerSettings(); return () => { ss.DiscoverNatDevices = dss.DiscoverNatDevices; ss.VerboseNatDiscovery = dss.VerboseNatDiscovery; ds.PerfText = dds.PerfText; ds.PerfGraph = dds.PerfGraph; ds.SanityCheckUnsyncedCode = dds.SanityCheckUnsyncedCode; ds.BotDebug = dds.BotDebug; ds.LuaDebug = dds.LuaDebug; }; }
void Start() { if( sts == null ) { sts = Main.GetSettings( gameObject ); if( sts != null ) Debug.LogWarning( "Boid initialized with default settings" ); else { Debug.LogWarning( "Boid initialized with standalone settings copy" ); sts = new Settings(); } } if( dbgSts == null ) { Debug.LogWarning( "Boid initialized with standalone debug settings copy" ); dbgSts = new DebugSettings(); } }
private void InitializeValuesAndReferences() { _debugSettings = DebugSettings.Instance; }
public Config() { Debug = new DebugSettings(); EnableLazyLoadingForCachableModels = false; }
/// <summary> /// Default constructor for DynamoModel /// </summary> /// <param name="config">Start configuration</param> protected DynamoModel(IStartConfiguration config) { ClipBoard = new ObservableCollection<ModelBase>(); pathManager = new PathManager(new PathManagerParams { CorePath = config.DynamoCorePath, HostPath = config.DynamoHostPath, PathResolver = config.PathResolver }); // Ensure we have all directories in place. var exceptions = new List<Exception>(); pathManager.EnsureDirectoryExistence(exceptions); Context = config.Context; IsTestMode = config.StartInTestMode; var config2 = config as IStartConfiguration2; IsHeadless = (config2 != null) ? config2.IsHeadless : false; DebugSettings = new DebugSettings(); Logger = new DynamoLogger(DebugSettings, pathManager.LogDirectory); foreach (var exception in exceptions) { Logger.Log(exception); // Log all exceptions. } MigrationManager = new MigrationManager(DisplayFutureFileMessage, DisplayObsoleteFileMessage); MigrationManager.MessageLogged += LogMessage; MigrationManager.MigrationTargets.Add(typeof(WorkspaceMigrations)); var thread = config.SchedulerThread ?? new DynamoSchedulerThread(); Scheduler = new DynamoScheduler(thread, config.ProcessMode); Scheduler.TaskStateChanged += OnAsyncTaskStateChanged; geometryFactoryPath = config.GeometryFactoryPath; IPreferences preferences = CreateOrLoadPreferences(config.Preferences); var settings = preferences as PreferenceSettings; if (settings != null) { PreferenceSettings = settings; PreferenceSettings.PropertyChanged += PreferenceSettings_PropertyChanged; } InitializeInstrumentationLogger(); if (!IsTestMode && PreferenceSettings.IsFirstRun) { DynamoMigratorBase migrator = null; try { var dynamoLookup = config.UpdateManager != null && config.UpdateManager.Configuration != null ? config.UpdateManager.Configuration.DynamoLookUp : null; migrator = DynamoMigratorBase.MigrateBetweenDynamoVersions(pathManager, dynamoLookup); } catch (Exception e) { Logger.Log(e.Message); } if (migrator != null) { var isFirstRun = PreferenceSettings.IsFirstRun; PreferenceSettings = migrator.PreferenceSettings; // Preserve the preference settings for IsFirstRun as this needs to be set // only by UsageReportingManager PreferenceSettings.IsFirstRun = isFirstRun; } } InitializePreferences(PreferenceSettings); // At this point, pathManager.PackageDirectories only has 1 element which is the directory // in AppData. If list of PackageFolders is empty, add the folder in AppData to the list since there // is no additional location specified. Otherwise, update pathManager.PackageDirectories to include // PackageFolders if (PreferenceSettings.CustomPackageFolders.Count == 0) PreferenceSettings.CustomPackageFolders = new List<string> {pathManager.UserDataDirectory}; //Make sure that the default package folder is added in the list if custom packages folder. var userDataFolder = pathManager.GetUserDataFolder(); //Get the default user data path if (Directory.Exists(userDataFolder) && !PreferenceSettings.CustomPackageFolders.Contains(userDataFolder)) { PreferenceSettings.CustomPackageFolders.Add(userDataFolder); } pathManager.Preferences = PreferenceSettings; SearchModel = new NodeSearchModel(); SearchModel.ItemProduced += node => ExecuteCommand(new CreateNodeCommand(node, 0, 0, true, true)); NodeFactory = new NodeFactory(); NodeFactory.MessageLogged += LogMessage; CustomNodeManager = new CustomNodeManager(NodeFactory, MigrationManager); InitializeCustomNodeManager(); extensionManager = new ExtensionManager(); extensionManager.MessageLogged += LogMessage; var extensions = config.Extensions ?? LoadExtensions(); Loader = new NodeModelAssemblyLoader(); Loader.MessageLogged += LogMessage; // Create a core which is used for parsing code and loading libraries var libraryCore = new ProtoCore.Core(new Options()); libraryCore.Compilers.Add(Language.Associative, new Compiler(libraryCore)); libraryCore.Compilers.Add(Language.Imperative, new ProtoImperative.Compiler(libraryCore)); libraryCore.ParsingMode = ParseMode.AllowNonAssignment; LibraryServices = new LibraryServices(libraryCore, pathManager, PreferenceSettings); LibraryServices.MessageLogged += LogMessage; LibraryServices.LibraryLoaded += LibraryLoaded; ResetEngineInternal(); AddHomeWorkspace(); AuthenticationManager = new AuthenticationManager(config.AuthProvider); UpdateManager = config.UpdateManager ?? new DefaultUpdateManager(null); // config.UpdateManager has to be cast to IHostUpdateManager in order to extract the HostVersion and HostName // see IHostUpdateManager summary for more details var hostUpdateManager = config.UpdateManager as IHostUpdateManager; if (hostUpdateManager != null) { HostName = hostUpdateManager.HostName; HostVersion = hostUpdateManager.HostVersion == null ? null : hostUpdateManager.HostVersion.ToString(); } else { HostName = string.Empty; HostVersion = null; } UpdateManager.Log += UpdateManager_Log; if (!IsTestMode && !IsHeadless) { DefaultUpdateManager.CheckForProductUpdate(UpdateManager); } Logger.Log(string.Format("Dynamo -- Build {0}", Assembly.GetExecutingAssembly().GetName().Version)); InitializeNodeLibrary(PreferenceSettings); if (extensions.Any()) { var startupParams = new StartupParams(config.AuthProvider, pathManager, new ExtensionLibraryLoader(this), CustomNodeManager, GetType().Assembly.GetName().Version, PreferenceSettings); foreach (var ext in extensions) { var logSource = ext as ILogSource; if (logSource != null) logSource.MessageLogged += LogMessage; try { ext.Startup(startupParams); } catch (Exception ex) { Logger.Log(ex.Message); } ExtensionManager.Add(ext); } } LogWarningMessageEvents.LogWarningMessage += LogWarningMessage; StartBackupFilesTimer(); TraceReconciliationProcessor = this; foreach (var ext in ExtensionManager.Extensions) { try { ext.Ready(new ReadyParams(this)); } catch (Exception ex) { Logger.Log(ex.Message); } } }
/// <summary> /// Bind the debug uniform class. /// </summary> /// <param name="settings"></param> /// <param name="frame"></param> public void Bind(DebugSettings settings, int frame) { if (dbgOut <= 0) return; // get last free unused image unit unit = imgUnits.LastIndexOf(x => x.glname == 0); if (unit < 0) return; // bind texture to image unit GLTexture.BindImg(unit, tex, 0, 0, TextureAccess.WriteOnly, GpuFormat.Rgba32f); GL.Uniform1(dbgOut, unit); // set debug uniform if (dbgVert >= 0) GL.Uniform2(dbgVert, settings.vs_InstanceID, settings.vs_VertexID); if (dbgTess >= 0) GL.Uniform2(dbgTess, settings.ts_InvocationID, settings.ts_PrimitiveID); if (dbgEval >= 0) GL.Uniform1(dbgEval, settings.ts_PrimitiveID); if (dbgGeom >= 0) GL.Uniform2(dbgGeom, settings.gs_InvocationID, settings.gs_PrimitiveIDIn); if (dbgFrag >= 0) GL.Uniform4(dbgFrag, settings.fs_FragCoord[0], settings.fs_FragCoord[1], settings.fs_Layer, settings.fs_ViewportIndex); if (dbgComp >= 0) GL.Uniform3(dbgComp, (uint)settings.cs_GlobalInvocationID[0], (uint)settings.cs_GlobalInvocationID[1], (uint)settings.cs_GlobalInvocationID[2]); if (dbgFrame >= 0) GL.Uniform1(dbgFrame, frame); }