Project name: Celeo ResourceManager
Current version: 1.0.0.0 (basic functions have been completed and need to be updated)
IDE: Visual Studio 2010
Download tool program source code:
Download resourcefile source code
Download the dll library program source code:
Download DLL source code
The Helper document is reflected in the execution file.
By the way, the DLL code for reading resource images is used to generate resource files for ease of use in other projects. The resource file path is accepted using the parameters of the constructor, you can call the getimage () method to obtain the image [] in the resource file. streamreader and memorystream are still used in the getimage method. You can refer to the code used to view the resource file form, some code is:
1 using system;
2 using system. Collections. Generic;
3 using system. text;
4 using system. IO;
5 using system. drawing;
6 using system. Windows. forms;
7
8 namespace loadresourcefile
9 {
10 public class LoadImage
11 {
12
13 int count;
14 int [] C;
15 byte [] [] IMG;
16 image [] image;
17 memorystream MS;
18 string path;
19
20 public LoadImage (string P)
21 {
22 Path = P;
23}
24
25 public image [] getimage ()
26 {
27 try
28 {
29 streamreader sr = new streamreader (PATH );
30 string temp = Sr. Readline ();
31 if (temp. indexof ("(<-- | ")! =-1 & temp. indexof ("| --> )")! =-1)
32 {
33 temp = temp. Replace ("(<-- | ","");
34 temp = temp. Replace ("| --> )","");
35 COUNT = convert. toint32 (temp );
36}
37 IMG = new byte [count] [];
38 string [] T = new string [count];
39 c = new int [count];
40 for (INT I = 0; I <count; I ++)
41 {
42 T [I] = Sr. Readline ();
43 If (T [I]. indexof ("(<-- | ")! =-1 & T [I]. indexof ("| --> )")! =-1)
44 {
45 t [I] = T [I]. Replace ("(<-- | ","");
46 t [I] = T [I]. Replace ("| --> )","");
47 c [I] = convert. toint32 (T [I]);
48}
49 IMG [I] = new byte [C [I];
50 for (Int J = 0; j <C [I]; j ++)
51 {
52 IMG [I] [J] = convert. tobyte (Sr. Readline ());
53}
54}
55 Sr. Close ();
56 image = new image [count];
57 for (INT I = 0; I <count; I ++)
58 {
59 MS = new memorystream (IMG [I], 0, C [I]);
60 image [I] = image. fromstream (MS );
61}
62 Return image;
63}
64 catch
65 {
66 MessageBox. Show ("An error occurred while obtaining the resource file! "," Prompt ", messageboxbuttons. OK, messageboxicon. Error );
67 return NULL;
68}
69}
70
71}
72}
The demo snippets are as follows:
Resourcefile's version1.0.0.0 has been completed. Recently, we are preparing to play the Wuzi game. We plan to write the computer's sub-algorithm within 1-3 days, optimize and improve resourcefile with spare time, and strive to upgrade the version to version1.5.0.0.
Project name: Celeo ResourceManager
Current version: 1.0.0.0 (basic functions have been completed and need to be updated)
IDE: Visual Studio 2010
Download tool program source code:
Download resourcefile source code
Download the dll library program source code:
Download DLL source code
The Helper document is reflected in the execution file.
By the way, the DLL code for reading resource images is used to generate resource files for ease of use in other projects. The resource file path is accepted using the parameters of the constructor, you can call the getimage () method to obtain the image [] in the resource file. streamreader and memorystream are still used in the getimage method. You can refer to the code used to view the resource file form, some code is:
1 using system;
2 using system. Collections. Generic;
3 using system. text;
4 using system. IO;
5 using system. drawing;
6 using system. Windows. forms;
7
8 namespace loadresourcefile
9 {
10 public class LoadImage
11 {
12
13 int count;
14 int [] C;
15 byte [] [] IMG;
16 image [] image;
17 memorystream MS;
18 string path;
19
20 public LoadImage (string P)
21 {
22 Path = P;
23}
24
25 public image [] getimage ()
26 {
27 try
28 {
29 streamreader sr = new streamreader (PATH );
30 string temp = Sr. Readline ();
31 if (temp. indexof ("(<-- | ")! =-1 & temp. indexof ("| --> )")! =-1)
32 {
33 temp = temp. Replace ("(<-- | ","");
34 temp = temp. Replace ("| --> )","");
35 COUNT = convert. toint32 (temp );
36}
37 IMG = new byte [count] [];
38 string [] T = new string [count];
39 c = new int [count];
40 for (INT I = 0; I <count; I ++)
41 {
42 T [I] = Sr. Readline ();
43 If (T [I]. indexof ("(<-- | ")! =-1 & T [I]. indexof ("| --> )")! =-1)
44 {
45 t [I] = T [I]. Replace ("(<-- | ","");
46 t [I] = T [I]. Replace ("| --> )","");
47 c [I] = convert. toint32 (T [I]);
48}
49 IMG [I] = new byte [C [I];
50 for (Int J = 0; j <C [I]; j ++)
51 {
52 IMG [I] [J] = convert. tobyte (Sr. Readline ());
53}
54}
55 Sr. Close ();
56 image = new image [count];
57 for (INT I = 0; I <count; I ++)
58 {
59 MS = new memorystream (IMG [I], 0, C [I]);
60 image [I] = image. fromstream (MS );
61}
62 Return image;
63}
64 catch
65 {
66 MessageBox. Show ("An error occurred while obtaining the resource file! "," Prompt ", messageboxbuttons. OK, messageboxicon. Error );
67 return NULL;
68}
69}
70
71}
72}
The demo snippets are as follows:
Resourcefile's version1.0.0.0 has been completed. Recently, we are preparing to play the Wuzi game. We plan to write the computer's sub-algorithm within 1-3 days, optimize and improve resourcefile with spare time, and strive to upgrade the version to version1.5.0.0.