EDN Admin
Well-known member
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Imports System.IO
<span style="color:Blue; Imports System.Text
<span style="color:Blue; Imports System.Net
<span style="color:Blue; Public <span style="color:Blue; Class Form1
<span style="color:Blue; Inherits System.Windows.Forms.Form
<span style="color:Blue; Dim total <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; Private _Worker <span style="color:Blue; As System.ComponentModel.BackgroundWorker
<span style="color:Blue; Dim filename <span style="color:Blue; As <span style="color:Blue; String
<span style="color:Blue; Private <span style="color:Blue; Sub Form1_Shown(<span style="color:Blue; ByVal sender <span style="color:Blue; As <span style="color:Blue; Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.EventArgs) <span style="color:Blue; Handles <span style="color:Blue; Me.Shown
<span style="color:Blue; Dim OJNListPath <span style="color:Blue; As <span style="color:Blue; String = System.Environment.CurrentDirectory & <span style="color:#A31515; "ImageRepairList.dat"
<span style="color:Blue; Using fs <span style="color:Blue; As <span style="color:Blue; New FileStream(OJNListPath, FileMode.Open)
<span style="color:Blue; Using rdr <span style="color:Blue; As <span style="color:Blue; New BinaryReader(fs)
<span style="color:Blue; Dim c <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(0, SeekOrigin.Begin)
total = rdr.ReadInt32
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Dim song <span style="color:Blue; As <span style="color:Blue; Integer = 112
<span style="color:Blue; Dim ID <span style="color:Blue; As <span style="color:Blue; Integer = 4
<span style="color:Blue; Dim genreL <span style="color:Blue; As <span style="color:Blue; Integer = 16
<span style="color:Blue; Dim bpmL <span style="color:Blue; As <span style="color:Blue; Integer = 20
<span style="color:Blue; Dim LExL <span style="color:Blue; As <span style="color:Blue; Integer = 24
<span style="color:Blue; Dim LNxL <span style="color:Blue; As <span style="color:Blue; Integer = 26
<span style="color:Blue; Dim LHxL <span style="color:Blue; As <span style="color:Blue; Integer = 28
<span style="color:Blue; Dim nExL <span style="color:Blue; As <span style="color:Blue; Integer = 44
<span style="color:Blue; Dim nNxL <span style="color:Blue; As <span style="color:Blue; Integer = 48
<span style="color:Blue; Dim nHxL <span style="color:Blue; As <span style="color:Blue; Integer = 52
<span style="color:Blue; Dim artisL <span style="color:Blue; As <span style="color:Blue; Integer = 176
<span style="color:Blue; Dim OJML <span style="color:Blue; As <span style="color:Blue; Integer = 240
<span style="color:Blue; Dim NCL <span style="color:Blue; As <span style="color:Blue; Integer = 208
<span style="color:Blue; Dim signL <span style="color:Blue; As <span style="color:Blue; Integer = 8
<span style="color:Blue; For value <span style="color:Blue; As <span style="color:Blue; Integer = 1 <span style="color:Blue; To total
<span style="color:Blue; Using fs <span style="color:Blue; As <span style="color:Blue; New FileStream(OJNListPath, FileMode.Open)
<span style="color:Blue; Using rdr <span style="color:Blue; As <span style="color:Blue; New BinaryReader(fs)
<span style="color:Blue; Dim c <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(song, SeekOrigin.Current)
<span style="color:Blue; Dim b() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(64)
<span style="color:Blue; Dim terminatingIndex = Array.IndexOf(b, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim title <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(b).Substring(0, terminatingIndex)
<span style="color:Blue; Dim d <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(ID, SeekOrigin.Begin)
<span style="color:Blue; Dim IDn = rdr.ReadInt32
<span style="color:Blue; Dim f <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(genreL, SeekOrigin.Begin)
<span style="color:Blue; Dim Genreset = rdr.ReadInt32
<span style="color:Blue; Dim Genre <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; ""
<span style="color:Blue; If Genreset = 0 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Ballad"
<span style="color:Blue; ElseIf Genreset = 1 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Rock"
<span style="color:Blue; ElseIf Genreset = 2 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Dance"
<span style="color:Blue; ElseIf Genreset = 3 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Techno"
<span style="color:Blue; ElseIf Genreset = 4 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Hip-Hop"
<span style="color:Blue; ElseIf Genreset = 5 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "R&B"
<span style="color:Blue; ElseIf Genreset = 6 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Jazz"
<span style="color:Blue; ElseIf Genreset = 7 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Funk"
<span style="color:Blue; ElseIf Genreset = 8 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Classical"
<span style="color:Blue; ElseIf Genreset = 9 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Traditional"
<span style="color:Blue; ElseIf Genreset = 10 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Etc"
<span style="color:Blue; End <span style="color:Blue; If
fs.Seek(bpmL, IO.SeekOrigin.Begin)
<span style="color:Blue; Dim bpm = rdr.ReadSingle
<span style="color:Blue; Dim LEx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LExL, SeekOrigin.Begin)
<span style="color:Blue; Dim difex = rdr.ReadInt16
<span style="color:Blue; Dim LNx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LNxL, SeekOrigin.Begin)
<span style="color:Blue; Dim difnx = rdr.ReadInt16
<span style="color:Blue; Dim LHx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LHxL, SeekOrigin.Begin)
<span style="color:Blue; Dim difhx = rdr.ReadInt16
<span style="color:Blue; Dim lvlENH <span style="color:Blue; As <span style="color:Blue; String = difex & <span style="color:#A31515; "/" & difnx & <span style="color:#A31515; "/" & difhx
<span style="color:Blue; Dim ncEx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nExL, SeekOrigin.Begin)
<span style="color:Blue; Dim nEx = rdr.ReadInt16
<span style="color:Blue; Dim ncNx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nNxL, SeekOrigin.Begin)
<span style="color:Blue; Dim nNx = rdr.ReadInt16
<span style="color:Blue; Dim ncHx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nHxL, SeekOrigin.Begin)
<span style="color:Blue; Dim nHx = rdr.ReadInt16
<span style="color:Blue; Dim ncENH <span style="color:Blue; As <span style="color:Blue; String = nEx & <span style="color:#A31515; "/" & nNx & <span style="color:#A31515; "/" & nHx
<span style="color:Blue; Dim g <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(artisL, SeekOrigin.Begin)
<span style="color:Blue; Dim h() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexArtis = Array.IndexOf(h, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim Artis <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(h).Substring(0, terminatingIndexArtis)
<span style="color:Blue; Dim i <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(OJML, SeekOrigin.Begin)
<span style="color:Blue; Dim j() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexOJM = Array.IndexOf(j, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim OJM <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(j).Substring(0, terminatingIndexOJM)
<span style="color:Blue; Dim k <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(NCL, SeekOrigin.Begin)
<span style="color:Blue; Dim l() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexNC = Array.IndexOf(l, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim NC <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(l).Substring(0, terminatingIndexNC)
<span style="color:Blue; Dim m <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(signL, SeekOrigin.Begin)
<span style="color:Blue; Dim sign = rdr.ReadChars(3)
<span style="color:Blue; Dim hash <span style="color:Blue; As <span style="color:Blue; String = title & IDn & Genre & bpm & lvlENH & ncENH & Artis & OJM & NC & sign
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {IDn, title, encode(hash)}
DataGridView1.Rows.Add(row)
song += 300
ID += 300
genreL += 300
bpmL += 300
LExL += 300
LNxL += 300
LHxL += 300
nExL += 300
nNxL += 300
nHxL += 300
artisL += 300
OJML += 300
NCL += 300
signL += 300
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Next
<span style="color:Blue; Dim row1 <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; For row1 = 0 <span style="color:Blue; To DataGridView1.RowCount - 1
<span style="color:Blue; Dim idDGV1 = DataGridView1.Item(0, row1).Value
<span style="color:Blue; Dim titleDGV1 = DataGridView1.Item(1, row1).Value
<span style="color:Blue; Dim hashDGV1 = DataGridView1.Item(2, row1).Value
<span style="color:Blue; Dim filename <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "o2ma" & idDGV1 & <span style="color:#A31515; ".ojn"
<span style="color:Blue; Dim ojnclient <span style="color:Blue; As <span style="color:Blue; String = System.Environment.CurrentDirectory & <span style="color:#A31515; "Music" & filename
<span style="color:Blue; If <span style="color:Blue; My.Computer.FileSystem.FileExists(ojnclient) <span style="color:Blue; Then
<span style="color:Green; OJN found
<span style="color:Blue; Dim hash = getHashOJN(ojnclient)
<span style="color:Blue; Dim ojnfilename = Path.GetFileName(ojnclient)
<span style="color:Blue; Dim ojntitle = GetTitle(ojnclient)
<span style="color:Blue; If hashDGV1 = hash <span style="color:Blue; Then
<span style="color:Green; same
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "OK"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; Else
<span style="color:Green; not same and will put into download list..
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "ERROR"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Else
<span style="color:Green; OJN not found
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "NOT INSTALLED"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub Button1_Click(<span style="color:Blue; ByVal sender <span style="color:Blue; As System.Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.EventArgs) <span style="color:Blue; Handles Button1.Click
<span style="color:Blue; Dim L <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; For L = 0 <span style="color:Blue; To DataGridView2.RowCount - 1
<span style="color:Blue; Dim state = DataGridView2.Item(2, L).Value
<span style="color:Blue; If state = <span style="color:#A31515; "OK" <span style="color:Blue; Then
<span style="color:Green; OK = do nothing
<span style="color:Blue; ElseIf state = <span style="color:#A31515; "ERROR" <span style="color:Blue; Then
<span style="color:Green; ERROR and will download fixed file
<span style="color:Green; DOWNLOAD LINK KAT SINI
<span style="color:Blue; Dim ID = DataGridView2.Item(0, L).Value
<span style="color:Blue; Dim filename = <span style="color:#A31515; "o2ma" & ID & <span style="color:#A31515; ".rar"
<span style="color:Blue; Dim filelength = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/" & filename
<span style="color:Blue; Dim filelink <span style="color:Blue; As <span style="color:Blue; New Uri(<span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/" & filename)
<span style="color:Blue; Dim locate = System.Environment.CurrentDirectory & <span style="color:#A31515; "update" & filename
DataGridView2.Item(2, L).Value = <span style="color:Blue; CStr(<span style="color:#A31515; "FIXING")
<span style="color:Blue; Dim filelengths() <span style="color:Blue; As <span style="color:Blue; Long = Array.ConvertAll(filelength.toarray, <span style="color:Blue; Function(s) GetFileLength(s))
DownloadFiles(filelength.toarray, fileLengths)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Function GetFileLengths(<span style="color:Blue; ByVal urls <span style="color:Blue; As <span style="color:Blue; String()) <span style="color:Blue; As <span style="color:Blue; Long()
<span style="color:Blue; Dim upperBound = urls.GetUpperBound(0)
<span style="color:Blue; Dim fileLengths(upperBound) <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; For index = 0 <span style="color:Blue; To upperBound
fileLengths(index) = <span style="color:Blue; Me.GetFileLength(urls(index))
<span style="color:Blue; Next
<span style="color:Blue; Return fileLengths
<span style="color:Blue; End <span style="color:Blue; Function
<span style="color:Blue; Private <span style="color:Blue; Function GetFileLength(<span style="color:Blue; ByVal url <span style="color:Blue; As <span style="color:Blue; String) <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://tekantekankeyboard.webs.com/"
<span style="color:Blue; Dim request = WebRequest.Create(link & url)
<span style="color:Green; Get headers only.
request.Method = WebRequestMethods.Http.Head
<span style="color:Blue; Using response = request.GetResponse()
<span style="color:Blue; Return response.ContentLength
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Function
<span style="color:Blue; Private <span style="color:Blue; Sub DownloadFiles(<span style="color:Blue; ByVal urls <span style="color:Blue; As <span style="color:Blue; String(), <span style="color:Blue; ByVal fileLengths <span style="color:Blue; As <span style="color:Blue; Long())
<span style="color:Green; ProgressBar2.Maximum = CInt(fileLengths.Sum())
<span style="color:Blue; For index = 0 <span style="color:Blue; To urls.GetUpperBound(0)
<span style="color:Green; Dim File As String = "patch" & index + 1 & ".rar"
<span style="color:Green; Label1.Text = "Downloading patch" & index + 1 & ".rar"
<span style="color:Green; Label1.Text = String.Format("Downloading file {0} of {1}...", _
<span style="color:Green; index + 1, _
<span style="color:Green; fileLengths.Length)
<span style="color:Green; Me.stageLabel.Refresh()
<span style="color:Blue; Me.DownloadFile(urls(index), fileLengths(index))
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/"
<span style="color:Blue; Me.Refresh()
<span style="color:Blue; Using wc = <span style="color:Blue; New Net.WebClient
<span style="color:Blue; AddHandler wc.DownloadFileCompleted, <span style="color:Blue; AddressOf done
wc.DownloadFileAsync(<span style="color:Blue; New Uri(link & urls(index)), filename)
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub DownloadFile(<span style="color:Blue; ByVal url <span style="color:Blue; As <span style="color:Blue; String, <span style="color:Blue; ByVal fileLength <span style="color:Blue; As <span style="color:Blue; Long)
ProgressBar1.Maximum = <span style="color:Blue; CInt(fileLength)
ProgressBar1.Value = 0
<span style="color:Blue; Const BUFFER_SIZE <span style="color:Blue; As <span style="color:Blue; Integer = 1024
<span style="color:Blue; Dim buffer(BUFFER_SIZE - 1) <span style="color:Blue; As <span style="color:Blue; Byte
<span style="color:Blue; Dim byteCount <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; Dim totalByteCount = 0
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/"
<span style="color:Blue; Dim request = WebRequest.Create(link & url)
<span style="color:Green; Get entire file.
<span style="color:Green; This line is included for clarity only because GET is the default method for HTTP urls.
request.Method = WebRequestMethods.Http.<span style="color:Blue; Get
<span style="color:Blue; Using response = request.GetResponse()
<span style="color:Blue; Dim responseStream = response.GetResponseStream()
<span style="color:Blue; Do
byteCount = responseStream.Read(buffer, 0, BUFFER_SIZE)
totalByteCount += byteCount
<span style="color:Green; TODO: Process data here as required, e.g. write to disk using a FileStream.
<span style="color:Green; Update progress.
ProgressBar1.Value += byteCount
ProgressBar2.Value += byteCount
<span style="color:Green; Me.Refresh()
<span style="color:Blue; Loop <span style="color:Blue; Until totalByteCount = fileLength
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub done(<span style="color:Blue; ByVal sender <span style="color:Blue; As <span style="color:Blue; Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.ComponentModel.AsyncCompletedEventArgs)
MsgBox(<span style="color:#A31515; "done")
<span style="color:Blue; End <span style="color:Blue; Sub
[/code]
<br/>
the code looks nothing error, but when i debugged, its showing error "Public member toarray on type String not found." on code:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Dim filelengths() <span style="color:Blue; As <span style="color:Blue; Long = Array.ConvertAll(filelength.toarray, <span style="color:Blue; Function(s) GetFileLength(s))
[/code]
<br/>
can anyone help me please?
View the full article
<span style="color:Blue; Imports System.IO
<span style="color:Blue; Imports System.Text
<span style="color:Blue; Imports System.Net
<span style="color:Blue; Public <span style="color:Blue; Class Form1
<span style="color:Blue; Inherits System.Windows.Forms.Form
<span style="color:Blue; Dim total <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; Private _Worker <span style="color:Blue; As System.ComponentModel.BackgroundWorker
<span style="color:Blue; Dim filename <span style="color:Blue; As <span style="color:Blue; String
<span style="color:Blue; Private <span style="color:Blue; Sub Form1_Shown(<span style="color:Blue; ByVal sender <span style="color:Blue; As <span style="color:Blue; Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.EventArgs) <span style="color:Blue; Handles <span style="color:Blue; Me.Shown
<span style="color:Blue; Dim OJNListPath <span style="color:Blue; As <span style="color:Blue; String = System.Environment.CurrentDirectory & <span style="color:#A31515; "ImageRepairList.dat"
<span style="color:Blue; Using fs <span style="color:Blue; As <span style="color:Blue; New FileStream(OJNListPath, FileMode.Open)
<span style="color:Blue; Using rdr <span style="color:Blue; As <span style="color:Blue; New BinaryReader(fs)
<span style="color:Blue; Dim c <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(0, SeekOrigin.Begin)
total = rdr.ReadInt32
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Dim song <span style="color:Blue; As <span style="color:Blue; Integer = 112
<span style="color:Blue; Dim ID <span style="color:Blue; As <span style="color:Blue; Integer = 4
<span style="color:Blue; Dim genreL <span style="color:Blue; As <span style="color:Blue; Integer = 16
<span style="color:Blue; Dim bpmL <span style="color:Blue; As <span style="color:Blue; Integer = 20
<span style="color:Blue; Dim LExL <span style="color:Blue; As <span style="color:Blue; Integer = 24
<span style="color:Blue; Dim LNxL <span style="color:Blue; As <span style="color:Blue; Integer = 26
<span style="color:Blue; Dim LHxL <span style="color:Blue; As <span style="color:Blue; Integer = 28
<span style="color:Blue; Dim nExL <span style="color:Blue; As <span style="color:Blue; Integer = 44
<span style="color:Blue; Dim nNxL <span style="color:Blue; As <span style="color:Blue; Integer = 48
<span style="color:Blue; Dim nHxL <span style="color:Blue; As <span style="color:Blue; Integer = 52
<span style="color:Blue; Dim artisL <span style="color:Blue; As <span style="color:Blue; Integer = 176
<span style="color:Blue; Dim OJML <span style="color:Blue; As <span style="color:Blue; Integer = 240
<span style="color:Blue; Dim NCL <span style="color:Blue; As <span style="color:Blue; Integer = 208
<span style="color:Blue; Dim signL <span style="color:Blue; As <span style="color:Blue; Integer = 8
<span style="color:Blue; For value <span style="color:Blue; As <span style="color:Blue; Integer = 1 <span style="color:Blue; To total
<span style="color:Blue; Using fs <span style="color:Blue; As <span style="color:Blue; New FileStream(OJNListPath, FileMode.Open)
<span style="color:Blue; Using rdr <span style="color:Blue; As <span style="color:Blue; New BinaryReader(fs)
<span style="color:Blue; Dim c <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(song, SeekOrigin.Current)
<span style="color:Blue; Dim b() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(64)
<span style="color:Blue; Dim terminatingIndex = Array.IndexOf(b, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim title <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(b).Substring(0, terminatingIndex)
<span style="color:Blue; Dim d <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(ID, SeekOrigin.Begin)
<span style="color:Blue; Dim IDn = rdr.ReadInt32
<span style="color:Blue; Dim f <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(genreL, SeekOrigin.Begin)
<span style="color:Blue; Dim Genreset = rdr.ReadInt32
<span style="color:Blue; Dim Genre <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; ""
<span style="color:Blue; If Genreset = 0 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Ballad"
<span style="color:Blue; ElseIf Genreset = 1 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Rock"
<span style="color:Blue; ElseIf Genreset = 2 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Dance"
<span style="color:Blue; ElseIf Genreset = 3 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Techno"
<span style="color:Blue; ElseIf Genreset = 4 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Hip-Hop"
<span style="color:Blue; ElseIf Genreset = 5 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "R&B"
<span style="color:Blue; ElseIf Genreset = 6 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Jazz"
<span style="color:Blue; ElseIf Genreset = 7 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Funk"
<span style="color:Blue; ElseIf Genreset = 8 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Classical"
<span style="color:Blue; ElseIf Genreset = 9 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Traditional"
<span style="color:Blue; ElseIf Genreset = 10 <span style="color:Blue; Then
Genre = <span style="color:#A31515; "Etc"
<span style="color:Blue; End <span style="color:Blue; If
fs.Seek(bpmL, IO.SeekOrigin.Begin)
<span style="color:Blue; Dim bpm = rdr.ReadSingle
<span style="color:Blue; Dim LEx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LExL, SeekOrigin.Begin)
<span style="color:Blue; Dim difex = rdr.ReadInt16
<span style="color:Blue; Dim LNx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LNxL, SeekOrigin.Begin)
<span style="color:Blue; Dim difnx = rdr.ReadInt16
<span style="color:Blue; Dim LHx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(LHxL, SeekOrigin.Begin)
<span style="color:Blue; Dim difhx = rdr.ReadInt16
<span style="color:Blue; Dim lvlENH <span style="color:Blue; As <span style="color:Blue; String = difex & <span style="color:#A31515; "/" & difnx & <span style="color:#A31515; "/" & difhx
<span style="color:Blue; Dim ncEx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nExL, SeekOrigin.Begin)
<span style="color:Blue; Dim nEx = rdr.ReadInt16
<span style="color:Blue; Dim ncNx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nNxL, SeekOrigin.Begin)
<span style="color:Blue; Dim nNx = rdr.ReadInt16
<span style="color:Blue; Dim ncHx <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(nHxL, SeekOrigin.Begin)
<span style="color:Blue; Dim nHx = rdr.ReadInt16
<span style="color:Blue; Dim ncENH <span style="color:Blue; As <span style="color:Blue; String = nEx & <span style="color:#A31515; "/" & nNx & <span style="color:#A31515; "/" & nHx
<span style="color:Blue; Dim g <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(artisL, SeekOrigin.Begin)
<span style="color:Blue; Dim h() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexArtis = Array.IndexOf(h, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim Artis <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(h).Substring(0, terminatingIndexArtis)
<span style="color:Blue; Dim i <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(OJML, SeekOrigin.Begin)
<span style="color:Blue; Dim j() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexOJM = Array.IndexOf(j, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim OJM <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(j).Substring(0, terminatingIndexOJM)
<span style="color:Blue; Dim k <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(NCL, SeekOrigin.Begin)
<span style="color:Blue; Dim l() <span style="color:Blue; As <span style="color:Blue; Byte = rdr.ReadBytes(32)
<span style="color:Blue; Dim terminatingIndexNC = Array.IndexOf(l, <span style="color:Blue; CByte(0))
<span style="color:Blue; Dim NC <span style="color:Blue; As <span style="color:Blue; String = Encoding.UTF7.GetString(l).Substring(0, terminatingIndexNC)
<span style="color:Blue; Dim m <span style="color:Blue; As <span style="color:Blue; String = fs.Seek(signL, SeekOrigin.Begin)
<span style="color:Blue; Dim sign = rdr.ReadChars(3)
<span style="color:Blue; Dim hash <span style="color:Blue; As <span style="color:Blue; String = title & IDn & Genre & bpm & lvlENH & ncENH & Artis & OJM & NC & sign
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {IDn, title, encode(hash)}
DataGridView1.Rows.Add(row)
song += 300
ID += 300
genreL += 300
bpmL += 300
LExL += 300
LNxL += 300
LHxL += 300
nExL += 300
nNxL += 300
nHxL += 300
artisL += 300
OJML += 300
NCL += 300
signL += 300
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Next
<span style="color:Blue; Dim row1 <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; For row1 = 0 <span style="color:Blue; To DataGridView1.RowCount - 1
<span style="color:Blue; Dim idDGV1 = DataGridView1.Item(0, row1).Value
<span style="color:Blue; Dim titleDGV1 = DataGridView1.Item(1, row1).Value
<span style="color:Blue; Dim hashDGV1 = DataGridView1.Item(2, row1).Value
<span style="color:Blue; Dim filename <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "o2ma" & idDGV1 & <span style="color:#A31515; ".ojn"
<span style="color:Blue; Dim ojnclient <span style="color:Blue; As <span style="color:Blue; String = System.Environment.CurrentDirectory & <span style="color:#A31515; "Music" & filename
<span style="color:Blue; If <span style="color:Blue; My.Computer.FileSystem.FileExists(ojnclient) <span style="color:Blue; Then
<span style="color:Green; OJN found
<span style="color:Blue; Dim hash = getHashOJN(ojnclient)
<span style="color:Blue; Dim ojnfilename = Path.GetFileName(ojnclient)
<span style="color:Blue; Dim ojntitle = GetTitle(ojnclient)
<span style="color:Blue; If hashDGV1 = hash <span style="color:Blue; Then
<span style="color:Green; same
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "OK"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; Else
<span style="color:Green; not same and will put into download list..
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "ERROR"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Else
<span style="color:Green; OJN not found
<span style="color:Blue; Dim row <span style="color:Blue; As <span style="color:Blue; String() = <span style="color:Blue; New <span style="color:Blue; String() {idDGV1, titleDGV1, <span style="color:#A31515; "NOT INSTALLED"}
DataGridView2.Rows.Add(row)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub Button1_Click(<span style="color:Blue; ByVal sender <span style="color:Blue; As System.Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.EventArgs) <span style="color:Blue; Handles Button1.Click
<span style="color:Blue; Dim L <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; For L = 0 <span style="color:Blue; To DataGridView2.RowCount - 1
<span style="color:Blue; Dim state = DataGridView2.Item(2, L).Value
<span style="color:Blue; If state = <span style="color:#A31515; "OK" <span style="color:Blue; Then
<span style="color:Green; OK = do nothing
<span style="color:Blue; ElseIf state = <span style="color:#A31515; "ERROR" <span style="color:Blue; Then
<span style="color:Green; ERROR and will download fixed file
<span style="color:Green; DOWNLOAD LINK KAT SINI
<span style="color:Blue; Dim ID = DataGridView2.Item(0, L).Value
<span style="color:Blue; Dim filename = <span style="color:#A31515; "o2ma" & ID & <span style="color:#A31515; ".rar"
<span style="color:Blue; Dim filelength = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/" & filename
<span style="color:Blue; Dim filelink <span style="color:Blue; As <span style="color:Blue; New Uri(<span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/" & filename)
<span style="color:Blue; Dim locate = System.Environment.CurrentDirectory & <span style="color:#A31515; "update" & filename
DataGridView2.Item(2, L).Value = <span style="color:Blue; CStr(<span style="color:#A31515; "FIXING")
<span style="color:Blue; Dim filelengths() <span style="color:Blue; As <span style="color:Blue; Long = Array.ConvertAll(filelength.toarray, <span style="color:Blue; Function(s) GetFileLength(s))
DownloadFiles(filelength.toarray, fileLengths)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Function GetFileLengths(<span style="color:Blue; ByVal urls <span style="color:Blue; As <span style="color:Blue; String()) <span style="color:Blue; As <span style="color:Blue; Long()
<span style="color:Blue; Dim upperBound = urls.GetUpperBound(0)
<span style="color:Blue; Dim fileLengths(upperBound) <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; For index = 0 <span style="color:Blue; To upperBound
fileLengths(index) = <span style="color:Blue; Me.GetFileLength(urls(index))
<span style="color:Blue; Next
<span style="color:Blue; Return fileLengths
<span style="color:Blue; End <span style="color:Blue; Function
<span style="color:Blue; Private <span style="color:Blue; Function GetFileLength(<span style="color:Blue; ByVal url <span style="color:Blue; As <span style="color:Blue; String) <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://tekantekankeyboard.webs.com/"
<span style="color:Blue; Dim request = WebRequest.Create(link & url)
<span style="color:Green; Get headers only.
request.Method = WebRequestMethods.Http.Head
<span style="color:Blue; Using response = request.GetResponse()
<span style="color:Blue; Return response.ContentLength
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Function
<span style="color:Blue; Private <span style="color:Blue; Sub DownloadFiles(<span style="color:Blue; ByVal urls <span style="color:Blue; As <span style="color:Blue; String(), <span style="color:Blue; ByVal fileLengths <span style="color:Blue; As <span style="color:Blue; Long())
<span style="color:Green; ProgressBar2.Maximum = CInt(fileLengths.Sum())
<span style="color:Blue; For index = 0 <span style="color:Blue; To urls.GetUpperBound(0)
<span style="color:Green; Dim File As String = "patch" & index + 1 & ".rar"
<span style="color:Green; Label1.Text = "Downloading patch" & index + 1 & ".rar"
<span style="color:Green; Label1.Text = String.Format("Downloading file {0} of {1}...", _
<span style="color:Green; index + 1, _
<span style="color:Green; fileLengths.Length)
<span style="color:Green; Me.stageLabel.Refresh()
<span style="color:Blue; Me.DownloadFile(urls(index), fileLengths(index))
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/"
<span style="color:Blue; Me.Refresh()
<span style="color:Blue; Using wc = <span style="color:Blue; New Net.WebClient
<span style="color:Blue; AddHandler wc.DownloadFileCompleted, <span style="color:Blue; AddressOf done
wc.DownloadFileAsync(<span style="color:Blue; New Uri(link & urls(index)), filename)
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; Next
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub DownloadFile(<span style="color:Blue; ByVal url <span style="color:Blue; As <span style="color:Blue; String, <span style="color:Blue; ByVal fileLength <span style="color:Blue; As <span style="color:Blue; Long)
ProgressBar1.Maximum = <span style="color:Blue; CInt(fileLength)
ProgressBar1.Value = 0
<span style="color:Blue; Const BUFFER_SIZE <span style="color:Blue; As <span style="color:Blue; Integer = 1024
<span style="color:Blue; Dim buffer(BUFFER_SIZE - 1) <span style="color:Blue; As <span style="color:Blue; Byte
<span style="color:Blue; Dim byteCount <span style="color:Blue; As <span style="color:Blue; Integer
<span style="color:Blue; Dim totalByteCount = 0
<span style="color:Blue; Dim link <span style="color:Blue; As <span style="color:Blue; String = <span style="color:#A31515; "http://www.ujd.x10.bz/OJNRepaired/"
<span style="color:Blue; Dim request = WebRequest.Create(link & url)
<span style="color:Green; Get entire file.
<span style="color:Green; This line is included for clarity only because GET is the default method for HTTP urls.
request.Method = WebRequestMethods.Http.<span style="color:Blue; Get
<span style="color:Blue; Using response = request.GetResponse()
<span style="color:Blue; Dim responseStream = response.GetResponseStream()
<span style="color:Blue; Do
byteCount = responseStream.Read(buffer, 0, BUFFER_SIZE)
totalByteCount += byteCount
<span style="color:Green; TODO: Process data here as required, e.g. write to disk using a FileStream.
<span style="color:Green; Update progress.
ProgressBar1.Value += byteCount
ProgressBar2.Value += byteCount
<span style="color:Green; Me.Refresh()
<span style="color:Blue; Loop <span style="color:Blue; Until totalByteCount = fileLength
<span style="color:Blue; End <span style="color:Blue; Using
<span style="color:Blue; End <span style="color:Blue; Sub
<span style="color:Blue; Private <span style="color:Blue; Sub done(<span style="color:Blue; ByVal sender <span style="color:Blue; As <span style="color:Blue; Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.ComponentModel.AsyncCompletedEventArgs)
MsgBox(<span style="color:#A31515; "done")
<span style="color:Blue; End <span style="color:Blue; Sub
[/code]
<br/>
the code looks nothing error, but when i debugged, its showing error "Public member toarray on type String not found." on code:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Dim filelengths() <span style="color:Blue; As <span style="color:Blue; Long = Array.ConvertAll(filelength.toarray, <span style="color:Blue; Function(s) GetFileLength(s))
[/code]
<br/>
can anyone help me please?
View the full article