Trying to experiment with some Resharper Open APIs -


I was trying to parse it by reading a C # source file and using Resharper. I wanted to get the list of namespaces used in the file, but I had an exception in this line

  icsharp file file = cshrppc utility Purse (escoded);  Exception description:  One type of exception was 'System.InvalidOperationException' in JetBrains.Platform.ReSharper.Shell.dll  

Thread has exited the 0x1020 code 0 (0x0) thread 0x14c0 has been exited with code 0 (0x0).

  static zero main () {string sCode = File.ReadAllText (@ "D: \ ResharperTries \ TestFile.cs"); Try {ICSHRP file file = CSRPPrice utility. Purse (acid); IList & LT; ICSharpNamespaceDeclaration & gt; X = file Name-place announcements; Foreach (in ICSHRPnSpaceDiscalationValue X) {console.writeline (value.ContainingNamespace.ShortName); }} Hold (exception e) {console} WrightLine (e.Message); }}   

Some help is required regarding this problem.

Thanks

It is possible to do this that part of Dxcore and coded Are there.

In version 10.2 we have released standalone parser libraries for C # and VB ( freely downloadable DXCore part) Therefore parser libraries have to be referenced to make it very easy to do what you are looking for.

If you need help about it, just email support@devexpress.com with any question.

Here is a sample of code, which can be used to fill with listbones names, some files:

  string filepath = @ "insert file path"; CSHRP 30 parser parser = new CSHRP 30 parser (); SourceFile fileNode = parser.ParseFile (filePath) as SourceFile; If (fileNode == faucet || fileNode.UsingList == faucet) return; LbUsedNamespaces.Items.Clear (); For (int i = 0; i & lt; fileNode.UsingList.Count; i ++) {string strUsing = fileNode.UsingList.GetKey (i) as string; If (String.IsNullOrEmpty (strUsing) continues); LbUsedNamespaces.Items.Add (strUsing); }    

Comments