From 2641fc83cf853c7e7e5387ab6ac3965a89a0c95d Mon Sep 17 00:00:00 2001 From: Lukasz Date: Tue, 22 Dec 2015 10:01:41 +0100 Subject: [PATCH] Removed unused result string from PairResult. Check for assets folder when opening Unity project. Improved logging. --- .../RestClient.cs | 1 - MonoDevelop.UnityMode/UnityModeAddin.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/MonoDevelop.UnityMode.UnityRestClient/RestClient.cs b/MonoDevelop.UnityMode.UnityRestClient/RestClient.cs index d9c1f15..3348eb3 100644 --- a/MonoDevelop.UnityMode.UnityRestClient/RestClient.cs +++ b/MonoDevelop.UnityMode.UnityRestClient/RestClient.cs @@ -60,7 +60,6 @@ namespace MonoDevelop.UnityMode.UnityRestClient unityprocessid = -1; } - public string result { get; set; } public int unityprocessid { get; set; } public string unityproject { get; set; } } diff --git a/MonoDevelop.UnityMode/UnityModeAddin.cs b/MonoDevelop.UnityMode/UnityModeAddin.cs index 077b9f3..39dfb85 100644 --- a/MonoDevelop.UnityMode/UnityModeAddin.cs +++ b/MonoDevelop.UnityMode/UnityModeAddin.cs @@ -89,6 +89,13 @@ namespace MonoDevelop.UnityMode public static void OpenUnityProject(string projectPath) { + if(!System.IO.Directory.Exists(System.IO.Path.Combine(projectPath, "Assets"))) + { + MessageService.GenericAlert(new GenericMessage("Not a Unity project directory. Assets folder not found.", projectPath)); + ShutdownAndUnpair(); + return; + } + var restServiceSettings = UnityRestServiceSettings.Load (projectPath); if(restServiceSettings == null) @@ -116,18 +123,18 @@ namespace MonoDevelop.UnityMode DispatchService.ThreadDispatch(() => { LoggingService.LogInfo("Sending Pair request to Unity"); - + PairResult pairResult = null; try { pairResult = RestClient.Pair(monoDevelopRestServiceUrl, BrandingService.ApplicationName + " " + BuildInfo.VersionLabel); - LoggingService.LogInfo("Unity Pair Request Result: " + pairResult.result); + LoggingService.LogInfo("Unity Pair response. Project:" + pairResult.unityproject + " Process ID: " + pairResult.unityprocessid); } catch(Exception e) { MessageService.GenericAlert(new GenericMessage("Unable to connect to Unity instance. Is Unity running?")); - LoggingService.LogInfo("Unity Pair Request (" + unityRestServiceUrl + ") Exception: " + e); + LoggingService.LogWarning("Unity Pair Request (" + unityRestServiceUrl + ")", e); ShutdownAndUnpair(); return; } @@ -180,8 +187,9 @@ namespace MonoDevelop.UnityMode return; } - LoggingService.LogInfo("Sending Unity AssetDatabase request"); + LoggingService.LogInfo("Starting Unity Project refresh"); + LoggingService.LogInfo("Sending Unity AssetDatabase request"); var assetDatabase = RestClient.GetUnityAssetDatabase(); assetDatabase.Hint = hint; UnityAssetDatabase = assetDatabase;