-
Notifications
You must be signed in to change notification settings - Fork 0
/
junk_unused_code.txt
100 lines (88 loc) · 4.87 KB
/
junk_unused_code.txt
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using (StreamReader sreader = File.OpenText(file_name))
{
string str_ln = String.Empty;
while ((str_ln = sreader.ReadLine()) != null)
{
// read line by line
if (str_ln.Substring(0, 3) == "[+]")
{
string[] str_elem_type = str_ln.Substring(4).Split(',');
// store the number of elements
int n_count = 0;
int.TryParse(str_elem_type[1], out n_count);
if (str_elem_type[0] == "End Points")
{
// Read all End points
str_end_pts = new string[n_count];
for (i = 0; i < n_count; i++)
{
// Add all the end points to string list
str_end_pts[i] = sreader.ReadLine();
}
}
else if (str_elem_type[0] == "Lines")
{
// Read all Lines
str_lines = new string[n_count];
for (i = 0; i < n_count; i++)
{
// Add all the lines to string list
str_lines[i] = sreader.ReadLine();
}
}
else if (str_elem_type[0] == "Arcs")
{
// Read all Arcs
str_arcs = new string[n_count];
for (i = 0; i < n_count; i++)
{
// Each arc has 3 lines of inputs
str_arcs[i] = sreader.ReadLine() + ",";
for (j = 0; j < 2; j++)
{
// Add all the arcs to string list
str_arcs[i] = str_arcs[i] + sreader.ReadLine() + ",";
}
}
}
else if (str_elem_type[0] == "Beziers")
{
// Read all Beziers
str_beziers = new string[n_count];
for (i = 0; i < n_count; i++)
{
// Each beziers has 1,2 or 3 control points (2 end points)
string[] str_temp = sreader.ReadLine().Split(",");
str_beziers[i] = str_temp[0] + ", " + str_temp[1] + ", " + str_temp[2] + ", ";
int index0 = str_temp[3].IndexOf('@');
int cntrl_count = 0;
int.TryParse(str_temp[3].Substring(index0 + 1), out cntrl_count);
for (j = 0; j < cntrl_count; j++)
{
// Add all the beziers to string list
str_beziers[i] = str_beziers[i] + sreader.ReadLine() + ",";
}
}
}
else if (str_elem_type[0] == "Surfaces")
{
// Read all surfaces
str_surfaces = new string[n_count];
for (i = 0; i < n_count; i++)
{
str_surfaces[i] = sreader.ReadLine();
int index0 = str_surfaces[i].IndexOf('@');
int cntrl_count = 0;
int.TryParse(str_surfaces[i].Substring(index0 + 1), out cntrl_count);
// remove the last 3 characters
str_surfaces[i] = str_surfaces[i].Substring(0, str_surfaces[i].Length - 3);
for (j = 0; j < cntrl_count; j++)
{
// Add all the beziers to string list
str_surfaces[i] = str_surfaces[i] + sreader.ReadLine() + ",";
}
}
}
}
}
}