Hallo zusammen
Vorweg bitte erschlagt mich nicht aber ich habe jetzt Tagelang alles gewälzt was ich im web gefunden habe komme aber nicht weiter...
Ich nutze in einem Project GeckoFX 31 mit passendem Xulrunner.
Das ganze funktioniert auch weitestgehend ganz gut bis auf das ich (glaube ich) zu doof bin raus zu bekommen wie ich einen Download mit der GeckoFX initialisiere...
Downloadmanager und co sind alles kein Problem auch das Navigieren innerhalb des GeckoFX Browsers klappt wunderbar.
Nur wie kann ich einen Download starten der auf ein ButtonEvent hin startet?
Leider finde ich dazu kein Tutorial...
Ich hoffe ihr könnt mir da ein wenig unter die Arme greifen...
Ich muss nämlich ein Array von ca 400 Dateien darüber downloaden können und komme momentan nicht weiter
EDIT://
Entschuldigung ich nutze GeckoFX 33.0.1.0 mit passendem Xulrunner...
EDIT2://
Das hab ich gerade gefunden komme damit aber nicht wirklich weiter...
Ich verstehe nicht so ganz woher ich "e", "F", "S" und "savebox" bekomme.
Ich denke "savebox" könnte ich als SaveFileDialog einbinden aber der Rest erschließt sich mir gar nicht...
Ich hoffe ihr könnt mir da ein wenig unter die Arme greifen...
Gruß
Panics
Vorweg bitte erschlagt mich nicht aber ich habe jetzt Tagelang alles gewälzt was ich im web gefunden habe komme aber nicht weiter...
Ich nutze in einem Project GeckoFX 31 mit passendem Xulrunner.
Das ganze funktioniert auch weitestgehend ganz gut bis auf das ich (glaube ich) zu doof bin raus zu bekommen wie ich einen Download mit der GeckoFX initialisiere...
Downloadmanager und co sind alles kein Problem auch das Navigieren innerhalb des GeckoFX Browsers klappt wunderbar.
Nur wie kann ich einen Download starten der auf ein ButtonEvent hin startet?
Leider finde ich dazu kein Tutorial...
Ich hoffe ihr könnt mir da ein wenig unter die Arme greifen...
Ich muss nämlich ein Array von ca 400 Dateien darüber downloaden können und komme momentan nicht weiter
EDIT://
Entschuldigung ich nutze GeckoFX 33.0.1.0 mit passendem Xulrunner...
EDIT2://
VB.NET-Quellcode
- Dim P As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\\tmp" ' If Not System.IO.Directory.Exists(P) Then System.IO.Directory.CreateDirectory(P)
- Dim objTarget As nsILocalFile = Xpcom.CreateInstance(Of nsILocalFile)("@mozilla.org/file/local;1")
- Dim tmp_Loc As String = P & "\tmpdload"
- Using tmp As New nsAString(tmp_Loc)
- objTarget.InitWithPath(tmp)
- End Using
- If e.FileName.Contains(".") Then
- S = Strings.Split(e.FileName, ".")
- F = S(S.Length - 1).ToUpper & " File (*." & S(S.Length - 1) & ")|*." & S(S.Length - 1)
- Else
- F = "File (*.*)|*.*"
- End If
- savebox.Filter = F '"HTML File (*.html)|*.html"
- savebox.Title = "Save File:"
- savebox.FileName = e.FileName
- If savebox.ShowDialog = System.Windows.Forms.DialogResult.OK And Not String.IsNullOrEmpty(savebox.FileName) Then
- Dim source As nsIURI = IOService.CreateNsIUri(New Uri("http://sync.excore-gaming.eu/@excore_gaming/addons/Bornholm.pbo").AbsoluteUri)
- Dim dest As nsIURI = IOService.CreateNsIUri(New Uri(savebox.FileName).AbsoluteUri)
- Dim t As nsAStringBase = DirectCast(New nsAString(System.IO.Path.GetFileName(savebox.FileName)), nsAStringBase)
- Dim persist As nsIWebBrowserPersist = Xpcom.CreateInstance(Of nsIWebBrowserPersist)("@mozilla.org/embedding/browser/nsWebBrowserPersist;1")
- Dim DownloadMan As nsIDownloadManager = Xpcom.CreateInstance(Of nsIDownloadManager)("@mozilla.org/download-manager;1")
- Dim downloadX As nsIDownload = DownloadMan.AddDownload(0, source, dest, t, e.Mime, 0, Nothing, DirectCast(persist, nsICancelable), False) '
- If (downloadX IsNot Nothing) Then
- persist.SetPersistFlagsAttribute(2 Or 32 Or 16384)
- persist.SetProgressListenerAttribute(DirectCast(downloadX, nsIWebProgressListener))
- persist.SaveURI(source, Nothing, Nothing, Nothing, Nothing, DirectCast(dest, nsISupports), Nothing)
- End If
- End If
Das hab ich gerade gefunden komme damit aber nicht wirklich weiter...
Ich verstehe nicht so ganz woher ich "e", "F", "S" und "savebox" bekomme.
Ich denke "savebox" könnte ich als SaveFileDialog einbinden aber der Rest erschließt sich mir gar nicht...
Ich hoffe ihr könnt mir da ein wenig unter die Arme greifen...
Gruß
Panics
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „Panics“ ()