GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
GenerallyPositive.ConverterHelper Class Reference

Classes

class  ReferenceEqualityComparer

Static Public Member Functions

static List< dynamic > ConvertClassToList (dynamic myClass)
static Dictionary< object, dynamic > ConvertClassToDictionary (dynamic myClass, string name="", HashSet< object > visited=null)
static dynamic ConvertToClass (dynamic dictList, Type targetType, dynamic parentDictionary, List< string > columnNames)
static bool IsBigIntegerType (Type type)
static bool IsByteType (Type type)
static bool IsBooleanType (Type type)
static bool IsDateTimeType (Type type)
static bool IsDateTimeOffsetType (Type type)
static bool IsIpAddressType (Type type)
static bool IsTimeSpanType (Type type)
static bool IsGuidType (Type type)
static bool IsVersionType (Type type)
static bool IsEnumerableType (Type type)
static int CountGraphNodes (object root, int limit, out bool cyclic)
 Walks an object graph far enough to answer two questions about it: is it big, and does it hold a cycle.
static int CountGraphNodes (object root, int limit)
 Counts nodes in an object graph, stopping at limit .
static bool IsEnumerableObject (dynamic dynamicObject)
static void ConvertDictionaryToXmlElement (dynamic obj, XmlElement parent, bool emitWrapper=true, bool isTopLevel=true, HashSet< object > visited=null)
static void ConvertHtmlDictionaryToXml (dynamic obj, XmlElement parent)
static string ConvertDictionaryToHtml (Dictionary< object, dynamic > dictionary)
static List< Dictionary< object, dynamic > > ConvertHtmlToDictionary (dynamic inputDataOrFilename, bool isChildren=false)
static HtmlNodeCollection GetHtmlNodes (dynamic htmlorFilename)
static dynamic CreateIEnumerableFromClass< T > (ConverterSettings converterSettings)
static List< T > CreateListFromClass< T > (ConverterSettings converterSettings)
static dynamic InstantiateOne (Type objectType, int arrayLength=0)
static bool AddToList (dynamic listQueueStackDictHashsetOrArray, dynamic value, int count)
static Type GetConcreteType (Type type)
static object NormalizeForCleanJson (object input)
static object StripGpalKeys (object input)
 Strips GPAL###_ prefixes and correctly handles repeated XML elements by turning sibling elements with the same name into proper lists — without extra nesting.
static bool TryConvertToWaitTime (object value, out WaitTime result)

Detailed Description

Definition at line 41 of file ConverterHelper.cs.

Member Function Documentation

◆ AddToList()

bool GenerallyPositive.ConverterHelper.AddToList ( dynamic listQueueStackDictHashsetOrArray,
dynamic value,
int count )
static

Definition at line 5256 of file ConverterHelper.cs.

◆ ConvertClassToDictionary()

Dictionary< object, dynamic > GenerallyPositive.ConverterHelper.ConvertClassToDictionary ( dynamic myClass,
string name = "",
HashSet< object > visited = null )
static

Definition at line 256 of file ConverterHelper.cs.

◆ ConvertClassToList()

List< dynamic > GenerallyPositive.ConverterHelper.ConvertClassToList ( dynamic myClass)
static

Definition at line 46 of file ConverterHelper.cs.

◆ ConvertDictionaryToHtml()

string GenerallyPositive.ConverterHelper.ConvertDictionaryToHtml ( Dictionary< object, dynamic > dictionary)
static

Definition at line 4659 of file ConverterHelper.cs.

◆ ConvertDictionaryToXmlElement()

void GenerallyPositive.ConverterHelper.ConvertDictionaryToXmlElement ( dynamic obj,
XmlElement parent,
bool emitWrapper = true,
bool isTopLevel = true,
HashSet< object > visited = null )
static

Definition at line 3141 of file ConverterHelper.cs.

◆ ConvertHtmlDictionaryToXml()

void GenerallyPositive.ConverterHelper.ConvertHtmlDictionaryToXml ( dynamic obj,
XmlElement parent )
static

Definition at line 3306 of file ConverterHelper.cs.

◆ ConvertHtmlToDictionary()

List< Dictionary< object, dynamic > > GenerallyPositive.ConverterHelper.ConvertHtmlToDictionary ( dynamic inputDataOrFilename,
bool isChildren = false )
static
Parameters
inputDataOrFilename
isChildrentrue if we are processing child records, so we want to keep #text tags
Returns

Definition at line 4787 of file ConverterHelper.cs.

◆ ConvertToClass()

dynamic GenerallyPositive.ConverterHelper.ConvertToClass ( dynamic dictList,
Type targetType,
dynamic parentDictionary,
List< string > columnNames )
static

Definition at line 612 of file ConverterHelper.cs.

◆ CountGraphNodes() [1/2]

int GenerallyPositive.ConverterHelper.CountGraphNodes ( object root,
int limit )
static

Counts nodes in an object graph, stopping at limit .

Parameters
rootThe graph to walk
limitNode count to stop at
Returns
Nodes counted

Definition at line 2914 of file ConverterHelper.cs.

◆ CountGraphNodes() [2/2]

int GenerallyPositive.ConverterHelper.CountGraphNodes ( object root,
int limit,
out bool cyclic )
static

Walks an object graph far enough to answer two questions about it: is it big, and does it hold a cycle.

Both answers are wanted for the same decision, so the graph is walked once. The walk stops at limit nodes or at the first node it meets twice, whichever comes first, so its cost does not grow with the payload: a collection of forty thousand and one of four million cost the same.

A node already on the path back to the root is a cycle. Reference identity decides that, not Equals, because two equal nodes are not the same node and writing each of them out is correct.

Members are walked as well as collection items, since a cycle usually runs through a property rather than a list. What that would cost is kept down two ways: the members worth walking are worked out once per type and remembered, and a type whose members are all primitives, strings, dates, guids or decimals is never descended at all, because nothing made of those can take part in a cycle.

Parameters
rootThe graph to walk
limitNode count to stop at. Zero or less walks the whole graph, answering only cyclic
cyclicAnswers true when a node was met twice on one path
Returns
Nodes counted, which reaches but never passes limit

Definition at line 2896 of file ConverterHelper.cs.

◆ CreateIEnumerableFromClass< T >()

dynamic GenerallyPositive.ConverterHelper.CreateIEnumerableFromClass< T > ( ConverterSettings converterSettings)
static

Definition at line 4930 of file ConverterHelper.cs.

◆ CreateListFromClass< T >()

List< T > GenerallyPositive.ConverterHelper.CreateListFromClass< T > ( ConverterSettings converterSettings)
static

Definition at line 5076 of file ConverterHelper.cs.

◆ GetConcreteType()

Type GenerallyPositive.ConverterHelper.GetConcreteType ( Type type)
static

Definition at line 5439 of file ConverterHelper.cs.

◆ GetHtmlNodes()

HtmlNodeCollection GenerallyPositive.ConverterHelper.GetHtmlNodes ( dynamic htmlorFilename)
static

Definition at line 4905 of file ConverterHelper.cs.

◆ InstantiateOne()

dynamic GenerallyPositive.ConverterHelper.InstantiateOne ( Type objectType,
int arrayLength = 0 )
static

Definition at line 5089 of file ConverterHelper.cs.

◆ IsBigIntegerType()

bool GenerallyPositive.ConverterHelper.IsBigIntegerType ( Type type)
static

Definition at line 2813 of file ConverterHelper.cs.

◆ IsBooleanType()

bool GenerallyPositive.ConverterHelper.IsBooleanType ( Type type)
static

Definition at line 2830 of file ConverterHelper.cs.

◆ IsByteType()

bool GenerallyPositive.ConverterHelper.IsByteType ( Type type)
static

Definition at line 2826 of file ConverterHelper.cs.

◆ IsDateTimeOffsetType()

bool GenerallyPositive.ConverterHelper.IsDateTimeOffsetType ( Type type)
static

Definition at line 2838 of file ConverterHelper.cs.

◆ IsDateTimeType()

bool GenerallyPositive.ConverterHelper.IsDateTimeType ( Type type)
static

Definition at line 2834 of file ConverterHelper.cs.

◆ IsEnumerableObject()

bool GenerallyPositive.ConverterHelper.IsEnumerableObject ( dynamic dynamicObject)
static

Definition at line 3058 of file ConverterHelper.cs.

◆ IsEnumerableType()

bool GenerallyPositive.ConverterHelper.IsEnumerableType ( Type type)
static

Definition at line 2869 of file ConverterHelper.cs.

◆ IsGuidType()

bool GenerallyPositive.ConverterHelper.IsGuidType ( Type type)
static

Definition at line 2861 of file ConverterHelper.cs.

◆ IsIpAddressType()

bool GenerallyPositive.ConverterHelper.IsIpAddressType ( Type type)
static

Definition at line 2842 of file ConverterHelper.cs.

◆ IsTimeSpanType()

bool GenerallyPositive.ConverterHelper.IsTimeSpanType ( Type type)
static

Definition at line 2846 of file ConverterHelper.cs.

◆ IsVersionType()

bool GenerallyPositive.ConverterHelper.IsVersionType ( Type type)
static

Definition at line 2865 of file ConverterHelper.cs.

◆ NormalizeForCleanJson()

object GenerallyPositive.ConverterHelper.NormalizeForCleanJson ( object input)
static

Definition at line 5997 of file ConverterHelper.cs.

◆ StripGpalKeys()

object GenerallyPositive.ConverterHelper.StripGpalKeys ( object input)
static

Strips GPAL###_ prefixes and correctly handles repeated XML elements by turning sibling elements with the same name into proper lists — without extra nesting.

Definition at line 6104 of file ConverterHelper.cs.

◆ TryConvertToWaitTime()

bool GenerallyPositive.ConverterHelper.TryConvertToWaitTime ( object value,
out WaitTime result )
static

Definition at line 6283 of file ConverterHelper.cs.


The documentation for this class was generated from the following file: