Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# App to Split Files

C# App to Split Files

Scheduled Pinned Locked Moved C#
graphicscsharptutorial
13 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S stylez500

    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);

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    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

    S 1 Reply Last reply
    0
    • S stylez500

      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);

      R Offline
      R Offline
      R Giskard Reventlov
      wrote on last edited by
      #3

      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

      S 2 Replies Last reply
      0
      • R R Giskard Reventlov

        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

        S Offline
        S Offline
        stylez500
        wrote on last edited by
        #4

        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!!!!!

        S 1 Reply Last reply
        0
        • L Lost User

          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

          S Offline
          S Offline
          stylez500
          wrote on last edited by
          #5

          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!!!!!

          L D P 4 Replies Last reply
          0
          • R R Giskard Reventlov

            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

            S Offline
            S Offline
            stylez500
            wrote on last edited by
            #6

            you right home work 4 your self

            Richard Andrew x64R 1 Reply Last reply
            0
            • S stylez500

              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!!!!!

              S Offline
              S Offline
              SilimSayo
              wrote on last edited by
              #7

              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.

              S 1 Reply Last reply
              0
              • S stylez500

                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!!!!!

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                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

                1 Reply Last reply
                0
                • S SilimSayo

                  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.

                  S Offline
                  S Offline
                  stylez500
                  wrote on last edited by
                  #9

                  Your welcome

                  1 Reply Last reply
                  0
                  • S stylez500

                    you right home work 4 your self

                    Richard Andrew x64R Offline
                    Richard Andrew x64R Offline
                    Richard Andrew x64
                    wrote on last edited by
                    #10

                    You won't last long here with that attitude.

                    The difficult we do right away... ...the impossible takes slightly longer.

                    1 Reply Last reply
                    0
                    • S stylez500

                      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!!!!!

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #11

                      It's "supposed". TXTSPEAK is heavily frowed upon here as it makes you look childish.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak

                      1 Reply Last reply
                      0
                      • S stylez500

                        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!!!!!

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #12

                        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

                        1 Reply Last reply
                        0
                        • S stylez500

                          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!!!!!

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #13

                          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

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups