private static PageAttr GetNativePMA(PageAttributes attr) { if ((uint)attr == 0xFFFFFFFF) { return((PageAttr)attr); } PageAttr attrMask = 0; if ((attr & PageAttributes.ReadWrite) != 0) { attrMask |= PageAttr.ReadWrite; } if ((attr & PageAttributes.User) != 0) { attrMask |= PageAttr.User; } if ((attr & PageAttributes.Present) != 0) { attrMask |= PageAttr.Present; } return(attrMask); }
protected async void ListViewDevices_ItemTapped(object sender, ItemTappedEventArgs e) { try { if (noDeviceWasClicked) { noDeviceWasClicked = false; DeviceInfo device = (DeviceInfo)e.Item; CheckAndDownloadAditionalContent downloader = new CheckAndDownloadAditionalContent(); PageAttributes page = await downloader.DownloadDeviceContent(device.UID, true); page.belongsToAnEquipment = device.belongsToAnEquipment.Equals(Constants.OkIcon) ? true : false; page.isALoogBook = IsALogBook(); if (page != null) { await this.Navigation.PushAsync(page); } else { ShowToast("No hay resultados"); } } } catch (Exception ex) { ShowToast(GetExceptionMessageWhenDeviceTappedFailed() + ex.Message); } }
/// <summary> /// Updates an existing page. /// </summary> /// <param name="reader"></param> private void EditPage(IDataReader reader) { string fileName = MakePageName(Name.Text); bool fileIsDefault = false; bool fileIsPublic = false; bool isFolder = (bool)reader["IsFolder"]; if (isFolder) { return; } fileIsDefault = IsDefault.IsSelected; // clear old default in current folder if (fileIsDefault) { string outline = ((string)reader[_OutlineKey]).Substring(0, ((string)reader[_OutlineKey]).LastIndexOf('/') + 1); using (IDataReader reader2 = FileTreeItem.GetItemByOutline(outline, SiteId)) { while (reader2.Read()) { FileTreeItem.UpdateFileItem((int)reader2[_PageIdKey], (string)reader2["Name"], (bool)reader2["IsPublic"], (bool)reader["IsFolder"], false, (string)reader2[reader2.FieldCount - 1] /*MasterPage*/, SiteId); } reader2.Close(); } } // update page attributes FileTreeItem.UpdateFileItem(PageId, fileName, fileIsPublic, false, fileIsDefault, MasterPageText.Text, SiteId); PageAttributes.Update(PageId, txtTitle.Text, txtKeywords.Text, txtDescription.Text); }
public void ClearIndex() { // Retrieve the storage account from the connection string. CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); //App? CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("myurls"); queue.Clear(); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // Create the table if it doesn't exist. CloudTable table = tableClient.GetTableReference("people"); table.CreateIfNotExists(); TableOperation retrieveOperation = TableOperation.Retrieve("url", "rowkey"); TableResult retrievedResult = table.Execute(retrieveOperation); // Assign the result to a CustomerEntity. PageAttributes deleteEntity = (PageAttributes)retrievedResult.Result; if (deleteEntity != null) { TableOperation deleteOperation = TableOperation.Delete(deleteEntity); table.Execute(deleteOperation); Console.WriteLine("Entity deleted."); } else { Console.WriteLine("Could not retrieve the entity."); } }
private async Task <bool> GetTaskInfoByUID(string UID, bool push = false) { CheckAndDownloadAditionalContent downloader = new CheckAndDownloadAditionalContent(); PageAttributes page = await downloader.DownloadDeviceContent(UID, push); if (page != null) { page.ViewNewDev = true; page.OnNew += Page_OnNew; if (page != null && push) { page.NewDevIcon = comos.Constants.IncidentIcon; page.IsActivity = true; await this.Navigation.PushAsync(page); } return(true); } else { ShowToast(Services.TranslateExtension.TranslateText("task_not_found")); return(false); } }
public static PageAllocator.Errors SetPageAttributes(void *page, uint granularity, PageAttributes attr) { uint pde = 0, pte = 0; uint *table = null; uint nativeAttr = (uint)GetNativePMA(attr); if (granularity < 0 || granularity > 1) { return(PageAllocator.Errors.UnsupportedGranularity); } Diagnostics.Assert(nativeAttr != 0xFFFFFFFF, "X86.Pager::SetPageAttributes(): bad page map attributes"); Diagnostics.Assert(ADC.Pager.GetPointerGranularity(page) == granularity, "X86.Pager::SetPageAttributes(): bad alignment on page pointer"); PagePtrToTables(page, &pde, &pte); table = PageDirectory; if (granularity == 0) { table = (uint *)(PageDirectory[pde] & (uint)PageAttr.FrameMask); } table[pte] = (table[pte] & (uint)PageAttr.FrameMask) | nativeAttr; return(PageAllocator.Errors.Success); }
private static PageAttributes GetAbstractPMA(PageAttr attr) { if ((uint)attr == 0xFFFFFFFF) { return((PageAttributes)attr); } PageAttributes ret = PageAttributes.None; if ((attr & PageAttr.ReadWrite) != 0) { ret |= PageAttributes.ReadWrite; } if ((attr & PageAttr.User) != 0) { ret |= PageAttributes.User; } if ((attr & PageAttr.Present) != 0) { ret |= PageAttributes.Present; } return(ret); }
/// <summary> /// Sets the headers. /// </summary> private void SetHeaders() { string cacheKey = CmsCache.CreateCacheKey("page-headers", CMSContext.Current.PageId.ToString()); // check cache first object cachedObject = CmsCache.Get(cacheKey); string[] headersArray = null; if (cachedObject != null) { headersArray = (string[])cachedObject; } // Load the object if (headersArray == null) { lock (CmsCache.GetLock(cacheKey)) { cachedObject = CmsCache.Get(cacheKey); if (cachedObject != null) { headersArray = (string[])cachedObject; } else { using (IDataReader reader = PageAttributes.GetByPageId(CMSContext.Current.PageId)) { if (reader.Read()) { headersArray = new string[] { (string)reader["MetaKeys"], (string)reader["MetaDescriptions"], (string)reader["Title"] }; CmsCache.Insert(cacheKey, headersArray, CmsConfiguration.Instance.Cache.PageDocumentTimeout); } reader.Close(); } } } } if (headersArray != null) { MetaKeyWord.Attributes.Add("content", headersArray[0]); MetaKeyWord.Attributes.Add("name", "keywords"); MetaDescription.Attributes.Add("content", headersArray[1]); MetaDescription.Attributes.Add("name", "description"); Head1.Title = headersArray[2]; Page.Title = headersArray[2]; // Set footer as well PageInclude.Text = GlobalVariable.GetVariable("page_include", CMSContext.Current.SiteId); } }
/// <summary> /// Binds the form. /// </summary> private void BindForm() { bool pageExists = false; if (PageId > 0) { using (IDataReader reader = FileTreeItem.GetItemById(PageId)) { if (reader.Read()) { pageExists = true; Name.Text = reader["Name"].ToString(); IsDefault.IsSelected = (bool)reader["IsDefault"]; MasterPageText.Text = (reader["MasterPage"] != DBNull.Value) && (reader["MasterPage"] != null) ? (string)reader["MasterPage"] : String.Empty; } reader.Close(); } // Load meta attributes using (IDataReader reader = PageAttributes.GetByPageId(PageId)) { if (reader.Read()) { txtTitle.Text = (string)reader["Title"]; txtKeywords.Text = (string)reader["MetaKeys"]; txtDescription.Text = (string)reader["MetaDescriptions"]; } else { // add default site attributes PageAttributes.Add(PageId, GlobalVariable.GetVariable(_GlobalVariableTitleKey, SiteId), GlobalVariable.GetVariable(_GlobalVariableMetaKeywordsKey, SiteId), GlobalVariable.GetVariable(_GlobalVariableMetaDescriptionKey, SiteId)); txtTitle.Text = GlobalVariable.GetVariable(_GlobalVariableTitleKey, SiteId); txtKeywords.Text = GlobalVariable.GetVariable(_GlobalVariableMetaKeywordsKey, SiteId); txtDescription.Text = GlobalVariable.GetVariable(_GlobalVariableMetaDescriptionKey, SiteId); } reader.Close(); } } if (!pageExists) { // update UI for creating a new page BindParentFolderList(); ParentFolderRow.Visible = true; } // since mater page is not used anywhere for now, hide it alway MasterPageRow.Visible = false; }
/** * <summary> * Changes the mapping of an individual page. * </summary> */ public static PageAllocator.Errors MapPage(void *page, void *phys_page, uint granularity, PageAttributes attr) { uint nativeAttr = 0, pde = 0, pte = 0; uint *table = null; // validity checks Diagnostics.Assert(ADC.Pager.GetPointerGranularity(page) == granularity, "X86.Pager::MapPage(): bad alignment on virtual page pointer"); Diagnostics.Assert(ADC.Pager.GetPointerGranularity(phys_page) == granularity, "X86.Pager::MapPage(): bad alignment on physical page pointer"); Diagnostics.Assert(page != PageTables, "X86.Pager::MapPage(): tried to change mapping of the page table!"); Diagnostics.Assert(page != PageDirectory, "X86.Pager::MapPage(): tried to change mapping of the page directory!"); Diagnostics.Assert(!PageAllocator.IsPageReserved(page), "X86.Pager::MapPage(): tried to change mapping on a reserved page."); // perform mapping nativeAttr = (uint)GetNativePMA(attr); PagePtrToTables(page, &pde, &pte); // Make sure the directory is present and read write PageDirectory[pde] |= (uint)PageAttr.Present; PageDirectory[pde] |= (uint)PageAttr.ReadWrite; if (granularity == 0) { uint tablePointer = PageDirectory[pde] & (uint)PageAttr.FrameMask; table = (uint *)tablePointer; } if (nativeAttr == 0xFFFFFFFF) { nativeAttr = table[pte] & (uint)PageAttr.AttributeMask; } // set our table entry to it's new target table[pte] = (uint)phys_page | nativeAttr; return(PageAllocator.Errors.Success); }
public override void Run() { // This is a sample worker implementation. Replace with your logic. Trace.TraceInformation("WorkerRole1 entry point called", "Information"); while (true) { Thread.Sleep(500); Trace.TraceInformation("Working", "Information"); CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("myurls"); queue.CreateIfNotExists(); // Create the table client. CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // Create the table if it doesn't exist. CloudTable table = tableClient.GetTableReference("people"); table.CreateIfNotExists(); CloudQueueMessage test = new CloudQueueMessage("Hello world"); queue.AddMessage(test); getRobotsTxt(); string results = getPageHTML("http://www.cnn.com"); getHrefLinks(results, robots); getXML("http://www.cnn.com/robots.txt"); CloudQueueMessage message; foreach (string eachURL in urls) { message = new CloudQueueMessage(eachURL); queue.AddMessage(message); } PageAttributes pA = new PageAttributes(); } }
/// <summary> /// Creates a new page. /// </summary> private void CreatePage() { int newId = 0; string newPageName = MakePageName(Name.Text); //create new page string guid = Guid.NewGuid().ToString(); newId = FileTreeItem.AddFileItem(guid, true, false, false, MasterPageText.Text, SiteId); FileTreeItem.MoveTo(newId, int.Parse(Root.SelectedValue)); FileTreeItem.UpdateFileItem(newId, newPageName, true, true, false, MasterPageText.Text, SiteId); //append meta description and keywords PageAttributes.Add(newId, String.IsNullOrEmpty(txtTitle.Text) ? GlobalVariable.GetVariable(_GlobalVariableTitleKey, SiteId) : txtTitle.Text, String.IsNullOrEmpty(txtKeywords.Text) ? GlobalVariable.GetVariable(_GlobalVariableMetaKeywordsKey, SiteId) : txtKeywords.Text, String.IsNullOrEmpty(txtDescription.Text) ? GlobalVariable.GetVariable(_GlobalVariableMetaDescriptionKey, SiteId) : txtDescription.Text); }
private static PageAttr GetNativePMA (PageAttributes attr) { if ((uint)attr == 0xFFFFFFFF) return (PageAttr)attr; PageAttr attrMask = 0; if ((attr & PageAttributes.ReadWrite) != 0) attrMask |= PageAttr.ReadWrite; if ((attr & PageAttributes.User) != 0) attrMask |= PageAttr.User; if ((attr & PageAttributes.Present) != 0) attrMask |= PageAttr.Present; return attrMask; }
public static Errors SetPageAttributes(void *page, uint granularity, PageAttributes attr) { return(Pager.SetPageAttributes(page, granularity, attr)); }
public static Errors SetPageAttributes (void* page, uint granularity, PageAttributes attr) { return Pager.SetPageAttributes (page, granularity, attr); }
/// <summary> /// Modifies the virtual memory mapping of the given super-page to point to /// the given physical super page. Both pointers must be aligned along the /// platform's native super-page boundaries. /// </summary> /// <remarks> /// This function is only available on platforms which can provide super-page /// mapping. The Intel 386 and later processors support this using the 'page /// directory', which maps large 4MB sections of memory at a time (via /// redirection to page tables which contain 4KB blocks). /// </remarks> /// <param name="superPage"> /// A pointer aligned along the platform's native super-page boundaries which /// represents the virtual address to map. /// </param> /// <param name="phys_superPage"> /// A pointer aligned along the platform's native super-page boundaries which /// represents the physical address to point to. /// </param> /// <param name="attr"> /// The attributes to apply to the paging table entry for this super-page. If /// one or more flags given in this parameter are not supported by the current /// platform, the call will fail, returning false. /// </param> /// <returns> /// Returns true if the map operation completed successfully. Returns false /// if the platform does not support super-page mapping or one of the flags /// supplied in <paramref name="attr"/>, or an error occurred. /// </returns> public static PageAllocator.Errors MapPage (void* page, void* physPage, uint granularity, PageAttributes attr) { return Pager.MapPage (page, physPage, granularity, attr); }
private async Task <bool> GetTaskInfoByUID(string UID, bool push = false) { IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); List <CSpecification> Specifications; try { Specifications = await m_ComosWeb.GetObjectSpecification( projectdata.SelectedDB.Key, projectdata.SelectedProject.UID, projectdata.SelectedLayer.UID, projectdata.SelectedLanguage.LCID, UID); } catch (Exception e) { await App.Current.MainPage.DisplayAlert("Error", "Error al obtener atributos: " + e.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } foreach (var item in Specifications) { if (item.Name.Equals(Constants.MobileTabName)) { CSystemObject sysobj; try { sysobj = await m_ComosWeb.GetObject(projectdata.SelectedLayer, UID, projectdata.SelectedLanguage.LCID); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar OT´s: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(false); } if (sysobj == null) { return(false); } CObject o = new CObject() { ClassType = sysobj.SystemType, Description = sysobj.Description, IsClientPicture = sysobj.IsClientPicture, Name = sysobj.Name, UID = sysobj.UID, OverlayUID = projectdata.SelectedLayer.UID, Picture = sysobj.Picture, ProjectUID = projectdata.SelectedProject.ProjectUID, SystemFullName = sysobj.Name, }; //Get OT Number string otNumber = ""; var objects = await m_ComosWeb.GetNavigatorNodes_Children(projectdata.SelectedLayer.Database, projectdata.SelectedProject.UID, projectdata.SelectedLayer.UID, projectdata.SelectedLanguage.LCID, sysobj.UID, "U"); CObject[] devices = objects.ToArray(); foreach (var device in devices) { if (device.Description.Equals(Constants.WP_OTCode_Description)) { otNumber = device.Name; } } PageAttributes page = new PageAttributes(projectdata.SelectedDB.Key, projectdata.SelectedLanguage.LCID, item, o, "wp", otNumber); //WorkPackageDetail page = new WorkPackageDetail(item,UID); if (push) { await this.Navigation.PushAsync(page); } return(true); } } this.ShowToast(Services.TranslateExtension.TranslateText("mobile_tab_not_found")); return(false); }
public async Task <PageAttributes> DownloadDeviceContent(string UID, bool push, bool onlymobile = true, bool recursive = true) { PageAttributes mobilepage = null; bool download = false; IComosWeb m_ComosWeb = Services.XServices.Instance.GetService <IComosWeb>(); ViewModels.ProjectData projectdata = Services.XServices.Instance.GetService <ViewModels.ProjectData>(); Services.XDatabase db = Services.XServices.Instance.GetService <Services.XDatabase>(); List <CSpecification> Specifications; try { Specifications = await m_ComosWeb.GetObjectSpecification( projectdata.SelectedDB.Key, projectdata.SelectedProject.UID, projectdata.SelectedLayer.UID, projectdata.SelectedLanguage.LCID, UID); } catch (TaskCanceledException) { return(null); } // If there is a Logout Request catch (Exception e) { await App.Current.MainPage.DisplayAlert("Error", "Error al obtener atributos: " + e.Message, Services.TranslateExtension.TranslateText("OK")); return(null); } if (Specifications == null || Specifications.Count == 0) { return(null); } foreach (var item in Specifications) { //TO DO DOWNLOAD EVERYTHING??? if (item.Name.Equals(Constants.MobileTabName) || !onlymobile) { download = true; } if (download) { CSystemObject sysobj; try { sysobj = await m_ComosWeb.GetObject(projectdata.SelectedLayer, UID, projectdata.SelectedLanguage.LCID); } catch (TaskCanceledException) { return(null); } // If there is a Logout Request catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", "Error al cargar objetos de Comos Web: " + ex.Message, Services.TranslateExtension.TranslateText("OK")); return(null); } if (sysobj == null) { return(null); } CObject o = new CObject() { ClassType = sysobj.SystemType, Description = sysobj.Description, IsClientPicture = sysobj.IsClientPicture, Name = sysobj.Name, UID = sysobj.UID, OverlayUID = projectdata.SelectedLayer.UID, Picture = sysobj.Picture, ProjectUID = projectdata.SelectedProject.UID, SystemFullName = sysobj.Name, }; //check if its download only PageAttributes page = null; if (!push) { page = new PageAttributes(); await page.Init(projectdata.SelectedDB.Key, projectdata.SelectedLanguage.LCID, item, o); } else { page = new PageAttributes(projectdata.SelectedDB.Key, projectdata.SelectedLanguage.LCID, item, o); } //download all documents if not pushing to page if (!push) { List <string> uids_docs = await page.DownloadDocuments(); foreach (var doc in uids_docs) { // string[] filename_mime = await DownloadDocument(doc, false); CDocument filename_mime = await DownloadDocument(doc, false); if (filename_mime != null && filename_mime.FileName != null) { db.CacheDocumentFilePath(filename_mime.FileName, filename_mime.MimeType, doc, projectdata.SelectedProject.UID, projectdata.SelectedLayer.UID, filename_mime.Name, filename_mime.Description, filename_mime.Picture); } else { if (recursive) { await DownloadDeviceContent(doc, false, true, false); } } } } if (item.Name.Equals(Constants.MobileTabName)) { mobilepage = page; } download = false; } } return(mobilepage); }
/** <summary> Changes the mapping of an individual page. </summary> */ public static PageAllocator.Errors MapPage(void* page, void* phys_page, uint granularity, PageAttributes attr) { uint nativeAttr = 0, pde = 0, pte = 0; uint* table = null; // validity checks Diagnostics.Assert(ADC.Pager.GetPointerGranularity(page) == granularity, "X86.Pager::MapPage(): bad alignment on virtual page pointer"); Diagnostics.Assert(ADC.Pager.GetPointerGranularity(phys_page) == granularity, "X86.Pager::MapPage(): bad alignment on physical page pointer"); Diagnostics.Assert(page != PageTables, "X86.Pager::MapPage(): tried to change mapping of the page table!"); Diagnostics.Assert(page != PageDirectory, "X86.Pager::MapPage(): tried to change mapping of the page directory!"); Diagnostics.Assert(!PageAllocator.IsPageReserved(page), "X86.Pager::MapPage(): tried to change mapping on a reserved page."); // perform mapping nativeAttr = (uint) GetNativePMA(attr); PagePtrToTables(page, &pde, &pte); // Make sure the directory is present and read write PageDirectory[pde] |= (uint)PageAttr.Present; PageDirectory[pde] |= (uint)PageAttr.ReadWrite; if (granularity == 0) { uint tablePointer = PageDirectory[pde] & (uint)PageAttr.FrameMask; table = (uint*)tablePointer; } if (nativeAttr == 0xFFFFFFFF) nativeAttr = table[pte] & (uint)PageAttr.AttributeMask; // set our table entry to it's new target table[pte] = (uint)phys_page | nativeAttr; return PageAllocator.Errors.Success; }
public static PageAllocator.Errors SetPageAttributes (void* page, uint granularity, PageAttributes attr) { uint pde = 0, pte = 0; uint* table = null; uint nativeAttr = (uint)GetNativePMA(attr); if (granularity < 0 || granularity > 1) return PageAllocator.Errors.UnsupportedGranularity; Diagnostics.Assert(nativeAttr != 0xFFFFFFFF, "X86.Pager::SetPageAttributes(): bad page map attributes"); Diagnostics.Assert(ADC.Pager.GetPointerGranularity(page) == granularity, "X86.Pager::SetPageAttributes(): bad alignment on page pointer"); PagePtrToTables(page, &pde, &pte); table = PageDirectory; if (granularity == 0) table = (uint*)(PageDirectory[pde] & (uint)PageAttr.FrameMask); table[pte] = (table[pte] & (uint)PageAttr.FrameMask) | nativeAttr; return PageAllocator.Errors.Success; }
public static PageAllocator.Errors MapPage(void *page, void *phys_page, uint granularity, PageAttributes attr) { Diagnostics.Warning("Pager.MapPage - not implemented!"); return(PageAllocator.Errors.NotImplemented); }
/// <summary> /// Modifies the virtual memory mapping of the given super-page to point to /// the given physical super page. Both pointers must be aligned along the /// platform's native super-page boundaries. /// </summary> /// <remarks> /// This function is only available on platforms which can provide super-page /// mapping. The Intel 386 and later processors support this using the 'page /// directory', which maps large 4MB sections of memory at a time (via /// redirection to page tables which contain 4KB blocks). /// </remarks> /// <param name="superPage"> /// A pointer aligned along the platform's native super-page boundaries which /// represents the virtual address to map. /// </param> /// <param name="phys_superPage"> /// A pointer aligned along the platform's native super-page boundaries which /// represents the physical address to point to. /// </param> /// <param name="attr"> /// The attributes to apply to the paging table entry for this super-page. If /// one or more flags given in this parameter are not supported by the current /// platform, the call will fail, returning false. /// </param> /// <returns> /// Returns true if the map operation completed successfully. Returns false /// if the platform does not support super-page mapping or one of the flags /// supplied in <paramref name="attr"/>, or an error occurred. /// </returns> public static PageAllocator.Errors MapPage(void *page, void *physPage, uint granularity, PageAttributes attr) { return(Pager.MapPage(page, physPage, granularity, attr)); }