Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Resolve deprecated code warnings #488

Merged
merged 1 commit into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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