C# App to Split Files
-
By stylesmylez using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace SplitFile { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private String _sPLITe = null; //private SaveFileDialog sPLITeFM; private void btnSplit_Click(object sender, EventArgs e) { //statusBar.Text = DateTime.Today; OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Open Photo"; dlg.Filter = "Windows Bitmap Files (*.bmp)|*.bmp" + "|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { try { //pbxPhoto.Image = new Bitmap(dlg.OpenFile()); _sPLITe = dlg.FileName; Split300DividedbyLenthorSizeOfFile(_sPLITe); } catch (Exception ex) { MessageBox.Show("Unable to load file: " + ex.Message); } } dlg.Dispose(); } private void Split300DividedbyLenthorSizeOfFile(string inputFile) { //string inputFile = txtInputFile.Text; // Substitute this with your Input File FileStream fs = new FileStream(inputFile, FileMode.Open, FileAccess.Read); //int numberOfFilesx = Convert.ToInt32(txtChunks.Text); //int sizeOfEachFilex = (int)Math.Ceiling((double)fs.Length); //txtChunks.Text= string txtChunksx; ////new byte [(int)fs.Length / 300000000]); //int numberOfFilexs = // (Convert.ToInt32(fs.Length / 1500000)); //int numberOfFiles = Convert.ToInt32(txtChunks.Text); int sizeOfEachFile = (int)Math.Ceiling((double) fs.Length / //Devided By inserted Peace to get Amount example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000))); for (int i = 1; i <= //Devided By inserted Peace MB to get Amount. example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000)) ; i++) { string baseFileName = Path.GetFileNameWithoutExtension(inputFile);
-
By stylesmylez using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace SplitFile { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private String _sPLITe = null; //private SaveFileDialog sPLITeFM; private void btnSplit_Click(object sender, EventArgs e) { //statusBar.Text = DateTime.Today; OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Open Photo"; dlg.Filter = "Windows Bitmap Files (*.bmp)|*.bmp" + "|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { try { //pbxPhoto.Image = new Bitmap(dlg.OpenFile()); _sPLITe = dlg.FileName; Split300DividedbyLenthorSizeOfFile(_sPLITe); } catch (Exception ex) { MessageBox.Show("Unable to load file: " + ex.Message); } } dlg.Dispose(); } private void Split300DividedbyLenthorSizeOfFile(string inputFile) { //string inputFile = txtInputFile.Text; // Substitute this with your Input File FileStream fs = new FileStream(inputFile, FileMode.Open, FileAccess.Read); //int numberOfFilesx = Convert.ToInt32(txtChunks.Text); //int sizeOfEachFilex = (int)Math.Ceiling((double)fs.Length); //txtChunks.Text= string txtChunksx; ////new byte [(int)fs.Length / 300000000]); //int numberOfFilexs = // (Convert.ToInt32(fs.Length / 1500000)); //int numberOfFiles = Convert.ToInt32(txtChunks.Text); int sizeOfEachFile = (int)Math.Ceiling((double) fs.Length / //Devided By inserted Peace to get Amount example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000))); for (int i = 1; i <= //Devided By inserted Peace MB to get Amount. example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000)) ; i++) { string baseFileName = Path.GetFileNameWithoutExtension(inputFile);
Is there a question mixed in there somewhere?
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns
-
By stylesmylez using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace SplitFile { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private String _sPLITe = null; //private SaveFileDialog sPLITeFM; private void btnSplit_Click(object sender, EventArgs e) { //statusBar.Text = DateTime.Today; OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Open Photo"; dlg.Filter = "Windows Bitmap Files (*.bmp)|*.bmp" + "|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { try { //pbxPhoto.Image = new Bitmap(dlg.OpenFile()); _sPLITe = dlg.FileName; Split300DividedbyLenthorSizeOfFile(_sPLITe); } catch (Exception ex) { MessageBox.Show("Unable to load file: " + ex.Message); } } dlg.Dispose(); } private void Split300DividedbyLenthorSizeOfFile(string inputFile) { //string inputFile = txtInputFile.Text; // Substitute this with your Input File FileStream fs = new FileStream(inputFile, FileMode.Open, FileAccess.Read); //int numberOfFilesx = Convert.ToInt32(txtChunks.Text); //int sizeOfEachFilex = (int)Math.Ceiling((double)fs.Length); //txtChunks.Text= string txtChunksx; ////new byte [(int)fs.Length / 300000000]); //int numberOfFilexs = // (Convert.ToInt32(fs.Length / 1500000)); //int numberOfFiles = Convert.ToInt32(txtChunks.Text); int sizeOfEachFile = (int)Math.Ceiling((double) fs.Length / //Devided By inserted Peace to get Amount example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000))); for (int i = 1; i <= //Devided By inserted Peace MB to get Amount. example 3000/1500=2 (Convert.ToInt32(fs.Length / 1500000)) ; i++) { string baseFileName = Path.GetFileNameWithoutExtension(inputFile);
Homework? :)
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Homework? :)
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Is there a question mixed in there somewhere?
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns
-
Homework? :)
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
what is that soposto mean?? That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc. At one point i needed one so i put this out for those who where in my position!!!!!
If you look at the very first item in this forum, it says "How to ask a question". This forum is for asking questions. So when you post something like that, we are left wondering what the questions is. In any case, you could have been more clear by stating that you're not asking a question(which the purpose of the forum) but posting a solution to a problem you encountered. Nonetheless, thanks for sharing.
-
what is that soposto mean?? That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc. At one point i needed one so i put this out for those who where in my position!!!!!
stylez500 wrote:
i put this out for those who
Then write an article instead of posting code in forums where questions are asked...
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns
-
If you look at the very first item in this forum, it says "How to ask a question". This forum is for asking questions. So when you post something like that, we are left wondering what the questions is. In any case, you could have been more clear by stating that you're not asking a question(which the purpose of the forum) but posting a solution to a problem you encountered. Nonetheless, thanks for sharing.
-
You won't last long here with that attitude.
The difficult we do right away... ...the impossible takes slightly longer.
-
what is that soposto mean?? That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc. At one point i needed one so i put this out for those who where in my position!!!!!
It's "supposed". TXTSPEAK is heavily frowed upon here as it makes you look childish.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
what is that soposto mean?? That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc. At one point i needed one so i put this out for those who where in my position!!!!!
stylez500 wrote:
That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc.
At one point i needed one so i put this out for those who where in my position!!!!!OK, great. The problem you didn't consider is that the forums fill up so fast nobody will see your code by the end of next week because it'll be buried by a dozen pages of forum posts. Yeah and don't think "Oh it'll still be visible because of Google." Think again. If everyone used Google people would be finding their own answers instead of relying on the regulars here to spoon-feed them answers.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
what is that soposto mean?? That C# code is for those who want to create split file app jst copy n paste n modify put in buttons etc. At one point i needed one so i put this out for those who where in my position!!!!!
It's just a shame that you ignored the tips and tricks, and articles sections where this would have ben much better received.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility