Skip to content

Commit 3c56bf9

Browse files
committed
Merge branch 'Issue5319_Exported_doccls_include_attributes' of https://github.com/IvenBach/Rubberduck into doccls
2 parents 79cea90 + c389d78 commit 3c56bf9

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

Rubberduck.Core/UI/CodeExplorer/Commands/ExportCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public bool PromptFileNameAndExport(QualifiedModuleName qualifiedModule)
100100
var component = ProjectsProvider.Component(qualifiedModule);
101101
try
102102
{
103-
component.Export(dialog.FileName);
103+
var path = System.IO.Path.GetDirectoryName(dialog.FileName);
104+
component.ExportAsSourceFile(path);
104105
}
105106
catch (Exception ex)
106107
{

Rubberduck.Core/UI/Command/ComCommands/ExportAllCommand.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,9 @@ private void Export(IVBProject project)
107107

108108
// If .GetDirectoryName is passed an empty string for a RootFolder,
109109
// it defaults to the Documents library (Win 7+) or equivalent.
110-
var path = string.Empty;
111-
if (!string.IsNullOrWhiteSpace(project.FileName))
112-
{
113-
path = Path.GetDirectoryName(project.FileName);
114-
}
110+
var path = string.IsNullOrWhiteSpace(project.FileName)
111+
? string.Empty
112+
: Path.GetDirectoryName(project.FileName);
115113

116114
using (var _folderBrowser = _factory.CreateFolderBrowser(desc, true, path))
117115
{

Rubberduck.VBEEditor/SafeComWrappers/VB/Abstract/IVBComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface IVBComponent : ISafeComWrapper, IEquatable<IVBComponent>
2020
IWindow DesignerWindow();
2121
void Activate();
2222
void Export(string path);
23-
string ExportAsSourceFile(string folder, bool tempFile = false, bool specialCaseDocumentModules = true);
23+
string ExportAsSourceFile(string folder, bool isTempFile = false, bool specialCaseDocumentModules = true);
2424
int FileCount { get; }
2525
string GetFileName(short index);
2626
IVBProject ParentProject { get; }

Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBComponent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public bool HasDesigner
123123
/// Exports the component to the folder. The file name matches the component name and file extension is based on the component's type.
124124
/// </summary>
125125
/// <param name="folder">Destination folder for the resulting source file.</param>
126-
/// <param name="tempFile">True if a unique temp file name should be generated. WARNING: filenames generated with this flag are not persisted.</param>
127-
/// <param name="specialCaseDocumentModules">If reimpot of a document file is required later, it has to receive special treatment.</param>
128-
public string ExportAsSourceFile(string folder, bool tempFile = false, bool specialCaseDocumentModules = true)
126+
/// <param name="isTempFile">True if a unique temp file name should be generated. WARNING: filenames generated with this flag are not persisted.</param>
127+
/// <param name="specialCaseDocumentModules">If reimport of a document file is required later, it has to receive special treatment.</param>
128+
public string ExportAsSourceFile(string folder, bool isTempFile = false, bool specialCaseDocumentModules = true)
129129
{
130130
throw new NotSupportedException("Export as source file is not supported in VB6");
131131
}

Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBComponent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ public bool HasDesigner
9595
/// Exports the component to the folder. The file name matches the component name and file extension is based on the component's type.
9696
/// </summary>
9797
/// <param name="folder">Destination folder for the resulting source file.</param>
98-
/// <param name="tempFile">True if a unique temp file name should be generated. WARNING: filenames generated with this flag are not persisted.</param>
98+
/// <param name="isTempFile">True if a unique temp file name should be generated. WARNING: filenames generated with this flag are not persisted.</param>
9999
/// <param name="specialCaseDocumentModules">If reimport of a document file is required later, it has to receive special treatment.</param>
100-
public string ExportAsSourceFile(string folder, bool tempFile = false, bool specialCaseDocumentModules = true)
100+
public string ExportAsSourceFile(string folder, bool isTempFile = false, bool specialCaseDocumentModules = true)
101101
{
102102
//TODO: this entire thign needs to be reworked. IO is not the class' concern.
103103
//We probably need to leverage IPersistancePathProvider? ITempSourceFileHandler?
104104
//Just not here.
105-
var fullPath = tempFile
105+
var fullPath = isTempFile
106106
? Path.Combine(folder, Path.GetRandomFileName())
107107
: Path.Combine(folder, SafeName + Type.FileExtension());
108108

@@ -160,7 +160,7 @@ private void ExportUserFormModule(string path)
160160

161161
var tempFile = ExportToTempFile();
162162
var tempFilePath = Directory.GetParent(tempFile).FullName;
163-
var fileEncoding = System.Text.Encoding.Default; //We use the current ANSI codepage because that is what the VBE does.
163+
var fileEncoding = Encoding.Default; //We use the current ANSI codepage because that is what the VBE does.
164164
var contents = File.ReadAllLines(tempFile, fileEncoding);
165165
var nonAttributeLines = contents.TakeWhile(line => !line.StartsWith("Attribute")).Count();
166166
var attributeLines = contents.Skip(nonAttributeLines).TakeWhile(line => line.StartsWith("Attribute")).Count();

0 commit comments

Comments
 (0)