예제 #1
0
        public static void DownloadAndInstallPython()
        {
            Logger.Debug("Downloading python...");
            var url            = PythonDownloadUrl;
            var destinationDir = AppDataDirectory;
            var localZipFile   = Path.Combine(destinationDir, "python.zip");
            var extractToDir   = Path.Combine(destinationDir, "python");

            // Download python
            var proxy  = WakaTimePackage.GetProxy();
            var client = new WebClient {
                Proxy = proxy
            };

            client.DownloadFile(url, localZipFile);
            Logger.Debug("Finished downloading python.");

            // Remove old python folder if it exists
            RecursiveDelete(extractToDir);

            // Extract wakatime cli zip file
            Logger.Debug(string.Format("Extracting python to: {0}", extractToDir));
            ZipFile.ExtractToDirectory(localZipFile, extractToDir);
            Logger.Debug("Finished extracting python.");

            try {
                File.Delete(localZipFile);
            } catch { /* ignored */ }
        }
        static public void DownloadAndInstallPython()
        {
            Logger.Debug("Downloading python...");

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

            // Check for proxy setting
            var proxy = WakaTimePackage.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
        public static void DownloadAndInstallCli()
        {
            Logger.Debug("Downloading wakatime-cli...");
            var url            = Constants.CliUrl;
            var destinationDir = AppDataDirectory;
            var localZipFile   = Path.Combine(destinationDir, "wakatime-cli.zip");

            // Download wakatime-cli
            var proxy  = WakaTimePackage.GetProxy();
            var client = new WebClient {
                Proxy = proxy
            };

            client.DownloadFile(url, localZipFile);
            Logger.Debug("Finished downloading wakatime-cli.");

            // Remove old folder if it exists
            RecursiveDelete(Path.Combine(destinationDir, "wakatime-master"));

            // Extract wakatime-cli zip file
            Logger.Debug(string.Format("Extracting wakatime-cli to: {0}", destinationDir));
            ZipFile.ExtractToDirectory(localZipFile, destinationDir);
            Logger.Debug("Finished extracting wakatime-cli.");

            try {
                File.Delete(localZipFile);
            } catch { /* ignored */ }
        }
예제 #4
0
        static public void DownloadAndInstallCli()
        {
            Logger.Debug("Downloading wakatime cli...");

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

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

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

            var client = new WebClient {
                Proxy = proxy
            };

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

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

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

            try
            {
                File.Delete(localZipFile);
            }
            catch { /* ignored */ }
        }
예제 #5
0
        internal static void DownloadFile(string url, string saveAs)
        {
            if (!ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12))
            {
                ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12;
            }
            var proxy  = WakaTimePackage.GetProxy();
            var client = new WebClient {
                Proxy = proxy
            };

            client.DownloadFile(url, saveAs);
        }
예제 #6
0
        private static WebClient GetWebClient()
        {
            if (!ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12))
            {
                ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
            }

            var proxy = WakaTimePackage.GetProxy();

            return(new WebClient {
                Proxy = proxy
            });
        }
예제 #7
0
        static void beNotified(IntPtr notifyCode)
        {
            ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification));

            if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION)
            {
                PluginBase._funcItems.RefreshItems();
                WakaTimePackage.SetToolBarIcon();
            }
            else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN)
            {
                WakaTimePackage.PluginCleanUp();
                Marshal.FreeHGlobal(_ptrPluginName);
            }
            else
            {
                WakaTimePackage.OnNotification(notification);
            }
        }
예제 #8
0
 static void setInfo(NppData notepadPlusData)
 {
     PluginBase.nppData = notepadPlusData;
     WakaTimePackage.CommandMenuInit();
 }