-
Notifications
You must be signed in to change notification settings - Fork 0
/
IRepository.cs
52 lines (46 loc) · 1.47 KB
/
IRepository.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
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.IO;
namespace LabCsharp
{
public interface IRepository
{
ProgState getProg();
void PrintlogFile();
void CloseFile();
}
public class Repository :IRepository
{
private ProgState[] progs;
private StreamWriter log;
public Repository(ProgState prog,string filename)
{
progs = new ProgState[1];
progs[0] = prog;
log = new StreamWriter(filename);
}
public ProgState getProg() { return progs[0];}
private string To()
{
string str = null;
foreach (KeyValuePair<int,Tuple> item in progs[0].getFile().getDict())
{
str = str + item.Key + "->" + item.Value.getName() + '\n';
}
return str;
}
public void PrintlogFile()
{
log.WriteLine("----------------------------------------\n");
log.WriteLine("EXE Stack :\n");
log.WriteLine(progs[0].getStk().ToString());
log.WriteLine("SYM Table:\n");
log.WriteLine(progs[0].getDict().ToString());
log.WriteLine("OUT List:\n");
log.WriteLine(progs[0].getList().ToString());
log.WriteLine("FILE Table:\n");
log.WriteLine(To());
}
public void CloseFile() { log.Close(); }
}
}