EDN Admin
Well-known member
This is the code in the constructor:
<pre class="prettyprint if (_outputDir.Contains("_Automatic"))
{
AutomaticsubDirectoryName = _outputDir;
}
else
{
AutomaticsubDirectoryName = _outputDir + "\" + automaticModeDirectory;
}
DirectoryInfo di = new DirectoryInfo(AutomaticsubDirectoryName);
if (Directory.Exists(AutomaticsubDirectoryName))
{
FileInfo[] _fi = di.GetFiles("*.bmp", SearchOption.AllDirectories);[/code]
The result is that _fi(FileInfo[]) wontain in this case 51 files so i see for example in index [0] and [1] i see:
[0] 000001.bmp
[1] 000002.bmp
Then i have this code:
<pre class="prettyprint string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
//Assemble filename
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
if (!_outputDir.Contains("Automatic"))
{
fn = _outputDir + "\" + automaticModeDirectory + "\" + filename;
}
else
{
fn = _outputDir + "\" + filename;
}
files.Add(fn);
}[/code]
And then:<br/>
<pre class="prettyprint public void PlayLightnings()
{
Get_Lightnings_Files();
button10.Enabled = true;
Image iOLd = this.pictureBox1.Image;
Image img = Image.FromFile(files[0]);
myTrackPanelss1.trackBar1.Value = _indx;
this.pictureBox1.Image = img;
if (iOLd != null)
iOLd.Dispose();
}[/code]
Im getting error on files[0] in files wich is List<string> i have 5 files in this case for example the first one is looks like this:
D:New folder (45)converted.avi_Automatic 00276.bmp
But this directory D:New folder (45)converted.avi_Automatic not good anymore since now the files are not in one general directory but each file/s have its own directory.
In D:New folder (45)converted.avi_Automatic there are some subdirectories and in each sun directory there are some file/s
So i need that in files i will see for example in index [0]:
D:New folder (45)converted.avi_AutomaticLightning 0 Length 2 [91 - 93]
And in index [1] D:New folder (45)converted.avi_AutomaticLightning 1 Length 1 [96 - 97]
Now Lightning 1 Length 1 [96 - 97] is a sub directory wich there are files inside also Lightning 0 Length 2 [91 - 93]
The problem is here:
<pre class="prettyprint for (y = 0; y <= (result[1] - result[0]); y++)
{
//Assemble filename
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
if (!_outputDir.Contains("Automatic"))
{
fn = _outputDir + "\" + automaticModeDirectory + "\" + filename;
}
else
{
fn = _outputDir + "\" + filename;
}
files.Add(fn);
}[/code]
_outputDir and automaticModeDirectory are both giving me:
D:New folder (45)converted.avi_Automatic 00281.bmp
The file name name is ok but the directory is not.
For example file 000281.bmp is in:
D:New folder (45)converted.avi_AutomaticLightning 3 Length 1 [281 - 282] 00281.bmp
The problem is how instead of D:New folder (45)converted.avi_Automatic 00281.bmp i can get the file/s with its each own directory like D:New folder (45)converted.avi_AutomaticLightning 3 Length 1 [281 - 282] 00281.bmp
Or D:New folder (45)converted.avi_AutomaticLightning 5 Length 1 [526 - 527] some this directories have one file some more then one.
The problem is that im buidling the wrong directories and it cant find the files there.
How can i fix it so it will consider also the subdirectories .
<
danieli
View the full article
<pre class="prettyprint if (_outputDir.Contains("_Automatic"))
{
AutomaticsubDirectoryName = _outputDir;
}
else
{
AutomaticsubDirectoryName = _outputDir + "\" + automaticModeDirectory;
}
DirectoryInfo di = new DirectoryInfo(AutomaticsubDirectoryName);
if (Directory.Exists(AutomaticsubDirectoryName))
{
FileInfo[] _fi = di.GetFiles("*.bmp", SearchOption.AllDirectories);[/code]
The result is that _fi(FileInfo[]) wontain in this case 51 files so i see for example in index [0] and [1] i see:
[0] 000001.bmp
[1] 000002.bmp
Then i have this code:
<pre class="prettyprint string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
//Assemble filename
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
if (!_outputDir.Contains("Automatic"))
{
fn = _outputDir + "\" + automaticModeDirectory + "\" + filename;
}
else
{
fn = _outputDir + "\" + filename;
}
files.Add(fn);
}[/code]
And then:<br/>
<pre class="prettyprint public void PlayLightnings()
{
Get_Lightnings_Files();
button10.Enabled = true;
Image iOLd = this.pictureBox1.Image;
Image img = Image.FromFile(files[0]);
myTrackPanelss1.trackBar1.Value = _indx;
this.pictureBox1.Image = img;
if (iOLd != null)
iOLd.Dispose();
}[/code]
Im getting error on files[0] in files wich is List<string> i have 5 files in this case for example the first one is looks like this:
D:New folder (45)converted.avi_Automatic 00276.bmp
But this directory D:New folder (45)converted.avi_Automatic not good anymore since now the files are not in one general directory but each file/s have its own directory.
In D:New folder (45)converted.avi_Automatic there are some subdirectories and in each sun directory there are some file/s
So i need that in files i will see for example in index [0]:
D:New folder (45)converted.avi_AutomaticLightning 0 Length 2 [91 - 93]
And in index [1] D:New folder (45)converted.avi_AutomaticLightning 1 Length 1 [96 - 97]
Now Lightning 1 Length 1 [96 - 97] is a sub directory wich there are files inside also Lightning 0 Length 2 [91 - 93]
The problem is here:
<pre class="prettyprint for (y = 0; y <= (result[1] - result[0]); y++)
{
//Assemble filename
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
if (!_outputDir.Contains("Automatic"))
{
fn = _outputDir + "\" + automaticModeDirectory + "\" + filename;
}
else
{
fn = _outputDir + "\" + filename;
}
files.Add(fn);
}[/code]
_outputDir and automaticModeDirectory are both giving me:
D:New folder (45)converted.avi_Automatic 00281.bmp
The file name name is ok but the directory is not.
For example file 000281.bmp is in:
D:New folder (45)converted.avi_AutomaticLightning 3 Length 1 [281 - 282] 00281.bmp
The problem is how instead of D:New folder (45)converted.avi_Automatic 00281.bmp i can get the file/s with its each own directory like D:New folder (45)converted.avi_AutomaticLightning 3 Length 1 [281 - 282] 00281.bmp
Or D:New folder (45)converted.avi_AutomaticLightning 5 Length 1 [526 - 527] some this directories have one file some more then one.
The problem is that im buidling the wrong directories and it cant find the files there.
How can i fix it so it will consider also the subdirectories .
<
danieli
View the full article