internal static string ForgeErrorMessages(ErrorCode errorCode, bool full) { StringBuilder b = new StringBuilder(); if (full) { b.Append($"[{errorCode}] "); } b.Append(Wim.GetLastError() ?? Wim.GetErrorString(errorCode)); return(b.ToString()); }
/// <summary> /// Same as wimlib_open_wim(), but allows specifying a progress function and\ /// progress context. If successful, the progress function will be registered in /// the newly open ::WIMStruct, as if by an automatic call to /// wimlib_register_progress_function(). In addition, if /// ::WIMLIB_OPEN_FLAG_CHECK_INTEGRITY is specified in @p open_flags, then the /// progress function will receive ::WIMLIB_PROGRESS_MSG_VERIFY_INTEGRITY /// messages while checking the WIM file's integrity. /// </summary> /// <param name="wimFile">The path to the WIM file to open.</param> /// <param name="openFlags">Bitwise OR of flags prefixed with WIMLIB_OPEN_FLAG.</param> /// <returns> /// On success, a pointer to a new ::WIMStruct backed by the specified /// on-disk WIM file is written to the memory location pointed to by this /// parameter.This ::WIMStruct must be freed using using wimlib_free() /// when finished with it. /// </returns> /// <exception cref="WimLibException">wimlib does not return WIMLIB_ERR_SUCCESS.</exception> public static Wim OpenWim(string wimFile, WimLibOpenFlags openFlags, WimLibCallback callback = null, object userData = null) { WimLibErrorCode ret = WimLibNative.OpenWim(wimFile, openFlags, out IntPtr wimPtr); WimLibException.CheckWimLibError(ret); Wim wim = new Wim(wimPtr); if (callback != null) { wim.RegisterCallback(callback, userData); } return(wim); }
public void ReferenceTemplateImage(int newImage, Wim template, int templateImage) { ErrorCode ret = NativeMethods.ReferenceTemplateImage(_ptr, newImage, template._ptr, templateImage, 0); WimLibException.CheckWimLibError(ret); }
public void ExportImage(int srcImage, Wim destWim, string destName, string destDescription, ExportFlags exportFlags) { ErrorCode ret = NativeMethods.ExportImage(_ptr, srcImage, destWim._ptr, destName, destDescription, exportFlags); WimLibException.CheckWimLibError(ret); }