Inheritance: DefaultMenuAction, MenuAction
コード例 #1
0
        public AC Remove <CT>() where CT : T
        {
            var op = new BuildAction <Type>(ActionTypes.Remove, typeof(CT));

            ActionList.Add(op);
            return((AC)AggregatorBuilder);
        }
コード例 #2
0
        public AC Clear()
        {
            var op = new BuildAction <T>(ActionTypes.Clear, null);

            ActionList.Add(op);
            return((AC)AggregatorBuilder);
        }
コード例 #3
0
        public AC Add <CT>() where CT : T    //TODO: Add<>
        {
            var op = new BuildAction <Type>(ActionTypes.Add, typeof(CT));

            ActionList.Add(op);
            return((AC)AggregatorBuilder);
        }
コード例 #4
0
ファイル: Engine.cs プロジェクト: gurudennis/EzBuildSys
        private void ResolveStage(BuildAction action, Profile.Stage stage)
        {
            if (stage == null)
            {
                return;
            }

            if (stage.Type != Profile.StageType.Build &&
                stage.Type != Profile.StageType.PostClean &&
                action == BuildAction.Clean)
            {
                return;
            }

            if (action == BuildAction.Rebuild && stage.Type == Profile.StageType.Build)
            {
                foreach (Profile.Item item in stage.Items)
                {
                    ResolveItem(BuildAction.Clean, stage, item);
                }

                foreach (Profile.Item item in stage.Items)
                {
                    ResolveItem(BuildAction.Build, stage, item);
                }
            }
            else
            {
                foreach (Profile.Item item in stage.Items)
                {
                    ResolveItem(action, stage, item);
                }
            }
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        public override void Parse(XmlNode node)
        {
            m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
                                                    Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
            m_SubType = (SubType)Enum.Parse(typeof(SubType),
                                            Helper.AttributeValue(node, "subType", m_SubType.ToString()));

            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
            if (m_Path == null)
            {
                m_Path = "";
            }

            m_Path  = m_Path.Trim();
            m_Valid = true;
            if (!File.Exists(m_Path))
            {
                m_Valid = false;
                Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
            }
        }
コード例 #6
0
        /// <summary>
        /// Builds the specified project.
        /// </summary>
        public async Task <bool> BuildProjectAsync(SolutionItem project, BuildAction action = BuildAction.Build)
        {
            if (project?.Type != SolutionItemType.Project && project?.Type != SolutionItemType.VirtualProject)
            {
                return(false);
            }

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsSolutionBuildManager svc = await VS.Services.GetSolutionBuildManagerAsync();

            uint buildFlags = (uint)GetBuildFlags(action);

            project.GetItemInfo(out IVsHierarchy hierarchy, out _, out _);

            BuildObserver observer = new(hierarchy);

            ErrorHandler.ThrowOnFailure(svc.AdviseUpdateSolutionEvents(observer, out uint cookie));

            try
            {
                ErrorHandler.ThrowOnFailure(svc.StartSimpleUpdateProjectConfiguration(hierarchy, null, null, buildFlags, 0, 0));
                return(await observer.Result);
            }
            finally
            {
                svc.UnadviseUpdateSolutionEvents(cookie);
            }
        }
コード例 #7
0
        public void ProjectBuildFinished(BuildAction buildAction, string projectIdentifier, bool success, bool canceled)
        {
            if (BuildInformationModel.BuildAction == BuildAction.Deploy)
            {
                return;
            }

            var currentProject = Projects.First(item => ProjectIdentifierGenerator.GetIdentifierForProjectItem(item) == projectIdentifier);

            currentProject.Success         = success;
            currentProject.State           = GetProjectState(success, canceled, currentProject);
            currentProject.BuildFinishTime = DateTime.Now;

            if (currentProject.State == ProjectState.BuildError && _packageSettingsProvider.Settings.GeneralSettings.StopBuildAfterFirstError)
            {
                _buildService.CancelBuildSolution();
            }

            BuildInformationModel.SucceededProjectsCount = Projects.Count(x => x.State == ProjectState.BuildDone || x.State == ProjectState.CleanDone);
            BuildInformationModel.FailedProjectsCount    = Projects.Count(x => x.State == ProjectState.BuildError || x.State == ProjectState.CleanError);
            BuildInformationModel.WarnedProjectsCount    = Projects.Count(x => x.State == ProjectState.BuildWarning);
            BuildInformationModel.UpToDateProjectsCount  = Projects.Count(x => x.State == ProjectState.UpToDate);
            BuildInformationModel.MessagesCount          = Projects.Sum(x => x.MessagesCount);
            BuildInformationModel.ErrorCount             = Projects.Sum(x => x.ErrorsCount);
            BuildInformationModel.WarningsCount          = Projects.Sum(x => x.WarningsCount);

            if (BuildInformationModel.CurrentProject == null)
            {
                BuildInformationModel.CurrentProject = Projects.Last();
            }

            UpdateTaskBar();
            BuildStateChanged();
        }
コード例 #8
0
        private static List <BuildAction> DetermineActions(float goalPitch, int tracksRemoving, float startPitch)
        {
            List <BuildAction> buildActions = new List <BuildAction>();

            for (int j = 0; j < tracksRemoving; j++)
            {
                buildActions.Add(new BuildAction(true));
            }

            float differnce = goalPitch - startPitch;

            if (differnce >= 180)
            {
                differnce -= 360;
            }
            else if (differnce < -180)
            {
                differnce += 360;
            }
            TrackType   direction   = (differnce >= 0) ? TrackType.Up : TrackType.Down;
            BuildAction buildAction = new BuildAction(direction);

            differnce = Math.Abs(differnce);
            int tracks = (int)(differnce / Globals.STANDARD_ANGLE_CHANGE);

            for (int j = 0; j < tracks; j++)
            {
                buildActions.Add(buildAction);
            }

            return(buildActions);
        }
コード例 #9
0
        public void ProjectBuildStarted(IProjectItem projectItem, BuildAction buildAction)
        {
            if (BuildInformationModel.BuildAction == BuildAction.Deploy)
            {
                return;
            }

            var projInCollection = Projects.FirstOrDefault(item => ProjectIdentifierGenerator.GetIdentifierForProjectItem(item) == ProjectIdentifierGenerator.GetIdentifierForProjectItem(projectItem));

            if (projInCollection == null)
            {
                Projects.Add(projectItem);
                projInCollection = projectItem;
            }
            projInCollection.State           = BuildInformationModel.BuildAction.GetProjectState();
            projInCollection.BuildFinishTime = null;
            projInCollection.BuildStartTime  = DateTime.Now;

            UpdateTaskBar();

            _currentQueuePosOfBuildingProject++;

            if (BuildInformationModel.BuildScope == BuildScope.Solution &&
                (BuildInformationModel.BuildAction == BuildAction.Build ||
                 BuildInformationModel.BuildAction == BuildAction.RebuildAll))
            {
                projInCollection.BuildOrder = _currentQueuePosOfBuildingProject;
            }
            BuildInformationModel.CurrentProject = projInCollection;
            BuildStateChanged();
        }
コード例 #10
0
        public void BuildStarted(BuildAction buildAction, BuildScope buildScope)
        {
            _currentQueuePosOfBuildingProject          = 0;
            ErrorNavigationService.BuildErrorNavigated = false;
            _buildOutputLogger.Attach();

            ResetBuildInformationModel();
            ReloadCurrentProjects();

            BuildInformationModel.BuildStartTime    = DateTime.Now;
            BuildInformationModel.BuildFinishTime   = null;
            BuildInformationModel.CurrentBuildState = BuildState.InProgress;
            BuildInformationModel.BuildAction       = buildAction;
            BuildInformationModel.BuildScope        = buildScope;
            BuildInformationModel.BuildId           = Guid.NewGuid();

            _windowStateService.ApplyToolWindowStateAction(_packageSettingsProvider.Settings.WindowSettings.WindowActionOnBuildBegin);
            _timer = new Timer(state => BuildUpdate(), null, BuildInProcessQuantumSleep, BuildInProcessQuantumSleep);

            string message = _buildMessagesFactory.GetBuildBeginMajorMessage(BuildInformationModel);

            _statusBarNotificationService.ShowTextWithFreeze(message);
            _origTextCurrentState = message;
            BuildInformationModel.StateMessage = _origTextCurrentState;
            UpdateTaskBar();
            BuildStateChanged();

            DiagnosticsClient.TrackEvent("BuildStarted", new Dictionary <string, string>
            {
                { "BuildId", BuildInformationModel.BuildId.ToString() },
                { "BuildAction", buildAction.ToString() },
                { "BuildScope", buildScope.ToString() }
            });
        }
コード例 #11
0
        /// <summary>
        /// Execute an individual action
        /// </summary>
        /// <param name="ProcessGroup">The process group</param>
        /// <param name="Action">The action to execute</param>
        /// <param name="CompletedActions">On completion, the list to add the completed action to</param>
        /// <param name="CompletedEvent">Event to set once an event is complete</param>
        static void ExecuteAction(ManagedProcessGroup ProcessGroup, BuildAction Action, List <BuildAction> CompletedActions, AutoResetEvent CompletedEvent)
        {
            if (Action.Inner.bShouldOutputStatusDescription && !String.IsNullOrEmpty(Action.Inner.StatusDescription))
            {
                Action.LogLines.Add(Action.Inner.StatusDescription);
            }

            try
            {
                using (ManagedProcess Process = new ManagedProcess(ProcessGroup, Action.Inner.CommandPath.FullName, Action.Inner.CommandArguments, Action.Inner.WorkingDirectory.FullName, null, null, ProcessPriorityClass.BelowNormal))
                {
                    Action.LogLines.AddRange(Process.ReadAllLines());
                    Action.ExitCode = Process.ExitCode;
                }
            }
            catch (Exception Ex)
            {
                Log.WriteException(Ex, null);
                Action.ExitCode = 1;
            }

            lock (CompletedActions)
            {
                CompletedActions.Add(Action);
            }

            CompletedEvent.Set();
        }
コード例 #12
0
        private bool CheckGlobalConditions(BuildAction buildAction, BuildUpToDateCheckLogger logger, State state)
        {
            if (buildAction != BuildAction.Build)
            {
                return(false);
            }

            if (!_tasksService.IsTaskQueueEmpty(ProjectCriticalOperation.Build))
            {
                return(Fail(logger, "CriticalTasks", "Critical build tasks are running, not up to date."));
            }

            if (state.LastVersionSeen == null || _configuredProject.ProjectVersion.CompareTo(state.LastVersionSeen) > 0)
            {
                return(Fail(logger, "ProjectInfoOutOfDate", "Project information is older than current project version, not up to date."));
            }

            if (state.IsDisabled)
            {
                return(Fail(logger, "Disabled", "The 'DisableFastUpToDateCheck' property is true, not up to date."));
            }

            string copyAlwaysItemPath = state.ItemsByItemType.SelectMany(kvp => kvp.Value).FirstOrDefault(item => item.copyType == CopyToOutputDirectoryType.CopyAlways).path;

            if (copyAlwaysItemPath != null)
            {
                return(Fail(logger, "CopyAlwaysItemExists", "Item '{0}' has CopyToOutputDirectory set to 'Always', not up to date.", _configuredProject.UnconfiguredProject.MakeRooted(copyAlwaysItemPath)));
            }

            return(true);
        }
コード例 #13
0
ファイル: UpgradeTester.cs プロジェクト: Aspekt1024/HexCraft
 private void UpdateActionCost(BuildAction action, Currency cost)
 {
     editor.RecordUndo(action.prefab, "Update build action cost");
     action.prefab.Cost = cost;
     EditorUtility.SetDirty(action.prefab);
     UpdateActions();
 }
コード例 #14
0
        static void Main(string[] args)
        {
            Board       = new DemoBuilder().Build();
            Writer      = Console.Out;
            TileDisplay = new TileDisplay(new DisplayFactory());

            BoardDisplay = new BoardDisplay(Writer, TileDisplay);

            MenuDisplay = new MenuDisplay(Writer, new List <MenuOption>
            {
                new MenuOption("Build"),
            });

            Player = new TerraMysticaPlayer("Player 1", new Mermaids());
            Player.Resources.Gold.Add(100);
            Player.Resources.Workers.Add(100);

            BoardDisplay.PrintHeader = true;
            PrintLoop();

            Console.WriteLine($"{Player.Name}, Build a damn Dwelling!");
            Console.ReadKey();

            Console.Clear();

            var tile        = Board.TileForLocation(new HexLocation(3, 0));
            var buildAction = new BuildAction(Board, Player, tile.Location);

            buildAction.Execute();

            PrintLoop();
            Console.WriteLine($"Good, good. Now dance for me!");

            Console.ReadKey();
        }
コード例 #15
0
        public override OutputFile SetBuildAction(BuildAction buildAction)
        {
            var defaultOutput = DefaultOutput;

            defaultOutput.BuildAction = buildAction;
            return(defaultOutput);
        }
コード例 #16
0
 public BuildActionExecutor(ManagedProcessGroup InProcessGroup, BuildAction InAction, AutoResetEvent InCompletedEvent, List <BuildActionExecutor> InCompletedActions)
 {
     ProcessGroup     = InProcessGroup;
     Action           = InAction;
     CompletedEvent   = InCompletedEvent;
     CompletedActions = InCompletedActions;
 }
コード例 #17
0
        public PackageFile(ITaskItem item, BuildAction buildAction)
        {
            FullPath      = item.GetMetadata("FullPath");
            PathInProject = item.ItemSpec;

            var environmentData = item.GetMetadata("Environment");

            if (string.IsNullOrEmpty(environmentData))
            {
                environmentData = "None";
            }

            var isDashboardData = item.GetMetadata("IsDashboard");

            if (string.IsNullOrEmpty(isDashboardData))
            {
                isDashboardData = "false";
            }

            var copyToOutputDirectoryData = item.GetMetadata("CopyToOutputDirectory");

            if (string.IsNullOrEmpty(copyToOutputDirectoryData))
            {
                copyToOutputDirectoryData = "DoNotCopy";
            }

            Environment           = ( TargetEnvironment )Enum.Parse(typeof(TargetEnvironment), environmentData, true);
            IsDashboard           = bool.Parse(isDashboardData);
            CopyToOutputDirectory = copyToOutputDirectoryData != "DoNotCopy";             // TODO: we should support the PreserveNewest properly
            BuildAction           = buildAction;
        }
コード例 #18
0
    public void BuildFixedObect(string type)
    {
        _buildAction = BuildAction.FixedObject;
        _buildType   = type;

        UpdatePreviewSprite();
    }
コード例 #19
0
ファイル: TreeBuilder.cs プロジェクト: CrispyDrone/BWSort
        public void Build()
        {
            NodeList <BuildAction> roots    = new NodeList <BuildAction>();
            NodeList <BuildAction> allgames = new NodeList <BuildAction>();

            foreach (var replay in m_replays)
            {
                foreach (var player in replay.Players)
                {
                    var actions = replay.Actions.Where(x => x.Player == player &&
                                                       x.ActionType == Entities.ActionType.Build)
                                  .OrderBy(y => y.Sequence)
                                  .Cast <BuildAction>();

                    if (actions.Count() > 0)
                    {
                        BuildAction        action = actions.ElementAt(0);
                        Node <BuildAction> node   = new Node <BuildAction>(1, action, buildTree(actions));
                        allgames.Add(node);

                        if (roots.Where(x => x.Value.ObjectType == action.ObjectType).Count() == 0)
                        {
                            roots.Add(node);
                        }
                    }
                }
            }

            countOccurances(roots, allgames);
            m_roots    = roots;
            m_allGames = allgames;
        }
        /// <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");
        }
コード例 #21
0
        public int Execute(BuildAction buildAction, StringBuilder output = null)
        {
            arguments.Clear();
            switch (buildAction)
            {
            case BuildAction.Clean: {
                PrepareForClean();
                return(Execute(output));
            }

            case BuildAction.Restore: {
                PrepareForRestore();
                return(Execute(output));
            }

            case BuildAction.Build: {
                PrepareForBuild();
                return(Execute(output));
            }

            default: {
                throw new InvalidOperationException($"Unknown {nameof(buildAction)}: {buildAction}");
            }
            }
        }
コード例 #22
0
ファイル: Translation.cs プロジェクト: qt-labs/vstools
        static void RunTranslationTarget(
            BuildAction buildAction,
            EnvDTE.Project project,
            IEnumerable <string> selectedFiles = null)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            using (WaitDialog.Start(
                       "Qt Visual Studio Tools", "Running translation tool...")) {
                var qtPro = QtProject.Create(project);
                if (project == null || qtPro == null)
                {
                    Messages.Print(
                        "translation: Error accessing project interface");
                    return;
                }

                if (qtPro.FormatVersion < Resources.qtMinFormatVersion_Settings)
                {
                    Messages.Print("translation: Legacy project format");
                    try {
                        Legacy_RunTranslation(buildAction, qtPro, selectedFiles);
                    } catch (Exception e) {
                        Messages.Print(
                            e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
                    }
                    return;
                }

                var activeConfig = project.ConfigurationManager?.ActiveConfiguration;
                if (activeConfig == null)
                {
                    Messages.Print(
                        "translation: Error accessing build interface");
                    return;
                }
                var activeConfigId = string.Format("{0}|{1}",
                                                   activeConfig.ConfigurationName, activeConfig.PlatformName);

                var target     = "QtTranslation";
                var properties = new Dictionary <string, string>();
                switch (buildAction)
                {
                case BuildAction.Update:
                    properties["QtTranslationForceUpdate"] = "true";
                    break;

                case BuildAction.Release:
                    properties["QtTranslationForceRelease"] = "true";
                    break;
                }
                if (selectedFiles != null)
                {
                    properties["SelectedFiles"] = string.Join(";", selectedFiles);
                }

                QtProjectBuild.StartBuild(
                    project, project.FullName, activeConfigId, properties, new[] { target });
            }
        }
コード例 #23
0
        public static void ExecuteAction(UMakeTarget t, BuildAction action)
        {
            UMake umake;

            if (!UMake.Get().TryGet(out umake))
            {
                return;
            }

            string buildPath;

            UMakeTarget.Path targetPath;

            switch (action)
            {
            case BuildAction.PreActions:
                EditorApplication.delayCall += () => t.ExecutePreBuildActions(umake);
                break;

            case BuildAction.Build:
                buildPath = UMake.GetBuildPath();
                EditorApplication.delayCall += () => t.Build(umake, buildPath);
                break;

            case BuildAction.PostActions:
                EditorApplication.delayCall += () => t.ExecutePostBuildActions(umake);
                break;

            case BuildAction.OpenFolder:
                targetPath = t.GetTargetPath(umake.version, UMake.GetBuildPath());
                EditorUtility.RevealInFinder(targetPath.directoryPath);
                break;
            }
        }
コード例 #24
0
ファイル: Engine.cs プロジェクト: gurudennis/EzBuildSys
        private void ResolveItem(BuildAction action, Profile.Stage stage, Profile.Item item)
        {
            if (stage == null || item == null)
            {
                return;
            }

            Actions.IAction resolvedAction = null;

            if (item.Type == Profile.ItemType.Solution || item.Type == Profile.ItemType.Project)
            {
                resolvedAction = new Actions.MSBuildAction(item.Path, action == BuildAction.Clean, _environment);
            }
            else if (item.Type == Profile.ItemType.BatchScript || item.Type == Profile.ItemType.ShellCommand)
            {
                resolvedAction = new Actions.ShellAction(item.Path);
            }
            else if (item.Type == Profile.ItemType.PowerShellScript)
            {
                resolvedAction = new Actions.PowerShellAction(item.Path);
            }

            if (resolvedAction == null)
            {
                throw new ApplicationException($"Don't know how to execute action of type {item.Type}");
            }

            _actions.Add(resolvedAction);
        }
コード例 #25
0
        private bool CheckGlobalConditions(BuildAction buildAction, Logger logger)
        {
            if (buildAction != BuildAction.Build)
            {
                return(false);
            }

            var itemsChangedSinceLastCheck = _itemsChangedSinceLastCheck;

            _itemsChangedSinceLastCheck = false;

            if (_lastVersionSeen == null || _configuredProject.ProjectVersion.CompareTo(_lastVersionSeen) > 0)
            {
                logger.Info("Project information is older than current project version, skipping check.");
                return(false);
            }

            if (itemsChangedSinceLastCheck)
            {
                logger.Info("The list of source items has changed since the last build.");
                return(false);
            }

            if (_isDisabled)
            {
                logger.Info("The 'DisableFastUpToDateCheckProperty' property is true, skipping check.");
                return(false);
            }

            return(true);
        }
コード例 #26
0
        public override void OnInspectorGUI()
        {
            var umakeTarget = target as UMakeTarget;

            Undo.RecordObject(umakeTarget, "UMakeTarget");

            EditorGUI.BeginChangeCheck();

            using (BoxGroup.Do("Build Settings"))
            {
                ShowBuildSettings(umakeTarget);
            }

            EditorGUILayout.Space();
            BuildAction action = ShowActions();

            EditorGUILayout.Space();

            ShowPreBuildActions(umakeTarget);
            ShowPostBuildActions(umakeTarget);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(umakeTarget);
            }

            GUILayout.FlexibleSpace();

            ExecuteAction(umakeTarget, action);
        }
コード例 #27
0
        public void TestScenarioCreationFromAction()
        {
            var provider = new Mock <IWebDriverProvider>();
            var factory  = new ScenarioFactory(provider.Object);
            var action   = new TrainArmyAction
            {
                UnitsToTrain = new Dictionary <string, int> {
                    { "test", 1 }
                }
            };

            var scenario = factory.GetScenario(action);

            Assert.NotNull(scenario);
            Assert.AreEqual(typeof(TrainArmyScenario), scenario.GetType());

            var buildAction = new BuildAction
            {
                BuildingId = "testBuilding"
            };

            var buildScenario = factory.GetScenario(buildAction);

            Assert.NotNull(buildScenario);
            Assert.AreEqual(typeof(BuildScenario), buildScenario.GetType());
        }
 public void RegisterBuildAction(BuildAction buildAction)
 {
     if (!this.buildActions.Contains(buildAction))
     {
         this.buildActions.Add(buildAction);
     }
 }
コード例 #29
0
        private static void SetBuildUnitAction(Entity entity, Vec2Int approxTarget, EntityType buildUnit, int unitCost, Dictionary <int, EntityAction> entityActions)
        {
            Vec2Int?target      = null;
            int     minDistance = int.MaxValue;

            var neighbors = entity.Position.Neighbors(5);

            foreach (var position in neighbors)
            {
                if (ScoreMap.Passable(position))
                {
                    int distance = position.Distance(approxTarget);
                    if (distance < minDistance)
                    {
                        target      = position;
                        minDistance = distance;
                    }
                }
            }

            if (target != null)
            {
                var buildAction = new BuildAction(buildUnit, target.Value);
                entityActions.Add(entity.Id, new EntityAction(null, buildAction, null, null));

                ScoreMap.Build(target.Value, 1);
                ScoreMap.MyResource -= unitCost;
            }
        }
コード例 #30
0
        /// <summary>
        /// Check if project tizen-manifest.xml is up-to-date (i.e there is no need to build)
        /// </summary>
        /// <param name="buildAction">The build action to perform.</param>
        /// <param name="logger">A logger that may be used to write out status or information messages regarding the up-to-date check.</param>
        /// <param name="cancellationToken">A token that is cancelled if the caller loses interest in the result.</param>
        /// <returns>A task whose result is true if project is up-to-date</returns>
        public Task <bool> IsUpToDateAsync(BuildAction buildAction, TextWriter logger, CancellationToken cancellationToken = default(CancellationToken))
        {
            var manifestFilePath = Path.Combine(_msBuildProjectDirectory, "tizen-manifest.xml");
            var hasManifestFile  = File.Exists(manifestFilePath);
            var lastWritetime    = hasManifestFile ? File.GetLastWriteTimeUtc(manifestFilePath) : DateTime.MinValue;

            var isUpToDate = (!hasManifestFile) || (hasManifestFile && _prevWriteTime != DateTime.MinValue && lastWritetime == _prevWriteTime);

            if (isUpToDate)
            {
                if (hasManifestFile)
                {
                    logger.WriteLineAsync($"FastUpToDateForTizen:  '{manifestFilePath}' ({_msBuildProjectName})");
                }
                else
                {
                    logger.WriteLineAsync($"FastUpToDateForTizen:  '{manifestFilePath}' was not found. skip to check ... ({_msBuildProjectName})");
                }
            }

            if (lastWritetime > _prevWriteTime)
            {
                _prevWriteTime = lastWritetime;
            }

            return(Task.FromResult(isUpToDate));
        }
コード例 #31
0
ファイル: Node.cs プロジェクト: sillsdev/FwSupportTools
 /// <summary>
 /// Initializes a new instance of the <see cref="Node"/> class.
 /// </summary>
 /// <param name="hierarchy">The parent <see cref="Hierarchy"/> object.</param>
 /// <param name="absolutePath">The absolute path to the node.</param>
 /// <param name="buildAction">The action that should be taken for this node when building the project.</param>
 protected Node(Hierarchy hierarchy, string absolutePath, BuildAction buildAction)
 {
     this.hierarchy = hierarchy;
     this.hierarchyId = nextHierarchyId;
     nextHierarchyId++;
     this.absolutePath = this.CanonicalizePath(absolutePath);
     this.BuildAction = buildAction;
 }
コード例 #32
0
		protected void CheckBuildAction(ProjectFile file, BuildAction expected)
		{
			file.Check(
				i => i.BuildAction == expected,
				String.Format(
					"Project file '{0}' is expected to have 'Build Action' set to '{1}', but now it is '{2}'.",
					file.FullName,
					expected,
					file.BuildAction));
		}
コード例 #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectFile"/> class.
        /// </summary>
        /// <param name="nodeFromProject">The x path navigator.</param>
        public ProjectFile(XPathNavigator nodeFromProject)
        {
            if (nodeFromProject == null)
            {
                throw new ArgumentNullException("nodeFromProject", @"Cannot create project file as the XML passed was null.");
            }

            _relativePath = nodeFromProject.GetAttribute(@"RelPath", string.Empty);

            string buildAction = nodeFromProject.GetAttribute(@"BuildAction", string.Empty);
            _buildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
        }
コード例 #34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectFile"/> class.
        /// </summary>
        /// <param name="buildAction">The build action.</param>
        /// <param name="relativePath">The relative path.</param>
        public ProjectFile(BuildAction buildAction, string relativePath)
        {
            _buildAction = buildAction;

            if (string.IsNullOrEmpty( relativePath ))
            {
                throw new ArgumentNullException(@"relativePath");
            }

            if (Path.IsPathRooted(relativePath))
            {
                throw new ArgumentException(@"Cannot set path as it is not a relative path.", @"relativePath");
            }

            _relativePath = relativePath;
        }
        public static IEnumerable<EstablishLinkParams> BuildParamsForMatchingFiles(BuildAction buildAction, string pathToFiles, string searchPattern,string rootProjectTarget = "")
        {
            if (!pathToFiles.EndsWith("\\"))
                throw new Exception("Path to files must end in a trailing backslash");

            if (!String.IsNullOrWhiteSpace(rootProjectTarget))
            {
                if (rootProjectTarget.StartsWith("\\"))
                    throw new Exception("Root target paths must not start with a backslash");

                if (!rootProjectTarget.EndsWith("\\"))
                    throw new Exception("Root target paths must end start with a backslash");
            }

            return from f in Directory.GetFiles(pathToFiles, searchPattern, SearchOption.AllDirectories)
                   let newPath = rootProjectTarget + f.Replace(pathToFiles, "")
                   select new EstablishLinkParams(buildAction, f, newPath);
        }
コード例 #36
0
ファイル: BuildProcess.cs プロジェクト: fifoforlifo/QRBuild
        ///-----------------------------------------------------------------
        /// Public interface
        public BuildProcess(
            BuildGraph buildGraph,
            BuildAction buildAction,
            BuildOptions buildOptions,
            BuildResults buildResults,
            IEnumerable<BuildNode> buildNodes,
            bool processDependencies)
        {
            m_buildGraph = buildGraph;
            m_buildAction = buildAction;
            m_buildOptions = buildOptions;
            m_buildResults = buildResults;

            bool initialized = InitializeBuildProcess(buildNodes, processDependencies);
            if (!initialized) {
                throw new InvalidOperationException("Failed to initialize BuildProcess.");
            }
        }
        public void LinkToFile(Project project, BuildAction buildAction, string includeValue, string projectTargetPath)
        {
            if(projectTargetPath.StartsWith("\\"))
                throw new Exception("project target path cannot begin with a backslash");

            var matchingProjectItemByTargetPath = (from t in project.Items
                                                   where
                                                       t.HasMetadata("Link") &&
                                                       t.GetMetadataValue("Link") == projectTargetPath
                                                   select t).SingleOrDefault();

            if (matchingProjectItemByTargetPath != null) 
                project.RemoveItem(matchingProjectItemByTargetPath);

            var buildActionName = Enum.GetName(typeof(BuildAction), buildAction);

            project.AddItem(buildActionName, includeValue,
                            new[] {new KeyValuePair<string, string>("Link", projectTargetPath)});
        }
コード例 #38
0
ファイル: FileItem.cs プロジェクト: codemonster234/scbuilder
        //=====================================================================
        /// <summary>
        /// Internal Constructor
        /// </summary>
        /// <param name="element">The project element</param>
        internal FileItem(ProjectElement element)
            : base(element)
        {
            buildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
                base.ProjectElement.ItemName, true);
            includePath = new FilePath(base.ProjectElement.Include,
                base.ProjectElement.Project);
            includePath.PersistablePathChanging += new EventHandler(
                includePath_PersistablePathChanging);
            base.ProjectElement.Include = includePath.PersistablePath;

            if(base.ProjectElement.HasMetadata(ProjectElement.LinkPath))
            {
                linkPath = new FilePath(base.ProjectElement.GetMetadata(
                    ProjectElement.LinkPath), base.ProjectElement.Project);
                linkPath.PersistablePathChanging += new EventHandler(
                    linkPath_PersistablePathChanging);
            }

            if(base.ProjectElement.HasMetadata(ProjectElement.ImageId))
                imageId = base.ProjectElement.GetMetadata(
                    ProjectElement.ImageId);

            if(base.ProjectElement.HasMetadata(ProjectElement.AlternateText))
                altText = base.ProjectElement.GetMetadata(
                    ProjectElement.AlternateText);

            if(base.ProjectElement.HasMetadata(ProjectElement.CopyToMedia))
                if(!Boolean.TryParse(ProjectElement.GetMetadata(
                  ProjectElement.CopyToMedia), out copyToMedia))
                    copyToMedia = false;

            if(base.ProjectElement.HasMetadata(ProjectElement.ExcludeFromToc))
                if(!Boolean.TryParse(ProjectElement.GetMetadata(
                  ProjectElement.ExcludeFromToc), out excludeFromToc))
                    excludeFromToc = false;

            if(base.ProjectElement.HasMetadata(ProjectElement.SortOrder))
                if(!Int32.TryParse(ProjectElement.GetMetadata(
                  ProjectElement.SortOrder), out sortOrder))
                    sortOrder = 0;
        }
コード例 #39
0
ファイル: BuildGraph.cs プロジェクト: fifoforlifo/QRBuild
        //-- Public interface
        /// Execute the specified action on targets.
        /// This is how you kick off a Build.
        public BuildResults Execute(
            BuildAction action,
            BuildOptions buildOptions,
            IEnumerable<string> targetPaths,
            bool processDependencies)
        {
            Trace.TraceInformation("Execute {0}", action);
            Trace.TraceInformation("-----------");
            // TODO: trace targets

            BuildResults buildResults = new BuildResults();
            buildResults.Action = action;
            buildResults.ExecuteStartTime = DateTime.Now;

            buildResults.Success = UntimedExecute(
                action,
                buildOptions,
                targetPaths,
                processDependencies,
                buildResults);

            buildResults.ExecuteEndTime = DateTime.Now;
            return buildResults;
        }
コード例 #40
0
 private ProjectItem AddTopicItemToProject(BuildAction buildAction, Topic topic)
 {
     var project = builder.CurrentProject.MSBuildProject;
     var itemName = buildAction.ToString();
     builder.ReportProgress("Adding itemName {0} located at {1} to project...", itemName, topic.FileName);
     var buildItems = project.AddItem(itemName, topic.FileName, new[] { new KeyValuePair<string, string>("Link", topic.FileName) });
     foreach (string imagePath in topic.ReferencedImagesPaths)
     {
         string imageId = Path.GetFileNameWithoutExtension(imagePath);
         bool imageIdAlreadyExists = false;
         foreach (ProjectItem image in project.GetItems(BuildAction.Image.ToString()))
         {
             
             imageIdAlreadyExists = image.GetMetadataValue("ImageId") == imageId;
             if (imageIdAlreadyExists) break;
         }
         if (imageIdAlreadyExists) {
             builder.ReportProgress("Image {0} is already referenced in project...", imagePath);
             continue;
         };
         builder.ReportProgress("Adding image {0} located at {1} to project...", imageId, imagePath);
         project.AddItem(BuildAction.Image.ToString(), imagePath, new[] { new KeyValuePair<string, string>("ImageId", imageId), new KeyValuePair<string, string>("AlternateText", imageId) });
     }
     return buildItems[0];
 }
コード例 #41
0
 private ProjectItem AddLinkedItem(BuildAction buildAction, string fileName)
 {
     var project = builder.CurrentProject.MSBuildProject;
     var itemName = buildAction.ToString();
     builder.ReportProgress("Adding itemName {0} located at {1} to project...", itemName, fileName);
     var buildItems = project.AddItem(itemName, fileName, new[] { new KeyValuePair<string, string>("Link", fileName) });
     return buildItems[0];
 }
コード例 #42
0
ファイル: FileNode.cs プロジェクト: foxracle/3di-viewer-rei
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        public override void Parse(XmlNode node)
        {
            m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
                Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
            m_SubType = (SubType)Enum.Parse(typeof(SubType),
                Helper.AttributeValue(node, "subType", m_SubType.ToString()));
            m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
            this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
            if ( this.m_Link == true )
            {
                this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
            }
            this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
            this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );

            if( node == null )
            {
                throw new ArgumentNullException("node");
            }

            m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
            if(m_Path == null)
            {
                m_Path = "";
            }

            m_Path = m_Path.Trim();
            m_Valid = true;
            if(!File.Exists(m_Path))
            {
                m_Valid = false;
                Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
            }
        }
コード例 #43
0
 /// <summary>
 /// This returns true if the project contains items using the given build action
 /// </summary>
 /// <param name="buildAction">The build action for which to check</param>
 /// <returns>True if at least one item has the given build action or false if there are no items with
 /// the given build action.</returns>
 public bool HasItems(BuildAction buildAction)
 {
     return (msBuildProject.GetItems(buildAction.ToString()).Count != 0);
 }
コード例 #44
0
ファイル: FileNode.cs プロジェクト: aurora-sim/Aurora-Libs
		/// <summary>
		/// 
		/// </summary>
		/// <param name="node"></param>
		public override void Parse(XmlNode node)
		{
			m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), 
				Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
			m_SubType = (SubType)Enum.Parse(typeof(SubType), 
				Helper.AttributeValue(node, "subType", m_SubType.ToString()));

			if( node == null )
			{
				throw new ArgumentNullException("node");
			}

			m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
			if(m_Path == null)
			{
				m_Path = "";
			}

			m_Path = m_Path.Trim();
			m_Valid = true;
			if(!File.Exists(m_Path))
			{
				m_Valid = false;
				Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
			}
		}
コード例 #45
0
ファイル: FileItem.cs プロジェクト: julianhaslinger/SHFB
        //=====================================================================

        /// <summary>
        /// This constructor is used to wrap an existing project item
        /// </summary>
        /// <param name="project">The project that owns the item</param>
        /// <param name="existingItem">The existing project item</param>
        /// <overloads>There are two overloads for the constructor</overloads>
        internal FileItem(SandcastleProject project, ProjectItem existingItem) : base(project, existingItem)
        {
            buildAction = (BuildAction)Enum.Parse(typeof(BuildAction), this.ItemType, true);
            includePath = new FilePath(this.Include, this.Project);
            includePath.PersistablePathChanging += includePath_PersistablePathChanging;

            this.Include = includePath.PersistablePath;

            if(this.HasMetadata(BuildItemMetadata.LinkPath))
            {
                linkPath = new FilePath(this.GetMetadata(BuildItemMetadata.LinkPath), this.Project);
                linkPath.PersistablePathChanging += linkPath_PersistablePathChanging;
            }

            if(this.HasMetadata(BuildItemMetadata.ImageId))
                imageId = this.GetMetadata(BuildItemMetadata.ImageId);

            if(this.HasMetadata(BuildItemMetadata.AlternateText))
                altText = this.GetMetadata(BuildItemMetadata.AlternateText);

            if(this.HasMetadata(BuildItemMetadata.CopyToMedia))
                if(!Boolean.TryParse(this.GetMetadata(BuildItemMetadata.CopyToMedia), out copyToMedia))
                    copyToMedia = false;

            if(this.HasMetadata(BuildItemMetadata.SortOrder))
                if(!Int32.TryParse(this.GetMetadata(BuildItemMetadata.SortOrder), out sortOrder))
                    sortOrder = 0;
        }
コード例 #46
0
		private static void RecursiveIncDependents(BuildAction Action, HashSet<BuildAction> VisitedActions)
		{
			foreach(BuildAction Dependency in Action.Dependencies)
			{
				if(!VisitedActions.Contains(Action))
				{
					VisitedActions.Add(Action);
					Dependency.TotalDependants++;
					RecursiveIncDependents(Dependency, VisitedActions);
				}
			}
		}
コード例 #47
0
ファイル: BuildGraph.cs プロジェクト: fifoforlifo/QRBuild
        private bool UntimedExecute(
            BuildAction action,
            BuildOptions buildOptions,
            IEnumerable<string> targetPaths,
            bool processDependencies,
            BuildResults buildResults)
        {
            TimedComputeDependencies(buildResults, buildOptions);
            if (!m_dependenciesValid) {
                return false;
            }

            HashSet<BuildFile> targets = GetBuildFilesForPaths(targetPaths);

            HashSet<BuildNode> buildNodes = GetBuildNodesForFiles(targets);
            if (buildNodes == null) {
                return false;
            }

            BuildProcess buildProcess = new BuildProcess(
                this,
                action,
                buildOptions,
                buildResults,
                buildNodes,
                processDependencies);
            bool result = buildProcess.Run();
            return result;
        }
コード例 #48
0
ファイル: MatchNode.cs プロジェクト: aurora-sim/Aurora-Libs
		/// <summary>
		/// 
		/// </summary>
		/// <param name="node"></param>
		public override void Parse(XmlNode node)
		{
			if( node == null )
			{
				throw new ArgumentNullException("node");
			}
			string path = Helper.AttributeValue(node, "path", ".");
			string pattern = Helper.AttributeValue(node, "pattern", "*");
			bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
			bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
			m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), 
				Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
			m_SubType = (SubType)Enum.Parse(typeof(SubType), 
				Helper.AttributeValue(node, "subType", m_SubType.ToString()));
			m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
			this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
			this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));


			if(path != null && path.Length == 0)
			{
				path = ".";//use current directory
			}
			//throw new WarningException("Match must have a 'path' attribute");

			if(pattern == null)
			{
				throw new WarningException("Match must have a 'pattern' attribute");
			}

			path = Helper.NormalizePath(path);
			if(!Directory.Exists(path))
			{
				throw new WarningException("Match path does not exist: {0}", path);
			}

			try
			{
				if(useRegex)
				{
					m_Regex = new Regex(pattern);
				}
			}
			catch(ArgumentException ex)
			{
				throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
			}

			RecurseDirectories(path, pattern, recurse, useRegex);

			foreach(XmlNode child in node.ChildNodes)
			{
				IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
				if(dataNode is ExcludeNode)
				{
					ExcludeNode excludeNode = (ExcludeNode)dataNode;
					if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name)))
					{
						m_Files.Remove(Helper.NormalizePath(excludeNode.Name));
					}
				}
			}

			if(m_Files.Count < 1)
			{
				throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern);
			}
			m_Regex = null;
		}
コード例 #49
0
		public AppBamlResourceProjectFile(string filename, TypeDef type, ILanguage language) {
			this.filename = filename;
			this.type = type;
			this.SubType = "Designer";
			this.Generator = "MSBuild:Compile";
			this.buildAction = DotNetUtils.IsStartUpClass(type) ? BuildAction.ApplicationDefinition : BuildAction.Page;
			this.language = language;
		}
コード例 #50
0
ファイル: FileNode.cs プロジェクト: sillsdev/FwSupportTools
 public FileNode(Hierarchy hierarchy, string absolutePath, BuildAction buildAction)
     : base(hierarchy, absolutePath, buildAction)
 {
 }
コード例 #51
0
        public override void Parse(XmlNode node)
        {
            string path = Helper.AttributeValue(node, "path", ".");
            string pattern = Helper.AttributeValue(node, "pattern", "*");
            bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
            bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
            m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
                Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));

            if(path == null || path == string.Empty)
                path = ".";//use current directory
            //throw new WarningException("Match must have a 'path' attribute");

            if(pattern == null)
                throw new WarningException("Match must have a 'pattern' attribute");

            path = Helper.NormalizePath(path);
            if(!Directory.Exists(path))
                throw new WarningException("Match path does not exist: {0}", path);

            try
            {
                if(useRegex)
                    m_Regex = new Regex(pattern);
            }
            catch(ArgumentException ex)
            {
                throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
            }

            RecurseDirs(path, pattern, recurse, useRegex);
            if(m_Files.Count < 1)
                throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern);

            m_Regex = null;
        }
コード例 #52
0
ファイル: FileItem.cs プロジェクト: julianhaslinger/SHFB
        /// <summary>
        /// This constructor is used to create a new item and add it to the project
        /// </summary>
        /// <param name="project">The project that will own the item</param>
        /// <param name="itemType">The type of item to create</param>
        /// <param name="itemPath">The path to the item</param>
        internal FileItem(SandcastleProject project, string itemType, string itemPath) :
          base(project, itemType, itemPath)
        {
            buildAction = (BuildAction)Enum.Parse(typeof(BuildAction), this.ItemType, true);
            includePath = new FilePath(this.Include, this.Project);
            includePath.PersistablePathChanging += includePath_PersistablePathChanging;

            this.Include = includePath.PersistablePath;
        }
コード例 #53
0
ファイル: NodeData.cs プロジェクト: julianhaslinger/SHFB
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="action">The build action</param>
        /// <param name="item">The node item</param>
        public NodeData(BuildAction action, object item)
        {
            buildAction = action;
            nodeItem = item;
        }
コード例 #54
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="action">The build action</param>
        /// <param name="item">The node item</param>
        /// <param name="properties">The node properties</param>
        public NodeData(BuildAction action, object item, object properties)
        {
            buildAction = action;
            nodeItem = item;
            nodeProperties = properties;
        }
コード例 #55
0
        //=====================================================================

        /// <inheritdoc />
        public IEnumerable<ContentFile> ContentFiles(BuildAction buildAction)
        {
            ContentFile contentFile;
            string metadata;
            int sortOrder;

            foreach(ProjectItem item in msBuildProject.GetItems(buildAction.ToString()))
            {
                contentFile = new ContentFile(new FilePath(item.EvaluatedInclude, this)) { ContentFileProvider = this };

                metadata = item.GetMetadataValue(BuildItemMetadata.LinkPath);

                if(!String.IsNullOrWhiteSpace(metadata))
                    contentFile.LinkPath = new FilePath(metadata, this);

                metadata = item.GetMetadataValue(BuildItemMetadata.SortOrder);

                if(!String.IsNullOrWhiteSpace(metadata) && Int32.TryParse(metadata, out sortOrder))
                    contentFile.SortOrder = sortOrder;

                yield return contentFile;
            }
        }
コード例 #56
0
ファイル: ProjectWriter.cs プロジェクト: GreenDamTan/dnSpy
		void Write(XmlWriter writer, BuildAction buildAction) {
			var files = project.Files.Where(a => a.BuildAction == buildAction).OrderBy(a => a.Filename, StringComparer.OrdinalIgnoreCase).ToArray();
			if (files.Length == 0)
				return;
			writer.WriteStartElement("ItemGroup");
			foreach (var file in files) {
				if (file.BuildAction == BuildAction.DontIncludeInProjectFile)
					continue;
				writer.WriteStartElement(ToString(buildAction));
				writer.WriteAttributeString("Include", GetRelativePath(file.Filename));
				if (file.DependentUpon != null)
					writer.WriteElementString("DependentUpon", GetRelativePath(Path.GetDirectoryName(file.Filename), file.DependentUpon.Filename));
				if (file.SubType != null)
					writer.WriteElementString("SubType", file.SubType);
				if (file.Generator != null)
					writer.WriteElementString("Generator", file.Generator);
				if (file.LastGenOutput != null)
					writer.WriteElementString("LastGenOutput", GetRelativePath(Path.GetDirectoryName(file.Filename), file.LastGenOutput.Filename));
				if (file.AutoGen)
					writer.WriteElementString("AutoGen", "True");
				if (file.DesignTime)
					writer.WriteElementString("DesignTime", "True");
				if (file.DesignTimeSharedInput)
					writer.WriteElementString("DesignTimeSharedInput", "True");
				writer.WriteEndElement();
			}
			writer.WriteEndElement();
		}
 public EstablishLinkParams(BuildAction buildAction, string filenameToLink, string projectTargetPath)
 {
     _buildAction = buildAction;
     _filenameToLink = filenameToLink;
     _projectTargetPath = projectTargetPath;
 }
コード例 #58
0
ファイル: ProjectWriter.cs プロジェクト: GreenDamTan/dnSpy
		static string ToString(BuildAction buildAction) {
			switch (buildAction) {
			case BuildAction.None:					return "None";
			case BuildAction.Compile:				return "Compile";
			case BuildAction.EmbeddedResource:		return "EmbeddedResource";
			case BuildAction.ApplicationDefinition:	return "ApplicationDefinition";
			case BuildAction.Page:					return "Page";
			case BuildAction.Resource:				return "Resource";
			case BuildAction.SplashScreen:			return "SplashScreen";
			default: throw new InvalidOperationException();
			}
		}
コード例 #59
0
		private static BuildAction FindOrAddAction(Dictionary<string, BuildAction> NameToAction, string Name, List<BuildAction> Actions)
		{
			BuildAction Action;
			if(!NameToAction.TryGetValue(Name, out Action))
			{
				Action = new BuildAction();
				Actions.Add(Action);
				NameToAction.Add(Name, Action);
			}
			return Action;
		}
コード例 #60
0
			public BuildActionExecutor(BuildAction InAction, ManualResetEvent InCompletedEvent, List<BuildActionExecutor> InCompletedActions)
			{
				Action = InAction;
				CompletedEvent = InCompletedEvent;
				CompletedActions = InCompletedActions;
			}