public void OpenUrl(string url) { CustomChrominWebBrowser browser = new CustomChrominWebBrowser(url); browser.LifeSpanHandler = LifeSpanHandler; var page = new ChrominViewModel(browser); browser.RequestHandler = new CustomRequestHandler(); browser.LoadHandler = new CustomLoadHandler(page); browser.MenuHandler = new CustomMenuHandler(); browser.DownloadHandler = DownloadHandler; //browser.StatusMessage += Browser_StatusMessage; //browser.CommandBindings.Add(new CommandBinding(CustomDownloadHandler.DownloadUpdated,new ExecutedRoutedEventHandler(DownloadUpdated)));//,new CanExecuteRoutedEventHandler(CanDownloadUpdated) page.IsSelected = true; PreLoad = page; if (PageList.Count > 0) { PageList.Insert(GetCurentPageIndex() + 1, page); } else { PageList.Add(page); } }
private void Web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { string[] baslik = new string[24]; string[] tarih = new string[24]; for (int i = 0; i < 24; i++) { string id = ("post" + i + ""); var text = web.Document.GetElementById(id); HtmlElementCollection tag = text.GetElementsByTagName("a"); url[i] = tag[0].GetAttribute("href"); baslik[i] = tag[0].InnerText; HtmlElementCollection tag2 = text.GetElementsByTagName("span"); tarih[i] = tag2[0].InnerText; } for (int i = 0; i < 24; i++) { PageModel model = new PageModel(); model.Baslik = baslik[i]; model.Tarih = tarih[i]; PageList.Add(model); } }
void TestToolStripMenuItemClick(object sender, EventArgs e) { Site import = new Site("http://www.startupcloud.it", null, null); Page main = new Page(import, "Startup_Cloud"); PageList list = new PageList(import); main.Load(); Regex rx1 = new Regex("\\[\\[(\\w*)]\\]\\s*(\\[\\[(.*)\\]\\])?\\s*(.*)", RegexOptions.Compiled | RegexOptions.Multiline); Regex rx2 = new Regex("<.*>(.*)<.*>", RegexOptions.Compiled); MatchCollection matches = rx1.Matches(main.text); foreach (Match match in matches) { GroupCollection groups = match.Groups; string name = groups[1].Value; string val = groups[4].Value; Match r = rx2.Match(val); if (r.Success) { val = r.Groups[1].Value; } Page p = new Page(import, name); list.Add(p); p.Load(); meOut.Text += name + " " + val + "\n"; meOut.Text += p.text; break; } }
public void CreatePaging() { if (PageList != null) { PageList.Clear(); } if (SourceList != null && SourceList.Count > 0) { int pageCount = 0; if (SourceList.Count % ItemsOnPageCount == 0) { pageCount = (SourceList.Count / ItemsOnPageCount); } else { pageCount = (SourceList.Count / ItemsOnPageCount) + 1; } for (int i = 0; i < pageCount; i++) { PageList.Add(i); } } SelectedIndex = 0; }
public void DeletePage(int Page) { for (int i = 0; i < DesktopItemList.Count; i++) { if (DesktopItemList.ElementAt(i).Page == Page) { DesktopItemList.RemoveAt(i); i--; } } PageList.Remove(Page); Dictionary <int, string> tempList = new Dictionary <int, string>(); for (int i = 0; i < PageList.Count(); i++) { if (PageList.ElementAt(i).Key > Page) { tempList.Add(PageList.ElementAt(i).Key - 1, PageList.ElementAt(i).Value); PageList.Remove(PageList.ElementAt(i).Key); i--; } } foreach (var item in tempList) { PageList.Add(item.Key, item.Value); } PageList = PageList.OrderBy(o => o.Key).ToDictionary(o => o.Key, p => p.Value); Save(); }
private void AddPagesIntoList(FbPageInfo obj) { App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE { PageList.Add(obj); }); //Task.Factory.StartNew(() => FillPageList()); }
public void GetModels() { PageList.Add(new Model.Model("Line Busy Indicator")); PageList.Add(new Model.Model("Rotating Busy Indicator")); PageList.Add(new Model.Model("Progress Bar List")); PageList.Add(new Model.Model("Media Control")); PageList.Add(new Model.Model("Numeric Up Down")); PageList.Add(new Model.Model("Select Panel")); PageList.Add(new Model.Model("Selective List")); }
public void Start() { Task getPagesThread; getPagesThread = Task.Run(() => GetPages()); Thread.Sleep(1); for (; AnalyzingPage < PageList.Count; AnalyzingPage++) { if (paused) { analizePause = true; } while (paused) { Thread.Sleep(1); } while (PageList[AnalyzingPage].content == null) { Thread.Sleep(5); } matrix[AnalyzingPage, AnalyzingPage] = 1; if (PageList[AnalyzingPage].statusCode != HttpStatusCode.OK) { continue; } var pageLinks = GetAllLinks(PageList[AnalyzingPage].content).ToArray(); for (int i = 0; i < pageLinks.Length; i++) { var item = pageLinks[i]; if (!PageList.AsParallel().Any(x => x.url == item)) { PageList.Add(new Page(item, PageList.Count)); var vector = Vector <double> .Build.Dense(matrix.RowCount, 0); matrix = matrix.InsertRow(matrix.RowCount, vector); vector = Vector <double> .Build.Dense(matrix.RowCount, 0); matrix = matrix.InsertColumn(matrix.ColumnCount, vector); } var index = PageList.FindIndex(x => x.url == item); matrix[index, AnalyzingPage] = 1; } var analizedPage = PageList[AnalyzingPage]; analizedPage.content = null; PageList[AnalyzingPage] = analizedPage; } IsDone = true; OnComplete(); }
public MainWindow() { InitializeComponent(); PageList.Add(new UsersViewer()); PageList.Add(new ControlMaps()); PageList.Add(new ControlSettings()); SelectedObj = PageList[0]; this.DataContext = this; }
public void DeleteSubApp(DesktopItem Item) { int page = Item.Page; DesktopItemList.Remove(Item); if (File.Exists(Item.Config)) { File.Delete(Item.Config); } bool isExist = false; foreach (DesktopItem i in DesktopItemList) { if (i.Page == page) { isExist = true; break; } } if (!isExist) { foreach (DesktopItem i in DesktopItemList) { if (i.Page > page) { i.Page--; } } PageList.Remove(page); Dictionary <int, string> tempList = new Dictionary <int, string>(); for (int i = 0; i < PageList.Count(); i++) { if (PageList.ElementAt(i).Key > page) { tempList.Add(PageList.ElementAt(i).Key - 1, PageList.ElementAt(i).Value); PageList.Remove(PageList.ElementAt(i).Key); i--; } } foreach (var item in tempList) { PageList.Add(item.Key, item.Value); } } Save(); }
public Spider(string homePage) { IsDone = false; if (homePage.EndsWith("/")) { homePage = homePage.Substring(0, homePage.Length - 1); } HomePage = homePage; PageList.Add(new Page(HomePage, PageList.Count)); matrix = Matrix <double> .Build.Sparse(1, 1, 0); AnalyzingPage = 0; }
public static void addpages(Site site, PageList pl) { //Page pp1 = new Page(site, "Aega monophthalma"); pl.Add(pp1); List <string> sl = new List <string>(); //sl.Add("Lista över insjöar i Arjeplogs kommun (1-1000)"); sl.Add("Ðakovića Kosa"); sl.Add("Ðanuša"); foreach (string s in sl) { Page pp = new Page(site, s); pl.Add(pp); } }
/// <summary> /// 执行查询SQL,返回列表object /// </summary> /// <param name="sql"></param> /// <param name="pageSize"></param> /// <param name="curPage"></param> /// <param name="returnClass">不能为null</param> /// <returns></returns> public PageList <T> ExecutePageListObjectByType <T>(string sql, string orderKey, int pageSize, int curPage, Type returnClass) { PageList <T> objs = new PageList <T>(); T obj; IDataReader idr = null; // 计算获取的记录编号范围(当前页) objs.SetPage(pageSize, curPage); try { // 获取总记录数 if (pageSize != -1) { objs.TotalCount = ParamUtil.getint(_db.ExecuteScalarBySql(_isql.CountSql(sql))); } string pageSql = _isql.PageSql(sql, orderKey, objs.StartRecord, objs.EndRecord); // 执行查询 idr = _db.ExecuteReaderBySql(pageSql); // 获取指定范围的数据 while (idr.Read()) { obj = (T)ReflectUtil.CreateInstance(returnClass); // 第一列为COL_ROWNUM(记录号),不设置属性值 for (int i = 1; i < idr.FieldCount; i++) { ReflectUtil.SetPropertyValue(obj, idr.GetName(i), idr.GetValue(i)); } objs.Add(obj); } // 如果未分页,则设置总数为当前页记录数 if (pageSize == -1) { objs.TotalCount = objs.CurPageCount; } } finally { if (idr != null) { idr.Close(); } } return(objs); }
public void OnNavigatedTo(object parameter) { NavigateViewModel = (INavigateViewModel)parameter; if (parameter is MainModel mainModel) { PageList.Clear(); foreach (var temp in mainModel.ViewModelPageBind.PageModelList) { if (!string.IsNullOrEmpty(temp.Describe)) { PageList.Add(temp); } } } }
/// <summary> /// /// </summary> /// <param name="mode"></param> public void Serach(int mode, string key) { ShowList.Clear(); PageList.Clear(); //启动动画 myProgress.Visibility = Visibility.Visible; myProgress.Start(); switch (Auth.Type) { case BTType.BT蚂蚁: new BTMY().Serach(mode, key, new Action <List <BT>, List <Models.Page>, string>((list, pagelist, info) => { if (list != null) { Dispatcher.Invoke(new Action(() => { for (int i = 0; i < list.Count; i++) { ShowList.Add(list[i]); } })); Dispatcher.Invoke(new Action(() => { for (int i = 0; i < pagelist.Count; i++) { PageList.Add(new Models.Page() { Name = pagelist[i].Name, Path = pagelist[i].Path, Type = BTType.BT蚂蚁 }); } })); } Dispatcher.Invoke(new Action(() => { myProgress.Stop(); myProgress.Visibility = Visibility.Collapsed; })); })); break; default: break; } }
public vmConfig() { PageList.Clear(); PageList.Add(new mPages() { Name = "Pdfs", Link = Properties.Resources.Sec_Governo_Portarias_Config_PDF }); if (Logged.Acesso != 0) { if (Logged.Acesso == (int)AccountAccess.Master) { PageList.Add(new mPages() { Name = "Classificações", Link = Properties.Resources.Sec_Governo_Portarias_Config_Classificacao }); } else { foreach (Account.Model.mSubModulos m in Logged.Submodulos) { if (m.SubModulo == (int)SubModulo.Portarias) { if (m.Acesso > (int)SubModuloAccess.Operador) { PageList.Add(new mPages() { Name = "Classificações", Link = Properties.Resources.Sec_Governo_Portarias_Config_Classificacao }); } } } } } PageSelected = new Uri(PageList[0].Link, UriKind.Relative); }
public vmConfig() { PageList.Clear(); PageList.Add(new mPages() { Name = "Pdfs", Link = "Pages/pLinkPdf.xaml" }); if (AccountOn.Acesso != 0) { if (AccountOn.Acesso == (int)AccountAccess.Master) { PageList.Add(new mPages() { Name = "Classificações", Link = "Pages/pClassf.xaml" }); } else { foreach (Accounts.Model.mSubModulos m in AccountOn.Submodulos) { if (m.SubModulo == (int)SubModulo.Legislacao) { if (m.Acesso > (int)SubModuloAccess.Operador) { PageList.Add(new mPages() { Name = "Classificações", Link = "Pages/pClassf.xaml" }); } } } } } PageSelected = new Uri(PageList[0].Link, UriKind.Relative); }
public void LoadNewConfigurations(string path) { _changedFlag = false; PageList.Clear(); _excel = ImportExcel.Instance; _excel.ImportExcelConfiguration(path); if (_excel.ImportFileOK) { ObservableCollection <PageType> tempList = GetAllPages(); GroupList = GetAllGroups(); ItemTypeOrderList = GetAllItems(); LinkCollections(tempList, GroupList, ItemTypeOrderList); foreach (PageType page in tempList) { PageList.Add(page); } _groupCounter = 0; int index = 0; while (index < WorkSheetktResources.Instance.ktResourceList.Count) { if (Convert.ToInt32(WorkSheetktResources.Instance.ktResourceList[index].ResourceID) > _groupCounter) { _groupCounter = Convert.ToInt32(WorkSheetktResources.Instance.ktResourceList[index].ResourceID); } index++; } } }
public void ParseData() { int dataSizeUnit = 4; PresetSize = BitConverter.ToInt32(PatchData, 0); PresetName = Encoding.UTF8.GetString(PatchData, 4, 16); int numberOfModules = BitConverter.ToInt32(PatchData, 20); int dataPosition = 24; for (int moduleNumber = 0; moduleNumber < numberOfModules; moduleNumber++) { int moduleSize = BitConverter.ToInt32(PatchData, dataPosition) * dataSizeUnit; byte[] moduleData = new byte[moduleSize]; Array.Copy(PatchData, dataPosition, moduleData, 0, moduleSize); ModuleList.Add(new ZoiaModule(moduleData, FormatDictionary)); dataPosition += moduleSize; } int numberOfConnections = BitConverter.ToInt32(PatchData, dataPosition); dataPosition += dataSizeUnit; int connectionSize = 20; for (int connectionNumber = 0; connectionNumber < numberOfConnections; connectionNumber++) { byte[] connectionData = new byte[connectionSize]; Array.Copy(PatchData, dataPosition, connectionData, 0, connectionSize); this.ConnectionList.Add(new ZoiaConnection(connectionData)); dataPosition += connectionSize; } int numberOfPages = BitConverter.ToInt32(PatchData, dataPosition); dataPosition += dataSizeUnit; int pageSize = 16; for (int pageNumber = 0; pageNumber < numberOfPages; pageNumber++) { string pageName = Encoding.UTF8.GetString(PatchData, dataPosition, pageSize); PageList.Add(pageName); dataPosition += pageSize; } int starredParameterCount = BitConverter.ToInt32(PatchData, dataPosition); dataPosition += dataSizeUnit; int starredParameterSize = 4; for (int starredParameterNumber = 0; starredParameterNumber < starredParameterCount; starredParameterNumber++) { byte[] starredParameterData = new byte[starredParameterSize]; Array.Copy(PatchData, dataPosition, starredParameterData, 0, starredParameterSize); StarredParameterList.Add(new ZoiaStarredParameter(starredParameterData)); dataPosition += starredParameterSize; } int moduleColorSize = 4; for (int moduleColorNumber = 0; moduleColorNumber < numberOfModules; moduleColorNumber++) { int moduleColor = BitConverter.ToInt32(PatchData, dataPosition); ModuleList[moduleColorNumber].ModuleColorId = moduleColor; dataPosition += moduleColorSize; } NumberOfBytesParsed = dataPosition; }
public static void Update() { Networking.TicketID = 1; GameManager.Instance.AssetVersion = GameManager.Instance.SessionID = null; var CheckVersion = Networking.RequestAPI(new ReqCheckVersion(GameManager.Instance.Version, "android")); GameManager.Instance.AssetVersion = CheckVersion["body"]["assets"].ToString(); //var AssetList = File.ReadAllBytes("ASSETLIST"); var AssetList = DownloadFile("ASSETLIST", "Text"); //File.WriteAllBytes("ASSETLIST", AssetList); List<AssetList.Item> ItemList = new List<AssetList.Item>(); ReadAssetListProc(AssetList, ref ItemList); var Data_MasterParam_Id = ItemList.Find(i => i.Path.Contains("Data/MasterParam")).IDStr; //var Data_MasterParam_Compressed = File.ReadAllBytes("Data_MasterParam"); var Data_MasterParam_Compressed = DownloadFile(Data_MasterParam_Id, "Text"); //File.WriteAllBytes("Data_MasterParam", Data_MasterParam_Compressed); var Data_MasterParam_Json = Encoding.UTF8.GetString(Decompress(Data_MasterParam_Compressed)); Data_MasterParam = (JObject)JsonConvert.DeserializeObject(Data_MasterParam_Json); var Loc_english_LocalizedMasterParam_Id = ItemList.Find(i => i.Path.Contains("Loc/english/LocalizedMasterParam")).IDStr; //var Loc_english_LocalizedMasterParam_Compressed = File.ReadAllBytes("LocalizedMasterParam"); var Loc_english_LocalizedMasterParam_Compressed = DownloadFile(Loc_english_LocalizedMasterParam_Id, "Text"); //File.WriteAllBytes("LocalizedMasterParam", Loc_english_LocalizedMasterParam_Compressed); var Loc_english_LocalizedMasterParam_String = Encoding.UTF8.GetString(Decompress(Loc_english_LocalizedMasterParam_Compressed)); File.WriteAllText("translation.txt", Loc_english_LocalizedMasterParam_String); var Loc_english_LocalizedMasterParam_Lines = Loc_english_LocalizedMasterParam_String.Replace("\r", "").Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries); var Loc_english_LocalizedMasterParam_KVP = Loc_english_LocalizedMasterParam_Lines.Select(l => l.Split(new char[1] { '\t' })); Loc_english_LocalizedMasterParam = Loc_english_LocalizedMasterParam_KVP.ToDictionary(a => a[0].Substring(a[0].IndexOf("Param") + 6), b => b[1]); var Loc_english_unit_Id = ItemList.Find(i => i.Path.Contains("Loc/english/unit")).IDStr; //var Loc_english_unit_Compressed = File.ReadAllBytes("unit"); var Loc_english_unit_Compressed = DownloadFile(Loc_english_unit_Id, "Text"); //File.WriteAllBytes("unit", Loc_english_unit_Compressed); var Loc_english_unit_String = Encoding.UTF8.GetString(Decompress(Loc_english_unit_Compressed).Skip(3).ToArray()); var Loc_english_unit_Lines = Loc_english_unit_String.Replace("\r", "").Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries); var Loc_english_unit_KVP = Loc_english_unit_Lines.Select(l => l.Split(new char[1] { '\t' })); Loc_english_unit_KVP.ToList().ForEach(u => Loc_english_LocalizedMasterParam.Add(u[0], u[1])); //Loc_english_LocalizedMasterParam.add = Loc_english_LocalizedMasterParam_KVP.ToDictionary(a => a[0], b => b[1]); foreach (var item in ItemList) File.WriteAllText(@"text\" + item.Path.Replace("/", "") + "_" + item.IDStr, Encoding.UTF8.GetString(Decompress(DownloadFile(item.IDStr, "Text")))); // DotNetWikiBot -- http://dotnetwikibot.sourceforge.net/ var site = new Site("https://thealchemistcode.gamepedia.com", "wikiusername", "wikipassword"); site.defaultEditComment = "unitlist element + "; site.minorEditByDefault = true; string content = ""; var pageList = new PageList(site); if (false) { var units = Data_MasterParam["Unit"]; var unitList = units.ToList().FindAll(u => Loc_english_LocalizedMasterParam.ContainsKey(u["iname"] + "_NAME") && u["ai"]?.ToString() == "AI_PLAYER" && u["iname"].ToString().Split(new char[] { '_' }).Count() == 3); pageList = new PageList(site, new List<string> { "Units" }); pageList.LoadWithMetadata(); content = Wiki.Units.CreateUnitListPage(unitList); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } foreach (var unit in unitList) { pageList = new PageList(site, new List<string> { Loc_english_LocalizedMasterParam[unit["iname"] + "_NAME"] }); pageList.LoadWithMetadata(); if (pageList.Count() == 0) { var page = new Page(Loc_english_LocalizedMasterParam[unit["iname"] + "_NAME"]); pageList.Add(page); } content = Wiki.Units.CreateUnitPage(unit); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } } } if (false) { var jobs = Data_MasterParam["Job"]; var jobList = jobs.ToList().FindAll(u => Loc_english_LocalizedMasterParam.ContainsKey(u["ranks"][0]["eqid1"] + "_NAME")); pageList = new PageList(site, new List<string> { "Jobs" }); pageList.LoadWithMetadata(); content = Wiki.Jobs.CreateJobListPage(jobList); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } foreach (var job in jobList) { pageList = new PageList(site, new List<string> { job["iname"].ToString() == job["origin"]?.ToString() ? Loc_english_LocalizedMasterParam[job["iname"] + "_NAME"] : (Loc_english_LocalizedMasterParam[job["iname"] + "_NAME"].Replace("[", "").Replace("]", "") + " (" + job["iname"].ToString().Substring(3) + ")") }); pageList.LoadWithMetadata(); if (pageList.Count() == 0) { var page = new Page(job["iname"].ToString() == job["origin"]?.ToString() ? Loc_english_LocalizedMasterParam[job["iname"] + "_NAME"] : (Loc_english_LocalizedMasterParam[job["iname"] + "_NAME"].Replace("[", "").Replace("]", "") + " (" + job["iname"].ToString().Substring(3) + ")")); pageList.Add(page); } content = Wiki.Jobs.CreateJobPage(job); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } } } if (false) { var equipment = Data_MasterParam["Item"]; var equipmentList = equipment.ToList().FindAll(u => u["type"].ToString() == "3" && Loc_english_LocalizedMasterParam.ContainsKey(u["iname"] + "_NAME")); pageList = new PageList(site, new List<string> { "Equipment" }); pageList.LoadWithMetadata(); content = Equipments.CreateEquipmentListPage(equipmentList); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } foreach (var equip in equipmentList) { pageList = new PageList(site, new List<string> { Loc_english_LocalizedMasterParam[equip["iname"] + "_NAME"] }); pageList.LoadWithMetadata(); if (pageList.Count() == 0) { var page = new Page(Loc_english_LocalizedMasterParam[equip["iname"] + "_NAME"]); pageList.Add(page); } content = Wiki.Equipments.CreateEquipmentPage(equip); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } } } if (true) { var skills = Data_MasterParam["Skill"]; var skillList = skills.ToList().FindAll(u => /*u["type"].ToString() == "3" &&*/ Loc_english_LocalizedMasterParam.ContainsKey(u["iname"] + "_NAME")); pageList = new PageList(site, new List<string> { "Skills" }); pageList.LoadWithMetadata(); if (pageList.Count() == 0) { var page = new Page(site, "Skills"); pageList.Add(page); } content = Skills.CreateSkillListPage(skillList); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } foreach (var skill in skillList) { pageList = new PageList(site, new List<string> { Loc_english_LocalizedMasterParam[skill["iname"] + "_NAME"] }); pageList.LoadWithMetadata(); if (pageList.Count() == 0) { var page = new Page(Loc_english_LocalizedMasterParam[skill["iname"] + "_NAME"]); pageList.Add(page); } content = Skills.CreateSkillPage(skill); if (pageList[0].text != content) { pageList[0].text = content; pageList[0].Save(); } } } }
public static void Main() { Console.Write("Password: "******"Lsjbot"; string makelang = "sv"; Site site = new Site("https://" + makelang + ".wikipedia.org", botkonto, password); PageList pl = new PageList(site); PageList pl1 = new PageList(site); site.defaultEditComment = "Flyttar sidor"; site.minorEditByDefault = true; //Select how to get pages. Uncomment as needed. //Find articles from a category //pl.FillAllFromCategory("Robotskapade artiklar 2014-10"); //pl1.FillAllFromCategoryTree("Eufriesea"); //foreach (Page p in pl1) // pl.Add(p); //pl1.FillAllFromCategoryTree("Euglossa"); //foreach (Page p in pl1) // pl.Add(p); //pl1.FillAllFromCategoryTree("Eulaema"); //foreach (Page p in pl1) // pl.Add(p); //pl1.FillAllFromCategoryTree("Exaerete"); //foreach (Page p in pl1) // pl.Add(p); //pl.FillFromCategory("Samtliga artiklar föreslagna för sammanslagningar och delningar"); //Find subcategories of a category //pl.FillSubsFromCategory("Svampars vetenskapliga namn"); //Find articles from all the links to an article, mostly useful on very small wikis //pl.FillFromLinksToPage("Boidae"); //Set specific article: //Page pp = new Page(site, "Användare:Lsjbot/Flytt-test");pl.Add(pp); List <string> sl = new List <string>(); //sl.Add("Lista över insjöar i Arjeplogs kommun (1-1000)"); sl.Add("Ðakovića Kosa"); sl.Add("Ðanuša"); sl.Add("Ðaprovica"); sl.Add("Ðatla"); sl.Add("Ðatlo"); sl.Add("Ðatlo (bergstopp)"); sl.Add("Ðatlo (grotta i Bosnien och Hercegovina, Republika Srpska, lat 43,06, long 18,49)"); sl.Add("Ðavat"); sl.Add("Ðavato"); sl.Add("Ðavolica"); sl.Add("Ðavor-Konak"); sl.Add("Ðed"); sl.Add("Ðed (berg i Bosnien och Hercegovina, Republika Srpska, lat 43,11, long 18,41)"); sl.Add("Ðed (kulle)"); sl.Add("Ðed (ås)"); sl.Add("Ðedov Do"); sl.Add("Ðedov Do (dal i Bosnien och Hercegovina)"); sl.Add("Ðedovac"); sl.Add("Ðedovac (kulle)"); sl.Add("Ðedovac (källa)"); sl.Add("Ðedovića Voda"); sl.Add("Ðedovo Brdo"); sl.Add("Ðekića Brdo"); sl.Add("Ðekića Vis"); sl.Add("Ðenića Brdo"); sl.Add("Ðera"); sl.Add("Ðerina Voda"); sl.Add("Ðerinac"); sl.Add("Ðerinac (bergstopp)"); sl.Add("Ðermašica"); sl.Add("Ðernovača"); sl.Add("Ðeropa"); sl.Add("Ðerzelovica"); sl.Add("Ðeva"); sl.Add("Ðevice"); sl.Add("Ðevigrad"); sl.Add("Ðidovi"); sl.Add("Ðilas"); sl.Add("Ðipovac"); sl.Add("Ðipuša"); sl.Add("Ðogat"); sl.Add("Ðon"); sl.Add("Ðorđe Stratimirović"); sl.Add("Ðorđo Lavrnić"); sl.Add("Ðubino Brdo"); sl.Add("Ðukanov Vis"); sl.Add("Ðukanov Vrh"); sl.Add("Ðukina Voda"); sl.Add("Ðukino Brdo"); sl.Add("Ðukića Brdo"); sl.Add("Ðukića Brdo (bergstopp)"); sl.Add("Ðukića Glavica"); sl.Add("Ðulanova Rijeka"); sl.Add("Ðulanovo Brdo"); sl.Add("Ðuletske Kose"); sl.Add("Ðulina Kosa"); sl.Add("Ðulina Rupa"); sl.Add("Ðulinac"); sl.Add("Ðupska Čuka"); sl.Add("Ðupska Čuka (kulle i Makedonien)"); sl.Add("Ðuranovac"); sl.Add("Ðuranovina"); sl.Add("Ðuranđa"); sl.Add("Ðuraš"); sl.Add("Ðuraš (kulle)"); sl.Add("Ðurendića Vis"); sl.Add("Ðurevac"); sl.Add("Ðurevac (vattendrag i Bosnien och Hercegovina)"); sl.Add("Ðurica"); sl.Add("Ðurin Sjek"); sl.Add("Ðurina Voda"); sl.Add("Ðurinovača"); sl.Add("Ðurinovača (bergstopp)"); sl.Add("Ðurinovača (utlöpare)"); sl.Add("Ðurića Brdo"); sl.Add("Ðurića Brdo (bergstopp)"); sl.Add("Ðurića Brdo (kulle)"); sl.Add("Ðurića Kuk"); sl.Add("Ðurića Vis"); sl.Add("Ðurića Vrelo"); sl.Add("Ðuričin Do"); sl.Add("Ðurkelina Jama"); sl.Add("Ðurkovac"); sl.Add("Ðurkovac (berg i Bosnien och Hercegovina)"); sl.Add("Ðuroje"); sl.Add("Ðurov"); sl.Add("Ðurov Ras"); sl.Add("Ðurđev Do"); sl.Add("Ðurđeva Glava"); sl.Add("Ðurđeva Glavica"); sl.Add("Ðurđeva Glavica (berg i Bosnien och Hercegovina)"); sl.Add("Ðurđevac"); sl.Add("Ðurđevac (utlöpare)"); sl.Add("Ðurđevica"); sl.Add("Ðurđevica (berg)"); sl.Add("Ðurđeviča Vis"); sl.Add("Ðurđevo Brdo"); sl.Add("Ðurđevo Brdo (berg i Bosnien och Hercegovina, Republika Srpska, lat 43,58, long 19,20)"); sl.Add("Ðurđevo Brdo (berg i Bosnien och Hercegovina, Republika Srpska, lat 44,04, long 19,58)"); sl.Add("Ðurđevo Brdo (kulle i Bosnien och Hercegovina, Republika Srpska, lat 42,76, long 18,27)"); sl.Add("Ðurđevo Brdo (kulle i Bosnien och Hercegovina, Republika Srpska, lat 43,49, long 18,82)"); sl.Add("Ðurđovac"); sl.Add("Ðusin Vrh"); sl.Add("Ðuvića Vrh"); sl.Add("Ðvogrla Jama"); foreach (string s in sl) { Page pp = new Page(site, s); pl.Add(pp); } //Skip all namespaces except articles: //pl.RemoveNamespaces(new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,100,101}); Dictionary <string, string> replacedict = new Dictionary <string, string>(); //replacedict.Add("-", "–"); replacedict.Add("Ð", "Đ"); //från isländskt Đ till bosniskt Đ //Require ALL in requireword list: List <string> requireword = new List <string>(); //requireword.Add("obotskapad"); //Require AT LEAST ONE in requireone list: List <string> requireone = new List <string>(); //Vetowords should NOT be in article List <string> vetoword = new List <string>(); vetoword.Add("Island"); vetoword.Add("isländska"); vetoword.Add("OMDIRIGERING"); vetoword.Add("Đ"); DateTime oldtime = DateTime.Now; oldtime = oldtime.AddSeconds(10); Console.WriteLine("Pages to change : " + pl.Count().ToString()); int iremain = pl.Count(); bool first = true; foreach (Page p in pl) { //Skip start of alphabet: string skipuntil = ""; if ((skipuntil != "") && String.Compare(p.title, skipuntil) < 0) { continue; } if (!tryload(p, 2)) { continue; } if (!p.Exists()) { continue; } string origtitle = p.title; ////Follow redirect: if (p.IsRedirect()) { p.title = p.RedirectsTo(); if (!tryload(p, 2)) { continue; } if (!p.Exists()) { continue; } } //Check so all required strings actually present: bool allfound = true; foreach (string s in requireword) { if (!p.text.Contains(s)) { allfound = false; } } if (!allfound) { continue; } if (requireone.Count > 0) { bool onefound = false; foreach (string s in requireone) { if (p.text.Contains(s)) { onefound = true; } } if (!onefound) { continue; } } //Check so no vetoword are present: bool vetofound = false; foreach (string s in vetoword) { if (p.text.Contains(s)) { vetofound = true; } } if (vetofound) { continue; } //If redirect, go back to redirect page: //if (origtitle != p.title) //{ // p.title = origtitle; // p.Load(); //} //string origtext = p.text; //Do the actual replacement: string frompage = p.title; string topage = p.title; foreach (KeyValuePair <string, string> replacepair in replacedict) { topage = topage.Replace(replacepair.Key, replacepair.Value); } //Do the actual move: movepage(site, frompage, topage); //Move discussion too: bool movedisk = true; if (movedisk) { Page pd = new Page(site, "Diskussion:" + frompage); tryload(pd, 1); if (pd.Exists()) { movepage(site, "Diskussion:" + frompage, "Diskussion:" + topage); } } //Wait: if (first) { Console.WriteLine("<ret"); Console.ReadLine(); first = false; } DateTime newtime = DateTime.Now; while (newtime < oldtime) { newtime = DateTime.Now; } oldtime = newtime.AddSeconds(10); iremain--; Console.WriteLine(iremain.ToString() + " remaining."); } Console.WriteLine("Total # edits = " + nedit.ToString()); }
public PageList <T> GetPageList <T>(string sql, string orderKey, int pageSize, int curPage) { PageList <T> pageList = new PageList <T>(); pageList.SetPage(pageSize, curPage); string pageSql = _Dialect.GetPageSql(sql, orderKey, pageList.StartRecord, pageList.EndRecord); string executeSql; if (pageSize > 0) { string countSql = _Dialect.GetCountSql(sql); executeSql = countSql + "; " + pageSql; } else { executeSql = pageSql; } DbCommand dbCommand = _DbInstance.GetSqlStringCommand(executeSql); //执行sql命令 IDataReader dr; try { dr = this._DbInstance.ExecuteReader(dbCommand); } catch (Exception ex) { throw new SqlException(ex.Message, LogHelper.GetSqlString(dbCommand), ex); } try { if (pageSize > 0) { //读取记录条数 dr.Read(); pageList.TotalCount = (int)dr[0]; dr.NextResult(); } string errorColumn = string.Empty; string errorDbValue = string.Empty; TableMetaData table = MetaDataCacheManager.GetTableMetaData(typeof(T)); try { while (dr.Read()) { pageList.Add((T)CreateObjectByDataReader(table, dr, out errorColumn, out errorDbValue)); } } catch (Exception ex) { throw new SqlException(string.Format("CreateObjectByDataReader error, table:{0}, column:{1}, dbValue:{2}. message:{3}", table.TableName, errorColumn, errorDbValue, ex.Message)); } // 如果未分页,则设置总数为当前页记录数 if (pageSize <= 0) { pageList.TotalCount = pageList.CurPageCount; } } finally { dr.Close(); } return(pageList); }
public vmConfig() { Mvvm.Helpers.Observers.GlobalNavigation.Pagina = "OPÇÕES"; PageList.Clear(); PageList.Add(new mPages() { Name = "Pdfs", Link = "Pages/pLinkPdf.xaml" }); if (AccountOn.Acesso != 0) { if (AccountOn.Acesso == (int)AccountAccess.Master) { PageList.Add(new mPages() { Name = "Tipos", Link = "Pages/pTipos.xaml" }); PageList.Add(new mPages() { Name = "Classificações L", Link = "Pages/pClassLoLc.xaml" }); PageList.Add(new mPages() { Name = "Classificações D", Link = "Pages/pClassDec.xaml" }); PageList.Add(new mPages() { Name = "Situações", Link = "Pages/pSituacao.xaml" }); PageList.Add(new mPages() { Name = "Origens", Link = "Pages/pOrigem.xaml" }); PageList.Add(new mPages() { Name = "Autores", Link = "Pages/pAutor.xaml" }); PageList.Add(new mPages() { Name = "Ações", Link = "Pages/pAcao.xaml" }); } else { foreach (mSubModulos m in AccountOn.Submodulos) { if (m.SubModulo == (int)SubModulo.Legislacao) { if (m.Acesso > (int)SubModuloAccess.Operador) { PageList.Add(new mPages() { Name = "Tipos", Link = "Pages/pTipos.xaml" }); PageList.Add(new mPages() { Name = "Classificações L", Link = "Pages/pClassLoLc.xaml" }); PageList.Add(new mPages() { Name = "Classificações D", Link = "Pages/pClassDec.xaml" }); PageList.Add(new mPages() { Name = "Situações", Link = "Pages/pSituacao.xaml" }); PageList.Add(new mPages() { Name = "Origens", Link = "Pages/pOrigem.xaml" }); PageList.Add(new mPages() { Name = "Autores", Link = "Pages/pAutor.xaml" }); PageList.Add(new mPages() { Name = "Ações", Link = "Pages/pAcao.xaml" }); } } } } } PageSelected = new Uri(PageList[0].Link, UriKind.Relative); }
public static void addpages(Site site, PageList pl) { //Page pp1 = new Page(site, "Aega monophthalma"); pl.Add(pp1); List <string> sl = new List <string>(); //sl.Add("Lista över insjöar i Arjeplogs kommun (1-1000)"); sl.Add("Ðakovića Kosa"); sl.Add("Ðanuša"); sl.Add("Ðaprovica"); sl.Add("Ðatla"); sl.Add("Ðatlo"); sl.Add("Ðatlo (bergstopp)"); sl.Add("Ðatlo (grotta i Bosnien och Hercegovina, Republika Srpska, lat 43,06, long 18,49)"); sl.Add("Ðavat"); sl.Add("Ðavato"); sl.Add("Ðavolica"); sl.Add("Ðavor-Konak"); sl.Add("Ðed"); sl.Add("Ðed (berg i Bosnien och Hercegovina, Republika Srpska, lat 43,11, long 18,41)"); sl.Add("Ðed (kulle)"); sl.Add("Ðed (ås)"); sl.Add("Ðedov Do"); sl.Add("Ðedov Do (dal i Bosnien och Hercegovina)"); sl.Add("Ðedovac"); sl.Add("Ðedovac (kulle)"); sl.Add("Ðedovac (källa)"); sl.Add("Ðedovića Voda"); sl.Add("Ðedovo Brdo"); sl.Add("Ðekića Brdo"); sl.Add("Ðekića Vis"); sl.Add("Ðenića Brdo"); sl.Add("Ðera"); sl.Add("Ðerina Voda"); sl.Add("Ðerinac"); sl.Add("Ðerinac (bergstopp)"); sl.Add("Ðermašica"); sl.Add("Ðernovača"); sl.Add("Ðeropa"); sl.Add("Ðerzelovica"); sl.Add("Ðeva"); sl.Add("Ðevice"); sl.Add("Ðevigrad"); sl.Add("Ðidovi"); sl.Add("Ðilas"); sl.Add("Ðipovac"); sl.Add("Ðipuša"); sl.Add("Ðogat"); sl.Add("Ðon"); sl.Add("Ðorđe Stratimirović"); sl.Add("Ðorđo Lavrnić"); sl.Add("Ðubino Brdo"); sl.Add("Ðukanov Vis"); sl.Add("Ðukanov Vrh"); sl.Add("Ðukina Voda"); sl.Add("Ðukino Brdo"); sl.Add("Ðukića Brdo"); sl.Add("Ðukića Brdo (bergstopp)"); sl.Add("Ðukića Glavica"); sl.Add("Ðulanova Rijeka"); sl.Add("Ðulanovo Brdo"); sl.Add("Ðuletske Kose"); sl.Add("Ðulina Kosa"); sl.Add("Ðulina Rupa"); sl.Add("Ðulinac"); sl.Add("Ðupska Čuka"); sl.Add("Ðupska Čuka (kulle i Makedonien)"); sl.Add("Ðuranovac"); sl.Add("Ðuranovina"); sl.Add("Ðuranđa"); sl.Add("Ðuraš"); sl.Add("Ðuraš (kulle)"); sl.Add("Ðurendića Vis"); sl.Add("Ðurevac"); sl.Add("Ðurevac (vattendrag i Bosnien och Hercegovina)"); sl.Add("Ðurica"); sl.Add("Ðurin Sjek"); sl.Add("Ðurina Voda"); sl.Add("Ðurinovača"); sl.Add("Ðurinovača (bergstopp)"); sl.Add("Ðurinovača (utlöpare)"); sl.Add("Ðurića Brdo"); sl.Add("Ðurića Brdo (bergstopp)"); sl.Add("Ðurića Brdo (kulle)"); sl.Add("Ðurića Kuk"); sl.Add("Ðurića Vis"); sl.Add("Ðurića Vrelo"); sl.Add("Ðuričin Do"); sl.Add("Ðurkelina Jama"); sl.Add("Ðurkovac"); sl.Add("Ðurkovac (berg i Bosnien och Hercegovina)"); sl.Add("Ðuroje"); sl.Add("Ðurov"); sl.Add("Ðurov Ras"); sl.Add("Ðurđev Do"); sl.Add("Ðurđeva Glava"); sl.Add("Ðurđeva Glavica"); sl.Add("Ðurđeva Glavica (berg i Bosnien och Hercegovina)"); sl.Add("Ðurđevac"); sl.Add("Ðurđevac (utlöpare)"); sl.Add("Ðurđevica"); sl.Add("Ðurđevica (berg)"); sl.Add("Ðurđeviča Vis"); sl.Add("Ðurđevo Brdo"); sl.Add("Ðurđevo Brdo (berg i Bosnien och Hercegovina, Republika Srpska, lat 43,58, long 19,20)"); sl.Add("Ðurđevo Brdo (berg i Bosnien och Hercegovina, Republika Srpska, lat 44,04, long 19,58)"); sl.Add("Ðurđevo Brdo (kulle i Bosnien och Hercegovina, Republika Srpska, lat 42,76, long 18,27)"); sl.Add("Ðurđevo Brdo (kulle i Bosnien och Hercegovina, Republika Srpska, lat 43,49, long 18,82)"); sl.Add("Ðurđovac"); sl.Add("Ðusin Vrh"); sl.Add("Ðuvića Vrh"); sl.Add("Ðvogrla Jama"); foreach (string s in sl) { Page pp = new Page(site, s); pl.Add(pp); } }
public void AddPage(int Page, string Title) { PageList.Add(Page, Title); Save(); }
public vmConfig() { GlobalNavigation.Pagina = "OPÇÕES"; PageList.Clear(); PageList.Add(new mPages() { Name = "Pdfs", Link = Properties.Resources.Sec_Governo_Legislacao_Config_LinkPDF }); if (Logged.Acesso != 0) { if (Logged.Acesso == (int)AccountAccess.Master) { PageList.Add(new mPages() { Name = "Tipos", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Tipo }); PageList.Add(new mPages() { Name = "Classificações L", Link = Properties.Resources.Sec_Governo_Legislacao_Config_ClassLLc }); PageList.Add(new mPages() { Name = "Classificações D", Link = Properties.Resources.Sec_Governo_Legislacao_Config_ClassDec }); PageList.Add(new mPages() { Name = "Situações", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Situacao }); PageList.Add(new mPages() { Name = "Origens", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Origem }); PageList.Add(new mPages() { Name = "Autores", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Autor }); PageList.Add(new mPages() { Name = "Ações", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Acao }); } else { foreach (mSubModulos m in Logged.Submodulos) { if (m.SubModulo == (int)SubModulo.Legislacao) { if (m.Acesso > (int)SubModuloAccess.Operador) { PageList.Add(new mPages() { Name = "Tipos", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Tipo }); PageList.Add(new mPages() { Name = "Classificações L", Link = Properties.Resources.Sec_Governo_Legislacao_Config_ClassLLc }); PageList.Add(new mPages() { Name = "Classificações D", Link = Properties.Resources.Sec_Governo_Legislacao_Config_ClassDec }); PageList.Add(new mPages() { Name = "Situações", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Situacao }); PageList.Add(new mPages() { Name = "Origens", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Origem }); PageList.Add(new mPages() { Name = "Autores", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Autor }); PageList.Add(new mPages() { Name = "Ações", Link = Properties.Resources.Sec_Governo_Legislacao_Config_Acao }); } } } } } PageSelected = new Uri(PageList[0].Link, UriKind.Relative); }