protected override void OnExecute(object parameter) { if (!Directory.Exists(_serializationProvider.Target)) { Directory.CreateDirectory(_serializationProvider.Target); } var toSerialize = new Dictionary <Guid, ComProject>(); foreach (var project in _state.ProjectsProvider.Projects().Select(proj => proj.Project)) { using (var references = project.References) { foreach (var reference in references) { var info = new ReferenceInfo(reference); reference.Dispose(); var library = _comLibraryProvider.LoadTypeLibrary(info.FullPath); if (library == null) { Logger.Warn($"Could not load library {info.FullPath} for serialization."); continue; } var type = new ComProject(library, info.FullPath); if (!toSerialize.ContainsKey(type.Guid)) { toSerialize.Add(type.Guid, type); } } } } foreach (var library in toSerialize.Values) { Logger.Warn($"Serializing {library.Path}."); _serializationProvider.SerializeProject(library); } #if DEBUG //This block must be inside a DEBUG block because the Serialize method //called is conditionally compiled and available only for a DEBUG build. var path = !string.IsNullOrWhiteSpace(_serializationProvider.Target) ? Path.GetDirectoryName(_serializationProvider.Target) : Path.GetTempPath(); var traceDirectory = Path.Combine(path, "COM Trace"); if (!Directory.Exists(traceDirectory)) { Directory.CreateDirectory(traceDirectory); } Rubberduck.VBEditor.ComManagement.ComSafeManager.GetCurrentComSafe().Serialize(traceDirectory); #endif }
protected override void OnExecute(object parameter) { if (!_fileSystem.Directory.Exists(_serializationProvider.Target)) { _fileSystem.Directory.CreateDirectory(_serializationProvider.Target); } var toSerialize = new Dictionary <Guid, ComProject>(); foreach (var project in _state.ProjectsProvider.Projects().Select(proj => proj.Project)) { using (var references = project.References) { foreach (var reference in references) { var info = new ReferenceInfo(reference); reference.Dispose(); var library = _comLibraryProvider.LoadTypeLibrary(info.FullPath); if (library == null) { Logger.Warn($"Could not load library {info.FullPath} for serialization."); continue; } var type = new ComProject(library, info.FullPath); if (!toSerialize.ContainsKey(type.Guid)) { toSerialize.Add(type.Guid, type); } } } } foreach (var library in toSerialize.Values) { Logger.Warn($"Serializing {library.Path}."); _serializationProvider.SerializeProject(library); } SerializeComSafe(); }