-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathModelBank.cs
45 lines (39 loc) · 1.09 KB
/
ModelBank.cs
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
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
namespace spb2xml
{
public class ModelBank
{
private Hashtable models = new Hashtable();
public ModelBank(string modelFileUrl)
{
StreamReader sr = new StreamReader(modelFileUrl);
string line;
char[] delimiters = new char[] { ' ', '\t' };
while ((line = sr.ReadLine()) != null)
{
string[] parts = line.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 2)
{
Guid g = new Guid(parts[1].Trim());
String name = parts[0].Trim();
if (!models.ContainsKey(g))
{
models.Add(g, name);
}
}
}
}
public string Lookup(Guid g)
{
return (string) models[g];
}
public int Size()
{
return models.Count;
}
}
}