C# Class TrackChanges.Command

Inheritance: IExternalCommand
Show file Open project: pix3lot/Slackit

Public Properties

Property Type Description
_start_state string>.Dictionary

Public Methods

Method Description
ElementDescription ( Document doc, int element_id ) : string
ElementDescription ( Element e ) : string

Return a string describing the given element: .NET type name, category name, family and symbol name for a family instance, element id and element name.

Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
GetElementState ( Element e ) : string

Return a string representing the given element state. This is the information you wish to track. It is up to you to ensure that all data you are interested in really is included in this snapshot. In this case, we ignore all elements that do not have a valid bounding box.

GetSnapshot ( IEnumerable a ) : string>.Dictionary

Return a dictionary mapping element id values to hash codes of the element state strings. This represents a snapshot of the current database state.

GetTrackedElements ( Document doc ) : IEnumerable

Retrieve all elements to track. It is up to you to decide which elements are of interest to you.

ReportDifferences ( Document doc, string>.Dictionary start_state, string>.Dictionary end_state ) : string

Compare the start and end states and report the differences found. In this implementation, we just store a hash code of the element state. If you choose to store the full string representation, you can use that for comparison, and then report exactly what changed and the original values as well.

Private Methods

Method Description
GetBytes ( string str ) : byte[]

Convert a string to a byte array.

Method Details

ElementDescription() public static method

public static ElementDescription ( Document doc, int element_id ) : string
doc Document
element_id int
return string

ElementDescription() public static method

Return a string describing the given element: .NET type name, category name, family and symbol name for a family instance, element id and element name.
public static ElementDescription ( Element e ) : string
e Element
return string

Execute() public method

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
return System.Result

GetElementState() public static method

Return a string representing the given element state. This is the information you wish to track. It is up to you to ensure that all data you are interested in really is included in this snapshot. In this case, we ignore all elements that do not have a valid bounding box.
public static GetElementState ( Element e ) : string
e Element
return string

GetSnapshot() public static method

Return a dictionary mapping element id values to hash codes of the element state strings. This represents a snapshot of the current database state.
public static GetSnapshot ( IEnumerable a ) : string>.Dictionary
a IEnumerable
return string>.Dictionary

GetTrackedElements() public static method

Retrieve all elements to track. It is up to you to decide which elements are of interest to you.
public static GetTrackedElements ( Document doc ) : IEnumerable
doc Document
return IEnumerable

ReportDifferences() public static method

Compare the start and end states and report the differences found. In this implementation, we just store a hash code of the element state. If you choose to store the full string representation, you can use that for comparison, and then report exactly what changed and the original values as well.
public static ReportDifferences ( Document doc, string>.Dictionary start_state, string>.Dictionary end_state ) : string
doc Document
start_state string>.Dictionary
end_state string>.Dictionary
return string

Property Details

_start_state public static property

Current snapshot of database state. You could also store the entire element state strings here, not just their hash code, to report their complete original and modified values.
public static Dictionary _start_state
return string>.Dictionary