Ejemplo n.º 1
0
        private void OnCmdAssignSite(RouterMessage msg)
        {
            //Decode arguments and create logger
            ManagerAssignSite   args   = msg.DeserializeAs <ManagerAssignSite>();
            MasterCommandLogger logger = new MasterCommandLogger(msg);

            //Update if it was supposed to be null
            if (args.site_id == "")
            {
                args.site_id = null;
            }

            //Find instance
            ManagerInstance instance = session.GetInstanceById(long.Parse(args.instance_id));

            if (instance == null)
            {
                logger.FinishFail("Could not find that instance on the server.");
                return;
            }

            //Run
            try
            {
                //Update
                instance.site_id = args.site_id;
                session.Save();
                session.RefreshSites();
            }
            catch (Exception ex)
            {
                logger.FinishFail($"Unexpected error: {ex.Message}{ex.StackTrace}");
            }
        }
Ejemplo n.º 2
0
 public ChannelReader <RouterMessage> AssignSite(ManagerAssignSite cmd)
 {
     return(SendMessageGetResponseChannelSerialized(MasterConnectionOpcodes.OPCODE_MASTER_M_ASSIGNSITE, cmd));
 }