Beispiel #1
0
 /// <summary>
 /// StartReplayService method implementation
 /// </summary>
 private void StartReplayService()
 {
     try
     {
         _svchost.StartService(this);
         ReplayClient replaymanager = new ReplayClient();
         replaymanager.Initialize();
         try
         {
             IReplay client = replaymanager.Open();
             try
             {
                 client.WarmUp();
             }
             catch (Exception e)
             {
                 this.EventLog.WriteEntry(string.Format("Error on WarmUp ReplayService : {0}.", e.Message), EventLogEntryType.Error, 1001);
             }
             finally
             {
                 replaymanager.Close(client);
             }
         }
         finally
         {
             replaymanager.UnInitialize();
         }
     }
     catch (Exception e)
     {
         this.EventLog.WriteEntry(string.Format("Error when starting ReplayService : {0}.", e.Message), EventLogEntryType.Error, 1001);
     }
 }
Beispiel #2
0
        public int Send(string fromDevice, string showID, string recipientISN)
        {
            int num = 1;

            ZoggrLogger.Log(string.Format("Sending showID {0} from {1} to {2}...", showID, fromDevice, recipientISN));
            try
            {
                ReplayDevice[] replayDevices = this.options.Options.rtvList.ReplayDevices;
                int            length        = replayDevices.Length;
                for (int i = 0; i < length; i++)
                {
                    ReplayDevice re = replayDevices[i];
                    if (fromDevice.Equals(re.friendlyName))
                    {
                        ReplayClient client = new ReplayClient(re);
                        ZoggrLogger.Log(string.Format("Found {0}...", re.friendlyName));
                        num = client.IVSSend(recipientISN, showID, this.rddnsServer);
                        if (num == 1)
                        {
                            ZoggrLogger.Log("Error: Failed to send the show!");
                        }
                        else
                        {
                            ZoggrLogger.Log("Show successfully sent.");
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ZoggrLogger.Log(exception.Message);
            }
            return(num);
        }
Beispiel #3
0
        protected ReplayServiceCapabilities GetReplayServiceCapabilities()
        {
            ReplayServiceCapabilities response = null;

            RunStep(() => { response = ReplayClient.GetServiceCapabilities(); }, "Get Replay service capabilities");
            DoRequestDelay();
            return(response);
        }
Beispiel #4
0
        protected override async Task <Window> Load(ILoadingView loadingView)
        {
            try {
                var replayClient = new ReplayClient();
                Program.Client = replayClient;

                Program.IsHost = true;

                loadingView.UpdateStatus("Loading Replay..");
                ReplayReader reader = null;
                ReplayEngine engine = null;
                try {
                    reader = ReplayReader.FromStream(File.OpenRead(_replayPath));
                    engine = new ReplayEngine(reader, replayClient);

                    loadingView.UpdateStatus("Loading Game...");
                    var game = GameManager.Get().GetById(reader.Replay.GameId);

                    loadingView.UpdateStatus("Loading Game Engine...");
                    Program.CurrentOnlineGameName = game.Name;
                    Program.GameEngine            = new GameEngine(engine, game, reader.Replay.User);
                } catch {
                    reader?.Dispose();
                    engine?.Dispose();

                    throw;
                }

                var dispatcher = Dispatcher.CurrentDispatcher;

                Window window = null;
                await dispatcher.InvokeAsync(() => {
                    window = WindowManager.PlayWindow = new PlayWindow();

                    window.Closed += PlayWindow_Closed;

                    window.Show();
                }, DispatcherPriority.Background);

                return(window);
            } catch (UserMessageException) {
                throw;
            } catch (Exception e) {
                var msg = $"Error launching replay from {_replayPath}: {e.Message}";

                Log.Warn(msg, e);

                throw new UserMessageException(UserMessageExceptionMode.Blocking, msg, e);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Pause method iplementation
        /// </summary>

        public static void Reset(List <string> computers)
        {
            ReplayClient manager = new ReplayClient();

            manager.Initialize();
            try
            {
                IReplay client = manager.Open();
                try
                {
                    client.Reset(computers);
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }
Beispiel #6
0
        /// <summary>
        /// Continue method iplementation
        /// </summary>
        public static bool Check(List <string> computers, ReplayRecord record)
        {
            ReplayClient manager = new ReplayClient();

            manager.Initialize();
            try
            {
                IReplay client = manager.Open();
                try
                {
                    return(client.Check(computers, record));
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }