/// <summary>
        ///     Look for updates while displaying a progress bar. At the end display a message box with the result.
        /// </summary>
        public static void LookForUpdates()
        {
            var result = UpdateSystem.UpdateStatus.CheckFailed;
            var error  = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleSearchingForUpdates,
                                                  x => { result = UpdateSystem.CheckForUpdates(); });

            if (error == null)
            {
                switch (result)
                {
                case UpdateSystem.UpdateStatus.CheckFailed:
                    MessageBoxes.UpdateFailed(UpdateSystem.LastError != null
                            ? UpdateSystem.LastError.Message
                            : "Unknown error");
                    break;

                case UpdateSystem.UpdateStatus.NewAvailable:
                    AskAndBeginUpdate();
                    break;

                case UpdateSystem.UpdateStatus.UpToDate:
                    MessageBoxes.UpdateUptodate();
                    break;
                }
            }
            else
            {
                MessageBoxes.UpdateFailed(error.Message);
            }
        }
        /// <summary>
        ///     Automatically search for updates if auto update is enabled.
        ///     Doesn't block, use delegates to interface.
        /// </summary>
        /// <param name="canDisplayMessage">updateFoundCallback will be called after this returns true</param>
        /// <param name="updateFoundCallback">Launched only if a new update was found. It's launched from a background thread.</param>
        public static void AutoUpdate(Func <bool> canDisplayMessage, Action updateFoundCallback)
        {
            if (Settings.Default.MiscCheckForUpdates && WindowsTools.IsNetworkAvailable())
            {
                new Thread(() =>
                {
                    if (UpdateSystem.CheckForUpdates() != UpdateSystem.UpdateStatus.NewAvailable)
                    {
                        return;
                    }

                    while (!canDisplayMessage())
                    {
                        Thread.Sleep(100);
                    }

                    try
                    {
                        updateFoundCallback();
                    }
                    catch
                    {
                        // Ignore background error, not necessary
                    }
                })
                {
                    Name = "UpdateCheck_Thread", IsBackground = true
                }.Start();
            }
        }
Ejemplo n.º 3
0
 void Callback(IAsyncResult ar)
 {
     try {
         task.EndInvoke(ar);
     }
     catch (Exception e) {
         UnityEngine.Debug.LogException(e);
     }
     try {
         if (onAnyThreadTrigger != null)
         {
             onAnyThreadTrigger();
         }
     }
     catch (Exception e) {
         UnityEngine.Debug.LogException(e);
     }
     try {
         if (this.onUnityThreadTrigger != null)
         {
             while (!UpdateSystem.AddUnityThreadCallbackToQueue(this))
             {
                 ;
             }
         }
     }
     catch (Exception e) {
         UnityEngine.Debug.LogException(e);
     }
 }
Ejemplo n.º 4
0
 void Callback(IAsyncResult ar)
 {
     secondThread.EndInvoke(ar);
     while (!UpdateSystem.AddUnityThreadCallbackToQueue(this))
     {
         ;
     }
 }
        private void OnForceState(ForceStateChange forceState)
        {
            var datas = turretHub.Data.TurretsDatas;

            foreach (var kvp in datas)
            {
                UpdateSystem.SendEvent(new BaseUnitStatus.ForceState.Event(forceState), kvp.Value.EntityId);
            }
        }
        private void HandleEvents()
        {
            var updatesEvents = UpdateSystem.GetEventsReceived <WorldTimer.Updates.Event>();

            if (updatesEvents.Count > 0)
            {
                var i          = UnityEngine.Random.Range(0, updatesEvents.Count);
                var timerEvent = updatesEvents[i];
                UpdateCurrent(timerEvent.Event.Payload.CurrentSeconds);
            }
        }
        void OnDisable()
        {
            m_SynthesizerProvider = null;

            UpdateSystem.Ignore <PreLateUpdate>(OnPreLateUpdate);

            Camera.onPostRender -= OnRender;
            RenderPipelineManager.endCameraRendering -= OnRenderRP;

            EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
        }
Ejemplo n.º 8
0
        public void GroupInjecting()
        {
            var context       = ContextFactory.CreateEntitiesContext();
            var systemManager = context.GetManager <SystemManager>();

            var system = new UpdateSystem();

            systemManager.AddSystem(system);

            Assert.NotNull(system.Group);
        }
Ejemplo n.º 9
0
 public static void Restart()
 {
     try
     {
         UpdateSystem.RestartApplication();
     }
     catch (Exception ex)
     {
         PremadeDialogs.GenericError(ex);
     }
 }
        private void OnOrderUpdate(OrderType order)
        {
            var datas = turretHub.Data.TurretsDatas;

            foreach (var kvp in datas)
            {
                UpdateSystem.SendEvent(new BaseUnitStatus.SetOrder.Event(new OrderInfo()
                {
                    Order = order
                }), kvp.Value.EntityId);
            }
        }
Ejemplo n.º 11
0
        public void AddEnabledUpdateSystem()
        {
            var context       = ContextFactory.CreateEntitiesContext();
            var systemManager = context.GetManager <SystemManager>();

            var system = new UpdateSystem();

            systemManager.AddSystem(system);

            Assert.AreEqual(1, systemManager.systems.Count);
            Assert.AreEqual(1, systemManager.updateSystems.Count);
        }
Ejemplo n.º 12
0
 public static void Restart()
 {
     try
     {
         IsRestarting = true;
         UpdateSystem.RestartApplication();
     }
     catch (Exception ex)
     {
         PremadeDialogs.GenericError(ex);
         IsRestarting = false;
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 从云上拉去数据到内存中
 /// </summary>
 private void RequestAccountAndChapters()
 {
     if (NetSystem.Instance.GetConnector().GetConnectStatus() == ConnectionStatus.CONNECTED)
     {
         string objectName = LocalAccountStorage.Get().account + ".txt";
         string filePath   = UpdateSystem.Get().saveRoot + objectName;
         NetSystem.Instance.helper.GenPresignedUrl(objectName, "GET", "text/plain", filePath, (int)EventId.OnSyncUserAndChapters);
     }
     else
     {
         StartSingleGame();
     }
 }
Ejemplo n.º 14
0
        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show(UpdateSystem.CheckForUpdates().ToString());
            if (UpdateSystem.LastError != null)
            {
                MessageBox.Show(UpdateSystem.LastError.Message);
            }

            if (UpdateSystem.LatestReply != null)
            {
                MessageBox.Show(UpdateSystem.LatestReply.FullReply.ToString());
                labelVersion.Text = UpdateSystem.LatestReply.GetUpdateVersion().ToString();
            }
        }
Ejemplo n.º 15
0
 private static void SetupDependancies()
 {
     // Order is semi-important, prepare settings should go first.
     Program.PrepareSettings();
     CultureConfigurator.SetupCulture();
     try
     {
         UpdateSystem.ProcessPendingUpdates();
     }
     catch (Exception ex)
     {
         PremadeDialogs.GenericError(ex);
     }
 }
Ejemplo n.º 16
0
        protected override void Initialize()
        {
            if (editorEnabled)
            {
                startEditor?.Invoke();
            }
            renderSystem = new RenderSystem(GraphicsDevice);
            renderSystem.Initialize();
            updateSystem = new UpdateSystem();
            updateSystem.Initialize();
            drawableSystems.Add("RenderSystem", renderSystem);
            updateableSystems.Add("UpdateSystem", updateSystem);

            base.Initialize();
        }
        private void HandleEvets()
        {
            var controllerEvents = UpdateSystem.GetEventsReceived <AdvancedUnitController.ControllerChanged.Event>();

            for (var i = 0; i < controllerEvents.Count; i++)
            {
                var ctrlEvent = controllerEvents[i];
                AdvancedUnitController.Component?comp = null;
                if (TryGetComponent(ctrlEvent.EntityId, out comp))
                {
                    var value = comp.Value;
                    value.Controller = ctrlEvent.Event.Payload;
                    SetComponent(ctrlEvent.EntityId, value);
                }
            }
        }
Ejemplo n.º 18
0
        private void HandleLaserFireInfoEvents()
        {
            var laserFireEvents = UpdateSystem.GetEventsReceived <LongRangeLaserComponent.LaserFired.Event>();

            for (var i = 0; i < laserFireEvents.Count; i++)
            {
                var laser = laserFireEvents[i];
                var id    = laser.EntityId.Id;
                if (laserContainer.ContainsKey(id) == false)
                {
                    laserContainer.Add(id, new LaserContainer(id));
                }

                var container = laserContainer[id];
                container.AddLaser(laser.Event.Payload);
            }
        }
Ejemplo n.º 19
0
        public MainWindow()
        {
            InitializeComponent();

            Editor.API.NotificationSystem.Initialize(UI_DockPanel_Notification, UI_DockPanel_Notification_Translate);
            UpdateSystem.Initialize();

            Navegation.NavegationMenu = navegationBar;
            Navegation.TabControl     = UI_TabControl;
            PluginEngine.Initialize();

            //PluginManager pluginManager = new PluginManager();
            // Internal.System.Initialize();
            // NavegationBar = this.navegationBar;
            // Main = this;
            InitializeUI();
        }
Ejemplo n.º 20
0
    /// <summary>
    /// 加载streaming资源
    /// 仅仅是获取了正确的资源路径,仍然使用外部读取手段
    /// </summary>
    /// <param name="relativePath">Relative path.</param>
    public string LoadStramingAsset(string relativePath)
    {
        object asset = null;

                #if !SERVER
        if (UpdateSystem.Get().HaveAssetBundle())
        {
            UpdateSystem.Get().LoadStreamingAssets(relativePath, out asset);
        }
                #endif

        if (asset == null)
        {
            return(DataProviderSystem.FormatDataProviderPath(relativePath));
        }

        return((string)asset);
    }
Ejemplo n.º 21
0
    /// <summary>
    /// 读取资源
    /// </summary>
    /// <returns>The resource.</returns>
    /// <param name="path">Path.</param>
    public Object LoadResource(string path)
    {
        object asset = null;

                #if !SERVER
        if (UpdateSystem.Get().HaveAssetBundle())
        {
            UpdateSystem.Get().LoadAsset(path, out asset);
        }

        if (asset == null)
        {
            asset = Resources.Load(path);
        }
                #endif

        return((Object)asset);
    }
        void OnEnable()
        {
            m_SynthesizerProvider = null;

            LoadTemplate();

            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;

            //For regular RP
            Camera.onPostRender -= OnRender;
            Camera.onPostRender += OnRender;

            //For HDRP
            RenderPipelineManager.endCameraRendering -= OnRenderRP;
            RenderPipelineManager.endCameraRendering += OnRenderRP;

            UpdateSystem.Listen <PreLateUpdate>(OnPreLateUpdate);

            m_ExitingPlayMode = false;
        }
Ejemplo n.º 23
0
        public static void AskAndBeginUpdate()
        {
            if (MessageBoxes.UpdateAskToDownload())
            {
                try
                {
                    // Prevent log cleaner from running in portable builds
                    EntryPoint.IsRestarting = true;

                    UpdateSystem.BeginUpdate();
                }
                catch (Exception ex)
                {
                    EntryPoint.IsRestarting = false;

                    Console.WriteLine(ex);
                    MessageBoxes.UpdateFailed(ex.Message);
                }
            }
        }
Ejemplo n.º 24
0
        protected override bool OnStartup(StartupEventArgs eventArgs)
        {
            // Order is semi-important, prepare settings should go first.
            Program.PrepareSettings();
            NBugConfigurator.SetupNBug();
            CultureConfigurator.SetupCulture();
            try
            {
                UpdateSystem.ProcessPendingUpdates();
            }
            catch (Exception ex)
            {
                PremadeDialogs.GenericError(ex);
            }

            // Necessary to put form constructor here for objectlistbox. It flips out if
            // the main form is created inside of the EntryPoint constructor.
            MainForm = new MainWindow();
            return(true);
        }
Ejemplo n.º 25
0
        public void DisableUpdateSystem()
        {
            var context       = ContextFactory.CreateEntitiesContext();
            var systemManager = context.GetManager <SystemManager>();

            var system = new UpdateSystem();

            system.IsEnabled = true;
            systemManager.AddSystem(system);
            context.Update();

            Assert.AreEqual(1, systemManager.systems.Count);
            Assert.AreEqual(1, systemManager.updateSystems.Count);
            Assert.IsTrue(system.Updated);

            system.Updated   = false;
            system.IsEnabled = false;
            context.Update();

            Assert.AreEqual(1, systemManager.systems.Count);
            Assert.AreEqual(0, systemManager.updateSystems.Count);
            Assert.IsFalse(system.Updated);
        }
 public MainWindow()
 {
     updateSystem = new UpdateSystem("0.1.0");
     settings = new Settings();
     InitializeComponent();
 }
Ejemplo n.º 27
0
 public WorldVisualizerFactory(UpdateSystem updateSystem)
 {
     this.updateSystem = updateSystem;
 }
Ejemplo n.º 28
0
 public WorldVisualizerFactory()
 {
     updateSystem = UpdateSystem.Presentation;
 }
Ejemplo n.º 29
0
 private void button3_Click(object sender, EventArgs e)
 {
     UpdateSystem.BeginUpdate();
 }
Ejemplo n.º 30
0
 public void AddSystem(UpdateSystem system)
 {
     _updateSystems.Add(system);
 }
Ejemplo n.º 31
0
 public void RemoveSystem(UpdateSystem system)
 {
     _updateSystems.Remove(system);
 }