Esempio n. 1
0
 public static void UpdateActions(List <BaseAction> actions, ActionParameters parameters)
 {
     foreach (BaseAction action in actions)
     {
         UpdateAction(action, parameters);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new action for the given creature with the given parameters and cost.
        /// </summary>
        /// <param name="type">An ActionType enumeration entry describing the type of the action.</param>
        /// <param name="param">An ActionParameters object.</param>
        /// <param name="subject">The subject, which actually performs the action.</param>
        /// <param name="cost">The cost of the action.</param>
        public Action(ActionType type, ActionParameters param, Creature subject, double cost)
        {
            this.Type = type;
            this.Subject = subject;
            this.Cost = cost;

            //Check if correct parameters
            switch (Type)
            {
                case ActionType.Move:
                    if (param.GetType() != typeof(MovementActionParameters))
                        throw new Exception("Tried to construct Action of type MOVE, but parameters are not MovementActionParameters!");
                    break;
                case ActionType.Take:
                    if (param.GetType() != typeof(TakeActionParameters))
                        throw new Exception("Tried to construct Action of type TAKE, but parameters are not TakeActionParameters!");
                    break;
                case ActionType.Equip:
                    if (param.GetType() != typeof(EquipActionParameters))
                        throw new Exception("Tried to construct Action of type EQUIP, but parameters are not EquipActionParameters!");
                    break;
                case ActionType.Unequip:
                    if (param.GetType() != typeof(UnequipActionParameters))
                        throw new Exception("Tried to construct Action of type UNEQUIP, but parameters are not UnequipActionParameters!");
                    break;
            }

            this.Param = param;
        }
Esempio n. 3
0
        public override void Run()
        {
            if (!(this.Owner is ObjectController))
            {
                return;
            }
            ObjectController objectController = (ObjectController)this.Owner;
            IObjectSpace     objectSpace      = new ODataObjectSpace();
            var selectedId = objectSpace.GetObjectId(objectController.ObjectName, objectController.SelectedObject);
            var parameters = new ActionParameters(objectName, Guid.Empty, ViewShowType.Show)
            {
                { "ProjectId", selectedId },
                { "WorkingMode", workMode }
            };

            if (string.IsNullOrEmpty(objectName))
            {
                objectName = objectController.ObjectName;
                parameters = new ActionParameters(objectName, selectedId, ViewShowType.Show)
                {
                    { "WorkingMode", workMode }
                };
            }
            App.Instance.Invoke(objectName, "Detail", parameters);
        }
        private void OnStatusCodeChange(object sender, EventArgs <object, int, int> e)
        {
            var fromStatus = e.Data2;
            var newStatus  = e.Data3;

            var isTaskCompleted    = fromStatus == 3 || fromStatus == 4;
            var attemptingComplete = newStatus == 3 || fromStatus == 4;
            var projectTask        = ConvertData.Convert <Katrin.Domain.Impl.ProjectTask>(e.Data1);
            var hasRemaininWorks   = projectTask.ActualWorkHours > projectTask.Effort;

            if (!isTaskCompleted && attemptingComplete && hasRemaininWorks)
            {
                Cursor.Current = Cursors.WaitCursor;
                var parameters = new ActionParameters("ProjectTaskEffort", projectTask.TaskId, ViewShowType.Show)
                {
                    { "WorkingMode", EntityDetailWorkingMode.Edit }
                };
                App.Instance.Invoke("ProjectTaskEffort", "Detail", parameters);
                Cursor.Current = Cursors.Default;
            }
            BackgroundWorker bgWorker = new BackgroundWorker();

            bgWorker.WorkerSupportsCancellation = true;
            bgWorker.DoWork += (ws, we) =>
            {
                var entity = (Katrin.Domain.Impl.ProjectTask)_objectSpace.GetOrNew(EntityName, projectTask.TaskId, null);
                entity.StatusCode = newStatus;
                _objectSpace.SaveChanges();
            };
            bgWorker.RunWorkerAsync();
        }
        public override void Run()
        {
            Guard.ObjectIsInstanceOfType(Owner, typeof(ISelection), "Owner");
            Guard.ObjectIsInstanceOfType(Owner, typeof(IObjectAware), "Owner");
            var selection   = (ISelection)Owner;
            var objectAware = (IObjectAware)Owner;
            ObjectController objectController = (ObjectController)this.Owner;

            Guid selectedId = Guid.Empty;
            var  parameters = new ActionParameters(objectAware.ObjectName, selectedId, ViewShowType.Show)
            {
                { "WorkingMode", _workMode }
            };
            var            controllerName   = objectAware.ObjectName;
            BaseController filterController =
                objectController.Context.ControllerFinder.FindController <BaseController>("BaseControllerList");

            if (filterController != null)
            {
                Guid?projectId   = filterController.GetSelectedFilterProjectId();
                Guid?memberId    = filterController.GetSelectedMemberId();
                Guid?iterationId = filterController.GetSelectedIterationId();
                parameters.Add("ProjectId", projectId);
                parameters.Add("MemberId", memberId);
                parameters.Add("IterationId", iterationId);
            }
            App.Instance.Invoke(controllerName, "Detail", parameters);
        }
Esempio n. 6
0
        public override IActionResult Execute(ActionParameters parameters)
        {
            var result = base.Execute(parameters);

            InitNotificationState();
            return(result);
        }
Esempio n. 7
0
        public IList <ActionParameters> GetActions(Chunk chunk)
        {
            List <ActionParameters> result   = new List <ActionParameters>();
            IList <BaseDecoder>     decoders = GetDecoders(chunk.ChunkTypeId);

            if (decoders == null)
            {
                return(result);
            }
            foreach (BaseDecoder decoder in decoders)
            {
                if (!decoder.CanDecode(chunk))
                {
                    continue;
                }
                string          output  = decoder.GetOutputDescription(chunk);
                IList <IViewer> viewers = ViewerManager.Current.GetViewers(decoder.Format);

                if (viewers == null)
                {
                    continue;
                }

                foreach (IViewer viewer in viewers)
                {
                    ActionParameters prms = new ActionParameters(chunk, decoder, viewer);
                    result.Add(prms);
                }
            }
            return(result);
        }
Esempio n. 8
0
        private void ApplyParameters(ProjectTask task)
        {
            ActionParameters parameters = this.Context.ActionParameter;

            if (!parameters.ContainsKey("ProjectId"))
            {
                return;
            }
            if (!parameters.ContainsKey("MemberId"))
            {
                return;
            }
            if (!parameters.ContainsKey("IterationId"))
            {
                return;
            }
            Guid?projectId = (Guid?)parameters["ProjectId"];

            if (projectId != null)
            {
                task.ProjectId = (Guid)projectId;
            }
            task.OwnerId            = (Guid?)parameters["MemberId"];
            task.ProjectIterationId = (Guid?)parameters["IterationId"];
        }
Esempio n. 9
0
        public FormAddEdit(FormStart fsClass, ActionParameters param)
        {
            InitializeComponent();
            this.fsClass = fsClass;
            this.param   = param;
            switch (param)
            {
            case ActionParameters.AddTree:
                IntiPositionIfTree(true);
                Text = "Добавить";
                Icon = Icon.FromHandle(Properties.Resources.plus.GetHicon());
                break;

            case ActionParameters.AddPlant:
                IntiPositionIfTree(false);
                Text = "Добавить";
                Icon = Icon.FromHandle(Properties.Resources.plus.GetHicon());
                break;

            case ActionParameters.EditTree:
                IntiPositionIfTree(true);
                Text = "Редактировать";
                Icon = Icon.FromHandle(Properties.Resources.edit.GetHicon());
                break;

            case ActionParameters.EditPlant:
                IntiPositionIfTree(false);
                Text = "Редактировать";
                Icon = Icon.FromHandle(Properties.Resources.edit.GetHicon());
                break;
            }
        }
Esempio n. 10
0
        public override IActionResult Execute(ActionParameters parameters)
        {
            IActionResult result = base.Execute(parameters);

            InitCustomDrawCell();
            return(result);
        }
Esempio n. 11
0
        public IActionResult NotificationAction(ActionParameters parameters)
        {
            var objectName = parameters.ObjectName;

            _sendView = ViewFactory.CreateView("DefaultNotificationView") as ISendSysNotification;
            OnViewSet();
            return(new ModalViewResult(_sendView));
        }
Esempio n. 12
0
 private void attemptExtract(ActionParameters action)
 {
     // for now we assume you're in range
     if (action.subject.LivingState == AgentPercept.LivingState.ALIVE)
     {
         _map.extractAgent(action.subject);
     }
 }
Esempio n. 13
0
        public ActionResult PerformAction(ActionParameters actionParmeters)
        {
            string testValue = "TestValue";

            return(new ActionResult {
                Success = true, Message = "Made it into the extension! TestValue = " + testValue
            });
        }
Esempio n. 14
0
 public void Dispose()
 {
     this._workspace         = null;
     this._actionParameters  = null;
     this._iControllerFinder = null;
     this._iWorkspaceInfo    = null;
     this._processer         = null;
 }
Esempio n. 15
0
        public RibbonFormWorkspace(ActionParameters parameters)
        {
            InitializeComponent();
            EventAggregationManager.AddListener(this);
            _wokspaceID = Guid.NewGuid();

            _config           = new ConfigService.ConfigService();
            _workspaceContext = new WorkSpaceContext(this, this, this, parameters, this);
        }
        public override IActionResult Execute(ActionParameters parameters)
        {
            _listView            = CreateListView("DefaultListView");
            _listView.ObjectName = ObjectName;
            var result = new PartialViewResult();

            result.View = _listView;
            return(result);
        }
 public override IActionResult Execute(ActionParameters parameters)
 {
     if (parameters.ContainsKey("ProjectId"))
     {
         _projectId = parameters.Get <Guid>("ProjectId");
     }
     //var view = Detail(objectName, objectId, workMode);
     return(base.Execute(parameters));
 }
        public override IActionResult Execute(ActionParameters parameters)
        {
            var gridView = parameters.Get <GridView>("GridView");

            _formatView     = ViewFactory.CreateView("DefaultFormatView") as IFormatConditionView;
            _entityTypeName = parameters.ObjectName;
            OnViewSet(gridView);
            return(new ModalViewResult(_formatView));
        }
        //void _chartView_RemoveListener(object sender, EventArgs e)
        //{
        //    EventAggregationManager.RemoveListener(this);
        //    _chartView = null;
        //}

        public override IActionResult Execute(ActionParameters parameters)
        {
            _chartView = ViewFactory.CreateView("DefaultProjectChartView") as IProjectChartView;
            OnViewSet();
            var result = new PartialViewResult();

            result.View = _chartView;
            return(result);
        }
        public override IActionResult Execute(ActionParameters parameters)
        {
            _ribbon            = parameters.Get <RibbonControl>("ribbonControl");
            _projectReportView = ViewFactory.CreateView("DefaultProjectReportView") as IProjectReportView;
            OnViewSet();
            var result = new PartialViewResult();

            result.View = _projectReportView;
            return(result);
        }
        private void OnEditItem(object sender, EventArgs <object> e)
        {
            var projectTask = ConvertData.Convert <Katrin.Domain.Impl.ProjectTask>(e.Data);
            var parameters  = new ActionParameters("ProjectTask", projectTask.TaskId, ViewShowType.Show)
            {
                { "WorkingMode", EntityDetailWorkingMode.Edit }
            };

            App.Instance.Invoke("ProjectTask", "Detail", parameters);
        }
Esempio n. 22
0
        public virtual IActionResult List(ActionParameters parameters)
        {
            string viewName = ObjectName;

            if (parameters.ViewShowType != ViewShowType.Mdi && parameters.ContainsKey("FixedFilter"))
            {
                viewName += parameters.Get <CriteriaOperator>("FixedFilter").LegacyToString();
            }
            return(ShowView(parameters, viewName, "List"));
        }
Esempio n. 23
0
        private void LoadMainView(string dockPath, ActionParameters parameters)
        {
            var viewDescriptors = AddInTree.BuildItems <object>(dockPath, this, false).OfType <ViewDescriptor>().ToList();

            if (!viewDescriptors.Any())
            {
                throw new Exception(string.Format("{0} doesn't contains any view, please check it", dockPath));
            }
            if (viewDescriptors.Count > 1 && !viewDescriptors.Any(c => c.Codon.Properties.Contains("MainView")))
            {
                throw new Exception(string.Format("One screen only supprt one view, {0} contains more then one view, please check it", dockPath));
            }
            var mainViewDescriptor = viewDescriptors[0];

            if (viewDescriptors.Any(c => c.Codon.Properties.Contains("MainView")))
            {
                mainViewDescriptor = viewDescriptors.Where(c => c.Codon.Properties.Contains("MainView")).First();
            }
            if (!mainViewDescriptor.Codon.Properties.Contains("controller"))
            {
                throw new Exception(string.Format("{0}/{1} doesn't contains controller property, please check it", dockPath, mainViewDescriptor.Id));
            }
            _mainController             = ControllerFactory.CreateController(mainViewDescriptor.Codon.Properties["controller"]);
            _mainController.WorkSpaceID = this.ID;
            _mainController.Context     = this._workspaceContext;
            this.LoadCommands();

            var ribbonPath = BasePath + "/Ribbon";

            if (AddInTree.ExistsTreeNode(ribbonPath))
            {
                RibbonManager.AddItemsToMenu(ribbon, _mainController, ribbonPath, this._commandManager);
            }
            parameters.Add("ribbonControl", this.ribbon);
            ActionResult = new ActionInvoker().Invoke(_mainController, null, parameters) as IActionResult;
            var result = ActionResult as IPartialViewResult;

            if (result == null)
            {
                return;
            }
            result.View.ViewName = mainViewDescriptor.Codon.Id;
            var mainControl = (Control)result.View;

            if (viewDescriptors.Count > 1)
            {
                LoadSubViews(viewDescriptors.Where(c => !c.Codon.Properties.Contains("MainView")).ToList(), dockPath, parameters, mainControl);
            }
            mainControl.Dock = DockStyle.Fill;
            AddView(result.View);
            this.Controls.Add(mainControl);
            ActiveView = result.View;
        }
        public override IActionResult Execute(ActionParameters parameters)
        {
            _projectTaskChartView  = ViewFactory.CreateView("DefaultProjectTaskChartView") as IProjectTaskChartView;
            _projectTaskFilterView = _projectTaskChartView.TaskFilter;
            this._projectTaskFilterView.ObjectName = this.ObjectName;
            this._projectTaskFilterView.ReadFilterConfig();
            OnViewSet();
            var result = new PartialViewResult();

            result.View = _projectTaskChartView;
            return(result);
        }
Esempio n. 25
0
 // Инициализация формы если выбрана строка в DataGridView на форме FormStart
 public FormAddEdit(FormStart fsClass, ActionParameters param, DataGridViewSelectedCellCollection selectedCells) : this(fsClass, param)
 {
     this.selectedCells = selectedCells;
     switch (param)
     {
     case ActionParameters.EditFish:
     case ActionParameters.EditPlant:
         TBName.Text = selectedCells[1].Value.ToString();
         TBType.Text = selectedCells[2].Value.ToString();
         break;
     }
 }
Esempio n. 26
0
        public override IActionResult Execute(ActionParameters parameters)
        {
            var result = new PartialViewResult();

            _projectTaskFilterView = ViewFactory.CreateView("DefaultTaskFilterView") as IProejctTaskFilter;
            result.View            = _projectTaskFilterView;
            this._projectTaskFilterView.ObjectName = "ProjectTask";
            this._projectTaskFilterView.ReadFilterConfig();
            _sendMessaage = true;
            OnViewSet();
            return(result);
        }
Esempio n. 27
0
 public WorkSpaceContext(IWorkspaceInfo workspaceInfo,
                         IControllerFinder controllerFinder,
                         IWorkspace1 workspace,
                         ActionParameters actionParameters,
                         IProcessInfo processer)
 {
     this._iWorkspaceInfo    = workspaceInfo;
     this._workspace         = workspace;
     this._iControllerFinder = controllerFinder;
     this._actionParameters  = actionParameters;
     this._processer         = processer;
 }
Esempio n. 28
0
        void OnStatusCodeChanged(object sender, EventArgs e)
        {
            Guid selectedId = Guid.Empty;

            selectedId = _objectSpace.GetObjectId(ObjectName, ObjectEntity);
            var parameters = new ActionParameters(ObjectName, selectedId, ViewShowType.Show)
            {
                { "NoteSubject", "Invoice Cancelled" },
                { "PutNoteEnable", "false" }
            };

            App.Instance.Invoke("NoteDetail", "NoteAction", parameters);
        }
Esempio n. 29
0
        void gridView_DoubleClick(object sender, EventArgs e)
        {
            if (_listView.SelectedObject == null)
            {
                return;
            }
            if (ObjectGridView is GridView)
            {
                var mPoint = ObjectGridView.GridControl.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));
                if (((GridView)ObjectGridView).CalcHitInfo(mPoint).RowHandle < 0)
                {
                    return;
                }
                if (!((GridView)ObjectGridView).CalcHitInfo(mPoint).InRow)
                {
                    return;
                }
            }
            SetReaded(true);

            NotificationDTO data = (NotificationDTO)_listView.SelectedObject;

            if (data.NotificationUrl == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(data.NotificationUrl))
            {
                return;
            }
            string[] notificationInfo   = data.NotificationUrl.Split(new char[] { '#' });
            string   relationObjectName = notificationInfo[0];
            Guid     relationOjectId    = Guid.Parse(notificationInfo[1]);
            var      relationEntity     = _objectSpace.GetOrNew(relationObjectName, relationOjectId, null);

            if (relationEntity == null)
            {
                XtraMessageBox.Show(ResourceService.GetString("DataDeletedTip"),
                                    ResourceService.GetString("Katrin"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return;
            }
            ActionParameters parameters = new ActionParameters(relationObjectName, relationOjectId, ViewShowType.Show)
            {
                { "WorkingMode", EntityDetailWorkingMode.View }
            };

            App.Instance.Invoke(notificationInfo[0], "Detail", parameters);
        }
Esempio n. 30
0
        public override void Run()
        {
            if (!(this.Owner is ListController))
            {
                return;
            }
            ListController listControl = (ListController)this.Owner;
            var            parameters  = new ActionParameters(listControl.ObjectName, Guid.Empty, ViewShowType.Show)
            {
                { "GridView", listControl.ObjectGridView }
            };

            App.Instance.Invoke("Format", null, parameters);
        }
Esempio n. 31
0
        public override void Run()
        {
            if (!(this.Owner is ListController))
            {
                return;
            }
            ListController listController = (ListController)this.Owner;
            var            parameters     = new ActionParameters("NewProjectTaskEffort", Guid.Empty, ViewShowType.Show)
            {
                { "WorkingMode", EntityDetailWorkingMode.Edit }
            };

            App.Instance.Invoke("NewProjectTaskEffort", "Detail", parameters);
        }
Esempio n. 32
0
    private void attemptConvert(ActionParameters action)
    {
        float distance = Vector2.Distance(action.subject.Location,
                                          action.directObject.Location);

        if( distance <= action.subject.ConvertRange )
        {
            // TODO: Is conversion guaranteed? Perhaps some just die, become corpses?
            // certainly possible to get multiple zombies attempting to convert in one cycle
            // so, prevent that
            if(action.directObject.LivingState == AgentPercept.LivingState.ALIVE)
            {
                action.directObject.configureAs(Agent.AgentType.ZOMBIE, true);
                if(_map != null)
                {
                    _map.agentCountChange(-1,1,0);
                }
            }
        }
    }
Esempio n. 33
0
 private void attemptExtract(ActionParameters action)
 {
     // for now we assume you're in range
     if(action.subject.LivingState == AgentPercept.LivingState.ALIVE)
     {
         _map.extractAgent(action.subject);
     }
 }
Esempio n. 34
0
        private void update(string source, ActionParameters args)
        {
            var existingPackage = getPackage(Path.GetFileNameWithoutExtension(args.Match));
            if (!runInstallVerify(args.TempPath, args.InstallPath)) {
                printUpdateFailed(args.Package.Signature);
                return;
            }
            if (!runUpgrade(args.TempPath, args.InstallPath, "before-update")) {
                printUpdateFailed(args.Package.Signature);
                return;
            }

            removePackage(args.Package.Command, args.InstallPath);
            new PackageExtractor().Extract(source, args.InstallPath);

            if (!runUpgrade(args.InstallPath, args.InstallPath, "after-update")) {
                printUpdateFailed(args.Package.Signature);
                return;
            }

            _dispatch(
                string.Format(
                    "Package updated from {0} to {1}",
                    existingPackage.Signature,
                    args.Package.Signature));
        }
Esempio n. 35
0
        private void Parse(String msg)
        {
            ActionParameters parameters;

            if (msg.StartsWith(PROPERTY_CHANGED))
            {
                /*string[] aux = msg.Split(' ');
                string propertyName = aux[2];
                string value = aux[3];
                if(this.HasProperty<Property<String>>(propertyName))
                {
                    Property<String> p = this.GetProperty<Property<String>>(propertyName);
                    if (!p.Value.Equals(value))
                    {
                        p.Value = value;
                    }
                }*/
            }
            else if (msg.StartsWith("<EmotionalState"))
            {
                string facialExpression = string.Empty;
                //EmotionalState es = (EmotionalState)EmotionalStateParser.Instance.Parse(msg);
                //this.emotionalState.Value = es;

                /*Emotion e = es.GetStrongestEmotion();
                if (e != null)
                {
                    if (e.Type.Equals(Emotion.GLOATING_EMOTION))
                    {
                        facialExpression = "laugh";
                    }
                    else if (e.Type.Equals(Emotion.REPROACH_EMOTION)
                            || e.Type.Equals(Emotion.RESENTMENT_EMOTION)
                            || e.Type.Equals(Emotion.ANGER_EMOTION)
                            || e.Type.Equals(Emotion.HATE_EMOTION))
                    {
                        facialExpression = "angry";
                    }
                    else if(e.Type.Equals(Emotion.DISTRESS_EMOTION) || e.Type.Equals(Emotion.PITTY_EMOTION))
                    {
                        facialExpression = "sad";
                    }
                    else if (e.Type.Equals(Emotion.JOY_EMOTION) || e.Type.Equals(Emotion.HAPPY_FOR_EMOTION))
                    {
                        facialExpression = "happy";
                    }
                    /*else if (es.Mood > 0.5f)
                    {
                        facialExpression = "happy";
                    }
                    else if (es.Mood < 0.5f)
                    {
                        facialExpression = "sad";
                    }
                    else
                    {
                        facialExpression = "natural";
                    }
                }
                else
                {
                    facialExpression = "natural";
                }

                Property<string> currentExpression = this.GetProperty<Property<string>>("expression");
                if (currentExpression != null)
                {
                    if (!currentExpression.Value.Equals(facialExpression))
                    {
                        currentExpression.Value = facialExpression;
                        Dictionary<string, object> arguments = new Dictionary<string, object>();
                        arguments.Add("expression", facialExpression);
                        Action a = this.GetAction("change-face");
                        a.Start(new Arguments(arguments));
                    }
                }*/
            }
            else if (msg.StartsWith("<Relations"))
            {
            }
            else if (msg.StartsWith("look-at"))
            {
                string[] aux = msg.Split(' ');
                //LookAt(aux[1]);
                parameters = new ActionParameters();
                parameters.Subject = this.Body.Name;
                parameters.ActionType = "look-at";
                parameters.Target = aux[1];
                this.lookATAction.Start(parameters);
            }
            else if (msg.StartsWith("<SpeechAct"))
            {
                SpeechActParameters speechParams = (SpeechActParameters) SpeechActParser.Instance.Parse(msg);
                if (speechParams.Meaning.Equals("episodesummary"))
                {
                    speechParams.Utterance = this.languageEngine.Narrate(speechParams.AMSummary);
                }
                else
                {
                    speechParams.Utterance = this.languageEngine.Say(speechParams);
                }

                EntityAction<ActionParameters> a = this.Body.getActionByName("SpeechAct") as EntityAction<ActionParameters>;
                if (a != null)
                {
                    a.Start(speechParams);
                }
            }
            else if (msg.StartsWith("<Action"))
            {
                parameters = (ActionParameters) ActionParametersParser.Instance.Parse(msg);
                EntityAction<ActionParameters> a = this.Body.getActionByName(parameters.ActionType) as EntityAction<ActionParameters>;
                if (a != null)
                {
                    a.Start(parameters);
                }
            }
            else if (msg.StartsWith(CANCEL_ACTION))
            {
                string actionMsg = msg.Substring(14);
                parameters = (ActionParameters)ActionParametersParser.Instance.Parse(actionMsg);
                EntityAction<ActionParameters> a = this.Body.getActionByName(parameters.ActionType) as EntityAction<ActionParameters>;
                if (a != null)
                {
                    a.Stop(false);
                }
            }
        }
Esempio n. 36
0
        private void update(string source, Package existingPackage, ActionParameters args)
        {
            if (existingPackage == null) {
                _dispatch("error|the requested package is not installed. Try install instead.");
                return;
            }
            if (!runInstallVerify(args.TempPath, args.InstallPath)) {
                printUpdateFailed(args.Package.Signature);
                return;
            }
            if (!runUpgrade(args.TempPath, args.InstallPath, "before-update")) {
                printUpdateFailed(args.Package.Signature);
                return;
            }

            var backupLocation = backupScripts(args.Package.Command, args.InstallPath);
            removePackage(args.Package, args.InstallPath, _useGlobal);
            new PackageExtractor().Extract(source, args.InstallPath);
            restoreScripts(args.Package.Command, args.InstallPath, backupLocation);

            if (!runUpgrade(args.InstallPath, args.InstallPath, "after-update")) {
                printUpdateFailed(args.Package.Signature);
                return;
            }

            _dispatch(
                string.Format(
                    "package updated from {0} to {1}",
                    existingPackage.Signature,
                    args.Package.Signature));
        }