Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
 public abstract string ExtractString(SUIStringResource resourceToken);
Esempio n. 7
0
        public static string GetInternationalString(string DllPath, string baseName, object stringID)
        {
            SUIStringResource stringResource = new SUIStringResource(DllPath, baseName, stringID);

            return(GetInternationalString(stringResource));
        }
Esempio n. 8
0
        public static string GetInternationalString(string DllPath, object stringID, StringResourceType stringType)
        {
            SUIStringResource stringResource = new SUIStringResource(DllPath, stringID, stringType);

            return(GetInternationalString(stringResource));
        }
Esempio n. 9
0
 public static string GetInternationalString(string DllPath, string baseName, object stringID)
 {
     SUIStringResource stringResource = new SUIStringResource(DllPath, baseName, stringID);
     return GetInternationalString(stringResource);
 }
Esempio n. 10
0
 public static string GetInternationalString(string DllPath, object stringID, StringResourceType stringType)
 {
     SUIStringResource stringResource = new SUIStringResource(DllPath, stringID, stringType);
     return GetInternationalString(stringResource);
 }
Esempio n. 11
0
 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);
     }
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
 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);
     }
 }
Esempio n. 14
0
 public abstract string ExtractString(SUIStringResource resourceToken);