public override string ExtractString(SUIStringResource resourceToken) { string baseName = (string)resourceToken.ManagedAssembly[resourceToken.ResourceDll]; Assembly assembly = Assembly.LoadFrom(resourceToken.ResourceDll); ResourceManager manager = new ResourceManager(baseName, assembly); return(manager.GetString((string)resourceToken.StringID)); }
public static string GetInternationalString(SUIStringResource stringResource) { if (m_ResourceManager == null) { m_ResourceManager = new SUIResourceManager(); } SUIStringResourceHandler handler = (SUIStringResourceHandler)m_ResourceManager.m_Handlers[stringResource.StringType]; return handler.ExtractString(stringResource); }
public static string GetInternationalString(SUIStringResource stringResource) { if (m_ResourceManager == null) { m_ResourceManager = new SUIResourceManager(); } SUIStringResourceHandler handler = (SUIStringResourceHandler)m_ResourceManager.m_Handlers[stringResource.StringType]; return(handler.ExtractString(stringResource)); }
public override string ExtractString(SUIStringResource resourceToken) { IntPtr hInstance = IntPtr.Zero; try { hInstance = SUIWinAPIs.LoadLibraryEx(resourceToken.ResourceDll, IntPtr.Zero, 2); StringBuilder result = new StringBuilder(255); SUIWinAPIs.LoadString(hInstance, (int)resourceToken.StringID, result, result.Capacity); return(result.ToString()); } catch (Exception e) { throw new SUIException("ExactString Error!", e); } finally { if (!hInstance.Equals(IntPtr.Zero)) { SUIWinAPIs.FreeLibrary(hInstance); } } }
public override string ExtractString(SUIStringResource resourceToken) { IntPtr hInstance = IntPtr.Zero; IntPtr hModule = IntPtr.Zero; try { hInstance = SUIWinAPIs.LoadLibraryEx(resourceToken.ResourceDll, IntPtr.Zero, 2); if (resourceToken.StringID is int) { hModule = SUIWinAPIs.FindResource(hInstance, (int)resourceToken.StringID, (int)resourceToken.StringType); } else { hModule = SUIWinAPIs.FindResource(hInstance, (string)resourceToken.StringID, (int)resourceToken.StringType); } IntPtr hResData = SUIWinAPIs.LoadResource(hInstance, hModule); IntPtr ptr = SUIWinAPIs.LockResource(hResData); DialogTemplateEx dlgtemplateex = new DialogTemplateEx(); DialogTemplate dlgtemplate = new DialogTemplate(); Marshal.PtrToStructure(ptr, dlgtemplateex); Marshal.PtrToStructure(ptr, dlgtemplate); if ((dlgtemplateex.wSignature & 0xffff) == 0xffff) //if dlg is extend dlg { ptr = (IntPtr)(ptr.ToInt64() + Marshal.SizeOf(dlgtemplateex)); //directly operation memory address } else { ptr = (IntPtr)(ptr.ToInt64() + 0x12); } if (Marshal.ReadInt16(ptr) == -1) { ptr = (IntPtr)(ptr.ToInt64() + 4); } else { while (Marshal.ReadInt16(ptr) != 0) { ptr = (IntPtr)(ptr.ToInt64() + 2); } ptr = (IntPtr)(ptr.ToInt64() + 2); } if (Marshal.ReadInt16(ptr) == -1) { ptr = (IntPtr)(ptr.ToInt64() + 4); } else { while (Marshal.ReadInt16(ptr) != 0) { ptr = (IntPtr)(ptr.ToInt64() + 2); } ptr = (IntPtr)(ptr.ToInt64() + 2); } return(Marshal.PtrToStringAuto(ptr)); } catch (Exception e) { throw new SUIException("ExactString Error", e); } finally { if (!hInstance.Equals(IntPtr.Zero)) { SUIWinAPIs.FreeLibrary(hInstance); } } }
public abstract string ExtractString(SUIStringResource resourceToken);
public static string GetInternationalString(string DllPath, string baseName, object stringID) { SUIStringResource stringResource = new SUIStringResource(DllPath, baseName, stringID); return(GetInternationalString(stringResource)); }
public static string GetInternationalString(string DllPath, object stringID, StringResourceType stringType) { SUIStringResource stringResource = new SUIStringResource(DllPath, stringID, stringType); return(GetInternationalString(stringResource)); }
public static string GetInternationalString(string DllPath, string baseName, object stringID) { SUIStringResource stringResource = new SUIStringResource(DllPath, baseName, stringID); return GetInternationalString(stringResource); }
public static string GetInternationalString(string DllPath, object stringID, StringResourceType stringType) { SUIStringResource stringResource = new SUIStringResource(DllPath, stringID, stringType); return GetInternationalString(stringResource); }
public override string ExtractString(SUIStringResource resourceToken) { IntPtr hInstance = IntPtr.Zero; IntPtr hModule = IntPtr.Zero; try { hInstance = SUIWinAPIs.LoadLibraryEx(resourceToken.ResourceDll, IntPtr.Zero, 2); if(resourceToken.StringID is int) { hModule = SUIWinAPIs.FindResource(hInstance, (int)resourceToken.StringID, (int)resourceToken.StringType); } else { hModule = SUIWinAPIs.FindResource(hInstance, (string)resourceToken.StringID,(int)resourceToken.StringType); } IntPtr hResData = SUIWinAPIs.LoadResource(hInstance, hModule); IntPtr ptr = SUIWinAPIs.LockResource(hResData); DialogTemplateEx dlgtemplateex = new DialogTemplateEx(); DialogTemplate dlgtemplate = new DialogTemplate(); Marshal.PtrToStructure(ptr, dlgtemplateex); Marshal.PtrToStructure(ptr, dlgtemplate); if ((dlgtemplateex.wSignature & 0xffff) == 0xffff) //if dlg is extend dlg { ptr = (IntPtr)(ptr.ToInt64() + Marshal.SizeOf(dlgtemplateex)); //directly operation memory address } else { ptr = (IntPtr)(ptr.ToInt64() + 0x12); } if (Marshal.ReadInt16(ptr) == -1) { ptr = (IntPtr)(ptr.ToInt64() + 4); } else { while (Marshal.ReadInt16(ptr) != 0) { ptr = (IntPtr)(ptr.ToInt64() + 2); } ptr = (IntPtr)(ptr.ToInt64() + 2); } if (Marshal.ReadInt16(ptr) == -1) { ptr = (IntPtr)(ptr.ToInt64() + 4); } else { while (Marshal.ReadInt16(ptr) != 0) { ptr = (IntPtr)(ptr.ToInt64() + 2); } ptr = (IntPtr)(ptr.ToInt64() + 2); } return Marshal.PtrToStringAuto(ptr); } catch (Exception e) { throw new SUIException("ExactString Error",e); } finally { if (!hInstance.Equals(IntPtr.Zero)) SUIWinAPIs.FreeLibrary(hInstance); } }
public override string ExtractString(SUIStringResource resourceToken) { string baseName = (string)resourceToken.ManagedAssembly[resourceToken.ResourceDll]; Assembly assembly = Assembly.LoadFrom(resourceToken.ResourceDll); ResourceManager manager = new ResourceManager(baseName, assembly); return manager.GetString((string)resourceToken.StringID); }
public override string ExtractString(SUIStringResource resourceToken) { IntPtr hInstance = IntPtr.Zero; try { hInstance = SUIWinAPIs.LoadLibraryEx(resourceToken.ResourceDll, IntPtr.Zero, 2); StringBuilder result = new StringBuilder(255); SUIWinAPIs.LoadString(hInstance, (int)resourceToken.StringID, result, result.Capacity); return result.ToString(); } catch (Exception e) { throw new SUIException("ExactString Error!",e); } finally { if (!hInstance.Equals(IntPtr.Zero)) SUIWinAPIs.FreeLibrary(hInstance); } }