epošta: info@strojnistvo.com
(C) 2001 - 2012 STROJNISTVO.com
Moderator: -M-




ManiaC napisal/-a:Sem ti naredil programček, ki ti bo spravil v željen format iz takšnega, ki si ga podal v prejšnjem postu.
Dobiš ga na spodnjem naslovu:
https://docs.google.com/open?id=0B7I3Ck ... MTlVSnhyZw

openFileDialog1.Filter = "Txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1.FileName = "";
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
StreamReader sr = new StreamReader(openFileDialog1.FileName);
StreamWriter sw = new StreamWriter(openFileDialog1.FileName + ".popravljeno");
string line;
string x="0";
string y="0";
string z="0";
while ((line = sr.ReadLine()) != null)
{
string[] line1;
int index = 0;
char[] MyChar = { ' ' };
line = line.TrimEnd(MyChar);
line1 = line.Split(' ');
if (line1.Length == 3)
{
x = line1[0].Substring(1);
y = line1[1].Substring(1);
z = line1[2].Substring(1);
}
if (line1.Length == 2)
{
index = line1[0].IndexOf('X');
if (index == -1)
{
y = line1[0].Substring(1);
z = line1[1].Substring(1);
}
else
{
x = line1[0].Substring(1);
index = line1[1].IndexOf('Y');
if (index == -1)
{
z = line1[1].Substring(1);
}
else
{
y = line1[1].Substring(1);
}
}
}
if (line1.Length == 1)
{
index = line1[0].IndexOf('X');
if (index == -1)
{
index = line1[0].IndexOf('Y');
if (index == -1)
{
z = line1[0].Substring(1);
}
else
{
y = line1[0].Substring(1);
}
}
else
{
x = line1[0].Substring(1);
}
}
sw.WriteLine(x + " " + y + " " + z);
}
sr.Close();
sw.Close();
}
Po forumu brska: 0 registriranih uporabnikov in 2 gostov