1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
private void FontSerialisieren(Schriftart alleFonts)
{
FileStream str = new FileStream(@"C:\fonts.dat", FileMode.Create);
BinaryFormatter binF = new BinaryFormatter();
binF.Serialize(str, alleFonts);
str.Close();
}
private Schriftart FontDeserialisieren()
{
BinaryFormatter binF = new BinaryFormatter();
FileStream fs = new FileStream(@"C:\fonts.dat", FileMode.Open);
return (Schriftart)binF.Deserialize(fs);
}
[Serializable()]
class Schriftart
{
public Schriftart(Font ersteSchrift, Font zweiteSchriftart)
{
Schrift1 = ersteSchrift;
Schrift2 = zweiteSchriftart;
}
private Font _Schrift1;
public Font Schrift1
{
get { return _Schrift1; }
set { _Schrift1 = value; }
}
private Font _Schrift2;
public Font Schrift2
{
get { return _Schrift2; }
set { _Schrift2 = value; }
}
}
|