本文整理汇总了C#中ICaptureDetails类的典型用法代码示例。如果您正苦于以下问题:C# ICaptureDetails类的具体用法?C# ICaptureDetails怎么用?C# ICaptureDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICaptureDetails类属于命名空间,在下文中一共展示了ICaptureDetails类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
SurfaceOutputSettings outputSettings = new SurfaceOutputSettings();
if (presetCommand != null) {
if (!config.runInbackground.ContainsKey(presetCommand)) {
config.runInbackground.Add(presetCommand, true);
}
bool runInBackground = config.runInbackground[presetCommand];
string fullPath = captureDetails.Filename;
if (fullPath == null) {
fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
}
string output;
string error;
if (runInBackground) {
Thread commandThread = new Thread(delegate() {
CallExternalCommand(exportInformation, presetCommand, fullPath, out output, out error);
ProcessExport(exportInformation, surface);
});
commandThread.Name = "Running " + presetCommand;
commandThread.IsBackground = true;
commandThread.SetApartmentState(ApartmentState.STA);
commandThread.Start();
exportInformation.ExportMade = true;
} else {
CallExternalCommand(exportInformation, presetCommand, fullPath, out output, out error);
ProcessExport(exportInformation, surface);
}
}
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:34,代码来源:ExternalCommandDestination.cs
示例2: FillPattern
/// <summary>
/// Fill the pattern wit the supplied details
/// </summary>
/// <param name="pattern">Pattern</param>
/// <param name="captureDetails">CaptureDetails</param>
/// <param name="filenameSafeMode">Should the result be made "filename" safe?</param>
/// <returns>Filled pattern</returns>
public static string FillPattern(string pattern, ICaptureDetails captureDetails, bool filenameSafeMode)
{
IDictionary processVars = null;
IDictionary userVars = null;
IDictionary machineVars = null;
try {
processVars = Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Process);
} catch (Exception e) {
LOG.Error("Error retrieving EnvironmentVariableTarget.Process", e);
}
try {
userVars = Environment.GetEnvironmentVariables(EnvironmentVariableTarget.User);
} catch (Exception e) {
LOG.Error("Error retrieving EnvironmentVariableTarget.User", e);
}
try {
machineVars = Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Machine);
} catch (Exception e) {
LOG.Error("Error retrieving EnvironmentVariableTarget.Machine", e);
}
try {
return VAR_REGEXP.Replace(pattern,
new MatchEvaluator(delegate(Match m) { return MatchVarEvaluator(m, captureDetails, processVars, userVars, machineVars, filenameSafeMode); })
);
} catch (Exception e) {
// adding additional data for bug tracking
e.Data.Add("title", captureDetails.Title);
e.Data.Add("pattern", pattern);
throw e;
}
}
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:41,代码来源:FilenameHelper.cs
示例3: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
_log.Debug("Start capture export to oo.vg");
try
{
string uploadUrl;
var exportInformation = new ExportInformation(this.Designation, this.Description)
{
ExportMade = UploadImage(captureDetails, surface, out uploadUrl),
Uri = uploadUrl
};
ProcessExport(exportInformation, surface);
if (exportInformation.ExportMade)
{
Clipboard.SetText(uploadUrl);
}
return exportInformation;
}
finally
{
_log.Debug("Export to oo.vg complete");
}
}
开发者ID:AlexMedia,项目名称:oovg-greenshot,代码行数:28,代码来源:OovgDestination.cs
示例4: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string uploadURL = null;
exportInformation.ExportMade = plugin.Upload(captureDetails, surface, out uploadURL);
exportInformation.Uri = uploadURL;
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:8,代码来源:ImgurDestination.cs
示例5: PrintHelper
public PrintHelper(Image image, ICaptureDetails captureDetails)
{
this.image = image;
printDialog.UseEXDialog = true;
printDocument.DocumentName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(conf.OutputFileFilenamePattern, captureDetails);
printDocument.PrintPage += DrawImageForPrint;
printDialog.Document = printDocument;
}
开发者ID:eservicepartner,项目名称:espUrl,代码行数:8,代码来源:PrintHelper.cs
示例6: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
string uploadUrl = _plugin.Upload(captureDetails, surface);
if (uploadUrl != null) {
exportInformation.ExportMade = true;
exportInformation.Uri = uploadUrl;
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:10,代码来源:BoxDestination.cs
示例7: UploadImage
private bool UploadImage(ICaptureDetails captureDetails, ISurface surface, out string url)
{
string path = null;
try
{
_log.Debug("Exporting file to oo.vg");
var uploadUrl = "http://oo.vg/a/upload";
var config = IniConfig.GetIniSection<OovgConfiguration>();
if (!string.IsNullOrEmpty(config.UploadKey))
{
uploadUrl += $"?key={HttpUtility.UrlEncode(config.UploadKey)}";
}
// Temporarily store the file somewhere
path = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings(OutputFormat.png));
ServicePointManager.Expect100Continue = false;
var webClient = new WebClient();
var response = webClient.UploadFile(uploadUrl, "POST", path);
url = Encoding.ASCII.GetString(response);
_log.InfoFormat("Upload of {0} to {1} complete", captureDetails.Filename, url);
return true;
}
catch (Exception ex)
{
MessageBox.Show("Error while uploading file:" + Environment.NewLine + ex.Message, "oo.vg Screenshot Share");
_log.Fatal("Uploading failed", ex);
url = null;
return false;
}
finally
{
// clean up after ourselves
if (!string.IsNullOrEmpty(path))
{
try
{
File.Delete(path);
}
catch (Exception e)
{
_log.Warn("Could not delete temporary file", e);
}
}
}
}
开发者ID:AlexMedia,项目名称:oovg-greenshot,代码行数:55,代码来源:OovgDestination.cs
示例8: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
bool outputMade;
bool overwrite;
string fullPath;
// Get output settings from the configuration
SurfaceOutputSettings outputSettings = new SurfaceOutputSettings();
if (captureDetails != null && captureDetails.Filename != null) {
// As we save a pre-selected file, allow to overwrite.
overwrite = true;
LOG.InfoFormat("Using previous filename");
fullPath = captureDetails.Filename;
outputSettings.Format = ImageOutput.FormatForFilename(fullPath);
} else {
fullPath = CreateNewFilename(captureDetails);
// As we generate a file, the configuration tells us if we allow to overwrite
overwrite = conf.OutputFileAllowOverwrite;
}
if (conf.OutputFilePromptQuality) {
QualityDialog qualityDialog = new QualityDialog(outputSettings);
qualityDialog.ShowDialog();
}
// Catching any exception to prevent that the user can't write in the directory.
// This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218, #3004642
try {
ImageOutput.Save(surface, fullPath, overwrite, outputSettings, conf.OutputFileCopyPathToClipboard);
outputMade = true;
} catch (ArgumentException ex1) {
// Our generated filename exists, display 'save-as'
LOG.InfoFormat("Not overwriting: {0}", ex1.Message);
// when we don't allow to overwrite present a new SaveWithDialog
fullPath = ImageOutput.SaveWithDialog(surface, captureDetails);
outputMade = (fullPath != null);
} catch (Exception ex2) {
LOG.Error("Error saving screenshot!", ex2);
// Show the problem
MessageBox.Show(Language.GetString(LangKey.error_save), Language.GetString(LangKey.error));
// when save failed we present a SaveWithDialog
fullPath = ImageOutput.SaveWithDialog(surface, captureDetails);
outputMade = (fullPath != null);
}
// Don't overwrite filename if no output is made
if (outputMade) {
exportInformation.ExportMade = outputMade;
exportInformation.Filepath = fullPath;
captureDetails.Filename = fullPath;
conf.OutputFileAsFullpath = fullPath;
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:54,代码来源:FileDestination.cs
示例9: ExportCapture
public override bool ExportCapture(ISurface surface, ICaptureDetails captureDetails)
{
using (Image image = surface.GetImageForExport()) {
bool uploaded = plugin.Upload(captureDetails, image);
if (uploaded) {
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to Dropbox");
surface.Modified = false;
}
return uploaded;
}
}
开发者ID:ploufs,项目名称:Greenshot-DropBox-Plugin,代码行数:11,代码来源:DropboxDestination.cs
示例10: ExportCapture
/// <summary>
/// A simple helper method which will call ExportCapture for the destination with the specified designation
/// </summary>
/// <param name="designation"></param>
/// <param name="surface"></param>
/// <param name="captureDetails"></param>
public static void ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails)
{
if (RegisteredDestinations.ContainsKey(designation)) {
IDestination destination = RegisteredDestinations[designation];
if (destination.isActive) {
if (destination.ExportCapture(manuallyInitiated, surface, captureDetails)) {
// Export worked, set the modified flag
surface.Modified = false;
}
}
}
}
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:18,代码来源:DestinationHelper.cs
示例11: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
try {
ClipboardHelper.SetClipboardData(surface);
exportInformation.ExportMade = true;
} catch (Exception) {
// TODO: Change to general logic in ProcessExport
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed));
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:12,代码来源:ClipboardDestination.cs
示例12: ExportCapture
public override ExportInformation ExportCapture(bool manually, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string uploadURL = null;
bool uploaded = plugin.Upload(captureDetails, surface, out uploadURL);
if (uploaded) {
exportInformation.Uri = uploadURL;
exportInformation.ExportMade = true;
if (config.AfterUploadLinkToClipBoard) {
ClipboardHelper.SetClipboardData(uploadURL);
}
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:14,代码来源:DropboxDestination.cs
示例13: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
string savedTo = null;
// Bug #2918756 don't overwrite path if SaveWithDialog returns null!
savedTo = ImageOutput.SaveWithDialog(surface, captureDetails);
if (savedTo != null) {
exportInformation.ExportMade = true;
exportInformation.Filepath = savedTo;
captureDetails.Filename = savedTo;
conf.OutputFileAsFullpath = savedTo;
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:14,代码来源:FileWithDialogDestination.cs
示例14: ExportCapture
/// <summary>
/// Export the capture with the destination picker
/// </summary>
/// <param name="manuallyInitiated">Did the user select this destination?</param>
/// <param name="surface">Surface to export</param>
/// <param name="captureDetails">Details of the capture</param>
/// <returns>true if export was made</returns>
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
List<IDestination> destinations = new List<IDestination>();
foreach(IDestination destination in DestinationHelper.GetAllDestinations()) {
if ("Picker".Equals(destination.Designation)) {
continue;
}
if (!destination.isActive) {
continue;
}
destinations.Add(destination);
}
// No Processing, this is done in the selected destination (if anything was selected)
return ShowPickerMenu(true, surface, captureDetails, destinations);
}
开发者ID:logtcn,项目名称:greenshot,代码行数:22,代码来源:PickerDestination.cs
示例15: ProcessCapture
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) {
LOG.DebugFormat("Changing surface to grayscale!");
using (BitmapBuffer bbb = new BitmapBuffer(surface.Image as Bitmap, false)) {
bbb.Lock();
for(int y=0;y<bbb.Height; y++) {
for(int x=0;x<bbb.Width; x++) {
Color color = bbb.GetColorAt(x, y);
int luma = (int)((0.3*color.R) + (0.59*color.G) + (0.11*color.B));
color = Color.FromArgb(luma, luma, luma);
bbb.SetColorAt(x, y, color);
}
}
}
return true;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:16,代码来源:GreyscaleProcessor.cs
示例16: ExportCapture
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
CoreConfiguration config = IniConfig.GetIniSection<CoreConfiguration>();
OutputSettings outputSettings = new OutputSettings();
string file = FilenameHelper.GetFilename(OutputFormat.png, null);
string filePath = Path.Combine(config.OutputFilePath, file);
using (FileStream stream = new FileStream(filePath, FileMode.Create)) {
using (Image image = surface.GetImageForExport()) {
ImageOutput.SaveToStream(image, stream, outputSettings);
}
}
exportInformation.Filepath = filePath;
exportInformation.ExportMade = true;
ProcessExport(exportInformation, surface);
return exportInformation;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:17,代码来源:SimpleOutputDestination.cs
示例17: ProcessCapture
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) {
surface.SelectElement(surface.AddCursorContainer(Cursors.Hand, 100, 100));
// Do something with the screenshot
string title = captureDetails.Title;
if (title != null) {
LOG.Debug("Added title to surface: " + title);
surface.SelectElement(surface.AddTextContainer(title, HorizontalAlignment.Center, VerticalAlignment.CENTER,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Red, Color.White));
}
surface.SelectElement(surface.AddTextContainer(Environment.UserName, HorizontalAlignment.Right, VerticalAlignment.TOP,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Red, Color.White));
surface.SelectElement(surface.AddTextContainer(Environment.MachineName, HorizontalAlignment.Right, VerticalAlignment.BOTTOM,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Red, Color.White));
surface.SelectElement(surface.AddTextContainer(captureDetails.DateTime.ToLongDateString(), HorizontalAlignment.Left, VerticalAlignment.BOTTOM,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Red, Color.White));
return true;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:17,代码来源:AnnotateProcessor.cs
示例18: SendImage
/// <summary>
/// Helper Method for creating an Email with Image Attachment
/// </summary>
/// <param name="image">The image to send</param>
/// <param name="captureDetails">ICaptureDetails</param>
public static void SendImage(ISurface surface, ICaptureDetails captureDetails) {
string tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings());
if (tmpFile != null) {
// Store the list of currently active windows, so we can make sure we show the email window later!
List<WindowDetails> windowsBefore = WindowDetails.GetVisibleWindows();
bool isEmailSend = false;
//if (EmailConfigHelper.HasOutlook() && (conf.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || conf.OutputEMailFormat == EmailFormat.OUTLOOK_TXT)) {
// isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
//}
if (!isEmailSend && EmailConfigHelper.HasMAPI()) {
// Fallback to MAPI
// Send the email
SendImage(tmpFile, captureDetails.Title);
}
WindowDetails.ActiveNewerWindows(windowsBefore);
}
}
开发者ID:logtcn,项目名称:greenshot,代码行数:23,代码来源:MailHelper.cs
示例19: ProcessCapture
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) {
bool changed = false;
string title = captureDetails.Title;
if (!string.IsNullOrEmpty(title)) {
title = title.Trim();
foreach(string titleIdentifier in config.ActiveTitleFixes) {
string regexpString = config.TitleFixMatcher[titleIdentifier];
string replaceString = config.TitleFixReplacer[titleIdentifier];
if (replaceString == null) {
replaceString = "";
}
if (!string.IsNullOrEmpty(regexpString)) {
Regex regex = new Regex(regexpString);
title = regex.Replace(title, replaceString);
changed = true;
}
}
}
captureDetails.Title = title;
return changed;
}
开发者ID:logtcn,项目名称:greenshot,代码行数:21,代码来源:TitleFixProcessor.cs
示例20: Upload
/// <summary>
/// Upload the capture to Facebook
/// </summary>
/// <param name="captureDetails"></param>
/// <param name="surfaceToUpload">ISurface</param>
/// <param name="uploadURL">out string for the url</param>
/// <returns>true if the upload succeeded</returns>
public bool Upload(ICaptureDetails captureDetails, ISurface surfaceToUpload, out string uploadURL)
{
SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(OutputFormat.png);
try {
string filename = Path.GetFileName(FilenameHelper.GetFilename(OutputFormat.png, captureDetails));
FacebookInfo FacebookInfo = null;
// Run upload in the background
new PleaseWaitForm().ShowAndWait("Facebook plug-in", Language.GetString("facebook", LangKey.communication_wait),
delegate {
FacebookInfo = FacebookUtils.UploadToFacebook(surfaceToUpload, outputSettings, config.IncludeTitle ? captureDetails.Title : null, filename);
}
);
// This causes an exeption if the upload failed :)
LOG.DebugFormat("Uploaded to Facebook page: " + FacebookInfo.Page);
uploadURL = null;
try {
uploadURL = FacebookInfo.Page;
Clipboard.SetText(FacebookInfo.Page);
} catch (Exception ex) {
LOG.Error("Can't write to clipboard: ", ex);
}
return true;
} catch (Exception e) {
LOG.Error(e);
MessageBox.Show(Language.GetString("facebook", LangKey.upload_failure) + " " + e.Message);
}
uploadURL = null;
return false;
}
开发者ID:erwinbovendeur,项目名称:GreenshotFacebookPlugin,代码行数:38,代码来源:FacebookPlugin.cs
注:本文中的ICaptureDetails类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论