Exemple #1
0
 static OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         isActiveFlag = true;
     }
     exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         applicationIcon = PluginUtils.GetExeIcon(exePath, 0);
         WindowDetails.AddProcessToExcludeFromFreeze("outlook");
         if (conf.OutlookAllowExportInMeetings)
         {
             meetingIcon = PluginUtils.GetExeIcon(exePath, 2);
         }
     }
     else
     {
         exePath = null;
     }
     if (exePath == null)
     {
         isActiveFlag = false;
     }
 }
 public ExcelDestination()
 {
     _exePath = PluginUtils.GetExePath("EXCEL.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
 }
Exemple #3
0
 public OneNoteDestination()
 {
     _exePath = PluginUtils.GetExePath("ONENOTE.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
 }
 static WordDestination()
 {
     exePath = PluginUtils.GetExePath("WINWORD.EXE");
     if (exePath != null && !File.Exists(exePath))
     {
         exePath = null;
     }
 }
Exemple #5
0
 public PowerpointDestination()
 {
     _exePath = PluginUtils.GetExePath("POWERPNT.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
 }
Exemple #6
0
        static OCRDestination()
        {
            string exePath = PluginUtils.GetExePath("MSPVIEW.EXE");

            if (exePath != null && File.Exists(exePath))
            {
                icon = PluginUtils.GetExeIcon(exePath, 0);
            }
        }
Exemple #7
0
 static ExternalCommandConfiguration()
 {
     try {
         paintPath       = PluginUtils.GetExePath("pbrush.exe");
         hasPaint        = !string.IsNullOrEmpty(paintPath) && File.Exists(paintPath);
         paintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
         hasPaintDotNet  = !string.IsNullOrEmpty(paintDotNetPath) && File.Exists(paintDotNetPath);
     } catch {
     }
 }
Exemple #8
0
        public override Bitmap GetDisplayIcon(double dpi)
        {
            var exePath = PluginUtils.GetExePath("MSPVIEW.EXE");

            if (exePath != null && File.Exists(exePath))
            {
                return(PluginUtils.GetCachedExeIcon(exePath, 0, dpi > 100));
            }
            return(null);
        }
Exemple #9
0
        /// <summary>
        /// Setup the Bitmap scaling (for icons)
        /// </summary>
        private void SetupBitmapScaleHandler()
        {
            ContextMenuDpiHandler = contextMenu.AttachDpiHandler();

            var dpiChangeSubscription = DpiHandler.OnDpiChangeInfo.Subscribe(info =>
            {
                switch (info.DpiChangeEventType)
                {
                case DpiChangeEventTypes.Before:
                    // Change the ImageScalingSize before setting the bitmaps
                    var width = DpiHandler.ScaleWithDpi(coreConfiguration.IconSize.Width, info.NewDpi);
                    var size  = new Size(width, width);
                    contextMenu.SuspendLayout();
                    contextMenu.ImageScalingSize   = size;
                    contextmenu_quicksettings.Size = new Size(170, width + 8);
                    break;

                case DpiChangeEventTypes.After:
                    // Redraw the form
                    contextMenu.ResumeLayout(true);
                    contextMenu.Refresh();
                    notifyIcon.Icon = GreenshotResources.GetGreenshotIcon();
                    break;
                }
            });

            var contextMenuResourceScaleHandler = BitmapScaleHandler.WithComponentResourceManager(ContextMenuDpiHandler, GetType(), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi));

            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturewindow, "contextmenu_capturewindow.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturearea, "contextmenu_capturearea.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturelastregion, "contextmenu_capturelastregion.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturefullscreen, "contextmenu_capturefullscreen.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_captureclipboard, "contextmenu_captureclipboard.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_openfile, "contextmenu_openfile.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_settings, "contextmenu_settings.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_help, "contextmenu_help.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_donate, "contextmenu_donate.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_exit, "contextmenu_exit.Image");

            // this is special handling, for the icons which come from the executables
            var exeBitmapScaleHandler = BitmapScaleHandler.Create <string>(ContextMenuDpiHandler,
                                                                           (path, dpi) => PluginUtils.GetCachedExeIcon(path, 0, dpi >= 120),
                                                                           (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi));

            exeBitmapScaleHandler.AddTarget(contextmenu_captureie, PluginUtils.GetExePath("iexplore.exe"));

            // Add cleanup
            Application.ApplicationExit += (sender, args) =>
            {
                dpiChangeSubscription.Dispose();
                ContextMenuDpiHandler.Dispose();
                contextMenuResourceScaleHandler.Dispose();
                exeBitmapScaleHandler.Dispose();
            };
        }
Exemple #10
0
        /// <summary>
        ///  Free resources
        /// </summary>
        private void Cleanup()
        {
            if (hOldObject != IntPtr.Zero && hDCDest != IntPtr.Zero)
            {
                // restore selection (old handle)
                GDI32.SelectObject(hDCDest, hOldObject);
                GDI32.DeleteDC(hDCDest);
            }
            if (hDCDesktop != IntPtr.Zero)
            {
                User32.ReleaseDC(hWndDesktop, hDCDesktop);
            }
            if (hDIBSection != IntPtr.Zero)
            {
                // free up the Bitmap object
                GDI32.DeleteObject(hDIBSection);
            }

            if (disabledDWM)
            {
                DWM.EnableComposition();
            }
            if (aviWriter != null)
            {
                aviWriter.Dispose();
                aviWriter = null;

                string ffmpegexe = PluginUtils.GetExePath("ffmpeg.exe");
                if (ffmpegexe != null)
                {
                    try {
                        string webMFile  = filename.Replace(".avi", ".webm");
                        string arguments = "-i \"" + filename + "\" -codec:v libvpx -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 42 -maxrate 1000k -bufsize 4000k -threads 4 \"" + webMFile + "\"";
                        LOG.DebugFormat("Starting {0} with arguments {1}", ffmpegexe, arguments);
                        ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, arguments);
                        processStartInfo.CreateNoWindow         = false;
                        processStartInfo.RedirectStandardOutput = false;
                        processStartInfo.UseShellExecute        = false;
                        Process process = Process.Start(processStartInfo);
                        process.WaitForExit();
                        if (process.ExitCode == 0)
                        {
                            MessageBox.Show("Recording written to " + webMFile);
                        }
                    } catch (Exception ex) {
                        MessageBox.Show("Recording written to " + filename + " couldn't convert due to an error: " + ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Recording written to " + filename);
                }
            }
        }
Exemple #11
0
 public WordDestination(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     ) : base(coreConfiguration, greenshotLanguage)
 {
     _exePath = PluginUtils.GetExePath("WINWORD.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
 }
 public PowerpointDestination(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     ) : base(coreConfiguration, greenshotLanguage)
 {
     _exePath = PluginUtils.GetExePath("POWERPNT.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
 }
 static PowerpointDestination()
 {
     exePath = PluginUtils.GetExePath("POWERPNT.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         WindowDetails.AddProcessToExcludeFromFreeze("powerpnt");
     }
     else
     {
         exePath = null;
     }
 }
Exemple #14
0
 static ExcelDestination()
 {
     ExePath = PluginUtils.GetExePath("EXCEL.EXE");
     if (ExePath != null && File.Exists(ExePath))
     {
         WindowDetails.AddProcessToExcludeFromFreeze("excel");
     }
     else
     {
         ExePath = null;
     }
 }
Exemple #15
0
 static OneNoteDestination()
 {
     exePath = PluginUtils.GetExePath("ONENOTE.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         WindowDetails.AddProcessToExcludeFromFreeze("onenote");
     }
     else
     {
         exePath = null;
     }
 }
Exemple #16
0
 static WordDestination()
 {
     exePath = PluginUtils.GetExePath("WINWORD.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         applicationIcon = PluginUtils.GetExeIcon(exePath, 0);
         documentIcon    = PluginUtils.GetExeIcon(exePath, 1);
     }
     else
     {
         exePath = null;
     }
 }
Exemple #17
0
 static ExcelDestination()
 {
     exePath = PluginUtils.GetExePath("EXCEL.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         applicationIcon = PluginUtils.GetExeIcon(exePath, 0);
         workbookIcon    = PluginUtils.GetExeIcon(exePath, 1);
         WindowDetails.AddProcessToExcludeFromFreeze("excel");
     }
     else
     {
         exePath = null;
     }
 }
Exemple #18
0
 /// <summary>
 /// Fix icon reference
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnIconSizeChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IconSize")
     {
         try {
             string exePath = PluginUtils.GetExePath("cmd.exe");
             if (exePath != null && File.Exists(exePath))
             {
                 itemPlugInRoot.Image = PluginUtils.GetCachedExeIcon(exePath, 0);
             }
         } catch (Exception ex) {
             LOG.Warn("Couldn't get the cmd.exe image", ex);
         }
     }
 }
 public OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         _isActiveFlag = true;
     }
     _exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
     if (_exePath == null)
     {
         _isActiveFlag = false;
     }
 }
Exemple #20
0
 static OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         isActiveFlag = true;
     }
     exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         WindowDetails.AddProcessToExcludeFromFreeze("outlook");
     }
     else
     {
         exePath = null;
     }
     if (exePath == null)
     {
         isActiveFlag = false;
     }
 }
 public OutlookDestination(
     IOfficeConfiguration officeConfiguration,
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     ) : base(coreConfiguration, greenshotLanguage)
 {
     _officeConfiguration = officeConfiguration;
     if (EmailConfigHelper.HasOutlook())
     {
         _isActiveFlag = true;
     }
     _exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
     if (_exePath == null)
     {
         _isActiveFlag = false;
     }
 }
 /// <summary>
 ///     Fix icon reference
 /// </summary>
 /// <param name="dpi">double with DPI</param>
 private void OnIconSizeChanged(double dpi)
 {
     try
     {
         var exePath = PluginUtils.GetExePath("cmd.exe");
         if (exePath == null || !File.Exists(exePath))
         {
             return;
         }
         if (true.Equals(_itemPlugInRoot.Tag))
         {
             _itemPlugInRoot.Image?.Dispose();
         }
         var exeIcon = PluginUtils.GetCachedExeIcon(exePath, 0, dpi > 100);
         _itemPlugInRoot.Image = exeIcon.ScaleIconForDisplaying(dpi);
         _itemPlugInRoot.Tag   = !Equals(exeIcon, _itemPlugInRoot.Image);
     }
     catch (Exception ex)
     {
         Log.Warn().WriteLine(ex, "Couldn't get the cmd.exe image");
     }
 }
        protected override void Load(ContainerBuilder builder)
        {
            var hasDestination = false;

            if (PluginUtils.GetExePath("EXCEL.EXE") != null)
            {
                hasDestination = true;
                builder
                .RegisterType <ExcelDestination>()
                .As <IDestination>()
                .SingleInstance();
            }

            if (PluginUtils.GetExePath("WINWORD.EXE") != null)
            {
                hasDestination = true;
                builder
                .RegisterType <WordDestination>()
                .As <IDestination>()
                .SingleInstance();
            }

            if (PluginUtils.GetExePath("POWERPNT.EXE") != null)
            {
                hasDestination = true;
                builder
                .RegisterType <PowerpointDestination>()
                .As <IDestination>()
                .SingleInstance();
            }

            if (PluginUtils.GetExePath("ONENOTE.EXE") != null)
            {
                hasDestination = true;
                builder
                .RegisterType <OneNoteDestination>()
                .As <IDestination>()
                .SingleInstance();
            }

            if (PluginUtils.GetExePath("OUTLOOK.EXE") != null)
            {
                hasDestination = true;
                builder
                .RegisterType <OutlookDestination>()
                .As <IDestination>()
                .SingleInstance();
            }

            if (hasDestination)
            {
                builder
                .Register(context => IniConfig.Current.Get <IOfficeConfiguration>())
                .As <IOfficeConfiguration>()
                .SingleInstance();


                builder
                .Register(context => LanguageLoader.Current.Get <IOfficeLanguage>())
                .As <IOfficeLanguage>()
                .SingleInstance();

                builder
                .RegisterType <OfficeConfigViewModel>()
                .As <IConfigScreen>()
                .SingleInstance();
            }

            base.Load(builder);
        }