Updated DownloadHandler stuff.

This commit is contained in:
Per Lundberg
2013-07-22 10:52:58 +03:00
parent 5e0171da92
commit dede307cd6
2 changed files with 12 additions and 17 deletions
+9 -17
View File
@@ -1,34 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace CefSharp.Example
{
class DownloadHandler : IDownloadHandler
internal class DownloadHandler : IDownloadHandler
{
private readonly string _path;
private Stream _stream;
public DownloadHandler(string fileName)
public bool OnBeforeDownload(string suggestedName, out string downloadPath, out bool showDialog)
{
_path = Path.Combine(Path.GetTempPath(), fileName);
_stream = File.Create(_path);
downloadPath = Path.GetTempPath();
showDialog = true;
return true;
}
public bool ReceivedData(byte[] data)
{
_stream.Write(data, 0, data.GetLength(0));
return true;
throw new NotImplementedException();
}
public void Complete()
{
_stream.Dispose();
_stream = null;
Console.WriteLine("Downloaded: {0}", _path);
throw new NotImplementedException();
}
}
}
+3
View File
@@ -6,10 +6,13 @@
#include "Stdafx.h"
using namespace System::Runtime::InteropServices;
namespace CefSharp
{
public interface class IDownloadHandler
{
bool OnBeforeDownload(String^ suggestedName, [Out] String^% downloadPath, [Out] bool% showDialog);
bool ReceivedData(array<Byte>^ data);
void Complete();
};