Skip to content
Permalink
Browse files

Additional check properties

  • Loading branch information...
DXSdata committed Feb 28, 2018
1 parent bda9218 commit afc616f19aa34ba54be9a7a9c4a1d731dbfb8f41
@@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
@@ -53,6 +53,10 @@ private static MemoryStream GetIStream(STGMEDIUM medium)
iStream.Stat(out iStreamStat, 0);
int iStreamSize = (int)iStreamStat.cbSize;

//prevent memoryexception
if (iStreamSize > 100000000)
return null;

//read the data from the IStream into a managed byte array
byte[] iStreamContent = new byte[iStreamSize];
iStream.Read(iStreamContent, iStreamContent.Length, IntPtr.Zero);
@@ -17,6 +17,9 @@ public static class VirtualFiles
private static List<FileInfo> savedFiles = new List<FileInfo>();
private static List<MemoryStream> savedStreams = new List<MemoryStream>();

/// <summary>
/// True if Clipboard contains a file reference
/// </summary>
public static bool ContainsVirtualFiles
{
get
@@ -27,10 +30,49 @@ public static bool ContainsVirtualFiles
// Clipboard.ContainsText())
// return false;

//var test = Clipboard.GetDataObject();
//var test2 = test.GetFormats();

return Clipboard.ContainsData("FileGroupDescriptorW");
}
}

/// <summary>
/// True if Clipboard contains a mail copied from eM Client
/// </summary>
public static bool ContainsEmclientEmail
{
get
{
String [] neededFormats = new [] { "FileGroupDescriptorW", "FileContents", "System.String", "Preferred DropEffect", "HTML Format" };
var data = Clipboard.GetDataObject();
var formats = data.GetFormats();

if (neededFormats.All(o => formats.Contains(o)))
return true;

return false;
}
}

/// <summary>
/// True if Clipboard contains a mail copied from Outlook
/// </summary>
public static bool ContainsOutlookEmail
{
get
{
String[] neededFormats = new[] { "FileGroupDescriptorW", "FileContents", "System.String", "Text", "Csv", "RenPrivateSourceFolder", "RenPrivateMessages" };
var data = Clipboard.GetDataObject();
var formats = data.GetFormats();

if (neededFormats.All(o => formats.Contains(o)))
return true;

return false;
}
}

/// <summary>
/// Retrieves all streams of the available clipboard content
/// </summary>
@@ -34,6 +34,10 @@ private void Notification_ClipboardUpdate(object sender, EventArgs e)

try
{
//some test properties
var containsEmClientEmail = VirtualFiles.ContainsEmclientEmail;
var containsOutlookEmail = VirtualFiles.ContainsOutlookEmail;

if (!checkBoxOutlook.Checked) //Default way
{

@@ -42,7 +46,7 @@ private void Notification_ClipboardUpdate(object sender, EventArgs e)

Log("Option 2: Get files saved to disk");
var files = VirtualFiles.GetVirtualFilesAsFiles();

foreach (var file in files)
{
Log("Saved file " + file.FullName);

0 comments on commit afc616f

Please sign in to comment.
You can’t perform that action at this time.