Skip to content

Commit 6e60131

Browse files
committed
[Extensions] Update exception types and add CodeTemplate attributes for deprecated Revit 2027 methods
1 parent 6f67596 commit 6e60131

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

source/Nice3point.Revit.Extensions/UtilsExtensions/ParameterUtilsExtensions.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public BuiltInParameter GetBuiltInParameter()
5353
/// <exception cref="T:Autodesk.Revit.Exceptions.ArgumentException">
5454
/// Thrown when the given parameter identifier is empty.
5555
/// </exception>
56-
/// <exception cref="!:Autodesk::Revit::Exceptions::NetworkCommunicationError">
56+
/// <exception cref="T:Autodesk.Revit.Exceptions.NetworkCommunicationException">
5757
/// Thrown when communication with the Parameters Service is unsuccessful.
5858
/// </exception>
5959
/// <exception cref="T:Autodesk.Revit.Exceptions.ResourceNotFoundException">
@@ -66,7 +66,13 @@ public BuiltInParameter GetBuiltInParameter()
6666
/// Thrown when the user is not signed in.
6767
/// </exception>
6868
#if REVIT2027_OR_GREATER
69+
[Pure]
6970
[Obsolete("This method is deprecated in Revit 2027 and may be removed in a later version of Revit. We suggest you use the overload which accepts a region input instead.")]
71+
[CodeTemplate(
72+
searchTemplate: "$expr$.DownloadParameterOptions()",
73+
Message = "DownloadParameterOptions() is obsolete, use overload with region parameter",
74+
ReplaceTemplate = "$expr$.DownloadParameterOptions($arg$)",
75+
ReplaceMessage = "Replace with DownloadParameterOptions(region)")]
7076
#endif
7177
public ParameterDownloadOptions DownloadParameterOptions()
7278
{
@@ -89,7 +95,7 @@ public ParameterDownloadOptions DownloadParameterOptions()
8995
/// <exception cref="T:Autodesk.Revit.Exceptions.ArgumentException">
9096
/// Thrown when the parameter identifier does not include an account identifier.
9197
/// </exception>
92-
/// <exception cref="!:Autodesk::Revit::Exceptions::NetworkCommunicationError">
98+
/// <exception cref="T:Autodesk.Revit.Exceptions.NetworkCommunicationException">
9399
/// Thrown when communication with the remote service is unsuccessful.
94100
/// </exception>
95101
/// <exception cref="T:Autodesk.Revit.Exceptions.ResourceNotFoundException">
@@ -102,7 +108,13 @@ public ParameterDownloadOptions DownloadParameterOptions()
102108
/// Thrown when the user is not signed in.
103109
/// </exception>
104110
#if REVIT2027_OR_GREATER
111+
[Pure]
105112
[Obsolete("This method is deprecated in Revit 2027 and may be removed in a later version of Revit. We suggest you use the overload which accepts a region input instead.")]
113+
[CodeTemplate(
114+
searchTemplate: "$expr$.DownloadCompanyName($document$)",
115+
Message = "DownloadCompanyName(Document) is obsolete, use overload with region parameter",
116+
ReplaceTemplate = "$expr$.DownloadCompanyName($document$, $arg$)",
117+
ReplaceMessage = "Replace with DownloadCompanyName(document, region)")]
106118
#endif
107119
public string DownloadCompanyName(Document document)
108120
{
@@ -171,14 +183,18 @@ public string DownloadCompanyName(Document document)
171183
[Pure]
172184
#if REVIT2027_OR_GREATER
173185
[Obsolete("This method is deprecated in Revit 2027 and may be removed in a later version of Revit. We suggest you use the overload which accepts a region input instead.")]
186+
[CodeTemplate(
187+
searchTemplate: "$expr$.DownloadParameter($document$, $options$)",
188+
Message = "DownloadParameter(Document, ParameterDownloadOptions) is obsolete, use overload with region parameter",
189+
ReplaceTemplate = "$expr$.DownloadParameter($document$, $options$, $arg$)",
190+
ReplaceMessage = "Replace with DownloadParameter(document, options, region)")]
174191
#endif
175192
public SharedParameterElement DownloadParameter(Document document, ParameterDownloadOptions options)
176193
{
177194
return ParameterUtils.DownloadParameter(document, options, typeId);
178195
}
179196
#endif
180197
#if REVIT2027_OR_GREATER
181-
182198
/// <summary>
183199
/// Retrieves settings associated with the given parameter from the Parameters Service.
184200
/// </summary>

0 commit comments

Comments
 (0)