2
\$\begingroup\$

I'm using shell 32 to get some file descriptions. It works perfect in Visual Studio 2010, but when it comes inside unity3d it crashes.

The code is:

using Shell32;

ShellClass shell = new ShellClass();
Folder objFolder = shell.NameSpace(path);

string fileTitle = objFolder.GetDetailsOf(objFolder.Items().item(0),21); //Crash on this line

I appreciate your help.

\$\endgroup\$
8
  • \$\begingroup\$ Sorry about the tags, I couldn't add more, but they are actually, "Shell32", "Crash", "Error" \$\endgroup\$
    – Kourosh
    Commented Sep 22, 2011 at 7:39
  • 1
    \$\begingroup\$ Do you have to use Shell32? It won't of course work on Mac, iOS, Android, or the WebPlayer. \$\endgroup\$ Commented Sep 22, 2011 at 9:53
  • \$\begingroup\$ What is column 21? \$\endgroup\$ Commented Sep 22, 2011 at 9:56
  • \$\begingroup\$ I'm writing a plugin, it won't need to be there for compile. just using inside the editor... 21 will return the title \$\endgroup\$
    – Kourosh
    Commented Sep 22, 2011 at 10:35
  • 1
    \$\begingroup\$ Try using System.Diagnosics.FileVersionInfo (msdn.microsoft.com/en-us/library/91sft6af.aspx) \$\endgroup\$
    – Nevermind
    Commented Sep 22, 2011 at 12:45

2 Answers 2

3
\$\begingroup\$

Using Shell32 isn't portable.

Have you tried using the .net equivalents?

http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.aspx

\$\endgroup\$
1
  • \$\begingroup\$ Thanks Tetrad, I looked into it. It won't give access to details tab. \$\endgroup\$
    – Kourosh
    Commented Sep 22, 2011 at 16:12
2
\$\begingroup\$

Yes, use the System.IO; namespace

there you have multiple interesting methods like

File.Exists(...) Directory.Exists( ...) Path.GetDirectoryName(...) Path.Combine(path, filename) Path.GetFileNameOnly(...)

( note: the method I wrote are not exactly correctly named, but you get the picture) :)

Cheers T.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .