예제 #1
0
        /// <summary>
        /// Checks if the active project has changed
        /// </summary>
        /// <param name="oldActiveProject">The file name of the old active project</param>
        private void CheckActiveProjectChange(string oldActiveProject)
        {
            _lastCollectedActiveProject = ActiveProject?.Root?.FileName;
            if (oldActiveProject == _lastCollectedActiveProject) return;

            var oldProject = Projects.FirstOrDefault(p => p.Root.FileName == oldActiveProject);
            var newProject = Projects.FirstOrDefault(p => p.Root.FileName == _lastCollectedActiveProject);
            ActiveProjectChanged?.Invoke(this, 
                new ActiveProjectChangedEventArgs(oldProject, newProject));
            if (newProject == null) return;

            SpectNetPackage.Log($"New active project: {newProject.Root.FileName}");
        }
예제 #2
0
        /// <summary>
        /// Compiles the program code
        /// </summary>
        /// <returns>True, if compilation successful; otherwise, false</returns>
        public async Task <bool> CompileCode()
        {
            var start = DateTime.Now;

            SpectNetPackage.Log(_compiler.ServiceName);
            var output = await _compiler.CompileDocument(_itemFullPath, PrepareAssemblerOptions());

            var duration = (DateTime.Now - start).TotalMilliseconds;

            SpectNetPackage.Log($"Compile time: {duration}ms");
            var compiled = output != null;

            if (compiled)
            {
                // --- Sign that compilation was successful
                HostPackage.DebugInfoProvider.CompiledOutput = Output = output;
                CreateCompilationListFile(_hierarchy, _itemId);
            }
            HostPackage.CodeManager.RaiseCompilationCompleted(output);
            return(compiled);
        }