static void beNotified(IntPtr notifyCode)
        {
            SCNotification nc = (SCNotification)Marshal.PtrToStructure(notifyCode, typeof(SCNotification));

            if (nc.nmhdr.code == (uint)NppMsg.NPPN_TBMODIFICATION)
            {
                PluginBase.FuncItems.RefreshItems();
                WakaTime.SetToolBarIcon();
            }
            else if (nc.nmhdr.code == (uint)NppMsg.NPPN_SHUTDOWN)
            {
                WakaTime.PluginCleanUp();
                Marshal.FreeHGlobal(_ptrPluginName);
            }
            else if (nc.nmhdr.code == (uint)NppMsg.NPPN_FILESAVED)
            {
                WakaTime.HandleActivity(true);
            }
            else if (nc.nmhdr.code == (uint)SciMsg.SCI_ADDTEXT)
            {
                WakaTime.HandleActivity(false);
            }
            else if (nc.nmhdr.code == (uint)SciMsg.SCI_INSERTTEXT)
            {
                WakaTime.HandleActivity(false);
            }
        }
示例#2
0
        static public void DownloadAndInstallPython()
        {
            Logger.Debug("Downloading python...");

            var url            = PythonManager.PythonDownloadUrl;
            var destinationDir = WakaTimeConstants.PluginConfigDir;

            // Check for proxy setting
            var proxy = WakaTime.GetProxy();

            var localFile = Path.Combine(destinationDir, "python.zip");

            var client = new WebClient {
                Proxy = proxy
            };

            // Download embeddable python
            client.DownloadFile(url, localFile);

            Logger.Debug("Finished downloading python.");

            // Extract wakatime cli zip file
            ZipFile.ExtractToDirectory(localFile, Path.Combine(destinationDir, "python"));

            Logger.Debug(string.Format("Finished extracting python: {0}", Path.Combine(destinationDir, "python")));

            try
            {
                File.Delete(localFile);
            }
            catch { /* ignored */ }
        }
示例#3
0
        static public void DownloadAndInstallCli()
        {
            Logger.Debug("Downloading iTimeTrack cli...");

            var url            = WakaTimeConstants.CliUrl;
            var destinationDir = WakaTimeConstants.PluginConfigDir;

            // clean up old wakatime-master directory
            try
            {
                Directory.Delete(Path.Combine(destinationDir, "itimetrack-master"), true);
            }
            catch { /* ignored */ }

            // Check for proxy setting
            var proxy = WakaTime.GetProxy();

            var localZipFile = Path.Combine(destinationDir, "itimetrack-cli.zip");

            var client = new WebClient {
                Proxy = proxy
            };

            // Download wakatime cli
            client.DownloadFile(url, localZipFile);

            Logger.Debug("Finished downloading iTimeTrack cli.");

            // Extract wakatime cli zip file
            ZipFile.ExtractToDirectory(localZipFile, destinationDir);

            try
            {
                File.Delete(localZipFile);
            }
            catch { /* ignored */ }
        }
 public CustomApplicationContext()
 {
     InitializeContext();
     _wakaTime = new WakaTime(_notifyIcon);
     _wakaTime.Initialize();
 }
示例#5
0
        internal static void DownloadFile(string url, string saveAs)
        {
            var client = WakaTime.GetWebClient();

            client.DownloadFile(url, saveAs);
        }
 static void setInfo(NppData notepadPlusData)
 {
     PluginBase.NppData = notepadPlusData;
     WakaTime.CommandMenuInit();
 }
 public CustomApplicationContext()
 {
     InitializeContext();
     _wakaTime = new WakaTime(_notifyIcon);
     _wakaTime.Initialize();
 }