Exemple #1
0
        static void Main(string[] args)
        {
            FastCompress.doNotUseTPL             = true;
            FastCompress.compressStrictSeqential = false;
            System.Console.WriteLine("Time taken for Seq compression = {0}", FastCompress.CompressFast(@"Z:\Projects\Test\File1.test.seq", @"Z:\Projects\Test\File1.test", true));
            System.Console.WriteLine("Time taken for Seq Un compression = {0}", FastCompress.UncompressFast(@"Z:\Projects\Test\File1.test.orgSeq", @"Z:\Projects\Test\File1.test.seq", true));


            FastCompress.doNotUseTPL             = false;
            FastCompress.compressStrictSeqential = false;
            System.Console.WriteLine("Time taken for Parallel compression = {0}", FastCompress.CompressFast(@"Z:\Projects\Test\File1.test.pll", @"Z:\Projects\Test\File1.test", true));
            System.Console.WriteLine("Time taken for Parallel Un compression = {0}", FastCompress.UncompressFast(@"Z:\Projects\Test\File1.test.orgpll", @"Z:\Projects\Test\File1.test.pll", true));
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            richTextBox2.ForeColor = Color.Black;
            richTextBox2.BackColor = Color.White;
            richTextBox2.Text      = "Processing compression request.  Please wait...";
            richTextBox2.Update();

            if (radioButton1.Checked == true)
            {
                FastCompress.doNotUseTPL = false;
                richTextBox1.ForeColor   = Color.DarkBlue;
                richTextBox1.BackColor   = Color.White;
                richTextBox1.Text        = processorDetail + "User selected Multi Core.  Selected Multi Core based Fast Compression";
            }
            else if (radioButton2.Checked == true)
            {
                FastCompress.doNotUseTPL = true;
                richTextBox1.ForeColor   = Color.DarkBlue;
                richTextBox1.BackColor   = Color.White;
                richTextBox1.Text        = processorDetail + "User selected not to use TPL based Compression";
            }
            else if (radioButton3.Checked == true)
            {
                if (isMultiProcessor)
                {
                    FastCompress.doNotUseTPL = false;
                    richTextBox1.ForeColor   = Color.DarkBlue;
                    richTextBox1.BackColor   = Color.White;
                    richTextBox1.Text        = processorDetail + "Auto detected Multi Core.  Selected Multi Core based Fast Compression";
                }
                else
                {
                    FastCompress.doNotUseTPL = true;
                    richTextBox1.ForeColor   = Color.DarkBlue;
                    richTextBox1.BackColor   = Color.White;
                    richTextBox1.Text        = processorDetail + "Auto detected Single Core.  Selected Single Core based Compression";
                }
            }

            if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text))
            {
                richTextBox2.ForeColor = Color.IndianRed;
                richTextBox2.BackColor = Color.WhiteSmoke;
                richTextBox2.Text      = "Please select the File Name to Compress.  Click Browse button above to select a file";
                return;
            }

            try
            {
                int timeTaken = FastCompress.CompressFast(textBox2.Text, textBox1.Text, true);

                richTextBox2.ForeColor = Color.DarkGreen;
                richTextBox2.BackColor = Color.White;
                richTextBox2.Text      = " File Compression Succesful. \n\n Time taken = " + timeTaken.ToString() + " milli seconds";
            }
            catch (FastCompressException ex)
            {
                richTextBox2.ForeColor = Color.IndianRed;
                richTextBox2.BackColor = Color.White;
                richTextBox2.Text      = " Exception: \n " + ex.Message;
            }
        }