public void Main(string argument, UpdateType updateSource)
        {
            Context.UpdateTime();

            if (commandLine.TryParse(argument))
            {
                subsystemManager.CommandV2(commandLine);
            }
            else
            {
                try
                {
                    subsystemManager.Update(updateSource);
                    var status = subsystemManager.GetStatus();
                    if (status != string.Empty)
                    {
                        Echo(subsystemManager.GetStatus());
                    }
                }
                catch (Exception e)
                {
                    Me.GetSurface(0).WriteText(e.StackTrace);
                    Me.GetSurface(0).WriteText("\n", true);
                    Me.GetSurface(0).WriteText(e.Message, true);
                    Me.GetSurface(0).WriteText("\n", true);
                    Me.GetSurface(0).WriteText(subsystemManager.GetStatus(), true);
                }
            }
        }
Exemple #2
0
 public void Main(string argument, UpdateType updateSource)
 {
     context.UpdateTime();
     if (commandLine.TryParse(argument))
     {
         subsystemManager.CommandV2(commandLine);
     }
     else
     {
         subsystemManager.Update(updateSource);
         Echo(subsystemManager.GetStatus());
     }
 }
Exemple #3
0
 public void Main(string argument, UpdateType updateSource)
 {
     Context.UpdateTime();
     if (commandLine.TryParse(argument))
     {
         subsystemManager.CommandV2(commandLine);
         //subsystemManager.Command(commandLine.Argument(0), commandLine.Argument(1), commandLine.ArgumentCount > 2 ? commandLine.Argument(2) : null);
     }
     else
     {
         subsystemManager.Update(updateSource);
         var s = subsystemManager.GetStatus();
         if (!string.IsNullOrEmpty(s))
         {
             Echo(s);
         }
     }
 }
Exemple #4
0
 public void Main(string argument, UpdateType updateSource)
 {
     Echo(MyRaven.GetStatus());
     if (!string.IsNullOrEmpty(argument))
     {
         if (commandLine.TryParse(argument))
         {
             MyRaven.SubsystemManager.CommandV2(commandLine);
         }
     }
     try
     {
         MyRaven.Update(updateSource);
     }
     catch (Exception exc)
     {
         Me.GetSurface(0).WriteText(exc.StackTrace);
         Me.GetSurface(0).WriteText("\n", true);
         Me.GetSurface(0).WriteText(exc.Message, true);
         Me.GetSurface(0).WriteText("\n", true);
         Me.GetSurface(0).WriteText(MyRaven.GetStatus(), true);
     }
 }
        public void Update(UpdateType updateSource)
        {
            if (Active)
            {
                if (Context.Frame % 100 == 0 && Context.WCAPI == null)
                {
                    Context.WCAPI = new WcPbApi();
                    if (!Context.WCAPI.Activate(Context.Program.Me))
                    {
                        Context.WCAPI = null;
                    }
                }

                while (GeneralListener.HasPendingMessage)
                {
                    var msg  = GeneralListener.AcceptMessage();
                    var data = msg.Data.ToString();
                    if (commandLine.TryParse(data))
                    {
                        CommandV2(commandLine);
                    }
                }


                if (OutputMode == OutputMode.Profile)
                {
                    profiler.StartSectionWatch("Setup frequencies");
                }
                if (OutputMode == OutputMode.Profile)
                {
                    profiler.UpdateRuntime();
                }
                Context.Frame++;

                UpdateFrequency updateFrequency = UpdateFrequency.None;
                if ((updateSource & UpdateType.Update1) != 0)
                {
                    updateFrequency |= UpdateFrequency.Update1;
                }
                if ((updateSource & UpdateType.Update10) != 0)
                {
                    updateFrequency |= UpdateFrequency.Update10;
                }
                if ((updateSource & UpdateType.Update100) != 0)
                {
                    updateFrequency |= UpdateFrequency.Update100;
                }

                UpdateFrequency targetFrequency = UpdateFrequency.Update1;
                if (OutputMode == OutputMode.Profile)
                {
                    profiler.StopSectionWatch("Setup frequencies");
                }
                foreach (var subsystem in Subsystems)
                {
                    if (OutputMode == OutputMode.Profile)
                    {
                        profiler.StartSectionWatch(subsystem.Key);
                    }
                    ISubsystem system = subsystem.Value;
                    if ((system.UpdateFrequency & updateFrequency) != 0)
                    {
                        system.Update(Context.LocalTime, updateFrequency);
                    }
                    targetFrequency |= system.UpdateFrequency;
                    if (OutputMode == OutputMode.Profile)
                    {
                        profiler.StopSectionWatch(subsystem.Key);
                    }
                }

                Context.Program.Runtime.UpdateFrequency = targetFrequency;
            }
            else if (Activating)
            {
                Activating = false;
                Activate();
            }
        }