@@ -47,6 +47,7 @@ internal static IEnumerable<IntellisenseObject> ProcessFile(ProjectItem item, Ha
4747
4848 return new HashSet < IntellisenseObject > ( list ) ;
4949 }
50+
5051 private static void ProcessElement ( CodeElement element , List < IntellisenseObject > list , HashSet < CodeClass > underProcess )
5152 {
5253 if ( element . Kind == vsCMElement . vsCMElementEnum )
@@ -95,9 +96,8 @@ private static void ProcessElement(CodeElement element, List<IntellisenseObject>
9596
9697 private static bool ShouldProcess ( CodeElement member )
9798 {
98- return
99- member . Kind == vsCMElement . vsCMElementClass
100- || member . Kind == vsCMElement . vsCMElementEnum ;
99+ return member . Kind == vsCMElement . vsCMElementClass ||
100+ member . Kind == vsCMElement . vsCMElementEnum ;
101101 }
102102
103103 private static void ProcessEnum ( CodeEnum element , List < IntellisenseObject > list )
@@ -204,46 +204,65 @@ private static bool IsPublic(CodeFunction cf)
204204
205205 private static string GetClassName ( CodeClass cc )
206206 {
207- return GetDataContractName ( cc , "Name" ) ?? cc . Name ;
207+ return cc . Name ;
208+
209+ // return GetDataContractName(cc, "Name") ?? cc.Name;
208210 }
209211
210212 private static string GetNamespace ( CodeClass cc )
211213 {
212- return GetDataContractName ( cc , "Namespace" ) ?? GetNamespace ( cc . Attributes ) ;
214+ if ( ! Options . UseNamespace )
215+ return Options . DefaultModuleName ;
216+
217+ return cc == null
218+ ? Options . DefaultModuleName
219+ : cc . Namespace . FullName ;
220+
221+ //return GetDataContractName(cc, "Namespace") ?? GetNamespace(cc.Attributes);
213222 }
214223
215- private static string GetDataContractName ( CodeClass cc , string attrName )
224+ private static string GetNamespace ( CodeEnum cc )
216225 {
217- var dataContractAttribute = cc . Attributes . Cast < CodeAttribute > ( ) . Where ( a => a . Name == "DataContract" ) ;
226+ if ( ! Options . UseNamespace )
227+ return Options . DefaultModuleName ;
218228
219- if ( ! dataContractAttribute . Any ( ) )
220- return null ;
229+ return cc == null
230+ ? Options . DefaultModuleName
231+ : cc . Namespace . FullName ;
232+
233+ //return GetNamespace(cc.Attributes);
234+ }
221235
222- string name = null ;
223- var keyValues = dataContractAttribute . First ( ) . Children . OfType < CodeAttributeArgument > ( )
224- . ToDictionary ( a => a . Name , a => ( a . Value ?? "" ) . Trim ( ' \" ' , ' \' ' ) ) ;
236+ //private static string GetDataContractName(CodeClass cc, string attrName)
237+ //{
238+ // var dataContractAttribute = cc.Attributes.Cast<CodeAttribute>().Where( a => a.Name == "DataContract" );
225239
226- if ( keyValues . ContainsKey ( attrName ) )
227- name = keyValues [ attrName ] ;
240+ // if (!dataContractAttribute.Any( ))
241+ // return null ;
228242
229- return name ;
230- }
243+ // string name = null;
244+ // var keyValues = dataContractAttribute.First().Children.OfType<CodeAttributeArgument>()
245+ // .ToDictionary(a => a.Name, a => (a.Value ?? "").Trim('\"', '\''));
231246
232- private static string GetNamespace ( CodeEnum cc ) { return GetNamespace ( cc . Attributes ) ; }
247+ // if (keyValues.ContainsKey(attrName))
248+ // name = keyValues[attrName];
233249
234- private static string GetNamespace ( CodeElements attrs )
235- {
236- if ( attrs == null ) return Options . DefaultModuleName ;
250+ // return name;
251+ //}
237252
238- var namespaceFromAttr = from a in attrs . Cast < CodeAttribute2 > ( )
239- where a . Name . EndsWith ( ModuleNameAttributeName , StringComparison . OrdinalIgnoreCase )
240- from arg in a . Arguments . Cast < CodeAttributeArgument > ( )
241- let v = ( arg . Value ?? "" ) . Trim ( '\" ' )
242- where ! string . IsNullOrWhiteSpace ( v )
243- select v ;
253+ //private static string GetNamespace(CodeElements attrs)
254+ //{
255+ // if (attrs == null || attrs.Count == 0) return Options.DefaultModuleName;
244256
245- return namespaceFromAttr . FirstOrDefault ( ) ?? Options . DefaultModuleName ;
246- }
257+ // var namespaceFromAttr = from a in attrs.Cast<CodeAttribute2>()
258+ // where a.Name.EndsWith(ModuleNameAttributeName, StringComparison.OrdinalIgnoreCase)
259+ // from arg in a.Arguments.Cast<CodeAttributeArgument>()
260+ // let v = (arg.Value ?? "").Trim('\"')
261+ // where !string.IsNullOrWhiteSpace(v)
262+ // select v;
263+
264+ // return namespaceFromAttr.FirstOrDefault() ?? Options.DefaultModuleName;
265+ //}
247266
248267 private static IntellisenseType GetType ( CodeClass rootElement , CodeTypeRef codeTypeRef , HashSet < string > traversedTypes , HashSet < string > references )
249268 {
@@ -261,7 +280,7 @@ private static IntellisenseType GetType(CodeClass rootElement, CodeTypeRef codeT
261280 }
262281
263282 string typeName = effectiveTypeRef . AsFullName ;
264-
283+
265284 try
266285 {
267286 var codeClass = effectiveTypeRef . CodeType as CodeClass2 ;
0 commit comments