Skip to content

Commit

Permalink
Merge pull request #488 from JoC0de/feature/resolve-deprecated-code
Browse files Browse the repository at this point in the history
Resolve deprecated code warnings
  • Loading branch information
JoC0de authored Jan 21, 2023
2 parents ba92e12 + 6254c6e commit 67b7551
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 20 additions & 3 deletions src/NuGetForUnity/Editor/NugetPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace NugetForUnity
/// <summary>
/// Handles the displaying, editing, and saving of the preferences for NuGet For Unity.
/// </summary>
public static class NugetPreferences
public class NugetPreferences : SettingsProvider
{
/// <summary>
/// The current version of NuGet for Unity.
Expand All @@ -18,11 +18,28 @@ public static class NugetPreferences
/// </summary>
private static Vector2 scrollPosition;

/// <summary>
/// Instantiate the settings provider.
/// </summary>
public NugetPreferences()
: base("Preferences/NuGet For Unity", SettingsScope.User)
{
}

/// <summary>
/// Creates a instance of the NuGet for Unity settings provider.
/// </summary>
/// <returns>The instance of the settings provider.</returns>
[SettingsProvider]
public static SettingsProvider Create()
{
return new NugetPreferences();
}

/// <summary>
/// Draws the preferences GUI inside the Unity preferences window in the Editor.
/// </summary>
[PreferenceItem("NuGet For Unity")]
public static void PreferencesGUI()
public override void OnGUI(string searchContext)
{
var preferencesChangedThisFrame = false;

Expand Down
4 changes: 2 additions & 2 deletions src/NuGetForUnity/Editor/NugetWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected static void CheckForUpdates()
string latestVersion = null;
string latestVersionDownloadUrl = null;
string response = null;
if (!request.isNetworkError && !request.isHttpError)
if (string.IsNullOrEmpty(request.error))
{
response = request.downloadHandler.text;
}
Expand Down Expand Up @@ -327,7 +327,7 @@ private void Refresh(bool forceFullRefresh)
}
catch (Exception e)
{
Debug.LogErrorFormat("Error while refreshing NuGet packages list: {0}", e.ToString());
Debug.LogErrorFormat("Error while refreshing NuGet packages list: {0}", e);
}
finally
{
Expand Down

0 comments on commit 67b7551

Please sign in to comment.