 |
|
 |
The code is a good idea, but it is missing a lot of validations, and the class is NOT ease to use. The idea to create only files with numbers is not a good solution.
I re-wrote 50% of your code.
|
|
|
|
 |
|
 |
It is necessary to correct
while ((FSout.Position < lgSize) && (FSIn.Position != FSIn.Length ))
{
prgbProgress.Value = (int) (( (float) FSIn.Position / (float) FSIn.Length ) * (float) prgbProgress.Maximum);
if ( ((FSIn.Length - FSIn.Position) < Math.Min(PreDefinedCacheSize,(int)lgSize)) && (PreDefinedCacheSize > lgSize) )
{
PreDefinedCacheSize = (int)FSIn.Length - (int)FSIn.Position;
buffer = new byte [PreDefinedCacheSize];
rFSIn.Read(buffer,0,PreDefinedCacheSize);
wFSOut.Write(buffer);
Thread.Sleep(1);
}
else
{
if ( PreDefinedCacheSize > lgSize )
{
PreDefinedCacheSize = (int)lgSize;
buffer = new byte [PreDefinedCacheSize];
}
rFSIn.Read(buffer,0,PreDefinedCacheSize);
wFSOut.Write(buffer);
Thread.Sleep(1);
}
}
AND
foreach(string a in strFiles)
{
PreDefinedCacheSize = DefineCache();
FSIn = new FileStream(strDirectory+"\\"+FileName(a),FileMode.Open);
BinaryReader rFSIn = new BinaryReader(FSIn);
while(FSIn.Position != FSIn.Length)
{
if ( PreDefinedCacheSize > FSIn.Length - FSIn.Position )
PreDefinedCacheSize = (int)FSIn.Length - (int)FSIn.Position;
byte [] buffer = new byte [PreDefinedCacheSize];
rFSIn.Read(buffer,0,PreDefinedCacheSize);
wFSOut.Write(buffer);
Thread.Sleep(1);
prgbProgress.Value = (int) ( (float) FSout.Position / (float) FileSizes * (float) prgbProgress.Maximum);
}
rFSIn.Close();
FSIn.Close();
}
|
|
|
|
 |
|
 |
i think you'll need to fix this app up to correctly use async worker threads. there are many things that are not thread safe here. enjoy.
SteveKuznicki
|
|
|
|
 |
|
|
 |
|
 |
when iam trying to run the application iam getting an error like
"Cross-thread operation not valid: Control 'btnCancel' accessed from a thread other than the thread it was created on."
that makes the application freeze without doing anything do you have any clue, like the code is system dependent. or do i have have to change something to make it work.
If you could help it would be great.
Thankx,
Ram.
|
|
|
|
 |
|
 |
When Accessing any Control Property in a multi threaded app, let's say label and label.text, instead of :
label.text = "string value";
You must use a delegate, as :
public delegate void SetControlText(Control ctrl,string text);
private void setControlText(Control ctrl, string text)
{
if(ctrl.InvokeRequired)
ctrl.BeginInvoke(new SetControlText(setControlText),new object[]{ctrl,text});
else
ctrl.Text = text;
}
And Call the delegate method as :
setControlText(label,text);
:: YOU make history ::
|
|
|
|
 |
|
 |
See news!
:: YOU make history ::
|
|
|
|
 |
|
 |
Rar splits files perfectly and its free so why would u bother to split something and not compress it? i donno..
I was searching for a mp3 splitter and there are a ton of shity ones out there that are not free... this is perfect for those long house mixes which u really want as seperate tracks.
Beautiful, good job mate..!
|
|
|
|
 |
|
|
 |
|
 |
Can't find link to click on to download the code.
|
|
|
|
 |
|
 |
, I'll correct it very soon,
As I updated the article after the threading support, I forgot 2 refresh the links
10x
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
Hi,
I updated the links and the version, with cache defining multithreading support, plz visit.
Any comment would be very usefull thus wellcome
:: YOU make history ::
^_^
|
|
|
|
 |
|
|
 |
|
 |
Here's an updated version of the FileSplitter, with threading and multiple cache support, plz visit!
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
Are you really creating a new buffer on every iteration of the loop?
And you should use the FileStream directly, no need for BinaryReader/Writer here.
|
|
|
|
 |
|
 |
I guess, that's the only way, moreover with the GC, no need to worry... do u have another way to do so?
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
You should create a byte array in front of the loop, if you do it inside a new object will be allocated for every 8k block.
This means the GC needs to find a place, zero out the memory and later release the memory FOR EVERY BLOCK.
Why put this heavy load on the GC if you can just re-use the buffer?
|
|
|
|
 |
|
 |
Ah, I get what u try 2 say now...
, It was just some code left from some other versions
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
If you want cancel the splitting process, what you need is new thread for that job.
It's quiet simple... you start a thread pointing to the splitting method and then you "start" it. And when you press the "Cancel" button you kill the thread.
There are some good articles about threading, here in Codeproject...
|
|
|
|
 |
|
 |
10x, I'm working on it
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
Hi, There's another version available sipporting asynchronous processing
plz visit
:: YOU make history ::
^_^
|
|
|
|
 |
|
 |
the newest version is available @ www.geocities.com/m_feriati
Don't worry it's just for fun
|
|
|
|
 |
|
 |
Hi
Nice article... I was just wondering, if this somehow can be used to overcome the asp.net server limit of 4mb for uploaded files?
Thanks in advance!
|
|
|
|
 |
|
 |
horsted wrote:
I was just wondering, if this somehow can be used to overcome the asp.net server limit of 4mb for uploaded files?
ASP.NET isn't limited to 4mb for file uploads.
You can specify the maximum allowed file upload size on a per web application basis (using the Web.config file for each app) or globally using the machine.config.
Just add something like the following to the Web.config (in the <system.web> section):
<httpRuntime executionTimeout="90"
maxRequestLength="20480"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"/>
The above sets a 20mb file upload limit. Have a look in the MSDN library form more info: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfHttpRuntimeSection.asp[^]
Regards,
Brian Dela
Now Bloging![^]
|
|
|
|
 |