public bool UnzipPackage() { var path = GetLocalFolderPath(); var filename = GetLocalFilename(); if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(filename)) { return(false); } lock (waitForDigest) { if (!string.IsNullOrEmpty(_sha256sum) && Misc.Utils.GetSha256SumFromFile(filename) != _sha256sum) { setting.SendLog(I18N.FileCheckSumFail); return(false); } } VgcApis.Misc.Utils.Sleep(2000); try { Misc.Utils.ZipFileDecompress(filename, path); } catch { setting.SendLog(I18N.DecompressFileFail); return(false); } return(true); }
public bool UnzipPackage() { var path = GetLocalFolderPath(); var filename = GetLocalFilename(); if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(filename)) { setting.SendLog(I18N.LocateTargetFolderFail); return(false); } lock (waitForDigest) { if (!string.IsNullOrEmpty(_sha256sum) && Misc.Utils.GetSha256SumFromFile(filename) != _sha256sum) { setting.SendLog(I18N.FileCheckSumFail); return(false); } } VgcApis.Misc.Utils.Sleep(1000); try { RemoveOldExe(path); Misc.Utils.ZipFileDecompress(filename, path); } catch (Exception ex) { setting.SendLog(I18N.DecompressFileFail + Environment.NewLine + ex.ToString()); return(false); } return(true); }
public void Log(string message) { qLogger.Log(message); try { setting.SendLog($"[{coreInfo.GetName()}] {message}"); } catch { } }
public void Log(string message) { try { setting.SendLog($"[{coreInfo.GetIndex()}.{coreInfo.GetShortName()}] {message}"); OnLog?.Invoke(this, message); } catch { } }
private void InitCtrlBatchOperation( ToolStripMenuItem stopSelected, ToolStripMenuItem restartSelected, ToolStripMenuItem runBatchSpeedtest, ToolStripMenuItem stopBatchSpeedtest, ToolStripMenuItem clearSpeedtestResults, ToolStripMenuItem modifySelected) { clearSpeedtestResults.Click += RunWhenSelectionIsNotEmptyHandler(() => { if (Misc.UI.Confirm(I18N.ConfirmClearSpeedTestResults)) { ClearSelectedServersSpeedTestResults(); } }); modifySelected.Click += RunWhenSelectionIsNotEmptyHandler( () => Views.WinForms.FormBatchModifyServerSetting.GetForm()); runBatchSpeedtest.Click += RunWhenSelectionIsNotEmptyHandler(() => { if (!Misc.UI.Confirm(I18N.TestWillTakeALongTime)) { return; } servers.RunSpeedTestOnSelectedServersBg(); }); stopBatchSpeedtest.Click += (s, a) => { settings.SendLog(I18N.StoppingSpeedtest); settings.isSpeedtestCancelled = true; }; stopSelected.Click += RunWhenSelectionIsNotEmptyHandler(() => { if (Misc.UI.Confirm(I18N.ConfirmStopAllSelectedServers)) { servers.StopSelectedServersThen(); } }); restartSelected.Click += RunWhenSelectionIsNotEmptyHandler(() => { if (Misc.UI.Confirm(I18N.ConfirmRestartAllSelectedServers)) { servers.RestartSelectedServersThen(); } }); }
private void LogDownloadFails(IEnumerable <string> links) { var downloadFailUrls = links.ToList(); if (downloadFailUrls.Count() <= 0) { return; } downloadFailUrls.Insert(0, ""); setting.SendLog(string.Join( Environment.NewLine + I18N.DownloadFail + @" ", downloadFailUrls)); }
public bool UnzipPackage() { var path = GetLocalFolderPath(); var filename = GetLocalFilename(); if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(filename)) { setting.SendLog(I18N.LocateTargetFolderFail); return(false); } VgcApis.Misc.Utils.Sleep(1000); try { RemoveOldExe(path); Misc.Utils.ZipFileDecompress(filename, path); } catch (Exception ex) { setting.SendLog(I18N.DecompressFileFail + Environment.NewLine + ex.ToString()); return(false); } return(true); }
Tuple <string, string, int> GetInboundInfoFromCustomInboundsSetting() { try { var jobj = JArray.Parse(setting.CustomDefInbounds)[0]; var protocol = Misc.Utils.GetValue <string>(jobj, "protocol"); string ip = Misc.Utils.GetValue <string>(jobj, "listen"); int port = Misc.Utils.GetValue <int>(jobj, "port"); return(new Tuple <string, string, int>(protocol, ip, port)); } catch { setting.SendLog(I18N.ParseCustomInboundsSettingFail); } return(null); }
private void lbScanQRCode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { void Success(string text) { var msg = VgcApis.Misc.Utils.AutoEllipsis(text, VgcApis.Models.Consts.AutoEllipsis.QrcodeTextMaxLength); setting.SendLog($"QRCode: {msg}"); slinkMgr.ImportLinkWithOutV2cfgLinks(text); } void Fail() { MessageBox.Show(I18N.NoQRCode); } Libs.QRCode.QRCode.ScanQRCode(Success, Fail); }
private void lbScanQRCode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { void Success(string text) { var msg = Misc.Utils.CutStr(text, 90); setting.SendLog($"QRCode: {msg}"); slinkMgr.ImportLinkWithOutV2cfgLinks(text); } void Fail() { MessageBox.Show(I18N.NoQRCode); } Libs.QRCode.QRCode.ScanQRCode(Success, Fail); }