See feature request #3488317: When taking an IE capture, now the URL is added to the meta data. This makes it possible to include the URL in the pattern. Although one should wonder how this would look after making it "filename safe"... but there is a use when printing. I also added the following info: URL_SCHEME, URL_HOSTNAME, URL_PORT, URL_PATH, URL_QUERY, URL_USER. These last fields might make more sense to use.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1720 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-03-21 15:17:27 +00:00
commit 20d4fb693f

View file

@ -295,13 +295,37 @@ namespace Greenshot.Helpers {
capture.Image = returnBitmap;
// Store the location of the window
capture.Location = documentContainer.ContentWindow.Location;
// Store the title of the Page
// Store the title of the page
if (documentContainer.Name != null) {
capture.CaptureDetails.Title = documentContainer.Name;
} else {
capture.CaptureDetails.Title = activeWindow.Text;
}
// Store the URL of the page
if (documentContainer.Url != null) {
Uri uri = new Uri(documentContainer.Url);
capture.CaptureDetails.AddMetaData("URL", uri.OriginalString);
// As the URL can hardly be used in a filename, the following can be used
if (!string.IsNullOrEmpty(uri.Scheme)) {
capture.CaptureDetails.AddMetaData("URL_SCHEME", uri.Scheme);
}
if (!string.IsNullOrEmpty(uri.DnsSafeHost)) {
capture.CaptureDetails.AddMetaData("URL_HOSTNAME", uri.DnsSafeHost);
}
if (!string.IsNullOrEmpty(uri.AbsolutePath)) {
capture.CaptureDetails.AddMetaData("URL_PATH", uri.AbsolutePath);
}
if (!string.IsNullOrEmpty(uri.Query)) {
capture.CaptureDetails.AddMetaData("URL_QUERY", uri.Query);
}
if (!string.IsNullOrEmpty(uri.UserInfo)) {
capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo);
}
capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString());
}
// Only move the mouse to correct for the capture offset
capture.MoveMouseLocation(-documentContainer.ViewportRectangle.X, -documentContainer.ViewportRectangle.Y);
// Used to be: capture.MoveMouseLocation(-(capture.Location.X + documentContainer.CaptureOffset.X), -(capture.Location.Y + documentContainer.CaptureOffset.Y));