public ConfiguratorForm(IExecutor exec) { this.exec = exec ?? throw new ArgumentNullException(nameof(exec)); extcfg = new Lazy <IExtCfg>(() => new FilterLineControl(this, exec)); caller = new Caller(exec.Config.SlnDir); pkgVer = new PackageInfo(exec); confFormater = new SimpleConfFormater(exec); InitializeComponent(); updaterInitName = tabUpdating.Text; Text = GetVersionInfo(); projectItems.Browse = projectItems.OpenUrl = (string url) => url.OpenUrl(); projectItems.NamespaceValidate = (string ns) => DDNS.IsValidNS(ns?.Trim()); ShowFilterPanel(); txtBuildInfo.Text = GetBuildInfo(); RenderSlnFiles(); comboBoxSln.SelectedIndex = 0; storage = new CfgStorage(exec, comboBoxStorage); storage.UpdateItem(); projectItems.Set(null); // TODO: this only when no projects in solution and only when initial start }
public ConfiguratorForm(IExecutor exec) { this.exec = exec ?? throw new ArgumentNullException(nameof(exec)); InitializeComponent(); Text = ".NET DllExport"; #if PUBLIC_RELEASE Text += " - v" + WizardVersion.S_INFO; #else Text += $" - Based on v{WizardVersion.S_NUM} {WizardVersion.S_REL} [{WizardVersion.BRANCH_SHA1}]"; #endif #if DEBUG Text += " [ Debug ]"; #endif Text += " github.com/3F/DllExport"; projectItems.Browse = projectItems.OpenUrl = OpenUrl; projectItems.NamespaceValidate = (string ns) => { return(DDNS.IsValidNS(ns?.Trim())); }; RenderSlnFiles(); comboBoxSln.SelectedIndex = 0; storage = new CfgStorage(exec, comboBoxStorage); storage.UpdateItem(); Load += (object sender, EventArgs e) => { TopMost = false; TopMost = true; }; }
public void nsTest1() { Assert.AreEqual(true, DDNS.IsValidNS("net.r_eg.DllExport")); Assert.AreEqual(true, DDNS.IsValidNS(" ")); Assert.AreEqual(true, DDNS.IsValidNS(" ")); Assert.AreEqual(true, DDNS.IsValidNS(null)); Assert.AreEqual(true, DDNS.IsValidNS(String.Empty)); }
private void comboNS_TextUpdate(object sender, EventArgs e) { if (!DDNS.IsValidNS(comboNS.Text)) { panelNScombo.BackColor = System.Drawing.Color.FromArgb(234, 0, 0); } else { panelNScombo.BackColor = System.Drawing.Color.FromArgb(92, 158, 207); } }
public void nsTest1() { Assert.AreEqual(true, DDNS.IsValidNS("net.r_eg.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("net.r_eg..DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("net.r-eg.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("net. r_eg . DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("net.r_eg.DllExport.")); Assert.AreEqual(false, DDNS.IsValidNS("0net.r_eg.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS(".net.r_eg.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS(" ")); Assert.AreEqual(false, DDNS.IsValidNS(null)); }
private void btnConfigure_Click(object sender, EventArgs e) { prefilter(); if (!DDNS.IsValidNS(comboNS.Text)) { MessageBox.Show("Your namespace is not correct.", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } apply(); FormClosed -= InstallationForm_FormClosed; Close(); }
private bool SaveProjects(IEnumerable <IProject> projects) { foreach (var prj in projects) { if (!DDNS.IsValidNS(prj.Config.Namespace)) { this.ForegroundAction(_ => MessageBox.Show( $"{prj.ProjectPath}\n\n>> Namespace: '{prj.Config.Namespace}'", "Fix data before continue", 0, MessageBoxIcon.Warning )); return(false); } exec.TargetsFileIfCfg?.Configure(ActionType.Configure, prj); prj.Configure(ActionType.Configure); } return(true); }
private async void OnForceUpdate() { UpdateCurrentIP(); var updateModels = from u in Runtime.UpdateList select u.UnWrap(); try { await DDNS.Start(updateModels, true); } catch (WebException) { MessageBox.Show("无法连接至服务器."); } Runtime.SetUpdateList(updateModels); DDnsSharpRuntime.AppConfig.UpdateList = updateModels.ToList(); DDnsSharpRuntime.SaveAppConfig(); }
private void btnApply_Click(object sender, EventArgs e) { foreach (var prj in projectItems.Data) { if (!DDNS.IsValidNS(prj.Config.Namespace)) { MessageBox.Show($"Fix incorrect namespace before continue:\n\n'{prj.Config.Namespace}'", "Incorrect data", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (exec.Config.CfgStorage == CfgStorageType.TargetsFile) { exec.TargetsFile?.Configure(ActionType.Configure, prj); } prj.Configure(ActionType.Configure); } Close(); }
private async void OnJob() { try { DDnsSharpRuntime.LoadAppConfig(); await DDNS.Start(DDnsSharpRuntime.AppConfig.UpdateList); DDnsSharpRuntime.SaveAppConfig(); if (timer.Interval > 30000) { timer.Interval = 30000; } } catch (Exception ex) { logger.ErrorException("更新记录时出现意外错误", ex); timer.Interval = 300000; } }
public void nsTest3() { // https://github.com/3F/DllExport/issues/61#issuecomment-352804273 Assert.AreEqual(true, DDNS.IsValidNS("あいうえおかきくけこ")); Assert.AreEqual(true, DDNS.IsValidNS("中文解决方案名称")); Assert.AreEqual(true, DDNS.IsValidNS("あいうえおかきくけこ.DllExport")); Assert.AreEqual(true, DDNS.IsValidNS("中文解决方案名称.DllExport")); Assert.AreEqual(true, DDNS.IsValidNS("Проверка")); Assert.AreEqual(true, DDNS.IsValidNS("Проверка.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("0あいうえおかきくけこ")); Assert.AreEqual(false, DDNS.IsValidNS("0中文解决方案名称")); Assert.AreEqual(false, DDNS.IsValidNS("0あいうえおかきくけこ.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("0中文解决方案名称.DllExport")); Assert.AreEqual(false, DDNS.IsValidNS("0Проверка")); Assert.AreEqual(false, DDNS.IsValidNS("0Проверка.DllExport")); }
private void Update(object state) { lock (thisLock) { var t1 = new DDNS(accessKeyId, accessKeySecret); var ip = Util.GetPublicIp(); if (!Util.IsIPv4Address(ip)) { UpdateLog(@"获取公网 IP 出错,解析记录未改变"); return; } UpdateLog($@"公网 IP: {ip}"); var subDomain = $@"{RR}.{Domain}"; var lastIp = t1.GetSubDomainARecord(subDomain); var lastRecordId = t1.GetSubDomainRecordId(subDomain); if (lastIp != ip) { if (t1.UpdateDomainRecord(RR, Domain, ip) == lastRecordId && t1.GetSubDomainARecord(subDomain) == ip) { UpdateLog($@"解析记录更改成功:{lastIp} → {ip}"); } else { UpdateLog(@"解析记录更改失败,请检查输入是否正确"); } } else { UpdateLog(@"公网 IP 未改变"); } } }