public SimpleDocument(IBlankPageSource blankPageSource, IDataFormatter dataFormatter) { if (blankPageSource == null) throw new ArgumentNullException("blankPageSource"); if (dataFormatter == null) throw new ArgumentNullException("dataFormatter"); _blankPageSource = blankPageSource; _dataFormatter = dataFormatter; }
public string FormatObject(ObjectData od, IDataFormatter formatter, bool objectBrief) { IObjectDataTypeFormatter td; if (m_TypeFormatter.TryGetValue(od.managedTypeIndex, out td)) { return(td.Format(m_Snapshot, od, formatter)); } return(FormatObjectBrief(od, formatter, objectBrief)); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { IDataFormatter formatter = DataFormatters.GetFormatter(filterContext); if (formatter != null) { filterContext.Controller.ViewBag.DataFormatter = formatter; filterContext.Controller.ViewBag.AddIncludes = formatter.AddIncludes; } base.OnActionExecuting(filterContext); }
public override string GetRowValueString(long row, IDataFormatter formatter) { var i = GetRowValue(row); if (i < 0) { return(""); } return(m_Table.Formatter.FormatPointer(i)); }
public string Format(ObjectData od, IDataFormatter formatter, bool objectBrief = true) { switch (od.dataType) { case ObjectDataType.BoxedValue: return(FormatValueType(od.GetBoxedValue(m_Snapshot, true), formatter, objectBrief)); case ObjectDataType.Value: return(FormatValueType(od, formatter, objectBrief)); case ObjectDataType.Object: return(FormatObject(od, formatter, objectBrief)); case ObjectDataType.Array: return(FormatArray(od, formatter)); case ObjectDataType.ReferenceObject: { ulong ptr = od.GetReferencePointer(); if (ptr == 0) { return(FormatPointer(ptr)); } else { var o = ObjectData.FromManagedPointer(m_Snapshot, ptr); return(FormatObject(o, formatter, objectBrief)); } } case ObjectDataType.ReferenceArray: { ulong ptr = od.GetReferencePointer(); if (ptr == 0) { return(FormatPointer(ptr)); } var arr = ObjectData.FromManagedPointer(m_Snapshot, ptr); return(FormatArray(arr, formatter)); } case ObjectDataType.Type: return(m_Snapshot.typeDescriptions.typeDescriptionName[od.managedTypeIndex]); case ObjectDataType.Global: return("<global>"); case ObjectDataType.NativeObject: return(FormatPointer(m_Snapshot.nativeObjects.nativeObjectAddress[od.nativeObjectIndex])); default: return("<uninitialized type>"); } }
public void SetUp() { _numberOfEvents = 0; _dataFormatter = Substitute.For <IDataFormatter>(); _transponderReceiver = Substitute.For <ITransponderReceiver>(); _uut = new TransponderReceiverClient(_transponderReceiver, _dataFormatter); _uut.ItemArrivedReceived += (sender, args) => _numberOfEvents++; }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { this.mDisposed = true; if (mStorageId != null) { lock (GLOBAL_STORAGE_ID) { GLOBAL_STORAGE_ID.Remove(mStorageId); } } mDataFormatter = null; }
public Report( IDataGetter dataGetter, IDataValidator dataValidator, IDataFormatter dataFormatter, IReportDistributor reportDistributor ) { _dataGetter = dataGetter; _dataValidator = dataValidator; _dataFormatter = dataFormatter; _reportDistributor = reportDistributor; }
public SQLiteDataAdapter( SQLiteConnection sqLiteConnection, IDataFormatter <T> dataFormatter, IUniqueIdentityGenerator uniqueIdentityGenerator) { Contract.Requires <ArgumentNullException>(sqLiteConnection != null); Contract.Requires <ArgumentNullException>(dataFormatter != null); Contract.Requires <ArgumentNullException>(uniqueIdentityGenerator != null); this.sqLiteConnection = sqLiteConnection; this.dataFormatter = dataFormatter; this.uniqueIdentityGenerator = uniqueIdentityGenerator; }
/// <summary> /// Initializes a new instance of the <see cref="HibernateStorageProvider<T>"/> class. /// </summary> /// <param name="storageId">The storage id.</param> /// <param name="dataFormatter">The data formatter.</param> /// <param name="compressContent">if set to <c>true</c> [compress content].</param> public HibernateStorageProvider(string storageId, IDataFormatter <T> dataFormatter, bool compressContent) : base(storageId) { if (dataFormatter == null) { ThrowHelper.ThrowArgumentNullException("dataFormatter"); } this.mDataFormatter = dataFormatter; this.mCompressContent = compressContent; Initialize(); }
public SimpleDocument(IBlankPageSource blankPageSource, IDataFormatter dataFormatter) { if (blankPageSource == null) { throw new ArgumentNullException("blankPageSource"); } if (dataFormatter == null) { throw new ArgumentNullException("dataFormatter"); } _blankPageSource = blankPageSource; _dataFormatter = dataFormatter; }
//This method takes an IDataReader and an IDataFormatter and uses them to convert source rows to standard data rows. public static DataTable Convert(IDataReader dataReader, IDataFormatter dataFormatter) { var sourceDataTable = dataReader.GetDataTable(); var destDataTable = new StandardDataTable(); foreach (DataRow row in sourceDataTable.Rows) { var formattedRow = dataFormatter.FormatRow(destDataTable, row); destDataTable.Rows.Add(formattedRow.ItemArray); } return(destDataTable); }
// Formats using available IObjectDataTypeFormatter or return false if none available public bool TryCustomFormat(ObjectData od, out string result, IDataFormatter formatter) { if (od.isManaged) { IObjectDataTypeFormatter td; if (m_TypeFormatter.TryGetValue(od.managedTypeIndex, out td)) { result = td.Format(m_Snapshot, od, formatter); return(true); } } result = null; return(false); }
/// <summary> /// Writes the specified obj. /// </summary> /// <typeparam name="T">Generic type</typeparam> /// <param name="obj">The obj.</param> /// <param name="file">The file.</param> /// <param name="formatter">The formatter.</param> /// <param name="compress">if set to <c>true</c> [compress].</param> /// <exception cref="System.ArgumentNullException"> /// file /// or /// formatter /// </exception> public static void Write <T>(T obj, FileInfo file, IDataFormatter <T> formatter, bool compress) { if (file == null) { ThrowHelper.ThrowArgumentNullException("file"); } if (formatter == null) { ThrowHelper.ThrowArgumentNullException("formatter"); } using (FileStream fs = new FileStream(file.FullName, FileMode.Create, FileAccess.Write, FileShare.Read)) { Write <T>(obj, fs, formatter, compress); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { IDataFormatter formatter = DataFormatters.GetFormatter(filterContext); if (formatter != null) { filterContext.Controller.ViewData[DxaViewDataItems.DisableOutputCache] = true; filterContext.Controller.ViewData[DxaViewDataItems.DataFormatter] = formatter; filterContext.Controller.ViewData[DxaViewDataItems.AddIncludes] = formatter.AddIncludes; } else { filterContext.Controller.ViewData[DxaViewDataItems.DisableOutputCache] = false; } base.OnActionExecuting(filterContext); }
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(""); } }
/// <summary> /// Reads the specified file. /// </summary> /// <typeparam name="T">Generic type</typeparam> /// <param name="file">The file.</param> /// <param name="formatter">The formatter.</param> /// <param name="decompress">if set to <c>true</c> [decompress].</param> /// <returns>Data</returns> /// <exception cref="System.ArgumentNullException"> /// file /// or /// formatter /// </exception> public static T Read <T>(FileInfo file, IDataFormatter <T> formatter, bool decompress) { if (file == null) { ThrowHelper.ThrowArgumentNullException("file"); } if (formatter == null) { ThrowHelper.ThrowArgumentNullException("formatter"); } using (FileStream fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) { return(Read <T>(fs, formatter, decompress)); } }
public string FormatArray(ObjectData od, IDataFormatter formatter) { IObjectDataTypeFormatter td; if (m_TypeFormatter.TryGetValue(od.managedTypeIndex, out td)) { return(td.Format(m_Snapshot, od, formatter)); } var str = FormatPointer(od.hostManagedObjectPtr); if (od.hostManagedObjectPtr != 0) { var arrayInfo = ArrayTools.GetArrayInfo(m_Snapshot, od.managedObjectData, od.managedTypeIndex); str += "[" + arrayInfo.ArrayRankToString() + "]"; } return(str); }
public T BuildApi <T>(string baseUri, IDataFormatter defaultDataFormatter) where T : class { var apiData = new ApiData { BaseUri = baseUri, HttpClient = _httpClient, DefaultDataFormatter = defaultDataFormatter }; var apiStructure = new ApiAnalyzer <T>().Analyze(); var interceptor = new ApiInvocator <T>(apiData, apiStructure); var api = new ProxyBuilder <T>().Build(interceptor); return(api); }
public override string GetRowValueString(long row, IDataFormatter formatter) { if (vc.m_IsDisplayMergedOnly) { return(""); } long r = GetRow(row); if (r >= 0) { return(column.GetRowValueString(r, formatter)); } else { return("N/A"); } }
/// <summary> /// Initializes a new instance of the <see cref="FileStorageProvider<T>"/> class. /// </summary> /// <param name="storageId">The storage id.</param> /// <param name="dataFormatter">The data formatter.</param> /// <param name="baseUrl">The base URL.</param> /// <param name="compressContent">if set to <c>true</c> [compress content].</param> public FileStorageProvider(String storageId, IDataFormatter <T> dataFormatter, String baseUrl, bool compressContent) : base(storageId) { if (dataFormatter == null) { throw new ArgumentNullException("dataFormatter"); } if (baseUrl == null) { throw new ArgumentNullException("baseUrl"); } this.mDataFormatter = dataFormatter; this.mBaseUrl = baseUrl; this.mCompressContent = compressContent; Initialize(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (disposing) { if (mAppIdMutex != null) { mAppIdMutex.Close(); mAppIdMutex = null; } //if (mAllocationTable != null) //{ // // remove all elements // try // { // using (ISession session = GetSession()) // { // using (ITransaction transaction = session.BeginTransaction()) // { // QueryParams<PersistentStorageAllocationTable> query = new QueryParams<PersistentStorageAllocationTable>( // GetAllocationTableCriteria(), 1); // IList<PersistentStorageAllocationTable> resultList = QueryHelper.Query<PersistentStorageAllocationTable>(session, query, LOG_QUERY); // if (resultList.Count > 0) // { // ORMUtils.DeleteEntity(resultList[0], session); // } // foreach (EntityId entityId in mAllocationTable.ItemIds) // { // RemoveObject(entityId, session); // } // transaction.Commit(); // } // } // } // catch (Exception) // { // } //} } mAllocationTable = null; mTableFormatter = null; base.Dispose(disposing); }
public override void OnActionExecuted(ActionExecutedContext filterContext) { ControllerBase controller = filterContext.Controller; IDataFormatter formatter = controller.ViewData[DxaViewDataItems.DataFormatter] as IDataFormatter; // Once we got here, we expect the View Model to be enriched already, but in case of a Page Model, // the embedded Region/Entity Models won't be enriched yet. if (formatter != null && formatter.ProcessModel && controller is PageController) { PageModel pageModel = controller.ViewData.Model as PageModel; ((PageController)controller).EnrichEmbeddedModels(pageModel); ActionResult result = formatter.FormatData(filterContext, pageModel); if (result != null) { filterContext.Result = result; } } base.OnActionExecuted(filterContext); }
// Formats "{field=value, ...}" public string FormatObjectBrief(ObjectData od, IDataFormatter formatter, bool objectBrief) { if (objectBrief) { string result = "{"; var iid = od.GetInstanceID(m_Snapshot); if (iid != ObjectData.InvalidInstanceID) { result += "InstanceID=" + iid; } int fieldCount = od.GetInstanceFieldCount(m_Snapshot); if (fieldCount > 0) { if (iid != ObjectData.InvalidInstanceID) { result += ", "; } var field = od.GetInstanceFieldByIndex(m_Snapshot, 0); string k = field.GetFieldName(m_Snapshot); string v = Format(field, formatter, false); if (fieldCount > 1) { return(result + k + "=" + v + ", ...}"); } else { return(result + k + "=" + v + "}"); } } else { return(result + "}"); } } ulong ptr; if (od.TryGetObjectPointer(out ptr)) { return(FormatPointer(ptr)); } return("{...}"); }
public override string GetRowValueString(long row, IDataFormatter formatter) { if (vc.m_IsDisplayMergedOnly) { return(""); } Update(); if (m_rowIndex == null) { //act as passthrough return(column.GetRowValueString(row, formatter)); } else if (row < m_rowIndex.Length && m_rowIndex[row] >= 0) { return(column.GetRowValueString(m_rowIndex[row], formatter)); } else { return("N/A"); } }
public string FormatArray(ObjectData od, IDataFormatter formatter) { IObjectDataTypeFormatter td; if (m_TypeFormatter.TryGetValue(od.managedTypeIndex, out td)) { return(td.Format(m_Snapshot, od, formatter)); } var originalTypeName = m_Snapshot.typeDescriptions.typeDescriptionName[od.managedTypeIndex]; var sb = new System.Text.StringBuilder(originalTypeName); if (od.hostManagedObjectPtr != 0) { var arrayInfo = ArrayTools.GetArrayInfo(m_Snapshot, od.managedObjectData, od.managedTypeIndex); switch (arrayInfo.rank.Length) { case 1: int nestedArrayCount = CountArrayOfArrays(originalTypeName); sb.Replace(k_ArrayClosedSqBrackets, string.Empty); sb.Append('['); sb.Append(arrayInfo.ArrayRankToString()); sb.Append(']'); for (int i = 1; i < nestedArrayCount; ++i) { sb.Append(k_ArrayClosedSqBrackets); } break; default: sb.Append('['); sb.Append(arrayInfo.ArrayRankToString()); sb.Append(']'); break; } } return(sb.ToString()); }
public override string GetRowValueString(long row, IDataFormatter formatter) { var e = m_Table.m_RowData[row]; if (e.isGroupHead()) { if (m_Column == null) { return((string)Convert.ChangeType(default(DataT), typeof(string))); } return(m_Column.GetRowValueString(e.groupIndex, formatter)); } else { var subTable = m_Table.GetGroupSubTable(e.groupIndex); if (subTable != null) { var col = subTable.GetColumnByIndex(m_ColumnIndex); return(col.GetRowValueString(e.subGroupIndex, formatter)); } } return(""); }
/// <summary> /// Writes the specified obj. /// </summary> /// <typeparam name="T">Generic type</typeparam> /// <param name="obj">The obj.</param> /// <param name="stream">The stream.</param> /// <param name="formatter">The formatter.</param> /// <param name="compress">if set to <c>true</c> [compress].</param> /// <exception cref="System.ArgumentNullException"> /// stream /// or /// formatter /// </exception> public static void Write <T>(T obj, Stream stream, IDataFormatter <T> formatter, bool compress) { if (stream == null) { ThrowHelper.ThrowArgumentNullException("stream"); } if (formatter == null) { ThrowHelper.ThrowArgumentNullException("formatter"); } if (compress) { using (MemoryStream ms = new MemoryStream()) { formatter.Write(ms, obj); COMPRESSION_FORMATTER.Write(stream, ms.ToArray()); } } else { formatter.Write(stream, obj); } }
public override string GetRowValueString(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row, IDataFormatter formatter) { return(sourceColumn.GetRowValueString(row, formatter)); }
public override string GetRowValueString(long row, IDataFormatter formatter) { return(m_Cache.GetValueStringFromExpression((int)row, entries[row], 0, formatter)); }
public SimpleDocument(IDataFormatter dataFormatter) : this(new RelayedBlankPageSource(_ => new BlankPageBase()), dataFormatter) { }
string IObjectDataTypeFormatter.Format(CachedSnapshot snapshot, ObjectData od, IDataFormatter formatter) { return(formatter.Format(od.managedObjectData.ReadUInt32())); }
public ServerEventWriter(IOutputWriter writer, IDataFormatter formatter) { _writer = writer; _formatter = formatter; }