예제 #1
0
        // retrieve cached string value.
        public bool TryGetCachedValueString(int index, out string value, IDataFormatter formatter)
        {
            int cacheIndex;

            if (TryGetCacheIndex(index, out cacheIndex))
            {
                if (!m_CacheDirty[cacheIndex])
                {
                    if (formatter != DefaultDataFormatter.Instance)
                    {
                        // not caching string from other formatter than the default one
                        value = formatter.Format(m_Cache[cacheIndex]);
                    }
                    else
                    {
                        var stringCache = GetDefaultStringCache();
                        if (stringCache[cacheIndex] == null)
                        {
                            stringCache[cacheIndex] = formatter.Format(m_Cache[cacheIndex]);
                        }
                        value = stringCache[cacheIndex];
                    }
                    return(true);
                }
            }
            value = null;
            return(false);
        }
예제 #2
0
        public string GenerateTelemetry()
        {
            var telemetry = File.ReadAllText(Path.Combine(_dataFolder, _files[_index % _files.Length]));

            _index++;

            if (_formatter != null)
            {
                telemetry = _formatter.Format(telemetry);
            }
            return(telemetry);
        }
예제 #3
0
        public void Scrape(uint numPosts)
        {
            if (numPosts == 0)
            {
                throw new ArgumentOutOfRangeException("Number of posts must be greater than zero.");
            }

            var  posts = new List <Post>();
            bool requiredPostsAdded = false;

            int pageNumber = 1;

            while (!requiredPostsAdded)
            {
                string             page      = _importer.Import(_uri + pageNumber);
                IEnumerable <Post> pagePosts = _parser.Parse(page);
                foreach (var post in pagePosts)
                {
                    posts.Add(post);
                    if (posts.Count == numPosts)
                    {
                        requiredPostsAdded = true;
                        break;
                    }
                }
                pageNumber++;
            }

            string formattedPosts = _formatter.Format(posts);

            _exporter.Export(formattedPosts);
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        private void ExportRows()
        {
            // grid row value
            //
            this._currentRow++;
            foreach (DataGridViewRow dgvrow in _dgv.Rows)
            {
                foreach (DataGridViewCell cell in dgvrow.Cells)
                {
                    if (cell.Value != null)
                    {
                        object         val       = null;
                        IDataFormatter formatter = this.DataFormatterCollection.GetDataFormatter(cell.ValueType);
                        if (formatter != null)
                        {
                            val = formatter.Format(cell.Value);
                        }
                        else
                        {
                            val = cell.FormattedValue;
                        }

                        int col = _dgv.Columns[cell.ColumnIndex].DisplayIndex + 1;
                        XlsFile.SetCellValue(_currentRow, col, val);
                    }
                }
                _currentRow++;
            }
        }
예제 #5
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     if (row >= GetRowCount())
     {
         return("Out of Range");
     }
     return(formatter.Format(GetRowValue(row)));
 }
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     if (mbDirty)
     {
         ComputeAllValues();
     }
     return(formatter.Format(entries[(int)row]));
 }
예제 #7
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     if (vc.m_IsDisplayMergedOnly)
     {
         return("");
     }
     return(formatter.Format(value));
 }
 string IObjectDataTypeFormatter.Format(CachedSnapshot snapshot, ObjectData od, IDataFormatter formatter)
 {
     if (od.dataIncludeObjectHeader)
     {
         od = od.GetBoxedValue(snapshot, true);
     }
     return(formatter.Format(od.managedObjectData.ReadString()));
 }
예제 #9
0
        public override string GetRowValueString(long row, IDataFormatter formatter)
        {
            var rc = GetRowValue(row);

            if (rc < 0)
            {
                return("N/A");
            }
            return(formatter.Format(rc));
        }
예제 #10
0
        public override string GetRowValueString(long row, IDataFormatter formatter)
        {
            var l = GetRowValue(row);

            if (l == CachedSnapshot.NativeObjectEntriesCache.InstanceID_None)
            {
                return("");
            }
            return(formatter.Format(l));
        }
예제 #11
0
        public override string GetRowValueString(long row, IDataFormatter formatter)
        {
            var i = GetRowValue(row);

            if (i < 0)
            {
                return("");
            }
            return(formatter.Format(i));
        }
        string IObjectDataTypeFormatter.Format(CachedSnapshot snapshot, ObjectData od, IDataFormatter formatter)
        {
            ulong ptr;

            if (od.managedObjectData.TryReadPointer(out ptr) != BytesAndOffset.PtrReadError.Success)
            {
                return(k_InvalidIntPtr);
            }

            return(formatter.Format(ptr));
        }
 private string GetGroupValueString(long groupIndex, long row, IDataFormatter formatter)
 {
     if (m_IsGroupKey || m_GroupTable.IsGroupDegenerate(groupIndex))
     {
         //pick first value of the group
         return(m_Column.GetRowValueString(m_GroupTable.m_Groups[groupIndex].m_GroupIndice[0], formatter));
     }
     else if (algorithm != null)
     {
         return(formatter.Format(GetGroupValue(groupIndex, row)));
     }
     else
     {
         return("");
     }
 }
 string IObjectDataTypeFormatter.Format(CachedSnapshot snapshot, ObjectData od, IDataFormatter formatter)
 {
     return(formatter.Format(od.managedObjectData.ReadUInt32()));
 }
예제 #15
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     return(formatter.Format(row));
 }
예제 #16
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     return(formatter.Format(Enum.GetName(typeof(DiffTable.DiffResult), m_Table.m_Entries[row].diffResult)));
 }
예제 #17
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     return(formatter.Format(getter(list[(int)row])));
 }
예제 #18
0
 public override string GetRowValueString(long row, IDataFormatter formatter)
 {
     return(formatter.Format(m_Transformer(m_Cache[row])));
 }