예제 #1
0
        private static string CalculateAboutWindowLabel()
        {
            string result;

            if (!UnityVSSupport.IsUnityVSEnabled())
            {
                result = "";
            }
            else
            {
                Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.Location == UnityVSSupport.s_UnityVSBridgeToLoad);
                if (assembly == null)
                {
                    result = "";
                }
                else
                {
                    StringBuilder stringBuilder = new StringBuilder("Microsoft Visual Studio Tools for Unity ");
                    stringBuilder.Append(assembly.GetName().Version);
                    stringBuilder.Append(" enabled");
                    result = stringBuilder.ToString();
                }
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Callback from AssetPostprocessor which is called after CSProj file(s) are generated.
        /// </summary>
        public static void OnGeneratedCSProjectFiles()
        {
            if (!UnityVSSupport.IsUnityVSEnabled())
            {
                return;
            }

            try
            {
                var projectDir   = Directory.GetCurrentDirectory();
                var projectFiles = Directory.GetFiles(projectDir, string.Format("*{0}", SolutionSynchronizer.GetProjectExtension(ScriptingLanguage.CSharp)), SearchOption.TopDirectoryOnly);
                foreach (string projectFile in projectFiles)
                {
                    var file = projectFile.Substring(projectDir.Length + 1);
                    ReplacePathsInProjectFile(file, projectDir);
                }
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogWarning("Post processing of CS project files failed, reason: " + e.Message);
            }
        }
 public static void OnGeneratedCSProjectFiles()
 {
     if (UnityVSSupport.IsUnityVSEnabled())
     {
         try
         {
             string   currentDirectory = Directory.GetCurrentDirectory();
             string[] files            = Directory.GetFiles(currentDirectory, string.Format("*{0}", SolutionSynchronizer.GetProjectExtension(ScriptingLanguage.CSharp)), SearchOption.TopDirectoryOnly);
             string[] array            = files;
             for (int i = 0; i < array.Length; i++)
             {
                 string text        = array[i];
                 string projectFile = text.Substring(currentDirectory.Length + 1);
                 SolutionPostProcessor.ReplacePathsInProjectFile(projectFile, currentDirectory);
             }
         }
         catch (Exception ex)
         {
             Debug.LogWarning("Post processing of CS project files failed, reason: " + ex.Message);
         }
     }
 }