BExplorer.Shell.Interop.Shell32.CommandLineToArgs C# (CSharp) Method

CommandLineToArgs() public static method

public static CommandLineToArgs ( string commandLine ) : string[]
commandLine string
return string[]
		public static string[] CommandLineToArgs(string commandLine) {
			int argc;
			var argv = CommandLineToArgvW(commandLine, out argc);
			if (argv == IntPtr.Zero)
				throw new System.ComponentModel.Win32Exception();
			try {
				var args = new string[argc];
				for (var i = 0; i < args.Length; i++) {
					var p = Marshal.ReadIntPtr(argv, i * IntPtr.Size);
					args[i] = Marshal.PtrToStringUni(p);
				}
				return args;
			} finally {
				Marshal.FreeHGlobal(argv);
			}
		}