public static byte[] Read(string typeRes, string nameRes) { IntPtr resH1 = FindResource(IntPtr.Zero, typeRes, nameRes); IntPtr resH2 = LoadResource(IntPtr.Zero, resH1); IntPtr resH3 = LockResource(resH2); uint resSize = SizeofResource(IntPtr.Zero, resH1); //copey resorce to byte array in our memory byte[] y = new byte[resSize]; Marshal.Copy(resH3, y, 0, (int)resSize); //convert byte array to string //System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); //string settingtxt = encoding.GetString(y); return y; }
mardi 25 décembre 2012
Best way to read ressources data in C#
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire