public void CheckRoot() { for (int i = 0; i < formList.Count; i++) { StatPage sp = formList[i] as StatPage; if (sp != null) { sp.CheckRoot(); sp.ChangeLoginButton(); continue; } StorePage storePage = formList[i] as StorePage; if (storePage != null) { storePage.CheckRoot(); continue; } MapPage mp = formList[i] as MapPage; if (mp != null) { mp.CheckRoot(); continue; } } }
private static StatPage FindPage(string categoryName) { if (categoryName == null) { categoryName = ""; } if (pages.ContainsKey(categoryName)) { // Return the existing page return(pages[categoryName]); } else { // Add a new page for this category StatPage page = new StatPage(categoryName); pages[categoryName] = page; // Add the category to the category list categories.Add(categoryName); categories.Sort(); return(page); } }
void clickStat() { if (ActualPage?.GetType() != typeof(StatPage)) { ActualPage = new StatPage(); } }
private void button2_Click(object sender, EventArgs e) { MainPush.Text = "Открытие телеметрии..."; StatPage sp = new StatPage(); formList.Add(sp); sp.ShadowType = MetroFormShadowType.None; sp.Owner = this; sp.Show(); MainPush.Text = ""; }
public static void SetStat(string category, string name, string value) { if (!allowLogging) { return; } StatPage page = FindPage(category); page.SetStat(name, value); hasStatsChanged = true; }
private void UpdateStats() { if (pages.Count == 0) { for (int i = 0; i < statLines.Length; i++) { statLines[i].text = ""; } return; } if (currentCategory == "" && categories.Count > 0) { currentCategory = categories [0]; } StatPage page = FindPage(currentCategory); List <string> keys = new List <string> (); List <string> values = new List <string> (); page.GetStats(keys, values); statLines [0].text = " [ " + currentCategory + " ]"; for (int i = 0; i < statLines.Length - 1; i++) { Text textLine = statLines[i + 1]; if (i < keys.Count) { textLine.text = keys[i] + ": " + values[i]; } else { textLine.text = ""; } } }
static int statDecodePage( Btree pBt, StatPage p ) { int nUnused; int iOff; int nHdr; int isLeaf; u8[] aData = sqlite3PagerGetData( p.pPg ); u8[] aHdr = new byte[p.iPgno == 1 ? aData.Length - 100 : aData.Length]; Buffer.BlockCopy( aData, p.iPgno == 1 ? 100 : 0, aHdr, 0, aHdr.Length ); p.flags = aHdr[0]; p.nCell = get2byte( aHdr, 3 ); p.nMxPayload = 0; isLeaf = ( p.flags == 0x0A || p.flags == 0x0D ) ? 1 : 0; nHdr = 12 - isLeaf * 4 + ( ( p.iPgno == 1 ) ? 1 : 0 ) * 100; nUnused = get2byte( aHdr, 5 ) - nHdr - 2 * p.nCell; nUnused += (int)aHdr[7]; iOff = get2byte( aHdr, 1 ); while ( iOff != 0 ) { nUnused += get2byte( aData, iOff + 2 ); iOff = get2byte( aData, iOff ); } p.nUnused = nUnused; p.iRightChildPg = isLeaf != 0 ? 0 : sqlite3Get4byte( aHdr, 8 ); if ( p.nCell != 0 ) { int i; /* Used to iterate through cells */ int nUsable = sqlite3BtreeGetPageSize( pBt ) - sqlite3BtreeGetReserve( pBt ); p.aCell = new StatCell[p.nCell + 1];// sqlite3_malloc( ( p.nCell + 1 ) * sizeof( StatCell ) ); //memset(p.aCell, 0, (p.nCell+1) * sizeof(StatCell)); for ( i = 0; i < p.nCell; i++ ) { p.aCell[i] = new StatCell(); StatCell pCell = p.aCell[i]; iOff = get2byte( aData, nHdr + i * 2 ); if ( 0 == isLeaf ) { pCell.iChildPg = sqlite3Get4byte( aData, iOff ); iOff += 4; } if ( p.flags == 0x05 ) { /* A table interior node. nPayload==0. */ } else { u32 nPayload; /* Bytes of payload total (local+overflow) */ int nLocal; /* Bytes of payload stored locally */ iOff += getVarint32( aData, iOff, out nPayload ); if ( p.flags == 0x0D ) { ulong dummy; iOff += sqlite3GetVarint( aData, iOff, out dummy ); } if ( nPayload > p.nMxPayload ) p.nMxPayload = (int)nPayload; getLocalPayload( nUsable, p.flags, (int)nPayload, out nLocal ); pCell.nLocal = nLocal; Debug.Assert( nPayload >= nLocal ); Debug.Assert( nLocal <= ( nUsable - 35 ) ); if ( nPayload > nLocal ) { int j; int nOvfl = (int)( ( nPayload - nLocal ) + nUsable - 4 - 1 ) / ( nUsable - 4 ); pCell.nLastOvfl = (int)( nPayload - nLocal ) - ( nOvfl - 1 ) * ( nUsable - 4 ); pCell.nOvfl = nOvfl; pCell.aOvfl = new uint[nOvfl];//sqlite3_malloc(sizeof(u32)*nOvfl); pCell.aOvfl[0] = sqlite3Get4byte( aData, iOff + nLocal ); for ( j = 1; j < nOvfl; j++ ) { int rc; u32 iPrev = pCell.aOvfl[j - 1]; DbPage pPg = null; rc = sqlite3PagerGet( sqlite3BtreePager( pBt ), iPrev, ref pPg ); if ( rc != SQLITE_OK ) { Debug.Assert( pPg == null ); return rc; } pCell.aOvfl[j] = sqlite3Get4byte( sqlite3PagerGetData( pPg ) ); sqlite3PagerUnref( pPg ); } } } } } return SQLITE_OK; }
static void statClearPage( ref StatPage p ) { int i; if ( p != null && p.aCell != null ) { for ( i = 0; i < p.nCell; i++ ) { p.aCell[i].aOvfl = null;//sqlite3_free( p.aCell[i].aOvfl ); } sqlite3PagerUnref( p.pPg ); // sqlite3_free( p.aCell ); // sqlite3_free( p.zPath ); } p = new StatPage();//memset( p, 0, sizeof( StatPage ) ); }