Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

VB --> C#

Anyone who knows how to convert this code to C# ??
Any help would be great.

Dim AviFile As Integer
Dim TempVHeight As Integer
Dim Aviheaderstart As Integer

AviFile = FreeFile()

CDL.Filter = "Avi files (*.avi) |*.avi|" & "All files (*.*) |*.*"
CDL.FilterIndex = 0

CDL.ShowDialog()

FileOpen(AviFile, CDL.FileName, OpenMode.Binary, OpenAccess.Read, OpenShare.LockWrite)

Aviheaderstart = 33

Seek(AviFile, Aviheaderstart + 36)
FileGet(AviFile, TempVHeight)
0
lazaruz
Asked:
lazaruz
1 Solution
 
AvonWyssCommented:
The CDL object is an object you have to insert into your form and set up there. Therefore, I will only translate the stuff around it and just take a filename.

At the top of the file, make sure to use the following namespaces:
    using System;
    using System.IO;

The rest of your code then is:
               int tempVHeight;
               int aviHeaderStart=33;
               using (BinaryReader aviFile=new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))) {
                    aviFile.BaseStream.Seek(aviHeaderStart+36, SeekOrigin.Begin);
                    tempVHeight=aviFile.ReadInt32();
               }
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now