Ejemplo n.º 1
0
        public async Task <string> GetConnectionTypeAsync()
        {
            await this.LoadCookiesIfNeededAsync();

            var status = await this.client.GetStringAsync(connectionStatusUrl);

            var match = Regex.Match(status, "<CurrentNetworkType>(?<mode>\\d+)</CurrentNetworkType>");

            if (match.Success)
            {
                return(ConnectionStatusType.Parse(match.Groups["mode"].Value));
            }

            if (status.Contains("timed out"))
            {
                Console.WriteLine("Response from server timed out.");
            }
            else if (status.Contains("125002"))
            {
                Console.WriteLine("Probably router rebooted or Session Lost. Trying to load home page to get cookies again... ");

                this.hasPublicKeys = false;

                await this.client.GetStringAsync(this.homePageUrl);
            }
            else
            {
                Console.WriteLine("Couldn't get proper connection type (<CurrentNetworkType> tag). Response was: {0}", status);
            }

            return(string.Empty);
        }
Ejemplo n.º 2
0
 private async void InstanceOnConnectionStatusChanged(AdpPushClient sender, ConnectionStatusType connectionStatus)
 {
     await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                   () =>
     {
         ConnectionState(connectionStatus == ConnectionStatusType.Connected);
     });
 }
Ejemplo n.º 3
0
 public Printer(string id, string name, string defaultDisplayName, string displayName, string description,
                PrinterType type, string proxy, long createTime, long accessTime, long updateTime, bool isTosAccepted,
                List <string> tags, dynamic capabilities, string capsHash, CapabilitiesFormat capsFormat, string ownerId,
                string ownerName, List <PrinterAcl> access, bool @public, bool quotaEnabled, int dailyQuota, int currentQuota,
                LocalSettings local_settings, string uuid, string manufacturer, string model, string gcpVersion, string setupUrl,
                string supportUrl, string updateUrl, string firmware, string supportedContentTypes, ConnectionStatusType connectionStatus,
                dynamic semanticState, dynamic uiState, int queuedJobsCount)
 {
     Id   = id;
     Name = name;
     DefaultDisplayName = defaultDisplayName;
     DisplayName        = displayName;
     Description        = description;
     Type                  = type;
     Proxy                 = proxy;
     CreateTime            = createTime;
     AccessTime            = accessTime;
     UpdateTime            = updateTime;
     IsTosAccepted         = isTosAccepted;
     Tags                  = tags;
     Capabilities          = capabilities;
     CapsHash              = capsHash;
     CapsFormat            = capsFormat;
     OwnerId               = ownerId;
     OwnerName             = ownerName;
     Access                = access;
     Public                = @public;
     QuotaEnabled          = quotaEnabled;
     DailyQuota            = dailyQuota;
     CurrentQuota          = currentQuota;
     LocalSettings         = local_settings;
     Uuid                  = uuid;
     Manufacturer          = manufacturer;
     Model                 = model;
     GcpVersion            = gcpVersion;
     SetupUrl              = setupUrl;
     SupportUrl            = supportUrl;
     UpdateUrl             = updateUrl;
     Firmware              = firmware;
     SupportedContentTypes = supportedContentTypes;
     ConnectionStatus      = connectionStatus;
     SemanticState         = semanticState;
     UiState               = uiState;
     QueuedJobsCount       = queuedJobsCount;
 }
 public ConnectionStatusEventHolder(MulticastDelegate multiDel, ConnectionStatusType status, bool willReconnect)
     : base(multiDel)
 {
     mStatus        = status;
     mWillReconnect = willReconnect;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Copies connection information from a new instance. Use this method on a game server
 /// when a spectator on a game client reconnects.
 /// </summary>
 public void ReconnectOnServer(Spectator newSpectator)
 {
     ConnectionID = newSpectator.ConnectionID;
     ConnectionStatus = ConnectionStatusType.Remote;
     StatsData = newSpectator.StatsData;
 }
Ejemplo n.º 6
0
 public void Disconnect()
 {
     if (ConnectionStatus != ConnectionStatusType.Remote) throw new InvalidOperationException("Cannot disconnect a " + ConnectionStatus + " spectator");
     LastDisconnectTime = Game.GameTime.TotalRealTime;
     ConnectionStatus = ConnectionStatusType.Disconnected;
 }
Ejemplo n.º 7
0
 public virtual void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo)
 {
     if (mode.HasFlag(SerializationModeFlags.ConstantDataFromServer) ||
         mode.HasFlag(SerializationModeFlags.ConstantDataFromClient))
     {
         Name = reader.ReadString();
     }
     if (mode.HasFlag(SerializationModeFlags.VaryingDataFromServer))
     {
         var isDisconnected = reader.ReadBoolean();
         if (IsRemote && isDisconnected) ConnectionStatus = ConnectionStatusType.Disconnected;
         if (IsDisconnected && !isDisconnected) ConnectionStatus = ConnectionStatusType.Remote;
         var oldTeam = Team;
         TeamProxy = reader.ReadTeamID(FindTeam);
         if (oldTeam != Team)
         {
             // Resign from old team now while we still have a direct reference to it.
             // The new team may not exist yet, so assign to it later in Update().
             if (oldTeam != null) oldTeam.UpdateAssignment(this);
             _teamAssignmentDeserialized = true;
         }
     }
     StatsData.Deserialize(reader, mode, framesAgo);
     ArenaStatistics.Deserialize(reader, mode, framesAgo);
 }