Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f5f267e61 | |||
| bde9fb4b41 | |||
| b42242540a | |||
| 755da5e9b9 | |||
| a1e50d20c5 | |||
| 1c4b41d474 | |||
| 0c6ded6b61 | |||
| e145d6529c | |||
| b10c622e57 | |||
| 85d8cc622f |
Generated
+66
-74
@@ -1,9 +1,9 @@
|
|||||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||||
Partial Class Form1
|
Partial Class Form1
|
||||||
Inherits System.Windows.Forms.Form
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
'Form overrides dispose to clean up the component list.
|
'Form overrides dispose to clean up the component list.
|
||||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
<System.Diagnostics.DebuggerNonUserCode()>
|
||||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
Try
|
Try
|
||||||
If disposing AndAlso components IsNot Nothing Then
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
@@ -20,46 +20,47 @@ Partial Class Form1
|
|||||||
'NOTE: The following procedure is required by the Windows Form Designer
|
'NOTE: The following procedure is required by the Windows Form Designer
|
||||||
'It can be modified using the Windows Form Designer.
|
'It can be modified using the Windows Form Designer.
|
||||||
'Do not modify it using the code editor.
|
'Do not modify it using the code editor.
|
||||||
<System.Diagnostics.DebuggerStepThrough()> _
|
<System.Diagnostics.DebuggerStepThrough()>
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
|
Me.components = New System.ComponentModel.Container()
|
||||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
|
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
|
||||||
Me.btnClickThis = New System.Windows.Forms.Button()
|
Me.btnClickThis = New System.Windows.Forms.Button()
|
||||||
Me.lblHelloWorld = New System.Windows.Forms.Label()
|
Me.lblHelloWorld = New System.Windows.Forms.Label()
|
||||||
Me.txtFinalUrl = New System.Windows.Forms.TextBox()
|
Me.txtFinalUrl = New System.Windows.Forms.TextBox()
|
||||||
Me.txtRMA = New System.Windows.Forms.TextBox()
|
Me.txtRMA = New System.Windows.Forms.TextBox()
|
||||||
Me.Label1 = New System.Windows.Forms.Label()
|
Me.Label1 = New System.Windows.Forms.Label()
|
||||||
Me.txtBaseURL = New System.Windows.Forms.TextBox()
|
|
||||||
Me.Label2 = New System.Windows.Forms.Label()
|
|
||||||
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
|
|
||||||
Me.OptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
|
||||||
Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
|
||||||
Me.btnEditBaseUrl = New System.Windows.Forms.Button()
|
Me.btnEditBaseUrl = New System.Windows.Forms.Button()
|
||||||
Me.Button1 = New System.Windows.Forms.Button()
|
Me.Button1 = New System.Windows.Forms.Button()
|
||||||
Me.btnFedexShipping = New System.Windows.Forms.Button()
|
Me.btnFedexShipping = New System.Windows.Forms.Button()
|
||||||
|
Me.btnDHLShipping = New System.Windows.Forms.Button()
|
||||||
|
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
|
||||||
|
Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||||
|
Me.lblCoppiedNotifyer = New System.Windows.Forms.Label()
|
||||||
|
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
|
||||||
Me.MenuStrip1.SuspendLayout()
|
Me.MenuStrip1.SuspendLayout()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'btnClickThis
|
'btnClickThis
|
||||||
'
|
'
|
||||||
Me.btnClickThis.Location = New System.Drawing.Point(12, 180)
|
Me.btnClickThis.Location = New System.Drawing.Point(11, 203)
|
||||||
Me.btnClickThis.Name = "btnClickThis"
|
Me.btnClickThis.Name = "btnClickThis"
|
||||||
Me.btnClickThis.Size = New System.Drawing.Size(138, 23)
|
Me.btnClickThis.Size = New System.Drawing.Size(138, 23)
|
||||||
Me.btnClickThis.TabIndex = 0
|
Me.btnClickThis.TabIndex = 0
|
||||||
Me.btnClickThis.Text = "Go && Copy to Clipboard"
|
Me.btnClickThis.Text = "Copy to Clipboard"
|
||||||
Me.btnClickThis.UseVisualStyleBackColor = True
|
Me.btnClickThis.UseVisualStyleBackColor = True
|
||||||
'
|
'
|
||||||
'lblHelloWorld
|
'lblHelloWorld
|
||||||
'
|
'
|
||||||
Me.lblHelloWorld.AutoSize = True
|
Me.lblHelloWorld.AutoSize = True
|
||||||
Me.lblHelloWorld.Location = New System.Drawing.Point(9, 137)
|
Me.lblHelloWorld.Location = New System.Drawing.Point(8, 161)
|
||||||
Me.lblHelloWorld.Name = "lblHelloWorld"
|
Me.lblHelloWorld.Name = "lblHelloWorld"
|
||||||
Me.lblHelloWorld.Size = New System.Drawing.Size(54, 13)
|
Me.lblHelloWorld.Size = New System.Drawing.Size(99, 13)
|
||||||
Me.lblHelloWorld.TabIndex = 1
|
Me.lblHelloWorld.TabIndex = 1
|
||||||
Me.lblHelloWorld.Text = "TNT URL"
|
Me.lblHelloWorld.Text = "Final Tracking URL"
|
||||||
'
|
'
|
||||||
'txtFinalUrl
|
'txtFinalUrl
|
||||||
'
|
'
|
||||||
Me.txtFinalUrl.Location = New System.Drawing.Point(12, 154)
|
Me.txtFinalUrl.Location = New System.Drawing.Point(12, 177)
|
||||||
Me.txtFinalUrl.Name = "txtFinalUrl"
|
Me.txtFinalUrl.Name = "txtFinalUrl"
|
||||||
Me.txtFinalUrl.ReadOnly = True
|
Me.txtFinalUrl.ReadOnly = True
|
||||||
Me.txtFinalUrl.Size = New System.Drawing.Size(652, 20)
|
Me.txtFinalUrl.Size = New System.Drawing.Size(652, 20)
|
||||||
@@ -69,7 +70,7 @@ Partial Class Form1
|
|||||||
'
|
'
|
||||||
Me.txtRMA.Location = New System.Drawing.Point(12, 41)
|
Me.txtRMA.Location = New System.Drawing.Point(12, 41)
|
||||||
Me.txtRMA.Name = "txtRMA"
|
Me.txtRMA.Name = "txtRMA"
|
||||||
Me.txtRMA.Size = New System.Drawing.Size(183, 20)
|
Me.txtRMA.Size = New System.Drawing.Size(197, 20)
|
||||||
Me.txtRMA.TabIndex = 3
|
Me.txtRMA.TabIndex = 3
|
||||||
'
|
'
|
||||||
'Label1
|
'Label1
|
||||||
@@ -77,57 +78,13 @@ Partial Class Form1
|
|||||||
Me.Label1.AutoSize = True
|
Me.Label1.AutoSize = True
|
||||||
Me.Label1.Location = New System.Drawing.Point(9, 24)
|
Me.Label1.Location = New System.Drawing.Point(9, 24)
|
||||||
Me.Label1.Name = "Label1"
|
Me.Label1.Name = "Label1"
|
||||||
Me.Label1.Size = New System.Drawing.Size(188, 13)
|
Me.Label1.Size = New System.Drawing.Size(200, 13)
|
||||||
Me.Label1.TabIndex = 4
|
Me.Label1.TabIndex = 4
|
||||||
Me.Label1.Text = "Customer Refrance or Shiping Number"
|
Me.Label1.Text = "Customer Reference or Shipping Number"
|
||||||
'
|
|
||||||
'txtBaseURL
|
|
||||||
'
|
|
||||||
Me.txtBaseURL.Location = New System.Drawing.Point(12, 79)
|
|
||||||
Me.txtBaseURL.Name = "txtBaseURL"
|
|
||||||
Me.txtBaseURL.ReadOnly = True
|
|
||||||
Me.txtBaseURL.Size = New System.Drawing.Size(652, 20)
|
|
||||||
Me.txtBaseURL.TabIndex = 5
|
|
||||||
Me.txtBaseURL.Text = "https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=re" &
|
|
||||||
"f&cons="
|
|
||||||
'
|
|
||||||
'Label2
|
|
||||||
'
|
|
||||||
Me.Label2.AutoSize = True
|
|
||||||
Me.Label2.Location = New System.Drawing.Point(9, 63)
|
|
||||||
Me.Label2.Name = "Label2"
|
|
||||||
Me.Label2.Size = New System.Drawing.Size(56, 13)
|
|
||||||
Me.Label2.TabIndex = 6
|
|
||||||
Me.Label2.Text = "Base URL"
|
|
||||||
'
|
|
||||||
'MenuStrip1
|
|
||||||
'
|
|
||||||
Me.MenuStrip1.Enabled = False
|
|
||||||
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OptionsToolStripMenuItem, Me.AboutToolStripMenuItem})
|
|
||||||
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
|
|
||||||
Me.MenuStrip1.Name = "MenuStrip1"
|
|
||||||
Me.MenuStrip1.Size = New System.Drawing.Size(687, 24)
|
|
||||||
Me.MenuStrip1.TabIndex = 8
|
|
||||||
Me.MenuStrip1.Text = "MenuStrip1"
|
|
||||||
'
|
|
||||||
'OptionsToolStripMenuItem
|
|
||||||
'
|
|
||||||
Me.OptionsToolStripMenuItem.Enabled = False
|
|
||||||
Me.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem"
|
|
||||||
Me.OptionsToolStripMenuItem.Size = New System.Drawing.Size(97, 20)
|
|
||||||
Me.OptionsToolStripMenuItem.Text = "Ajust Base URL"
|
|
||||||
Me.OptionsToolStripMenuItem.Visible = False
|
|
||||||
'
|
|
||||||
'AboutToolStripMenuItem
|
|
||||||
'
|
|
||||||
Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
|
|
||||||
Me.AboutToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.D6), System.Windows.Forms.Keys)
|
|
||||||
Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(52, 20)
|
|
||||||
Me.AboutToolStripMenuItem.Text = "About"
|
|
||||||
'
|
'
|
||||||
'btnEditBaseUrl
|
'btnEditBaseUrl
|
||||||
'
|
'
|
||||||
Me.btnEditBaseUrl.Location = New System.Drawing.Point(12, 106)
|
Me.btnEditBaseUrl.Location = New System.Drawing.Point(12, 70)
|
||||||
Me.btnEditBaseUrl.Name = "btnEditBaseUrl"
|
Me.btnEditBaseUrl.Name = "btnEditBaseUrl"
|
||||||
Me.btnEditBaseUrl.Size = New System.Drawing.Size(137, 23)
|
Me.btnEditBaseUrl.Size = New System.Drawing.Size(137, 23)
|
||||||
Me.btnEditBaseUrl.TabIndex = 9
|
Me.btnEditBaseUrl.TabIndex = 9
|
||||||
@@ -136,7 +93,7 @@ Partial Class Form1
|
|||||||
'
|
'
|
||||||
'Button1
|
'Button1
|
||||||
'
|
'
|
||||||
Me.Button1.Location = New System.Drawing.Point(155, 106)
|
Me.Button1.Location = New System.Drawing.Point(155, 70)
|
||||||
Me.Button1.Name = "Button1"
|
Me.Button1.Name = "Button1"
|
||||||
Me.Button1.Size = New System.Drawing.Size(137, 23)
|
Me.Button1.Size = New System.Drawing.Size(137, 23)
|
||||||
Me.Button1.TabIndex = 10
|
Me.Button1.TabIndex = 10
|
||||||
@@ -145,23 +102,59 @@ Partial Class Form1
|
|||||||
'
|
'
|
||||||
'btnFedexShipping
|
'btnFedexShipping
|
||||||
'
|
'
|
||||||
Me.btnFedexShipping.Location = New System.Drawing.Point(298, 106)
|
Me.btnFedexShipping.Location = New System.Drawing.Point(298, 70)
|
||||||
Me.btnFedexShipping.Name = "btnFedexShipping"
|
Me.btnFedexShipping.Name = "btnFedexShipping"
|
||||||
Me.btnFedexShipping.Size = New System.Drawing.Size(137, 23)
|
Me.btnFedexShipping.Size = New System.Drawing.Size(137, 23)
|
||||||
Me.btnFedexShipping.TabIndex = 11
|
Me.btnFedexShipping.TabIndex = 11
|
||||||
Me.btnFedexShipping.Text = "FedEx Shipping Number"
|
Me.btnFedexShipping.Text = "FedEx Shipping Number"
|
||||||
Me.btnFedexShipping.UseVisualStyleBackColor = True
|
Me.btnFedexShipping.UseVisualStyleBackColor = True
|
||||||
'
|
'
|
||||||
|
'btnDHLShipping
|
||||||
|
'
|
||||||
|
Me.btnDHLShipping.Location = New System.Drawing.Point(441, 69)
|
||||||
|
Me.btnDHLShipping.Name = "btnDHLShipping"
|
||||||
|
Me.btnDHLShipping.Size = New System.Drawing.Size(137, 23)
|
||||||
|
Me.btnDHLShipping.TabIndex = 12
|
||||||
|
Me.btnDHLShipping.Text = "DHL Shipping Number"
|
||||||
|
Me.btnDHLShipping.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'MenuStrip1
|
||||||
|
'
|
||||||
|
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AboutToolStripMenuItem})
|
||||||
|
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.MenuStrip1.Name = "MenuStrip1"
|
||||||
|
Me.MenuStrip1.Size = New System.Drawing.Size(587, 24)
|
||||||
|
Me.MenuStrip1.TabIndex = 13
|
||||||
|
Me.MenuStrip1.Text = "MenuStrip1"
|
||||||
|
'
|
||||||
|
'AboutToolStripMenuItem
|
||||||
|
'
|
||||||
|
Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
|
||||||
|
Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(52, 20)
|
||||||
|
Me.AboutToolStripMenuItem.Text = "About"
|
||||||
|
'
|
||||||
|
'lblCoppiedNotifyer
|
||||||
|
'
|
||||||
|
Me.lblCoppiedNotifyer.AutoSize = True
|
||||||
|
Me.lblCoppiedNotifyer.Location = New System.Drawing.Point(13, 100)
|
||||||
|
Me.lblCoppiedNotifyer.Name = "lblCoppiedNotifyer"
|
||||||
|
Me.lblCoppiedNotifyer.Size = New System.Drawing.Size(92, 13)
|
||||||
|
Me.lblCoppiedNotifyer.TabIndex = 14
|
||||||
|
Me.lblCoppiedNotifyer.Text = "lblCoppiedNotifyer"
|
||||||
|
'
|
||||||
|
'Timer1
|
||||||
|
'
|
||||||
|
'
|
||||||
'Form1
|
'Form1
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(687, 213)
|
Me.ClientSize = New System.Drawing.Size(587, 122)
|
||||||
|
Me.Controls.Add(Me.lblCoppiedNotifyer)
|
||||||
|
Me.Controls.Add(Me.btnDHLShipping)
|
||||||
Me.Controls.Add(Me.btnFedexShipping)
|
Me.Controls.Add(Me.btnFedexShipping)
|
||||||
Me.Controls.Add(Me.Button1)
|
Me.Controls.Add(Me.Button1)
|
||||||
Me.Controls.Add(Me.btnEditBaseUrl)
|
Me.Controls.Add(Me.btnEditBaseUrl)
|
||||||
Me.Controls.Add(Me.Label2)
|
|
||||||
Me.Controls.Add(Me.txtBaseURL)
|
|
||||||
Me.Controls.Add(Me.Label1)
|
Me.Controls.Add(Me.Label1)
|
||||||
Me.Controls.Add(Me.txtRMA)
|
Me.Controls.Add(Me.txtRMA)
|
||||||
Me.Controls.Add(Me.txtFinalUrl)
|
Me.Controls.Add(Me.txtFinalUrl)
|
||||||
@@ -170,10 +163,9 @@ Partial Class Form1
|
|||||||
Me.Controls.Add(Me.MenuStrip1)
|
Me.Controls.Add(Me.MenuStrip1)
|
||||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
|
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
|
||||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||||
Me.MainMenuStrip = Me.MenuStrip1
|
|
||||||
Me.MaximizeBox = False
|
Me.MaximizeBox = False
|
||||||
Me.Name = "Form1"
|
Me.Name = "Form1"
|
||||||
Me.Text = "TNT & FexEx Tacking Link Creator"
|
Me.Text = "Shipping Tracker"
|
||||||
Me.MenuStrip1.ResumeLayout(False)
|
Me.MenuStrip1.ResumeLayout(False)
|
||||||
Me.MenuStrip1.PerformLayout()
|
Me.MenuStrip1.PerformLayout()
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
@@ -186,12 +178,12 @@ Partial Class Form1
|
|||||||
Friend WithEvents txtFinalUrl As TextBox
|
Friend WithEvents txtFinalUrl As TextBox
|
||||||
Friend WithEvents txtRMA As TextBox
|
Friend WithEvents txtRMA As TextBox
|
||||||
Friend WithEvents Label1 As Label
|
Friend WithEvents Label1 As Label
|
||||||
Friend WithEvents txtBaseURL As TextBox
|
|
||||||
Friend WithEvents Label2 As Label
|
|
||||||
Friend WithEvents MenuStrip1 As MenuStrip
|
|
||||||
Friend WithEvents OptionsToolStripMenuItem As ToolStripMenuItem
|
|
||||||
Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
|
|
||||||
Friend WithEvents btnEditBaseUrl As Button
|
Friend WithEvents btnEditBaseUrl As Button
|
||||||
Friend WithEvents Button1 As Button
|
Friend WithEvents Button1 As Button
|
||||||
Friend WithEvents btnFedexShipping As Button
|
Friend WithEvents btnFedexShipping As Button
|
||||||
|
Friend WithEvents btnDHLShipping As Button
|
||||||
|
Friend WithEvents MenuStrip1 As MenuStrip
|
||||||
|
Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
|
||||||
|
Friend WithEvents lblCoppiedNotifyer As Label
|
||||||
|
Friend WithEvents Timer1 As Timer
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -120,6 +120,9 @@
|
|||||||
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>132, 17</value>
|
||||||
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
|||||||
+52
-17
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
Imports System.Media
|
||||||
Imports System.Net
|
Imports System.Net
|
||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
Imports System.Security.Cryptography.X509Certificates
|
Imports System.Security.Cryptography.X509Certificates
|
||||||
@@ -6,35 +7,69 @@ Imports System.Text
|
|||||||
|
|
||||||
|
|
||||||
Public Class Form1
|
Public Class Form1
|
||||||
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles btnClickThis.Click
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
||||||
|
lblCoppiedNotifyer.Text = ""
|
||||||
|
Timer1.Stop()
|
||||||
|
End Sub
|
||||||
|
Private Sub btnEditBaseUrl_Click(sender As Object, e As EventArgs) Handles btnEditBaseUrl.Click
|
||||||
Dim rawRMA As String
|
Dim rawRMA As String
|
||||||
Dim baseURL As String
|
|
||||||
rawRMA = txtRMA.Text
|
rawRMA = txtRMA.Text
|
||||||
baseURL = txtBaseURL.Text
|
|
||||||
|
|
||||||
Dim encodedRMA As String = Uri.EscapeDataString(rawRMA)
|
Dim encodedRMA As String = Uri.EscapeDataString(rawRMA)
|
||||||
|
|
||||||
txtFinalUrl.Text = baseURL & encodedRMA
|
txtFinalUrl.Text = "https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=ref&cons=" & encodedRMA
|
||||||
|
|
||||||
My.Computer.Clipboard.SetText(txtFinalUrl.Text)
|
My.Computer.Clipboard.SetText(txtFinalUrl.Text)
|
||||||
End Sub
|
lblCoppiedNotifyer.Text = "Copied!"
|
||||||
|
Timer1.Interval = 5000
|
||||||
|
Timer1.Start()
|
||||||
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
|
|
||||||
Dim box = New About()
|
|
||||||
box.Show()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub btnEditBaseUrl_Click(sender As Object, e As EventArgs) Handles btnEditBaseUrl.Click
|
|
||||||
txtBaseURL.Text = "https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=ref&cons="
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
|
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
|
||||||
txtBaseURL.Text = "https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=con&cons="
|
Dim rawRMA As String
|
||||||
|
rawRMA = txtRMA.Text
|
||||||
|
|
||||||
|
Dim encodedRMA As String = Uri.EscapeDataString(rawRMA)
|
||||||
|
|
||||||
|
txtFinalUrl.Text = "https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=con&cons=" & encodedRMA
|
||||||
|
My.Computer.Clipboard.SetText(txtFinalUrl.Text)
|
||||||
|
lblCoppiedNotifyer.Text = "Copied!"
|
||||||
|
Timer1.Interval = 5000
|
||||||
|
Timer1.Start()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnFedexShipping_Click(sender As Object, e As EventArgs) Handles btnFedexShipping.Click
|
Private Sub btnFedexShipping_Click(sender As Object, e As EventArgs) Handles btnFedexShipping.Click
|
||||||
txtBaseURL.Text = "https://www.fedex.com/fedextrack/?trknbr="
|
Dim rawRMA As String
|
||||||
|
rawRMA = txtRMA.Text
|
||||||
|
|
||||||
|
Dim encodedRMA As String = Uri.EscapeDataString(rawRMA)
|
||||||
|
|
||||||
|
txtFinalUrl.Text = "https://www.fedex.com/apps/fedextrack/?tracknumbers=" & encodedRMA
|
||||||
|
My.Computer.Clipboard.SetText(txtFinalUrl.Text)
|
||||||
|
lblCoppiedNotifyer.Text = "Copied!"
|
||||||
|
Timer1.Interval = 5000
|
||||||
|
Timer1.Start()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnDHLShipping.Click
|
||||||
|
Dim rawRMA As String
|
||||||
|
rawRMA = txtRMA.Text
|
||||||
|
|
||||||
|
Dim encodedRMA As String = Uri.EscapeDataString(rawRMA)
|
||||||
|
|
||||||
|
txtFinalUrl.Text = "https://www.dhl.com/au-en/home/tracking/tracking-express.html?submit=1&tracking-id=" & encodedRMA
|
||||||
|
My.Computer.Clipboard.SetText(txtFinalUrl.Text)
|
||||||
|
lblCoppiedNotifyer.Text = "Copied!"
|
||||||
|
Timer1.Interval = 5000
|
||||||
|
Timer1.Start()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
|
||||||
|
Dim box = New Form3()
|
||||||
|
box.Show()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
lblCoppiedNotifyer.Text = ""
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-16
@@ -23,26 +23,14 @@ Partial Class About
|
|||||||
<System.Diagnostics.DebuggerStepThrough()>
|
<System.Diagnostics.DebuggerStepThrough()>
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(About))
|
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(About))
|
||||||
Me.Label1 = New System.Windows.Forms.Label()
|
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'Label1
|
|
||||||
'
|
|
||||||
Me.Label1.AutoSize = True
|
|
||||||
Me.Label1.Location = New System.Drawing.Point(13, 20)
|
|
||||||
Me.Label1.Name = "Label1"
|
|
||||||
Me.Label1.Size = New System.Drawing.Size(222, 39)
|
|
||||||
Me.Label1.TabIndex = 0
|
|
||||||
Me.Label1.Text = "Verson 1.0.2.0" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Made by Ben Nicholson - All Rights Reserved" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
|
|
||||||
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
|
||||||
Me.Label1.UseWaitCursor = True
|
|
||||||
'
|
|
||||||
'About
|
'About
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(248, 80)
|
Me.ClientSize = New System.Drawing.Size(248, 80)
|
||||||
Me.Controls.Add(Me.Label1)
|
Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
|
||||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||||
Me.MaximizeBox = False
|
Me.MaximizeBox = False
|
||||||
Me.MinimizeBox = False
|
Me.MinimizeBox = False
|
||||||
@@ -50,9 +38,6 @@ Partial Class About
|
|||||||
Me.Text = "About"
|
Me.Text = "About"
|
||||||
Me.UseWaitCursor = True
|
Me.UseWaitCursor = True
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
Me.PerformLayout()
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend WithEvents Label1 As Label
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -2,4 +2,8 @@
|
|||||||
Private Sub About_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub About_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Label1_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
Generated
+72
@@ -0,0 +1,72 @@
|
|||||||
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||||
|
Partial Class Form3
|
||||||
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
|
'Form overrides dispose to clean up the component list.
|
||||||
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
|
Try
|
||||||
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
|
components.Dispose()
|
||||||
|
End If
|
||||||
|
Finally
|
||||||
|
MyBase.Dispose(disposing)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Required by the Windows Form Designer
|
||||||
|
Private components As System.ComponentModel.IContainer
|
||||||
|
|
||||||
|
'NOTE: The following procedure is required by the Windows Form Designer
|
||||||
|
'It can be modified using the Windows Form Designer.
|
||||||
|
'Do not modify it using the code editor.
|
||||||
|
<System.Diagnostics.DebuggerStepThrough()> _
|
||||||
|
Private Sub InitializeComponent()
|
||||||
|
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form3))
|
||||||
|
Me.Label1 = New System.Windows.Forms.Label()
|
||||||
|
Me.btnUpdates = New System.Windows.Forms.Button()
|
||||||
|
Me.SuspendLayout()
|
||||||
|
'
|
||||||
|
'Label1
|
||||||
|
'
|
||||||
|
Me.Label1.AutoSize = True
|
||||||
|
Me.Label1.Cursor = System.Windows.Forms.Cursors.Arrow
|
||||||
|
Me.Label1.Location = New System.Drawing.Point(12, 9)
|
||||||
|
Me.Label1.Name = "Label1"
|
||||||
|
Me.Label1.Size = New System.Drawing.Size(222, 39)
|
||||||
|
Me.Label1.TabIndex = 1
|
||||||
|
Me.Label1.Text = "Verson 1.1.0.0 " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Made by Ben Nicholson - All Rights Reserved" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
|
||||||
|
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'btnUpdates
|
||||||
|
'
|
||||||
|
Me.btnUpdates.Location = New System.Drawing.Point(87, 66)
|
||||||
|
Me.btnUpdates.Name = "btnUpdates"
|
||||||
|
Me.btnUpdates.Size = New System.Drawing.Size(75, 23)
|
||||||
|
Me.btnUpdates.TabIndex = 2
|
||||||
|
Me.btnUpdates.Text = "Updates"
|
||||||
|
Me.btnUpdates.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'Form3
|
||||||
|
'
|
||||||
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
|
Me.ClientSize = New System.Drawing.Size(246, 101)
|
||||||
|
Me.Controls.Add(Me.btnUpdates)
|
||||||
|
Me.Controls.Add(Me.Label1)
|
||||||
|
Me.ForeColor = System.Drawing.Color.Black
|
||||||
|
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
|
||||||
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||||
|
Me.MaximizeBox = False
|
||||||
|
Me.MinimizeBox = False
|
||||||
|
Me.Name = "Form3"
|
||||||
|
Me.ShowInTaskbar = False
|
||||||
|
Me.Text = "About"
|
||||||
|
Me.ResumeLayout(False)
|
||||||
|
Me.PerformLayout()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend WithEvents Label1 As Label
|
||||||
|
Friend WithEvents btnUpdates As Button
|
||||||
|
End Class
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
Public Class Form3
|
||||||
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnUpdates.Click
|
||||||
|
Dim webAddress As String = "https://gitea.apointless.space/bsncubed/ShippingTracker/releases"
|
||||||
|
Process.Start(webAddress)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Public Class About
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
<MyApplicationData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<MySubMain>true</MySubMain>
|
<MySubMain>true</MySubMain>
|
||||||
<MainForm>Form1</MainForm>
|
<MainForm>Form1</MainForm>
|
||||||
<SingleInstance>false</SingleInstance>
|
<SingleInstance>false</SingleInstance>
|
||||||
<ShutdownMode>0</ShutdownMode>
|
<ShutdownMode>0</ShutdownMode>
|
||||||
<EnableVisualStyles>true</EnableVisualStyles>
|
<EnableVisualStyles>true</EnableVisualStyles>
|
||||||
<AuthenticationMode>0</AuthenticationMode>
|
<AuthenticationMode>0</AuthenticationMode>
|
||||||
<ApplicationType>0</ApplicationType>
|
<MinimumSplashScreenDisplayTime>0</MinimumSplashScreenDisplayTime>
|
||||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||||
</MyApplicationData>
|
<HighDpiMpde>false</HighDpiMpde>
|
||||||
|
</MyApplicationData>
|
||||||
@@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices
|
|||||||
|
|
||||||
' Review the values of the assembly attributes
|
' Review the values of the assembly attributes
|
||||||
|
|
||||||
<Assembly: AssemblyTitle("TNT Tracking Link Creator")>
|
<Assembly: AssemblyTitle("Shipping Tracker")>
|
||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("")>
|
<Assembly: AssemblyCompany("")>
|
||||||
<Assembly: AssemblyProduct("TNT Tracking Link Creator")>
|
<Assembly: AssemblyProduct("Shipping Tracker")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2024 Ben Nicholson")>
|
<Assembly: AssemblyCopyright("Copyright © 2025 Ben Nicholson")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
|||||||
' by using the '*' as shown below:
|
' by using the '*' as shown below:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.0.0.1")>
|
<Assembly: AssemblyVersion("1.1.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.1")>
|
<Assembly: AssemblyFileVersion("1.1.0.0")>
|
||||||
<Assembly: NeutralResourcesLanguage("en-AU")>
|
<Assembly: NeutralResourcesLanguage("en-AU")>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice maxOccurs="unbounded">
|
<xsd:choice maxOccurs="unbounded">
|
||||||
@@ -68,9 +69,10 @@
|
|||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="assembly">
|
<xsd:element name="assembly">
|
||||||
@@ -85,9 +87,10 @@
|
|||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="resheader">
|
<xsd:element name="resheader">
|
||||||
@@ -109,9 +112,13 @@
|
|||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<!-- <data name="WindowsXPCriticalStop" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\WindowsXPCriticalStop.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data> -->
|
||||||
</root>
|
</root>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<StartupObject>TNTTracking.My.MyApplication</StartupObject>
|
<StartupObject>TNTTracking.My.MyApplication</StartupObject>
|
||||||
<RootNamespace>TNTTracking</RootNamespace>
|
<RootNamespace>TNTTracking</RootNamespace>
|
||||||
<AssemblyName>TNTTracking</AssemblyName>
|
<AssemblyName>Shipping Tracker</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<MyType>WindowsForms</MyType>
|
<MyType>WindowsForms</MyType>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>C:\Users\Ben\Desktop\Shipping\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<AutorunEnabled>true</AutorunEnabled>
|
<AutorunEnabled>true</AutorunEnabled>
|
||||||
<ApplicationRevision>1</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.2.%2a</ApplicationVersion>
|
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<DefineDebug>true</DefineDebug>
|
<DefineDebug>true</DefineDebug>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
<DefineDebug>true</DefineDebug>
|
<DefineDebug>true</DefineDebug>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<OutputPath>bin\x64\Release\</OutputPath>
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
@@ -112,12 +112,12 @@
|
|||||||
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SignManifests>true</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'cv|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'cv|AnyCPU'">
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<OutputPath>bin\cv\</OutputPath>
|
<OutputPath>bin\cv\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'cv|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'cv|x64'">
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<OutputPath>bin\x64\cv\</OutputPath>
|
<OutputPath>bin\x64\cv\</OutputPath>
|
||||||
<DocumentationFile>TNTTracking.xml</DocumentationFile>
|
<DocumentationFile>Shipping Tracker.xml</DocumentationFile>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
@@ -172,7 +172,10 @@
|
|||||||
<Compile Include="Form2.vb">
|
<Compile Include="Form2.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="My Project\About.vb">
|
<Compile Include="Form3.Designer.vb">
|
||||||
|
<DependentUpon>Form3.vb</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form3.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
@@ -199,6 +202,9 @@
|
|||||||
<EmbeddedResource Include="Form2.resx">
|
<EmbeddedResource Include="Form2.resx">
|
||||||
<DependentUpon>Form2.vb</DependentUpon>
|
<DependentUpon>Form2.vb</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Form3.resx">
|
||||||
|
<DependentUpon>Form3.vb</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="My Project\Resources.resx">
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
|
|||||||
@@ -0,0 +1,502 @@
|
|||||||
|
Imports System.Collections.Generic
|
||||||
|
Imports System.IO
|
||||||
|
Imports System.Net.Http
|
||||||
|
Imports System.Security.Cryptography
|
||||||
|
Imports System.Web.Script.Serialization
|
||||||
|
Imports System.Windows.Forms
|
||||||
|
|
||||||
|
' ---------------------------------------------------------------------------
|
||||||
|
' Updater.vb - self-update for Shipping Tracker
|
||||||
|
'
|
||||||
|
' Requires a project reference to: System.Web.Extensions (for JavaScriptSerializer)
|
||||||
|
' Everything else is in the framework already.
|
||||||
|
'
|
||||||
|
' Wire-up (see notes at bottom of file):
|
||||||
|
' Form1_Load -> Updater.CleanupOldBinary() + Await Updater.CheckForUpdatesAsync(True)
|
||||||
|
' Form3 btnUpdates -> Await Updater.CheckForUpdatesAsync(False)
|
||||||
|
' ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Public Module Updater
|
||||||
|
|
||||||
|
' --- configuration -----------------------------------------------------
|
||||||
|
|
||||||
|
Private Const ApiLatest As String =
|
||||||
|
"https://gitea.apointless.space/api/v1/repos/bsncubed/ShippingTracker/releases/latest"
|
||||||
|
|
||||||
|
Private Const ReleasesPage As String =
|
||||||
|
"https://gitea.apointless.space/bsncubed/ShippingTracker/releases"
|
||||||
|
|
||||||
|
' Name of the .exe asset attached to each release. Must match exactly.
|
||||||
|
Private Const AssetName As String = "Shipping Tracker.exe"
|
||||||
|
|
||||||
|
' Name of the checksum asset. sha256sum format: "<hash> <filename>" per line.
|
||||||
|
Private Const ChecksumAssetName As String = "checksums.txt"
|
||||||
|
|
||||||
|
Private ReadOnly Http As New HttpClient() With {.Timeout = TimeSpan.FromSeconds(10)}
|
||||||
|
|
||||||
|
' --- public entry points -----------------------------------------------
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Checks for a newer release and offers to install it.
|
||||||
|
''' silent = True -> startup check. Any failure (offline, DNS, timeout,
|
||||||
|
''' bad response) returns quietly with no UI at all.
|
||||||
|
''' silent = False -> user clicked "Check for updates". Reports
|
||||||
|
''' "up to date" and surfaces errors.
|
||||||
|
''' </summary>
|
||||||
|
Public Async Function CheckForUpdatesAsync(silent As Boolean) As Task
|
||||||
|
|
||||||
|
Dim rel As ReleaseInfo = Nothing
|
||||||
|
|
||||||
|
Try
|
||||||
|
rel = Await FetchLatestReleaseAsync()
|
||||||
|
Catch ex As Exception
|
||||||
|
' Offline / DNS failure / timeout / non-200 / malformed JSON.
|
||||||
|
If Not silent Then
|
||||||
|
MessageBox.Show("Could not check for updates:" & vbCrLf & vbCrLf & ex.Message,
|
||||||
|
"Shipping Tracker", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||||||
|
End If
|
||||||
|
Return
|
||||||
|
End Try
|
||||||
|
|
||||||
|
If rel Is Nothing OrElse rel.Version Is Nothing Then
|
||||||
|
If Not silent Then
|
||||||
|
MessageBox.Show("Could not read the latest version number.",
|
||||||
|
"Shipping Tracker", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||||||
|
End If
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim current As Version = Normalise(My.Application.Info.Version)
|
||||||
|
|
||||||
|
If rel.Version <= current Then
|
||||||
|
If Not silent Then
|
||||||
|
MessageBox.Show("You're running the latest version (" & current.ToString() & ").",
|
||||||
|
"Shipping Tracker", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||||||
|
End If
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' --- newer version available ---------------------------------------
|
||||||
|
|
||||||
|
Dim answer = MessageBox.Show(
|
||||||
|
"A new version of Shipping Tracker is available." & vbCrLf & vbCrLf &
|
||||||
|
"You have: " & current.ToString() & vbCrLf &
|
||||||
|
"Available: " & rel.Version.ToString() & vbCrLf & vbCrLf &
|
||||||
|
"Update now?",
|
||||||
|
"Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||||
|
|
||||||
|
If answer <> DialogResult.Yes Then Return
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(rel.AssetUrl) Then
|
||||||
|
OfferManualDownload("This release doesn't contain a file named """ & AssetName & """.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Fail early if we can't write next to ourselves (e.g. Program Files,
|
||||||
|
' read-only network share) rather than half-applying the update.
|
||||||
|
If Not CanWriteBesideExe() Then
|
||||||
|
OfferManualDownload("Shipping Tracker doesn't have permission to update itself " &
|
||||||
|
"in this folder.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
Await DownloadAndApplyAsync(rel)
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Deletes the previous binary left behind by an update.
|
||||||
|
''' Call once, early, from Form1_Load. Never throws.
|
||||||
|
''' </summary>
|
||||||
|
Public Sub CleanupOldBinary()
|
||||||
|
Try
|
||||||
|
Dim oldPath = Application.ExecutablePath & ".old"
|
||||||
|
If File.Exists(oldPath) Then File.Delete(oldPath)
|
||||||
|
Catch
|
||||||
|
' Still locked, or already gone. Harmless - try again next launch.
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' --- release metadata --------------------------------------------------
|
||||||
|
|
||||||
|
Private Class ReleaseInfo
|
||||||
|
Public Property Version As Version
|
||||||
|
Public Property AssetUrl As String
|
||||||
|
Public Property ChecksumUrl As String
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Private Async Function FetchLatestReleaseAsync() As Task(Of ReleaseInfo)
|
||||||
|
|
||||||
|
Using req As New HttpRequestMessage(HttpMethod.Get, ApiLatest)
|
||||||
|
req.Headers.Add("User-Agent", "ShippingTracker")
|
||||||
|
req.Headers.Add("Accept", "application/json")
|
||||||
|
|
||||||
|
Using resp = Await Http.SendAsync(req)
|
||||||
|
resp.EnsureSuccessStatusCode()
|
||||||
|
Dim body = Await resp.Content.ReadAsStringAsync()
|
||||||
|
|
||||||
|
Dim js As New JavaScriptSerializer()
|
||||||
|
Dim root = TryCast(js.DeserializeObject(body), Dictionary(Of String, Object))
|
||||||
|
If root Is Nothing Then Return Nothing
|
||||||
|
|
||||||
|
Dim info As New ReleaseInfo()
|
||||||
|
|
||||||
|
Dim tag As String = Nothing
|
||||||
|
If root.ContainsKey("tag_name") Then tag = TryCast(root("tag_name"), String)
|
||||||
|
info.Version = ParseVersion(tag)
|
||||||
|
|
||||||
|
If root.ContainsKey("assets") Then
|
||||||
|
Dim assets = TryCast(root("assets"), Object())
|
||||||
|
If assets IsNot Nothing Then
|
||||||
|
For Each a In assets
|
||||||
|
Dim asset = TryCast(a, Dictionary(Of String, Object))
|
||||||
|
If asset Is Nothing Then Continue For
|
||||||
|
|
||||||
|
Dim name As String = Nothing
|
||||||
|
Dim url As String = Nothing
|
||||||
|
If asset.ContainsKey("name") Then name = TryCast(asset("name"), String)
|
||||||
|
If asset.ContainsKey("browser_download_url") Then _
|
||||||
|
url = TryCast(asset("browser_download_url"), String)
|
||||||
|
|
||||||
|
If name Is Nothing OrElse url Is Nothing Then Continue For
|
||||||
|
|
||||||
|
If String.Equals(name, AssetName, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
info.AssetUrl = url
|
||||||
|
ElseIf String.Equals(name, ChecksumAssetName, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
info.ChecksumUrl = url
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return info
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' --- version handling --------------------------------------------------
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Parses a tag like "1.2.0.0", "v1.2.0" or "1.2" into a 4-part Version.
|
||||||
|
''' Missing components become 0 so comparison against AssemblyVersion is sane
|
||||||
|
''' (an unset component in System.Version is -1, which would sort wrong).
|
||||||
|
''' </summary>
|
||||||
|
Private Function ParseVersion(tag As String) As Version
|
||||||
|
If String.IsNullOrEmpty(tag) Then Return Nothing
|
||||||
|
|
||||||
|
Dim s = tag.Trim()
|
||||||
|
If s.StartsWith("v", StringComparison.OrdinalIgnoreCase) Then s = s.Substring(1)
|
||||||
|
|
||||||
|
Dim nums As New List(Of Integer)
|
||||||
|
For Each part In s.Split("."c)
|
||||||
|
Dim n As Integer
|
||||||
|
If Not Integer.TryParse(part.Trim(), n) Then Exit For
|
||||||
|
If n < 0 Then Exit For
|
||||||
|
nums.Add(n)
|
||||||
|
If nums.Count = 4 Then Exit For
|
||||||
|
Next
|
||||||
|
|
||||||
|
If nums.Count = 0 Then Return Nothing
|
||||||
|
While nums.Count < 4
|
||||||
|
nums.Add(0)
|
||||||
|
End While
|
||||||
|
|
||||||
|
Return New Version(nums(0), nums(1), nums(2), nums(3))
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function Normalise(v As Version) As Version
|
||||||
|
Return New Version(Math.Max(v.Major, 0), Math.Max(v.Minor, 0),
|
||||||
|
Math.Max(v.Build, 0), Math.Max(v.Revision, 0))
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' --- download / verify / swap -----------------------------------------
|
||||||
|
|
||||||
|
Private Async Function DownloadAndApplyAsync(rel As ReleaseInfo) As Task
|
||||||
|
|
||||||
|
Dim exePath = Application.ExecutablePath
|
||||||
|
Dim newPath = exePath & ".new"
|
||||||
|
|
||||||
|
Dim prog As New UpdateProgressForm()
|
||||||
|
prog.Show()
|
||||||
|
|
||||||
|
Try
|
||||||
|
' 1. download the new binary
|
||||||
|
prog.SetStatus("Downloading update...")
|
||||||
|
Await DownloadToFileAsync(rel.AssetUrl, newPath, prog)
|
||||||
|
|
||||||
|
' 2. verify it, if the release published checksums
|
||||||
|
If Not String.IsNullOrEmpty(rel.ChecksumUrl) Then
|
||||||
|
prog.SetStatus("Verifying download...")
|
||||||
|
prog.SetProgress(100)
|
||||||
|
|
||||||
|
Dim expected = Await FetchExpectedHashAsync(rel.ChecksumUrl)
|
||||||
|
If String.IsNullOrEmpty(expected) Then
|
||||||
|
Throw New Exception("The checksum file has no entry for """ & AssetName & """.")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim actual = Sha256File(newPath)
|
||||||
|
If Not String.Equals(expected, actual, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
Throw New Exception("Checksum mismatch - the download was corrupted or tampered with." &
|
||||||
|
vbCrLf & vbCrLf &
|
||||||
|
"Expected: " & expected & vbCrLf &
|
||||||
|
"Got: " & actual)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' 3. swap the binaries
|
||||||
|
prog.SetStatus("Installing...")
|
||||||
|
ApplyUpdate(newPath)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
SafeDelete(newPath)
|
||||||
|
prog.Close()
|
||||||
|
OfferManualDownload("The update could not be installed:" & vbCrLf & vbCrLf & ex.Message)
|
||||||
|
Return
|
||||||
|
End Try
|
||||||
|
|
||||||
|
prog.Close()
|
||||||
|
|
||||||
|
MessageBox.Show("Update installed. Shipping Tracker will now restart.",
|
||||||
|
"Shipping Tracker", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||||||
|
|
||||||
|
Try
|
||||||
|
Process.Start(exePath)
|
||||||
|
Catch
|
||||||
|
' If relaunch fails the update is still applied - next manual
|
||||||
|
' launch gets the new version.
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Application.Exit()
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Async Function DownloadToFileAsync(url As String, destPath As String,
|
||||||
|
prog As UpdateProgressForm) As Task
|
||||||
|
|
||||||
|
Using req As New HttpRequestMessage(HttpMethod.Get, url)
|
||||||
|
req.Headers.Add("User-Agent", "ShippingTracker")
|
||||||
|
|
||||||
|
' ResponseHeadersRead so we stream to disk instead of buffering it all.
|
||||||
|
Using resp = Await Http.SendAsync(req, HttpCompletionOption.ResponseHeadersRead)
|
||||||
|
resp.EnsureSuccessStatusCode()
|
||||||
|
|
||||||
|
Dim total As Long = -1
|
||||||
|
If resp.Content.Headers.ContentLength.HasValue Then
|
||||||
|
total = resp.Content.Headers.ContentLength.Value
|
||||||
|
End If
|
||||||
|
|
||||||
|
Using src = Await resp.Content.ReadAsStreamAsync(),
|
||||||
|
dst = New FileStream(destPath, FileMode.Create, FileAccess.Write, FileShare.None)
|
||||||
|
|
||||||
|
Dim buffer(81919) As Byte
|
||||||
|
Dim readTotal As Long = 0
|
||||||
|
Dim n As Integer
|
||||||
|
|
||||||
|
Do
|
||||||
|
n = Await src.ReadAsync(buffer, 0, buffer.Length)
|
||||||
|
If n = 0 Then Exit Do
|
||||||
|
Await dst.WriteAsync(buffer, 0, n)
|
||||||
|
readTotal += n
|
||||||
|
If total > 0 Then
|
||||||
|
prog.SetProgress(CInt(Math.Min(100L, readTotal * 100L \ total)))
|
||||||
|
End If
|
||||||
|
Loop
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Async Function FetchExpectedHashAsync(checksumUrl As String) As Task(Of String)
|
||||||
|
|
||||||
|
Using req As New HttpRequestMessage(HttpMethod.Get, checksumUrl)
|
||||||
|
req.Headers.Add("User-Agent", "ShippingTracker")
|
||||||
|
|
||||||
|
Using resp = Await Http.SendAsync(req)
|
||||||
|
resp.EnsureSuccessStatusCode()
|
||||||
|
Dim text = Await resp.Content.ReadAsStringAsync()
|
||||||
|
|
||||||
|
' sha256sum format: "<hash> <filename>" (two spaces, or " *")
|
||||||
|
For Each line In text.Split({vbCr, vbLf}, StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
Dim trimmed = line.Trim()
|
||||||
|
If trimmed.Length = 0 Then Continue For
|
||||||
|
|
||||||
|
Dim sep = trimmed.IndexOf(" "c)
|
||||||
|
If sep <= 0 Then Continue For
|
||||||
|
|
||||||
|
Dim hash = trimmed.Substring(0, sep).Trim()
|
||||||
|
Dim name = trimmed.Substring(sep).Trim().TrimStart("*"c).Trim()
|
||||||
|
|
||||||
|
If String.Equals(name, AssetName, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
Return hash
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return Nothing
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function Sha256File(path As String) As String
|
||||||
|
Using sha = SHA256.Create(), fs = File.OpenRead(path)
|
||||||
|
Return BitConverter.ToString(sha.ComputeHash(fs)).Replace("-", "").ToLowerInvariant()
|
||||||
|
End Using
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Windows won't let you delete a running .exe, but it will let you RENAME
|
||||||
|
''' one. So: current -> .old, downloaded -> current. The .old file is removed
|
||||||
|
''' by CleanupOldBinary() on the next launch.
|
||||||
|
''' </summary>
|
||||||
|
Private Sub ApplyUpdate(newFile As String)
|
||||||
|
|
||||||
|
Dim exePath = Application.ExecutablePath
|
||||||
|
Dim oldPath = exePath & ".old"
|
||||||
|
|
||||||
|
SafeDelete(oldPath)
|
||||||
|
|
||||||
|
File.Move(exePath, oldPath) ' running exe is now .old
|
||||||
|
|
||||||
|
Try
|
||||||
|
File.Move(newFile, exePath) ' new binary takes its place
|
||||||
|
Catch
|
||||||
|
' Roll back so the user isn't left without an application.
|
||||||
|
Try
|
||||||
|
File.Move(oldPath, exePath)
|
||||||
|
Catch
|
||||||
|
End Try
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' --- helpers -----------------------------------------------------------
|
||||||
|
|
||||||
|
Private Function CanWriteBesideExe() As Boolean
|
||||||
|
Try
|
||||||
|
Dim dir = Path.GetDirectoryName(Application.ExecutablePath)
|
||||||
|
Dim probe = Path.Combine(dir, "." & Guid.NewGuid().ToString("N") & ".tmp")
|
||||||
|
Using fs = New FileStream(probe, FileMode.CreateNew, FileAccess.Write, FileShare.None)
|
||||||
|
End Using
|
||||||
|
File.Delete(probe)
|
||||||
|
Return True
|
||||||
|
Catch
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub SafeDelete(path As String)
|
||||||
|
Try
|
||||||
|
If File.Exists(path) Then File.Delete(path)
|
||||||
|
Catch
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub OfferManualDownload(message As String)
|
||||||
|
Dim answer = MessageBox.Show(
|
||||||
|
message & vbCrLf & vbCrLf & "Open the downloads page instead?",
|
||||||
|
"Shipping Tracker", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
|
||||||
|
|
||||||
|
If answer = DialogResult.Yes Then
|
||||||
|
Try
|
||||||
|
Process.Start(ReleasesPage)
|
||||||
|
Catch
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Module
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Minimal progress window, built in code so there's no extra .Designer.vb
|
||||||
|
''' to add to the project.
|
||||||
|
''' </summary>
|
||||||
|
Friend Class UpdateProgressForm
|
||||||
|
Inherits Form
|
||||||
|
|
||||||
|
Private ReadOnly _bar As ProgressBar
|
||||||
|
Private ReadOnly _label As Label
|
||||||
|
|
||||||
|
Public Sub New()
|
||||||
|
Me.Text = "Updating Shipping Tracker"
|
||||||
|
Me.FormBorderStyle = FormBorderStyle.FixedDialog
|
||||||
|
Me.StartPosition = FormStartPosition.CenterScreen
|
||||||
|
Me.MaximizeBox = False
|
||||||
|
Me.MinimizeBox = False
|
||||||
|
Me.ControlBox = False
|
||||||
|
Me.ClientSize = New Drawing.Size(360, 90)
|
||||||
|
|
||||||
|
_label = New Label() With {
|
||||||
|
.Text = "Starting...",
|
||||||
|
.AutoSize = False,
|
||||||
|
.Location = New Drawing.Point(15, 15),
|
||||||
|
.Size = New Drawing.Size(330, 20)
|
||||||
|
}
|
||||||
|
|
||||||
|
_bar = New ProgressBar() With {
|
||||||
|
.Location = New Drawing.Point(15, 45),
|
||||||
|
.Size = New Drawing.Size(330, 22),
|
||||||
|
.Minimum = 0,
|
||||||
|
.Maximum = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
Me.Controls.Add(_label)
|
||||||
|
Me.Controls.Add(_bar)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetStatus(text As String)
|
||||||
|
_label.Text = text
|
||||||
|
_label.Refresh()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SetProgress(percent As Integer)
|
||||||
|
If percent < 0 Then percent = 0
|
||||||
|
If percent > 100 Then percent = 100
|
||||||
|
_bar.Value = percent
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
|
||||||
|
' ---------------------------------------------------------------------------
|
||||||
|
' INTEGRATION
|
||||||
|
'
|
||||||
|
' 1. Project -> Add Reference -> Assemblies -> System.Web.Extensions
|
||||||
|
'
|
||||||
|
' 2. Form1.vb - replace the existing Form1_Load with:
|
||||||
|
'
|
||||||
|
' Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
' lblCoppiedNotifyer.Text = ""
|
||||||
|
' Updater.CleanupOldBinary()
|
||||||
|
' Await Updater.CheckForUpdatesAsync(True)
|
||||||
|
' End Sub
|
||||||
|
'
|
||||||
|
' (Async Sub is fine here - the await resumes on the UI thread, and the
|
||||||
|
' window paints while the HTTP request is in flight.)
|
||||||
|
'
|
||||||
|
' 3. Form3.vb - replace the btnUpdates handler with:
|
||||||
|
'
|
||||||
|
' Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles btnUpdates.Click
|
||||||
|
' Await Updater.CheckForUpdatesAsync(False)
|
||||||
|
' End Sub
|
||||||
|
'
|
||||||
|
' 4. Bump <Assembly: AssemblyVersion> and AssemblyFileVersion in
|
||||||
|
' My Project\AssemblyInfo.vb before each release. This is what the updater
|
||||||
|
' compares against - if you forget, users are told they're up to date.
|
||||||
|
'
|
||||||
|
' PUBLISHING A RELEASE
|
||||||
|
'
|
||||||
|
' - Tag the release "1.2.0.0" (a leading "v" is also accepted).
|
||||||
|
' - Attach the built binary, named exactly: Shipping Tracker.exe
|
||||||
|
' - Attach checksums.txt containing:
|
||||||
|
' <sha256> Shipping Tracker.exe
|
||||||
|
' Generate it in PowerShell with:
|
||||||
|
' (Get-FileHash ".\Shipping Tracker.exe" -Algorithm SHA256).Hash.ToLower() `
|
||||||
|
' + " Shipping Tracker.exe" | Out-File checksums.txt -Encoding ascii
|
||||||
|
' - Don't mark it pre-release: /releases/latest skips drafts and pre-releases.
|
||||||
|
'
|
||||||
|
' If checksums.txt is missing the update still installs, but unverified.
|
||||||
|
' ---------------------------------------------------------------------------
|
||||||
@@ -1 +1,6 @@
|
|||||||
Yeet
|
# Shipping Link Generator
|
||||||
|
For all of those shipping companies that don't have an easy way to generate a tracking url from their system.
|
||||||
|
|
||||||
|
If you would like to see your favorite shipping company added, lodge an issue
|
||||||
|
|
||||||
|
License TBC
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
3b8e4dcfc328e7f3fedf6c8f0adbc8689e7eeb8c5646d5a81212b863dda07e7a Shipping Tracker.exe
|
||||||
Reference in New Issue
Block a user