void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DebugConnect          += DebugServiceDebugConnect;
            m_debugService.DebugDisconnect       += DebugServiceDebugDisconnect;
            m_debugService.DebugStart            += DebugServiceDebugStart;
            m_debugService.DebugCurrentStatement += DebugServiceDebugCurrentStatement;
            m_debugService.DebugStepInto         += DebugServiceDebugStepInto;
            m_debugService.DebugStepOver         += DebugServiceDebugStepOver;
            m_debugService.DebugStepOut          += DebugServiceDebugStepOut;
            m_debugService.BreakpointHitting     += DebugServiceBreakpointHitting;
            m_debugService.BreakpointHit         += DebugServiceBreakpointHit;
            m_debugService.BreakpointContinue    += DebugServiceBreakpointContinue;
            m_debugService.Disconnected          += DebugServiceDisconnected;

            m_documentService =
                SledServiceInstance.Get <ISledDocumentService>();

            m_documentService.Opened  += DocumentServiceOpened;
            m_documentService.Saving  += DocumentServiceSaving;
            m_documentService.Saved   += DocumentServiceSaved;
            m_documentService.Closing += DocumentServiceClosing;

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.FileAdded    += ProjectServiceFileAdded;
            m_projectService.FileRemoving += ProjectServiceFileRemoving;
        }
        private static ISledLanguagePlugin GetLanguagePlugin(string languagePluginString)
        {
            if (string.IsNullOrEmpty(languagePluginString))
            {
                return(null);
            }

            var languagePluginService =
                SledServiceInstance.Get <ISledLanguagePluginService>();

            foreach (var kv in languagePluginService.LanguagePlugins)
            {
                var plugin = kv.Value;
                if (plugin == null)
                {
                    continue;
                }

                if (string.Compare(plugin.LanguageName, languagePluginString, StringComparison.Ordinal) == 0)
                {
                    return(plugin);
                }
            }

            return(null);
        }
Example #3
0
        void IInitializable.Initialize()
        {
            PreviousStackLevel = -1;

            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closing += ProjectServiceClosing;

            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.UpdateBegin  += DebugServiceUpdateBegin;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaFunctionCursorWatcherService = SledServiceInstance.Get <ISledLuaFunctionCursorWatcherService>();
            m_luaFunctionCursorWatcherService.CursorFunctionChanged += LuaFunctionCursorWatcherServiceCursorFunctionChanged;

            m_callStackEditor.MouseClick       += CallStackEditorMouseClick;
            m_callStackEditor.MouseDoubleClick += CallStackEditorMouseDoubleClick;

            // Adjust to shortened name if Lua language plugin is the only one loaded
            if (m_languagePluginService.Value.Count == 1)
            {
                m_callStackEditor.Name = Localization.SledLuaCallStackTitleShort;
            }

            //m_liveConnectService = SledServiceInstance.TryGet<ISledLiveConnectService>();
            //if (m_liveConnectService != null)
            //{
            //}
        }
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            var projectService =
                SledServiceInstance.Get <ISledProjectService>();

            projectService.Created += ProjectServiceCreated;
            projectService.Opened  += ProjectServiceOpened;
            projectService.Saved   += ProjectServiceSaved;
            projectService.Closing += ProjectServiceClosing;

            m_editor.MouseDoubleClick += EditorMouseDoubleClick;

            m_funcCallsEditor.MouseDoubleClick += FuncCallsEditorMouseDoubleClick;
            m_funcCallsEditor.TreeListViewAdapter.ItemLazyLoad += FuncCallsEditorItemLazyLoad;

            // Adjust to shortened name if this language plugin is the only one loaded
            if (m_languagePluginService.Get.Count != 1)
            {
                return;
            }

            m_editor.Name          = Localization.SledLuaProfileInfoTitleShort;
            m_funcCallsEditor.Name = Localization.SledLuaProfileFuncCallsTitleShort;
        }
        public void Initialize(ISledDocument sd)
        {
            m_sd = sd;

            // Default state
            m_bChangingSelection = true;
            Items.Add(NotProjectFile);
            SelectedItem         = NotProjectFile;
            Enabled              = false;
            m_bChangingSelection = false;

            // Follow user interaction
            SelectedIndexChanged += SledLuaFunctionToolbarSelectedIndexChanged;

            m_gotoService = SledServiceInstance.Get <ISledGotoService>();

            m_projectService = SledServiceInstance.Get <ISledProjectService>();

            m_projectService.FileOpened   += ProjectServiceFileOpened;
            m_projectService.Opened       += ProjectServiceOpened;
            m_projectService.FileAdded    += ProjectServiceFileAdded;
            m_projectService.FileRemoving += ProjectServiceFileRemoving;

            m_luaFunctionParserService = SledServiceInstance.Get <ISledLuaFunctionParserService>();
            m_luaFunctionParserService.ParsedFunctions += LuaFunctionParserServiceParsedFunctions;

            m_luaFunctionCursorWatcherService = SledServiceInstance.Get <ISledLuaFunctionCursorWatcherService>();
            m_luaFunctionCursorWatcherService.CursorFunctionChanged += LuaFunctionCursorWatcherServiceCursorFunctionChanged;
        }
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            var projectService =
                SledServiceInstance.Get <ISledProjectService>();

            projectService.Created += ProjectServiceCreated;
            projectService.Opened  += ProjectServiceOpened;
            projectService.Saved   += ProjectServiceSaved;
            projectService.Closing += ProjectServiceClosing;

            m_editor.TreeListViewAdapter.RetrieveVirtualItem += TreeListViewAdapterRetrieveVirtualItem;

            // Adjust to shortened name if this language plugin is the only one loaded
            if (m_languagePluginService.Get.Count == 1)
            {
                m_editor.Name = Localization.SledLuaMemoryTraceTitleShort;
            }
        }
        private void WriteToDisk()
        {
            if (!m_bDirty)
            {
                return;
            }

            try
            {
                if (m_collection == null)
                {
                    return;
                }

                if (m_collection.ProfileInfo.Count <= 0)
                {
                    return;
                }

                var schemaLoader =
                    SledServiceInstance.Get <SledSharedSchemaLoader>();

                if (schemaLoader == null)
                {
                    return;
                }

                var projDir =
                    m_projectService.Get.ProjectDirectory;

                var filePath =
                    Path.Combine(
                        projDir + Path.DirectorySeparatorChar,
                        m_collection.Name + ".xml");

                var uri = new Uri(filePath);

                using (var stream =
                           new FileStream(uri.LocalPath, FileMode.Create, FileAccess.Write))
                {
                    var writer =
                        new DomXmlWriter(schemaLoader.TypeCollection);

                    writer.Write(m_collection.DomNode, stream, uri);
                }
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "[SledLuaProfilerService] Failure to " +
                    "save profiler data to disk: {0}",
                    ex.Message);
            }
            finally
            {
                m_bDirty = false;
            }
        }
Example #8
0
        void IInitializable.Initialize()
        {
            var luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            var ttyService = SledServiceInstance.Get <ISledTtyService>();

            ttyService.RegisterLanguage(luaLanguagePlugin);
        }
 protected override void Initialize()
 {
     m_luaCallStackService                     = SledServiceInstance.Get <ISledLuaCallStackService>();
     m_luaCallStackService.Clearing           += LuaCallStackServiceClearing;
     m_luaCallStackService.LevelAdding        += LuaCallStackServiceLevelAdding;
     m_luaCallStackService.StackLevelChanging += LuaCallStackServiceStackLevelChanging;
     m_luaCallStackService.StackLevelChanged  += LuaCallStackServiceStackLevelChanged;
 }
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.Connecting   += DebugServiceConnecting;
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.Disconnected += DebugServiceDisconnected;
        }
Example #11
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.Ready        += DebugServiceReady;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.Disconnected += DebugServiceDisconnected;
        }
Example #12
0
        void IInitializable.Initialize()
        {
            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaStatesEditor.TreeListViewAdapter.ItemChecked += TreeListViewAdapterItemChecked;
        }
Example #13
0
        void IInitializable.Initialize()
        {
            m_debugService = SledServiceInstance.Get <ISledDebugService>();

            m_networkPluginService = SledServiceInstance.Get <ISledNetworkPluginService>();

            LoadImportedTargets();
            UpdateRemoteTargetComboBox();
        }
Example #14
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady += DebugServiceDataReady;

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();
        }
Example #15
0
        void IInitializable.Initialize()
        {
            m_documentService = SledServiceInstance.Get <ISledDocumentService>();
            m_documentService.ActiveDocumentChanged += DocumentServiceActiveDocumentChanged;

            m_projectService              = SledServiceInstance.Get <ISledProjectService>();
            m_projectService.Created     += ProjectServiceCreated;
            m_projectService.Opened      += ProjectServiceOpened;
            m_projectService.Closed      += ProjectServiceClosed;
            m_projectService.NameChanged += ProjectServiceNameChanged;
        }
Example #16
0
        void IInitializable.Initialize()
        {
            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectWatcherService =
                SledServiceInstance.Get <ISledProjectWatcherService>();

            m_projectWatcherService.AttributeChangedEvent += ProjectWatcherServiceAttributeChangedEvent;
            m_projectWatcherService.FileChangedEvent      += ProjectWatcherServiceFileChangedEvent;
        }
Example #17
0
        /// <summary>
        /// Validate the condition string has some text in it
        /// </summary>
        /// <param name="sender">object that fired the event</param>
        /// <param name="e">event arguments</param>
        private void BtnOkClick(object sender, EventArgs e)
        {
            // Need to make sure if a condition is being saved then it must be valid
            var bSyntaxCheckCondition = (ConditionEnabled || !string.IsNullOrEmpty(Condition));

            if (!bSyntaxCheckCondition)
            {
                return;
            }

            if (string.IsNullOrEmpty(Condition))
            {
                MessageBox.Show(
                    this,
                    Localization.SledBreakpointConditionErrorNoCondition,
                    Localization.SledBreakpointConditionError,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                // Make user enter valid stuff
                DialogResult = DialogResult.None;
            }
            else
            {
                // Check syntax
                if (m_plugin != null)
                {
                    // Wrap the condition in a function like how it would be when running in libluaplugin
                    var szCondFunc = string.Format("function libluaplugin_condfunc(){0}    return ({1}){0}end", Environment.NewLine, Condition);

                    // Format actual syntax checker to use
                    var szSyntaxCheckFunc =
                        string.Format("function libluaplugin_condfunc()\nreturn ({0})\nend", Condition);

                    var syntaxCheckerService = SledServiceInstance.Get <ISledSyntaxCheckerService>();

                    // Force a syntax check of the string
                    var errors = syntaxCheckerService.CheckString(m_plugin, szSyntaxCheckFunc);
                    if (errors.Any())
                    {
                        // Show error
                        MessageBox.Show(
                            this,
                            SledUtil.TransSub(
                                Localization.SledBreakpointConditionErrorVarArg,
                                Environment.NewLine, szCondFunc, errors.ElementAt(0).Error),
                            Localization.SledBreakpointConditionSyntaxError);

                        // Make user fix error
                        DialogResult = DialogResult.None;
                    }
                }
            }
        }
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService            = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.DataReady += DebugServiceDataReady;

            var projectService = SledServiceInstance.Get <ISledProjectService>();

            projectService.Closing += ProjectServiceClosing;
        }
        void IInitializable.Initialize()
        {
            var projectService = SledServiceInstance.Get <ISledProjectService>();

            projectService.Created        += ProjectServiceCreated;
            projectService.Opened         += ProjectServiceOpened;
            projectService.SavedAsing     += ProjectServiceSavedAsing;
            projectService.SavedAsed      += ProjectServiceSavedAsed;
            projectService.SavingSettings += ProjectServiceSavingSettings;
            projectService.SavedSettings  += ProjectServiceSavedSettings;
            projectService.Closing        += ProjectServiceClosing;
        }
        public override void Initialize()
        {
            base.Initialize();

            m_projectService          = SledServiceInstance.Get <ISledProjectService>();
            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closed  += ProjectServiceClosed;

            m_syntaxCheckerService = SledServiceInstance.Get <ISledSyntaxCheckerService>();
            m_syntaxCheckerService.FilesCheckFinished += SyntaxCheckerServiceFilesCheckFinished;

            MouseDoubleClick += ControlMouseDoubleClick;
        }
Example #21
0
        public override void Initialize()
        {
            base.Initialize();

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closing += ProjectServiceClosing;

            KeyUp            += ControlKeyUp;
            MouseDoubleClick += ControlMouseDoubleClick;
        }
Example #22
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.Created   += ProjectServiceCreated;
            m_projectService.Opened    += ProjectServiceOpened;
            m_projectService.FileAdded += ProjectServiceFileAdded;
            m_projectService.Closing   += ProjectServiceClosing;
        }
Example #23
0
        void IInitializable.Initialize()
        {
            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_luaVariableParserService              = SledServiceInstance.Get <ISledLuaVariableParserService>();
            m_luaVariableParserService.ParsedFiles += LuaVariableParserServiceParsedFiles;

            var breakpointService = SledServiceInstance.Get <ISledBreakpointService>();

            breakpointService.Added       += BreakpointServiceAdded;
            breakpointService.SilentAdded += BreakpointServiceSilentAdded;
        }
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_documentService         = SledServiceInstance.Get <ISledDocumentService>();
            m_documentService.Opened += DocumentServiceOpened;
            m_documentService.ActiveDocumentChanged += DocumentServiceActiveDocumentChanged;
            m_documentService.Closing += DocumentServiceClosing;

            m_projectService               = SledServiceInstance.Get <ISledProjectService>();
            m_projectService.FileOpened   += ProjectServiceFileOpened;
            m_projectService.FileRemoving += ProjectServiceFileRemoving;

            m_luaFunctionParserService = SledServiceInstance.Get <ISledLuaFunctionParserService>();
            m_luaFunctionParserService.ParsedFunctions += LuaFunctionParserServiceParsedFunctions;
        }
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.PluginsReady += DebugService_PluginsReady;

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_breakpointService =
                SledServiceInstance.Get <ISledBreakpointService>();

            m_breakpointService.Added    += BreakpointService_Added;
            m_breakpointService.Changing += BreakpointService_Changing;
            m_breakpointService.Changed  += BreakpointService_Changed;
            m_breakpointService.Removing += BreakpointService_Removing;
        }
Example #26
0
        private static void Setup()
        {
            if (s_bSetup)
            {
                return;
            }

            // Find plugin dictionary
            var commandService = SledServiceInstance.Get <ICommandService>();

            // Register menu for all Lua plugin items to use
            s_menuInfo =
                commandService.RegisterMenu(
                    Menu.Lua,
                    Localization.SledLuaTag,
                    Localization.SledLuaPluginOptions);

            s_bSetup = true;
        }
Example #27
0
        void IInitializable.Initialize()
        {
            m_control.Initialize();

            var controlHostService =
                SledServiceInstance.Get <IControlHostService>();

            // Grab image
            var image =
                ResourceUtil.GetImage(Atf.Resources.UnsortedImage);

            // Rotate image
            image.RotateFlip(RotateFlipType.Rotate90FlipX);

            var controlInfo =
                new ControlInfo(
                    m_control.Name,
                    m_control.Name,
                    StandardControlGroup.Bottom,
                    image);

            // Show GUI
            controlHostService.RegisterControl(
                m_control,
                controlInfo,
                this);

            // Subscribe to events
            m_debugService                     = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.DataReady          += DebugServiceDataReady;
            m_debugService.BreakpointContinue += DebugServiceBreakpointContinue;
            m_debugService.UpdateEnd          += DebugServiceUpdateEnd;
            m_debugService.Disconnected       += DebugServiceDisconnected;

            m_projectService.Get.Closed += ProjectServiceClosed;
        }
Example #28
0
        void IInitializable.Initialize()
        {
            if (m_eventsToWatch == Events.None)
            {
                return;
            }

            m_commandService.RegisterMenu(Menu.EventsFiredService, "Mark", "Mark");
            m_commandService.RegisterCommand(Command.Mark, Menu.EventsFiredService, Group.EventsFiredService, "Mark", "Mark", Keys.None, null, this);
            m_commandService.RegisterCommand(Command.Clear, Menu.EventsFiredService, Group.EventsFiredService, "Clear", "Clear", Keys.None, null, this);

            if (IsSet(Events.Document))
            {
                m_documentService         = SledServiceInstance.Get <ISledDocumentService>();
                m_documentService.Opened += DocumentService_Opened;
                m_documentService.ActiveDocumentChanged += DocumentService_ActiveDocumentChanged;
                m_documentService.Saving  += DocumentService_Saving;
                m_documentService.Saved   += DocumentService_Saved;
                m_documentService.Closing += DocumentService_Closing;
                m_documentService.Closed  += DocumentService_Closed;
            }

            if (IsSet(Events.Project))
            {
                m_projectService                   = SledServiceInstance.Get <ISledProjectService>();
                m_projectService.Created          += ProjectService_Created;
                m_projectService.Opened           += ProjectService_Opened;
                m_projectService.AssetDirChanging += ProjectService_AssetDirChanging;
                m_projectService.AssetDirChanged  += ProjectService_AssetDirChanged;
                m_projectService.GuidChanging     += ProjectService_GuidChanging;
                m_projectService.GuidChanged      += ProjectService_GuidChanged;
                m_projectService.NameChanging     += ProjectService_NameChanging;
                m_projectService.NameChanged      += ProjectService_NameChanged;
                m_projectService.FileAdded        += ProjectService_FileAdded;
                m_projectService.FileOpened       += ProjectService_FileOpened;
                m_projectService.FileClosing      += ProjectService_FileClosing;
                m_projectService.FileClosed       += ProjectService_FileClosed;
                m_projectService.FileRenaming     += ProjectService_FileRenaming;
                m_projectService.FileRenamed      += ProjectService_FileRenamed;
                m_projectService.FolderRenaming   += ProjectService_FolderRenaming;
                m_projectService.FolderRenamed    += ProjectService_FolderRenamed;
                m_projectService.FolderRemoving   += ProjectService_FolderRemoving;
                m_projectService.FolderRemoved    += ProjectService_FolderRemoved;
                m_projectService.FileRemoving     += ProjectService_FileRemoving;
                m_projectService.FileRemoved      += ProjectService_FileRemoved;
                m_projectService.Saved            += ProjectService_Saved;
                m_projectService.SavedAsing       += m_projectService_SavedAsing;
                m_projectService.SavedAsed        += m_projectService_SavedAsed;
                m_projectService.SavingSettings   += ProjectService_SavingSettings;
                m_projectService.SavedSettings    += ProjectService_SavedSettings;
                m_projectService.Closing          += ProjectService_Closing;
                m_projectService.Closed           += ProjectService_Closed;
            }

            if (IsSet(Events.FileWatcher))
            {
                m_fileWatcherService = SledServiceInstance.Get <ISledFileWatcherService>();
                m_fileWatcherService.AttributeChangedEvent += FileWatcherService_AttributeChangedEvent;
                m_fileWatcherService.FileChangedEvent      += FileWatcherService_FileChangedEvent;
            }

            if (IsSet(Events.Debug))
            {
                m_debugService                        = SledServiceInstance.Get <ISledDebugService>();
                m_debugService.Connecting            += DebugServiceConnecting;
                m_debugService.Connected             += DebugServiceConnected;
                m_debugService.PluginsReady          += DebugServicePluginsReady;
                m_debugService.Ready                 += DebugServiceReady;
                m_debugService.Disconnected          += DebugServiceDisconnected;
                m_debugService.Error                 += DebugServiceError;
                m_debugService.DataReady             += DebugServiceDataReady;
                m_debugService.BreakpointHitting     += DebugServiceBreakpointHitting;
                m_debugService.BreakpointHit         += DebugServiceBreakpointHit;
                m_debugService.BreakpointContinue    += DebugServiceBreakpointContinue;
                m_debugService.UpdateBegin           += DebugServiceUpdateBegin;
                m_debugService.UpdateSync            += DebugServiceUpdateSync;
                m_debugService.UpdateEnd             += DebugServiceUpdateEnd;
                m_debugService.DebugConnect          += DebugServiceDebugConnect;
                m_debugService.DebugDisconnect       += DebugServiceDebugDisconnect;
                m_debugService.DebugStart            += DebugServiceDebugStart;
                m_debugService.DebugCurrentStatement += DebugServiceDebugCurrentStatement;
                m_debugService.DebugStepInto         += DebugServiceDebugStepInto;
                m_debugService.DebugStepOver         += DebugServiceDebugStepOver;
                m_debugService.DebugStepOut          += DebugServiceDebugStepOut;
                m_debugService.DebugStop             += DebugServiceDebugStop;
            }

            if (IsSet(Events.Breakpoint))
            {
                m_breakpointService              = SledServiceInstance.Get <ISledBreakpointService>();
                m_breakpointService.Added       += BreakpointService_Added;
                m_breakpointService.SilentAdded += BreakpointService_SilentAdded;
                m_breakpointService.Changing    += BreakpointService_Changing;
                m_breakpointService.Changed     += BreakpointService_Changed;
                m_breakpointService.Removing    += BreakpointService_Removing;
            }

            if (IsSet(Events.AtfSettings))
            {
                m_settingsService           = SledServiceInstance.Get <ISettingsService>();
                m_settingsService.Loading  += SettingsServiceLoading;
                m_settingsService.Reloaded += SettingsServiceReloaded;
                m_settingsService.Saving   += SettingsServiceSaving;
            }

            if (IsSet(Events.AtfMainForm))
            {
                m_mainForm          = SledServiceInstance.Get <MainForm>();
                m_mainForm.Loading += MainFormLoading;
                m_mainForm.Loaded  += MainFormLoaded;
                m_mainForm.Shown   += MainFormShown;
            }
        }
        private void WriteToDisk()
        {
            if (!m_bDirty)
            {
                return;
            }

            try
            {
                if (m_trace.Count <= 0)
                {
                    return;
                }

                var schemaLoader =
                    SledServiceInstance.Get <SledSharedSchemaLoader>();

                if (schemaLoader == null)
                {
                    return;
                }

                var projDir =
                    m_projectService.Get.ProjectDirectory;

                var filePath =
                    Path.Combine(
                        projDir + Path.DirectorySeparatorChar,
                        m_projectService.Get.ProjectName + " Lua Memory Trace.xml");

                var uri = new Uri(filePath);

                using (var stream = new FileStream(uri.LocalPath, FileMode.Create, FileAccess.Write))
                {
                    var settings =
                        new XmlWriterSettings
                    {
                        Indent          = true,
                        IndentChars     = "\t",
                        NewLineHandling = NewLineHandling.Replace,
                        NewLineChars    = "\r\n"
                    };

                    using (var writer = XmlWriter.Create(stream, settings))
                    {
                        writer.WriteStartDocument();
                        writer.WriteStartElement("SledMemoryTraceStreams");

                        foreach (var kv in m_trace)
                        {
                            writer.WriteStartElement("SledMemoryTraceStream");
                            writer.WriteAttributeString("Order", kv.Value.Order.ToString());
                            writer.WriteAttributeString("What", kv.Value.What);
                            writer.WriteAttributeString("OldSize", kv.Value.OldSize.ToString());
                            writer.WriteAttributeString("NewSize", kv.Value.NewSize.ToString());
                            writer.WriteAttributeString("OldAddress", kv.Value.OldAddress);
                            writer.WriteAttributeString("NewAddress", kv.Value.NewAddress);
                            writer.WriteEndElement();
                        }

                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                    }
                }
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "[SledLuaMemoryTraceService] Failure " +
                    "to save memory trace data to disk: {0}",
                    ex.Message);
            }
            finally
            {
                m_bDirty = false;
            }
        }
Example #30
0
 void IInitializable.Initialize()
 {
     m_documentService =
         SledServiceInstance.Get <ISledDocumentService>();
 }