Exemple #1
0
        IDisposable StartWatching(Action <string> callback)
        {
            string path = "";

            if (ScriptSource == ScriptSource.File)
            {
                path = SourcePath;
            }
#if UNITY_EDITOR
            else if (ScriptSource == ScriptSource.TextAsset)
            {
                path = UnityEditor.AssetDatabase.GetAssetPath(SourceAsset);
            }
            else if (ScriptSource == ScriptSource.Resource)
            {
                path = UnityEditor.AssetDatabase.GetAssetPath(Resources.Load(SourcePath));
            }
#endif

            if (string.IsNullOrWhiteSpace(path))
            {
                return(null);
            }

            return(DetectChanges.WatchFileSystem(path, x => callback(System.IO.File.ReadAllText(path))));
        }
        /// <summary>
        /// Saves the settings of this instance.
        /// </summary>
        public override void Save()
        {
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildVersioningStyle,
                                              VersioningStyle.ToGlobalVariable(), VersioningStyle.GetDefaultGlobalVariable());
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateAssemblyVersion,
                                              AutoUpdateAssemblyVersion.ToString(), "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateFileVersion,
                                              AutoUpdateFileVersion.ToString(), "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildAction,
                                              BuildAction.ToString(), "Both");
            string startDate = string.Format("{0}/{1}/{2}",
                                             StartDate.Year,
                                             StartDate.Month,
                                             StartDate.Day);

            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_startDate,
                                              startDate, "1975/10/21");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_replaceNonNumerics,
                                              ReplaceNonNumerics.ToString(), "true");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_incrementBeforeBuild,
                                              IncrementBeforeBuild.ToString(), "true");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_assemblyInfoFilename,
                                              AssemblyInfoFilename, "");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_configurationName,
                                              ConfigurationName, "Any");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useGlobalSettings,
                                              UseGlobalSettings.ToString(), "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useUniversalClock,
                                              IsUniversalTime.ToString(), "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_detectChanges,
                                              DetectChanges.ToString(), "true");
        }
Exemple #3
0
        IDisposable StartWatching(Action <string> callback)
        {
            string path = GetResolvedSourcePath();

            if (string.IsNullOrWhiteSpace(path))
            {
                return(null);
            }

            return(DetectChanges.WatchFileSystem(path, x => callback(System.IO.File.ReadAllText(path))));
        }
        public override void Save()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_buildVersioningStyle,
                                              VersioningStyle.ToGlobalVariable(),
                                              VersioningStyle.GetDefaultGlobalVariable());
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_updateAssemblyVersion,
                                              AutoUpdateAssemblyVersion.ToString(),
                                              "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_updateFileVersion,
                                              AutoUpdateFileVersion.ToString(),
                                              "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_buildAction,
                                              BuildAction.ToString(),
                                              "Both");
            var startDate = $"{StartDate.Year}/{StartDate.Month}/{StartDate.Day}";

            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_startDate,
                                              startDate,
                                              "2000/01/01");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_replaceNonNumerics,
                                              ReplaceNonNumerics.ToString(),
                                              "true");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_incrementBeforeBuild,
                                              IncrementBeforeBuild.ToString(),
                                              "true");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_assemblyInfoFilename,
                                              AssemblyInfoFilename,
                                              "");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_configurationName,
                                              ConfigurationName,
                                              "Any");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_useGlobalSettings,
                                              UseGlobalSettings.ToString(),
                                              "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_useUniversalClock,
                                              IsUniversalTime.ToString(),
                                              "false");
            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_detectChanges,
                                              DetectChanges.ToString(),
                                              "true");
        }