Skip to content

Commit 769c863

Browse files
author
Konstantina Chremmou
committed
Removed deprecated methods.
Signed-off-by: Konstantina Chremmou <[email protected]>
1 parent 9a1a547 commit 769c863

File tree

2 files changed

+4
-54
lines changed

2 files changed

+4
-54
lines changed

ocaml/sdk-gen/csharp/autogen/src/Session.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,11 @@ public Session(JsonRpcClient client)
7070
JsonRpcClient = client;
7171
}
7272

73-
[Obsolete("Use Session(string url) { Timeout = ... }; instead.")]
74-
public Session(int timeout, string url)
75-
: this(new JsonRpcClient(url))
76-
{
77-
JsonRpcClient.Timeout = timeout;
78-
}
79-
8073
public Session(string url) :
8174
this(new JsonRpcClient(url))
8275
{
8376
}
8477

85-
[Obsolete("Use Session(string host, int port) { Timeout = ... }; instead.")]
86-
public Session(int timeout, string host, int port)
87-
: this(timeout, GetUrl(host, port))
88-
{
89-
}
90-
9178
public Session(string host, int port)
9279
: this(GetUrl(host, port))
9380
{
@@ -100,23 +87,6 @@ public Session(string url, string opaqueRef)
10087
SetupSessionDetails();
10188
}
10289

103-
/// <summary>
104-
/// Create a new Session instance, using the given instance and timeout. The connection details and Xen-API session handle will be
105-
/// copied from the given instance, but a new connection will be created. Use this if you want a duplicate connection to a host,
106-
/// for example when you need to cancel an operation that is blocking the primary connection.
107-
/// </summary>
108-
/// <param name="session"></param>
109-
/// <param name="timeout"></param>
110-
[Obsolete("Use Session(Session session) { Timeout = ... }; instead.")]
111-
public Session(Session session, int timeout)
112-
: this(session)
113-
{
114-
if (JsonRpcClient != null)
115-
{
116-
JsonRpcClient.Timeout = timeout;
117-
}
118-
}
119-
12090
/// <summary>
12191
/// Create a new Session instance, using the given instance. The connection details
12292
/// and Xen-API session handle will be copied from the given instance, but a new

ocaml/sdk-gen/csharp/templates/ApiVersion.mustache

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
*/
2929

3030
using System;
31-
using System.Collections;
32-
using System.Collections.Generic;
33-
3431

3532
namespace XenAPI
3633
{
@@ -63,8 +60,7 @@ namespace XenAPI
6360
{
6461
try
6562
{
66-
return (API_Version)Enum.Parse(typeof(API_Version),
67-
string.Format("API_{0}_{1}", major, minor));
63+
return (API_Version)Enum.Parse(typeof(API_Version), $"API_{major}_{minor}");
6864
}
6965
catch (ArgumentException)
7066
{
@@ -82,30 +78,14 @@ namespace XenAPI
8278
{
8379
string[] tokens = version.Split('.');
8480
int major, minor;
85-
if (tokens.Length == 2 && int.TryParse(tokens[0], out major) && int.TryParse(tokens[1], out minor))
81+
if (tokens.Length == 2 &&
82+
int.TryParse(tokens[0], out major) &&
83+
int.TryParse(tokens[1], out minor))
8684
{
8785
return GetAPIVersion(major, minor);
8886
}
8987
}
9088
return API_Version.UNKNOWN;
9189
}
92-
93-
/// <summary>
94-
/// Return a positive number if the given session's API version is greater than the given
95-
/// API_version, negative if it is less, and 0 if they are equal.
96-
/// </summary>
97-
internal static int APIVersionCompare(Session session, API_Version v)
98-
{
99-
return (int)session.APIVersion - (int)v;
100-
}
101-
102-
/// <summary>
103-
/// Return true if the given session's API version is greater than or equal to the given
104-
/// API_version.
105-
/// </summary>
106-
internal static bool APIVersionMeets(Session session, API_Version v)
107-
{
108-
return APIVersionCompare(session, v) >= 0;
109-
}
11090
}
11191
}

0 commit comments

Comments
 (0)