예제 #1
0
        public bool DeactivateUnit(string name)
        {
            var transaction = UnitRegistry.CreateDeactivationTransaction(name);
            var result      = transaction.Execute();

            if (result.Type != ResultType.Success)
            {
                Log.Info($"Deactivation transaction failed. Result type: {result.Type}, message: {result.Message}");
                Log.Info("Transaction failed at highlighted task: ");

                var tree = transaction.GenerateTree(0, result.Task);

                foreach (var line in tree.Split('\n'))
                {
                    Log.Info(line);
                }
            }

            return(result.Type == ResultType.Success);
        }
예제 #2
0
        public Dictionary <string, List <string> > GetDeactivationPlan(string unit)
        {
            var transaction = UnitRegistry.CreateDeactivationTransaction(unit);

            return(transaction.Reasoning.ToDictionary(t => t.Key.UnitName, t => t.Value));
        }