private async void CheckUrl(Server server,Action<int> callback) { bool enablecookie = false; if (server.Name == "DMM" || server.Name == "DB" || server.Name == "MOO") enablecookie = true; (bool result, string title) = await Net.TestAndGetTitle(server.Url, enablecookie, server.Cookie, server.Name); if (!result && title.IndexOf("DB") >= 0) { await Dispatcher.BeginInvoke((Action)delegate { HandyControl.Controls.Growl.Error(Jvedio.Language.Resources.Message_TestError, "SettingsGrowl"); }); callback.Invoke(0); } if (result && title != "") { server.Available = 1; if (title.IndexOf("JavBus") >= 0 && title.IndexOf("歐美") < 0) { server.Name = "Bus"; } else if (title.IndexOf("JavBus") >= 0 && title.IndexOf("歐美") >= 0) { server.Name = "BusEurope"; } else if (title.IndexOf("JavDB") >= 0) { server.Name = "DB"; } else if (title.IndexOf("JavLibrary") >= 0) { server.Name = "Library"; } else if (title.IndexOf("FANZA") >= 0) { server.Name = "DMM"; if (server.Url.EndsWith("top/")) server.Url = server.Url.Replace("top/", ""); } else if (title.IndexOf("FC2コンテンツマーケット") >= 0 || title.IndexOf("FC2电子市场") >= 0) { server.Name = "FC2"; } else if (title.IndexOf("JAV321") >= 0) { server.Name = "Jav321"; } else if (title.IndexOf("AVMOO") >= 0) { server.Name = "MOO"; } else { server.Name = title; } } else { server.Available = -1; } await Dispatcher.BeginInvoke((Action)delegate { ServersDataGrid.Items.Refresh(); }); if (NeedCookie.Contains(server.Name)) { //是否包含 cookie if (server.Cookie == Jvedio.Language.Resources.Nothing || server.Cookie == "") { server.Available = -1; await Dispatcher.BeginInvoke((Action)delegate { new Msgbox(this, Jvedio.Language.Resources.Message_NeedCookies).ShowDialog(); }); } else { ServerConfig.Instance.SaveServer(server);//保存覆盖 } } else { ServerConfig.Instance.SaveServer(server);//保存覆盖 } callback.Invoke(0); }
private void DeleteServer(object sender, RoutedEventArgs e) { Server server = vieModel_Settings.Servers[CurrentRowIndex]; ServerConfig.Instance.DeleteByName(server.Name); vieModel_Settings.Servers.RemoveAt(CurrentRowIndex); }