Click here to Skip to main content
15,910,787 members
Home / Discussions / C#
   

C#

 
GeneralRe: Add connection Pin
Paul Conrad16-Sep-07 7:00
professionalPaul Conrad16-Sep-07 7:00 
AnswerRe: Add connection Pin
Guffa16-Sep-07 7:18
Guffa16-Sep-07 7:18 
AnswerRe: Add connection Pin
PIEBALDconsult16-Sep-07 8:27
mvePIEBALDconsult16-Sep-07 8:27 
Questionpopulating grid Pin
rcwoods16-Sep-07 2:38
rcwoods16-Sep-07 2:38 
AnswerRe: populating grid Pin
Ravi Bhavnani16-Sep-07 4:03
professionalRavi Bhavnani16-Sep-07 4:03 
AnswerRe: BinaryReader BinaryWriter Pin
Guffa16-Sep-07 2:23
Guffa16-Sep-07 2:23 
AnswerFileSize Pin
jblouir16-Sep-07 4:18
jblouir16-Sep-07 4:18 
AnswerRe: FileSize Pin
Guffa16-Sep-07 6:02
Guffa16-Sep-07 6:02 
QuestionError while duplicating a form! Pin
Muammar©16-Sep-07 0:42
Muammar©16-Sep-07 0:42 
AnswerOk, I found the solution Pin
Muammar©16-Sep-07 1:59
Muammar©16-Sep-07 1:59 
Questioncontrol panel languages Pin
md_refay15-Sep-07 23:39
md_refay15-Sep-07 23:39 
QuestionSlow binary reader Pin
Xmen Real 15-Sep-07 23:30
professional Xmen Real 15-Sep-07 23:30 
AnswerRe: Slow binary reader [modified] Pin
User 665816-Sep-07 1:02
User 665816-Sep-07 1:02 
GeneralRe: Slow binary reader Pin
Xmen Real 16-Sep-07 4:34
professional Xmen Real 16-Sep-07 4:34 
GeneralRe: Slow binary reader Pin
Dave Kreskowiak16-Sep-07 5:56
mveDave Kreskowiak16-Sep-07 5:56 
GeneralRe: Slow binary reader [modified] Pin
Xmen Real 16-Sep-07 7:05
professional Xmen Real 16-Sep-07 7:05 
AnswerRe: Slow binary reader Pin
Guffa16-Sep-07 1:50
Guffa16-Sep-07 1:50 
GeneralRe: Slow binary reader Pin
Xmen Real 16-Sep-07 4:32
professional Xmen Real 16-Sep-07 4:32 
GeneralRe: Slow binary reader Pin
Dave Kreskowiak16-Sep-07 5:58
mveDave Kreskowiak16-Sep-07 5:58 
GeneralRe: Slow binary reader Pin
Guffa16-Sep-07 6:04
Guffa16-Sep-07 6:04 
GeneralRe: Slow binary reader Pin
Xmen Real 16-Sep-07 7:24
professional Xmen Real 16-Sep-07 7:24 
ok i did some changes
1.
string filename = new string(br.ReadChars(filelength));

2.remove the line that was removing last 3 characters

but it still taking 12 secs, its too much for me, any other changes that reduce the time???

here is the changed coding
FileStream fs = new FileStream(@"D:\art2.bar", FileMode.Open);
                        
            BinaryReader br = new BinaryReader(fs);           
            string chk = new string(br.ReadChars(4));
            
            int version = br.ReadInt32();
            int unknown = br.ReadInt32();
            byte[] uselessbytes = br.ReadBytes(264);
            int unknown1 = br.ReadInt32();
            int tnums = br.ReadInt32();
            long dir = br.ReadInt64();


            byte[] byts = br.ReadBytes(tnums);
             
            

            br.BaseStream.Position = dir;
            int dirnamelength = br.ReadInt32();
            dirnamelength *= 2;         

            string dirname = new string(br.ReadChars(dirnamelength));
           
            dirname = dirname.Replace("\0", "");
            dirname = dirname.Replace("\\", "");
            dirname = dirname.Replace(" ", "");
            int numofFilesindir = br.ReadInt32();
            for (int a = 0; a < numofFilesindir; a++)
            {
                dataGridView1.Rows.Add();
                dataGridView1[1, a].Value = br.ReadInt32();
                dataGridView1[2, a].Value = br.ReadInt32();
                
                br.BaseStream.Position += 20;
                dataGridView1[3, a].Value ="";
                int filelength = br.ReadInt32();
                filelength *= 2;
                string filename = new string(br.ReadChars(filelength));
               
                filename = filename.Replace("\0", "");
                filename = filename.Trim();
               
                dataGridView1[0, a].Value = filename;
            }

            br.Close();
            fs.Close();




Becoming Programmer...

GeneralRe: Slow binary reader Pin
Insincere Dave16-Sep-07 8:11
Insincere Dave16-Sep-07 8:11 
GeneralRe: Slow binary reader Pin
Xmen Real 16-Sep-07 18:08
professional Xmen Real 16-Sep-07 18:08 
QuestionNetwork programing Pin
ali_reza_zareian15-Sep-07 22:54
ali_reza_zareian15-Sep-07 22:54 
AnswerRe: Network programing Pin
Muammar©16-Sep-07 0:48
Muammar©16-Sep-07 0:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.