Skip to content

Instantly share code, notes, and snippets.

@JeffJacobson
Created March 27, 2014 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffJacobson/9812906 to your computer and use it in GitHub Desktop.
Save JeffJacobson/9812906 to your computer and use it in GitHub Desktop.
Convert JSDoc property descriptions to C# properties using Regex search & replace in Visual Studio

Property Regex:

^\s*\*\s@property\s{(\w+)}\s(\w+)(?:\s*-\s*)?([^\r\n]+)\s*$

Captures

  1. type name
  2. property name
  3. property description

Replace:

/// <summary>$3</summary>\npublic $1 $2 { get; set; }
// Results. Note that some of the types from JavaScript will still need to be renamed (e.g., Date => DateTime | DateTimeOffset)
/// <summary> Since the Find Nearest Route Location method does not return records for locations where it could not find any routes within the search parameters, this ID parameter can be used to indicate which source location a route location corresponds to.</summary>
public number Id { get; set; }
/// <summary> An 3 to 11 digit state route identifier.</summary>
public string Route { get; set; }
/// <summary> Indicates of this location is on the Decrease LRS. This value will be ignored if Route is a ramp.</summary>
public Decrease Decrease { get; set; }
/// <summary> The starting measure value.</summary>
public number Arm { get; set; }
/// <summary> The SRMP for the start point of a route segment or the only point of a point.</summary>
public number Srmp { get; set; }
/// <summary> Indicates if the SRMP value is back mileage.</summary>
public Boolean Back { get; set; }
/// <summary> The date that the data was collected.</summary>
public Date ReferenceDate { get; set; }
/// <summary> The ArmCalc output date.</summary>
public Date ResponseDate { get; set; }
/// <summary> This is for storing ArmCalc result data of the start point.</summary>
public Date RealignmentDate { get; set; }
/// <summary> The end measure value. Not used when defining a point.</summary>
public number EndArm { get; set; }
/// <summary> The SRMP for the end point of a route segment. Not used when defining a point.</summary>
public number EndSrmp { get; set; }
/// <summary> Indicates if the EndSrmp value is back mileage. Not used when defining a point.</summary>
public Boolean EndBack { get; set; }
/// <summary> The date that the data was collected. Not used when defining a point.</summary>
public Date EndReferenceDate { get; set; }
/// <summary> The ArmCalc output date. Not used when defining a point.</summary>
public Date EndResponseDate { get; set; }
/// <summary> This is for storing ArmCalc result data of the end point. Not used when defining a point.</summary>
public Date EndRealignDate { get; set; }
/// <summary> ArmCalc return code. See Appendix A of <a href="http://wwwi.wsdot.wa.gov/gis/roadwaydata/training/roadwaydata/pdf/PC_ArmCalc_Manual_3-19-2009.pdf">the PC ArmCalc Training Program Manual</a>.</summary>
public number ArmCalcReturnCode { get; set; }
/// <summary> ArmCalc return code for end point of a route segment. See Appendix A of <a href="http://wwwi.wsdot.wa.gov/gis/roadwaydata/training/roadwaydata/pdf/PC_ArmCalc_Manual_3-19-2009.pdf">the PC ArmCalc Training Program Manual</a>.</summary>
public number ArmCalcEndReturnCode { get; set; }
/// <summary> The error message (if any) returned by ArmCalc when converting the begin point. If no error occurs, this will be set to an empty string by the SOE.</summary>
public string ArmCalcReturnMessage { get; set; }
/// <summary> The error message (if any) returned by ArmCalc when converting the end point. If no error occurs, this will be set to an empty string by the SOE.</summary>
public string ArmCalcEndReturnMessage { get; set; }
/// <summary> If a location cannot be found on the LRS, this value will contain a message.</summary>
public string LocatingError { get; set; }
/// <summary> An object representing either a point or a polygon.</summary>
public Object RouteGeometry { get; set; }
/// <summary> When locating the nearest point along a route, this value will be set to the input point.</summary>
public Object EventPoint { get; set; }
/// <summary> The offset distance from the EventPoint to the RouteGeometry point.</summary>
public number Distance { get; set; }
/// <summary> The offset angle from the EventPoint to the RouteGeometry point.</summary>
public number Angle { get; set; }
* @property {number} Id Since the Find Nearest Route Location method does not return records for locations where it could not find any routes within the search parameters, this ID parameter can be used to indicate which source location a route location corresponds to.
* @property {string} Route An 3 to 11 digit state route identifier.
* @property {Decrease} Decrease Indicates of this location is on the Decrease LRS. This value will be ignored if Route is a ramp.
* @property {number} Arm The starting measure value.
* @property {number} Srmp The SRMP for the start point of a route segment or the only point of a point.
* @property {Boolean} Back Indicates if the SRMP value is back mileage.
* @property {Date} ReferenceDate The date that the data was collected.
* @property {Date} ResponseDate The ArmCalc output date.
* @property {Date} RealignmentDate This is for storing ArmCalc result data of the start point.
* @property {number} EndArm The end measure value. Not used when defining a point.
* @property {number} EndSrmp The SRMP for the end point of a route segment. Not used when defining a point.
* @property {Boolean} EndBack Indicates if the EndSrmp value is back mileage. Not used when defining a point.
* @property {Date} EndReferenceDate The date that the data was collected. Not used when defining a point.
* @property {Date} EndResponseDate The ArmCalc output date. Not used when defining a point.
* @property {Date} EndRealignDate This is for storing ArmCalc result data of the end point. Not used when defining a point.
* @property {number} ArmCalcReturnCode ArmCalc return code. See Appendix A of <a href="http://wwwi.wsdot.wa.gov/gis/roadwaydata/training/roadwaydata/pdf/PC_ArmCalc_Manual_3-19-2009.pdf">the PC ArmCalc Training Program Manual</a>.
* @property {number} ArmCalcEndReturnCode ArmCalc return code for end point of a route segment. See Appendix A of <a href="http://wwwi.wsdot.wa.gov/gis/roadwaydata/training/roadwaydata/pdf/PC_ArmCalc_Manual_3-19-2009.pdf">the PC ArmCalc Training Program Manual</a>.
* @property {string} ArmCalcReturnMessage The error message (if any) returned by ArmCalc when converting the begin point. If no error occurs, this will be set to an empty string by the SOE.
* @property {string} ArmCalcEndReturnMessage The error message (if any) returned by ArmCalc when converting the end point. If no error occurs, this will be set to an empty string by the SOE.
* @property {string} LocatingError If a location cannot be found on the LRS, this value will contain a message.
* @property {Object} RouteGeometry An object representing either a point or a polygon.
* @property {Object} EventPoint When locating the nearest point along a route, this value will be set to the input point.
* @property {number} Distance The offset distance from the EventPoint to the RouteGeometry point.
* @property {number} Angle The offset angle from the EventPoint to the RouteGeometry point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment