namespace BSW4MES_TEST
{
class analyseFiles
{
[SerializableAttribute]
[ComVisibleAttribute(true)]
public class ArgumentOutOfRangeException : ArgumentException, ISerializable { }
oberflaeche ober = new oberflaeche();
public static void getFileInformations(bool isTrue)
{
for (int i = 0; i < 100; i++)
{
if (oberflaeche.txtFiles[i] != null && oberflaeche.txtFiles[i] != "")
{
string[] artikelnummer = new string[Convert.ToInt16(oberflaeche.txtFilesRows[i])];
string[,] artikelnummer_einzeln = new string[Convert.ToInt16(oberflaeche.txtFilesRows[i]), 4];
count = oberflaeche.txtFilesRows[i];
//Continue to read until you reach end of file
StreamReader sr = new StreamReader(oberflaeche.txtFiles[i], Encoding.Default);
string line;
int x = 0;
int c = 0;
while (!sr.EndOfStream)
{
line = sr.ReadLine();
artikelnummer[x] = line;
x++;
laenge = line.Length;
for (int j = 0; j < laenge; j++)
{
if (line[j].ToString() != ";" && line[j].ToString() != "")
{
nummer = j;
}
else if (line[j].ToString() == ";")
{
strichpunkt++;
}
if (strichpunkt == 1)
{
if (j+1 < laenge)
{
if (line[j + 1].ToString() != "")
{
nummer2 = nummer + 2;
endziffer[start] = nummer;
startIndex[start] = nummer2;
start++;
strichpunkt = 0;
}
else
{
nummer2 = nummer + 3;
endziffer[start] = nummer;
startIndex[start] = nummer2;
start++;
strichpunkt = 0;
}
}
}
if (start == 4)
{
break;
}
}
if (start != 4)
{
if (line[laenge-1].ToString() != ";")
{
nummer = laenge - 1;
nummer2 = nummer + 3;
endziffer[start] = nummer;
startIndex[start] = nummer2;
}
}
start = 0;
int g = 0;
for (int z = 0; z < 4; z++)
{
if (startIndex[z].ToString() == "0" || endziffer[z].ToString() == "0")
{
break;
}
else
{
if (z == 0)
{
artikelnummer_einzeln[c, z] = line.Substring(0, endziffer[z]+1);
}
else
{
artikelnummer_einzeln[c, z] = line.Substring(startIndex[g], (endziffer[z] - startIndex[g]) + 1);
g++;
}
}
}
for (int y = 0; y < 4; y++)
{
startIndex[y] = 0;
endziffer[y] = 0;
}
c++;
}
dllImport.LoadAnalyseFirstEntry(oberflaeche.DLLpath, checkFiles.filePath[i], checkFiles.fileName[i],
artikelnummer_einzeln[i, 0], artikelnummer_einzeln[i, 1],
artikelnummer_einzeln[i, 2], artikelnummer_einzeln[i, 3]);
if (dllImport.analyse == "1")
{
string newMeldung = "The analyse of the first entry was successfully!";
DialogResult res1 = MessageBox.Show(newMeldung,
Application.ProductName,
MessageBoxButtons.OKCancel,
MessageBoxIcon.Asterisk);
dllImport.LoadStartFile(oberflaeche.DLLpath, checkFiles.filePath[i], checkFiles.fileName[i], oberflaeche.txtFilesRows[i]);
if (res1 == DialogResult.OK)
{
for (int q = 0; q < Convert.ToInt16(oberflaeche.txtFilesRows[i]); q++)
{
dllImport.LoadProcessEntry(oberflaeche.DLLpath, artikelnummer_einzeln[q, 0],
artikelnummer_einzeln[q, 1], artikelnummer_einzeln[q, 2],
artikelnummer_einzeln[q, 3]);
dllImport.LoadLogEntry(oberflaeche.DLLpath);
oberflaeche.tBoxFilled(dllImport.logEntry);
}
dllImport.LoadStopFile(oberflaeche.DLLpath, checkFiles.filePath[i], checkFiles.fileName[i]);
string newMeldung2 = "The " + (i + 1) + ". File is finished. Do you want to continued?";
DialogResult res2 = MessageBox.Show(newMeldung2,
Application.ProductName,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (res2 == DialogResult.No)
{
Application.Exit();
}
}
else if (res1 == DialogResult.Cancel)
{
Application.Exit();
}
}
else
{
string meldung = "The First Entry is invalid! Do you want to continue?";
DialogResult res = MessageBox.Show(meldung,
Application.ProductName,
MessageBoxButtons.YesNo,
MessageBoxIcon.Asterisk);
if (res == DialogResult.No)
{
Application.Exit();
}
}
for (int r = 0; r < Convert.ToInt16(oberflaeche.txtFilesRows[i]); r++)
{
for (int o = 0; o < 4; o++)
{
artikelnummer_einzeln[r, o] = "";
}
}
}
}
string meldung3 = "All Files were checked!";
DialogResult res3 = MessageBox.Show(meldung3,
Application.ProductName,
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
}
}
}