In the article "using C # to develop smartphone software: Push Box (a)", I made a general introduction to the Push box program. This time, I first introduce Common/fcl.cs source program files.
The following is a reference fragment:
1 using System;
2 using System.IO
3 using System.Drawing;
4
5 namespace Skyiv.Ben.PushBox.Common
6 {
7///
8///here is the. NET Framework support, and the. NET Compact framework does not support Dongdong
9///
static class FCL
1 1 {
///
13///Gets the newline string defined for this environment. --Environment
///
public static string newline {get {return "\ r \ n";}}
///
18///opens a text file, reads all the rows of the file into a string, and then closes the file. ---File
///
20///The files to be opened for reading
21///The string containing all rows of the file
public static string ReadAllText (string path)
{
String text = ';
if (file.exists (path))
{
using (StreamReader sr = new StreamReader (path, pub.encode))
{
Tex t = Sr. ReadToEnd ();
30}
31}
Return text;
33}
///
36///Creates a new file, writes the specified string to it, and then closes the file. --File
Notoginseng///
38///to write to the
39///the string to write to the file
public static void WriteAllText (string path, String conte NTS)
The
(StreamWriterSW = new StreamWriter (path, False, Pub.encode))
{
SW. Write (contents);
45}
46}
$
///
49///Adds the specified Size to the specified point. --point
///
51///To add the point
52///the Size to add
53///The result of the addition operation
"public static" add (Point poi NT, size size
to return to new point. X + size. Width, point. Y + size. Height);
57} The
///
60///Changes the size of a one-dimensional array to the specified new size. --Array
///
62///The type of the array element
63///The one-dimensional array to resize
64///The size of the new array
-public static void Resize (ref t[] Ar Ray, int newsize)
$ {
(array!= null && array). Length = = newsize) return;
if (array = = null) array = new T[0];
t[] NewArray = new T[newsize];
Array.copy (Array, NewArray, Math.min (array). Length, newarray.length));
the array = NewArray;
72}
73}
I}