Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pscbot committed Dec 4, 2022
0 parents commit d4a52cf
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# VB6 source files (show diff + keep CRLF in zip download)

*.bas working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.cls working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.ctl working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.dob working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.dsr working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.frm working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.pag working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
*.vbg working-tree-encoding=CP1252 text eol=crlf
*.vbl working-tree-encoding=CP1252 text eol=crlf
*.vbp working-tree-encoding=CP1252 text eol=crlf
*.vbr working-tree-encoding=CP1252 text eol=crlf
*.vbw working-tree-encoding=CP1252 text eol=crlf

# Other source files (show diff + LF only in zip download)

*.asm text
*.asp text
*.bat text
*.c text
*.cpp text
*.dsp text
*.dsw text
*.h text
*.idl text
*.java text
*.js text
*.manifest text
*.odl text
*.php text
*.php3 text
*.rc text
*.sln text
*.sql text
*.vb text
*.vbs text

# Binary

*.res binary
*.frx binary
*.ctx binary
*.dsx binary
*.exe binary
*.dll binary
*.ocx binary
*.cmp binary
*.pdb binary
*.tlb binary
*.xls binary
*.doc binary
*.ppt binary
*.xlsx binary
*.docx binary
*.pptx binary
*.chm binary
*.hlp binary
*.jpg binary
*.png binary
*.bmp binary
*.gif binary
*.ico binary
*.zip binary
*.cab binary
*.7z binary
*.gz binary

# Text files but keep as binary (no diff)

# *.cfg text
# *.conf text
# *.csi text
# *.css text
# *.csv text
# *.def text
# *.htm text
# *.html text
# *.inf text
# *.ini text
# *.log text
# *.reg text
# *.rtf text
# *.txt text
# *.url text
# *.xml text
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.scc
*.dca
*.oca
*.obj
vb*.tmp
@PSC*
36 changes: 36 additions & 0 deletions Downloader/ProjectDownload.vbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Type=Exe
Form=frmDL.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\WINDOWS\System32\Stdole2.tlb#OLE Automation
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; comdlg32.ocx
Object={248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0; MSWINSCK.OCX
IconForm="frmDL"
Startup="frmDL"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName=" Nullific"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1
1 change: 1 addition & 0 deletions Downloader/ProjectDownload.vbw
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
frmDL = 108, 55, 707, 511, , 22, 30, 621, 485, C
264 changes: 264 additions & 0 deletions Downloader/frmDL.frm
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmDL
Caption = "Downloader"
ClientHeight = 1695
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1695
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin ComctlLib.ProgressBar P
Height = 255
Left = 120
TabIndex = 5
Top = 1320
Width = 4455
_ExtentX = 7858
_ExtentY = 450
_Version = 327682
Appearance = 1
End
Begin MSWinsockLib.Winsock WS
Left = 0
Top = 0
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin MSComDlg.CommonDialog CD
Left = 360
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "Download to..."
End
Begin VB.CommandButton cmdDL
Caption = "Download"
Height = 285
Left = 3600
TabIndex = 1
Top = 120
Width = 975
End
Begin VB.TextBox txtAd
Height = 285
Left = 1320
TabIndex = 0
Top = 120
Width = 2175
End
Begin VB.Label lblS
BackStyle = 0 'Transparent
Height = 255
Left = 960
TabIndex = 7
Top = 480
Width = 3615
End
Begin VB.Label lblDLFrom
BackStyle = 0 'Transparent
Caption = "Download From:"
Height = 255
Left = 120
TabIndex = 6
Top = 120
Width = 1215
End
Begin VB.Label lblDL
BackStyle = 0 'Transparent
Height = 255
Left = 120
TabIndex = 4
Top = 960
Width = 2655
End
Begin VB.Label lblSave
BackStyle = 0 'Transparent
Caption = "Saving to:"
Height = 255
Left = 120
TabIndex = 3
Top = 480
Width = 735
End
Begin VB.Label lblStat
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Specify a file"
Height = 255
Left = 120
TabIndex = 2
Top = 720
Width = 4455
End
End
Attribute VB_Name = "frmDL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Here is my HTTP File Downloader

Dim File As String
Dim Ad As String
Dim X As Integer
Dim I As Integer
Dim File2 As String
Dim Rec As String
Dim Num As Integer
Dim FSize As String
Dim Temp2 As String
Dim Str As String

Private Sub cmdBrowse_Click()
CD.Filter = "All Files (*.*)|*.*" 'sets the file types
CD.ShowSave 'shows the save dialog
txtS.Text = CD.FileName
End Sub

Private Sub cmdDL_Click()
Ad = txtAd.Text 'here is the long messy and confusing process of
'seperating the address, file path, and file name
'make sure ur only using /'s or else this wont work
If InStr(1, Ad, "http://") Then 'remover "http://" if it is present
Ad = Right(Ad, Len(Ad) - 7)
MsgBox Ad
End If

Do Until X = Len(Ad) 'scans for the first /
DoEvents
X = X + 1
If Mid(Ad, X, 1) = "/" Then
File = Mid(Ad, X, Len(Ad)) 'gets the end...the file path
Ad = Mid(Ad, 1, X - 1) 'gets the address
MsgBox File 'shows message boxes to ensure it is correct, there are a few of these
MsgBox Ad
Exit Do 'stops loop
End If
Loop
File2 = File
If InStr(2, File2, "/") Then 'this will go to the final / to get just the file name
Do Until InStr(2, File2, "/") = False
Do
DoEvents
I = I + 1
If Mid(File2, I, 1) = "/" Then 'when it finds a /
File2 = Mid(File2, I, Len(File2)) 'file2 will contain from the current / until the end..
MsgBox File2
Exit Do
End If
Loop
Loop
End If

CD.Filter = "All Files (*.*)|*.*"
CD.FileName = Right(File2, Len(File2) - 1)
CD.ShowSave
File2 = CD.FileName

lblS.Caption = File2

WS.Close 'closes winsock
WS.Connect Ad, 80 'connects to the address on port 80
lblStat.Caption = "Connecting to: " & Ad
End Sub

Private Sub Form_Unload(Cancel As Integer)
WS.Close 'closes winsock before u exit the app
End Sub

Private Sub WS_Connect()
Dim Header As String
lblStat.Caption = "Connected, requesting " & File
'this prepares our header
Header = Header & "GET " & File & " HTTP/1.1" & vbCrLf
Header = Header & "Host: " & WS.RemoteHostIP & vbCrLf
Header = Header & "User-Agent: Nullific Downloader\1.0" & vbCrLf
Header = Header & "Accept: */*" & vbCrLf
WS.SendData Header & vbCrLf 'sends the header
End Sub

Private Sub WS_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
WS.GetData Data 'gets the data that is sent

Num = 0

If InStr(1, Data, "HTTP") Then 'processes the servers response for the file size
Str = Data
Do
'Num = Num + 1
If Data = "" Then
MsgBox "Error, Invalid Request" 'sumthin went wrong
End If
Data = Right(Data, Len(Data) - 1) 'front of header
If Mid(Data, 1, 15) = "Content-Length:" Then 'when the front is...
MsgBox Data
Do 'for the file size...
Num = Num + 1
If Mid(Data, Num, 2) = vbCrLf Then 'finds the vbcrlf, telling us that the line with the file size has ended
Temp2 = Mid(Data, 1, Num) 'isolates the line with the size
MsgBox Temp2
FSize = Mid(Temp2, 16, Len(Temp2)) 'removes "Content-Length: " and leaves only the file size
MsgBox FSize

P.Max = FSize
Exit Do
End If
Loop
Exit Do
End If
Loop

Num = 0

Do
Num = Num + 1
If Mid(Str, Num, 4) = (vbCrLf & vbCrLf) Then 'at the end of the header may be the beginning of the file, seperated by two vbcrlfs
Str = Mid(Str, Num + 4, Len(Str)) 'when they are found
MsgBox "VBCRLF X2"
P.Value = P.Value + Len(Str)
Rec = Len(Str)
lblDL.Caption = Rec & "/" & FSize

Open File2 For Binary As #2 'writes to the file
Put #2, , Str
Close #2
Exit Do
End If
Loop
Else

Open File2 For Binary As #2
P.Value = P.Value + Len(Data)
Rec = Int(Rec) + Len(Data) 'adds to how many bytes have been recieved
lblDL.Caption = Rec & "/" & FSize
Temp = (LOF(2) + 1)
If Temp = 0 Then
Put #2, , Data
Else
Put #2, Temp, Data
End If
Close #2

If P.Value = P.Max Then
MsgBox "Completed"
End If
End If

End Sub

Private Sub WS_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "Error: " & Number & ", " & Description & "." 'if there is an error
End Sub

'I'll clean this up and update it later
'please give me feed back and suggestions
'i'm already in the process of resumable downloads
'too lazy to devise a way to show the kbps
Binary file added PIC200212272135481769.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d4a52cf

Please sign in to comment.