2
2
using System . IO ;
3
3
using System . Reflection ;
4
4
using Microsoft . Office . Interop . Access ;
5
+ using Rubberduck . VBEditor . Extensions ;
6
+ using Rubberduck . VBEditor . SafeComWrappers ;
5
7
6
8
namespace Rubberduck . VBEditor . Application
7
9
{
@@ -15,20 +17,28 @@ public override void Run(QualifiedMemberName qualifiedMemberName)
15
17
Application . Run ( call ) ;
16
18
}
17
19
18
- //public List<string> FormDeclarations(QualifiedModuleName qualifiedModuleName)
19
- //{
20
- // Application.DoCmd.OutputTo(AcOutputObjectType.acOutputForm, qualifiedModuleName.Name, AcCommand.acCmdExportText,
21
- // Path.Combine(ExportPath, qualifiedModuleName.Name), null, null, null);
22
- //}
23
-
24
- //private string ExportPath
25
- //{
26
- // get
27
- // {
28
- // var assemblyLocation = Assembly.GetAssembly(typeof(AccessApp)).Location;
29
- // return Path.GetDirectoryName(assemblyLocation);
30
- // }
31
- //}
20
+ public List < string > FormDeclarations ( QualifiedModuleName qualifiedModuleName )
21
+ {
22
+ //TODO: Determine if component is Form/Report
23
+ string filePath = Path . Combine ( ExportPath , qualifiedModuleName . Name + MSAccessComponentType . Form . FileExtension ( ) ) ;
24
+ Application . SaveAsText ( AcObjectType . acForm , qualifiedModuleName . Name , filePath ) ;
25
+ var code = File . ReadAllText ( filePath ) ;
26
+ File . Delete ( filePath ) ;
27
+
28
+
29
+
30
+
31
+ return new List < string > ( ) ;
32
+ }
33
+
34
+ private string ExportPath
35
+ {
36
+ get
37
+ {
38
+ var assemblyLocation = Assembly . GetAssembly ( typeof ( AccessApp ) ) . Location ;
39
+ return Path . GetDirectoryName ( assemblyLocation ) ;
40
+ }
41
+ }
32
42
33
43
private string GenerateMethodCall ( QualifiedMemberName qualifiedMemberName )
34
44
{
0 commit comments