/
RelatorioObjetos.cs
119 lines (102 loc) · 2.57 KB
/
RelatorioObjetos.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace FormsAnalyzerLib
{
public class RelatorioObjetos
{
public string[] linhasArquivo { get; set; }
int _indice { get; set; }
public RelatorioObjetos(string[] pLinhas)
{
_indice = 0;
linhasArquivo = pLinhas;
}
internal string linha
{
get{
try
{
return linhasArquivo[_indice];
}
catch (Exception)
{
return "";
}
}
}
internal void setLinhaAtual(int pLinha)
{
_indice = pLinha;
}
internal string getValor(string valor)
{
string retorno = null;
retorno = linha.Substring(linha.IndexOf(valor) + valor.Length).Trim();
return retorno;
}
internal bool isLabel(string pLabel, int pIndice = -1)
{
var regex = new Regex(@" ([\*\-o\^]) " + pLabel.Trim() + " ");
if (pIndice != -1)
return regex.IsMatch(getLinhaNoIndice(pIndice));
return regex.IsMatch(linha);
}
internal int getIndice()
{
return _indice;
}
internal int getTotalLinhas()
{
return linhasArquivo.Length;
}
internal string getProximaLinha(int pIndiceAdd = 0)
{
try
{
return linhasArquivo[_indice + pIndiceAdd + 1];
}
catch (Exception)
{
return "";
}
}
internal string getLinhaNoIndice(int pIndice)
{
try
{
return linhasArquivo[pIndice];
}
catch (Exception)
{
return "";
}
}
internal int next()
{
_indice ++;
return _indice;
}
internal int next(int pAddIndice)
{
_indice += pAddIndice;
return _indice;
}
internal int previus()
{
_indice --;
return _indice;
}
internal int previus(int pSubtraIndice)
{
_indice -= pSubtraIndice;
return _indice;
}
internal bool isFinal()
{
return (_indice+1) >= linhasArquivo.Length;
}
}
}