/// <summary> /// Loads a script directly from a file. It will not be converted to COMPATBGR32. /// </summary> /// <param name="path">The path of the script file to open.</param> /// <param name="setWorkingDir">If true, current working directory will be changed to the path of the script.</param> public static VsScript LoadFileDirect(string path, bool setWorkingDir) { IntPtr H = IntPtr.Zero; if (VsInvoke.vsscript_evaluateFile(ref H, new Utf8Ptr(path).ptr, setWorkingDir ? VsInvoke.FlagSetWorkingDir : 0) == 0) { return(new VsScript(H)); } else { string Err = new VsScript(H).GetError(); VsInvoke.vsscript_freeScript(H); throw new VsException(Err); } }
/// <summary> /// Loads specified script. /// </summary> /// <param name="script">The script to load.</param> /// <param name="convertToCompatBgr32">If true, the script output will be converted to COMPATBGR32.</param> public static VsScript LoadScript(string script, bool convertToCompatBgr3) { if (convertToCompatBgr3) { script = AppendConvertCompoatScript(script); } IntPtr H = IntPtr.Zero; if (VsInvoke.vsscript_evaluateScript(ref H, new Utf8Ptr(script).ptr, IntPtr.Zero, 0) == 0) { return(new VsScript(H)); } else { string Err = new VsScript(H).GetError(); VsInvoke.vsscript_freeScript(H); throw new VsException(Err); } }