private GameMap LoadMap() { return(Perf.Time("Loaded Map", () => new GameMapFactory().CreateGameMap( new Tmx(CurrentGame.GraphicsDevice, MapDir, MapFileName), TileData.RenderSize))); }
public ValidateResult Validate(ValidateRequest validateRequest) { try { _avaLog.Debug("AddressSvc.Validate"); Utilities.VerifyRequestObject(validateRequest); _avaLog.Debug("Copying address into proxy object"); ProxyValidateRequest proxyRequest = new ProxyValidateRequest(); validateRequest.CopyTo(proxyRequest); //Record time take for address validation Perf monitor = new Perf(); monitor.Start(); ProxyValidateResult svcResult = (ProxyValidateResult)base.InvokeService(typeof(ProxyAddressSvc), MethodBase.GetCurrentMethod().Name, new object[] { proxyRequest }); monitor.Stop(this, ref svcResult); _avaLog.Debug("Copying address from proxy object"); ValidateResult localResult = new ValidateResult(); localResult.CopyFrom(svcResult); return(localResult); } catch (Exception ex) { return(ValidateResult.CastFromBaseResult(ExceptionManager.HandleException(ex))); } }
public void TickClient(float dt, byte[] recvBuffer, ref NetIOMetrics reliableChannelMetrics, ref NetIOMetrics unreliableChannelMetrics) { Perf.Begin("LocalGameNetDriver.TickClient"); if (clientSend != null) { if (clientSend.connectPending) { clientSend.connectPending = false; clientSend.callbacks.OnConnect(clientSend); } if ((clientSend != null) && (serverSendOfs > 0)) { RecvMessages(serverSendBuffer, serverSendOfs, recvBuffer, clientSend, ref reliableChannelMetrics, ref unreliableChannelMetrics); serverSendOfs = 0; } if ((clientSend != null) && clientSend.disconnectPending) { clientSend.Dispose(); clientSend = null; } } Perf.End(); }
public void Draw(Transform2 parentTransform) { var chars = GameWorld.Characters .OrderBy(x => x.CurrentTile.Position.X) .ThenBy(x => x.CurrentTile.Position.Y).ToList(); Perf.Time("Drew Walls + Floors", () => GameWorld.Map.Tiles.ForEach(x => { x.Draw(Floors, parentTransform, MultiplyColor); x.Draw(Walls, parentTransform, MultiplyColor); })); Perf.Time("Drew Highlights", () => GameWorld.Highlights.Draw(parentTransform)); Perf.Time("Drew Under Char Objects", () => GameWorld.Map.Tiles.ForEach(x => { x.Draw(UnderChar1, parentTransform, MultiplyColor); x.Draw(UnderChar2, parentTransform, MultiplyColor); })); Perf.Time("Drew Characters", () => chars.ForEach(x => x.Draw(parentTransform))); Perf.Time("Drew Over Char Objects", () => GameWorld.Map.Tiles.ForEach(x => { x.Draw(OverChar1, parentTransform, MultiplyColor); x.Draw(OverChar2, parentTransform, MultiplyColor); x.Draw(Shadows, parentTransform, MultiplyColor); x.Draw(FogOfWar, parentTransform); })); Perf.Time("Drew High Highlights", () => GameWorld.HighHighlights.Draw(parentTransform)); Perf.Time("Drew PostFX", () => GameWorld.Map.Tiles.ForEach(x => _fx.Draw(parentTransform, x))); Perf.Time("Drew Char UI", () => chars.ForEach(x => x.DrawUI(parentTransform))); }
protected virtual void TickActors(MonoBehaviour loadingContext) { Perf.Begin("World.TickActors"); _loadingQueue.Run(loadingContext); _taskQueue.Run(loadingContext); for (int i = 0; i < _actors.Count;) { var actor = _actors[i]; if (!actor.pendingKill) { actor.Tick(); actor.TickComponents(); actor.TickLifetime(); } if (actor.pendingKill) { DestroyActor(actor, false); _actors.RemoveAt(i); } else { ++i; } } Perf.End(); }
public void Duration() { using (var perf = new Perf()) { Assert.IsTrue(perf.Duration > TimeSpan.Zero); } }
void RawNetRecv(ActorReplicationChannel channel, int size) { #if PROFILING try { Perf.Begin("World.RawNetRecv"); #endif _netArchive.BeginRead(size); int typeID = _netArchive.ReadInt(); NetMsg msg = _netMsgFactory.GetNetMsg(typeID); if (msg != null) { msg.Serialize(channel.connection, _netArchive); if (_netArchive.hasUnreadBytes) { throw new System.IO.IOException(msg.GetType().FullName + " did not consume its entire payload."); } DynamicDispatchNetMsg(msg, channel); } else { throw new System.IO.IOException("Unrecognized net message type " + typeID); } #if PROFILING } finally { Perf.End(); } #endif }
public void MinimumDuration() { using (var perf = new Perf()) { Assert.AreEqual <TimeSpan>(new TimeSpan(0, 0, 0, 1), perf.MinimumDuration); } }
protected override void Initialize() { try { Perf.Time($"{nameof(NeedlesslyComplexMainGame)}.Initialize", () => { CurrentGame.Init(this); Resources.Init(); // @todo #1 Bug: Update the GraphicsDeviceManager in the constructor, to avoid the window being mispositioned and visibly changing size CurrentDisplay.Init(_graphics, _display); Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - CurrentDisplay.GameWidth) / 2, (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - CurrentDisplay.GameHeight) / 2 - 40); // Delete this once the above issue is fixed IsMouseVisible = true; _uiSpriteBatch = new SpriteBatch(GraphicsDevice); _worldSpriteBatch = new SpriteBatch(GraphicsDevice); Input.SetController(_controller); World.Init(_worldSpriteBatch); UI.Init(_uiSpriteBatch); _scene.Init(); base.Initialize(); }); } catch (Exception e) { _errorHandler.Handle(new Exception("Error while Initializing MonoDragons Core engine", e)); } }
private static void Main() { HandleExceptions(() => { using (var game = Perf.Time("Startup", () => CreateGame("Lobby"))) game.Run(); }); }
public void SendReliable(byte[] buffer, int numBytes) { Perf.Begin("LocalGameNetDriverConnection.SendReliable"); netDriver.SendReliable(this, buffer, numBytes); reliableMetrics.bytesSent += numBytes; ++reliableMetrics.numPacketsSent; Perf.End(); }
public void AppendFormatNull() { using (var perf = new Perf()) { perf.Append(null, StringHelper.ValidString(), StringHelper.NullEmptyWhiteSpace()); Assert.IsNull(perf.Content); } }
public void AppendFormatDataNull() { using (var perf = new Perf()) { perf.Append(StringHelper.ValidString(), null); Assert.IsNull(perf.Content); } }
public void AppendMessageNull() { using (var perf = new Perf()) { perf.Append(null); Assert.IsNull(perf.Content); } }
public virtual void Draw(Transform2 parentTransform) { var t = _useAbsolutePosition ? Transform2.Zero : parentTransform + GetOffset(); _visuals.ForEach(x => { Perf.Time($"Drew {x.GetType().Name}", () => x.Draw(t), 20); }); }
static void Main(string[] _) { Dbg.Write("Starting Fasta Profiling"); Perf.causalProfiling(10, FuncConvert.FromAction(() => Fasta.Run(new[] { "25000000" }))); Dbg.Write("Finished Fasta Profiling"); }
public void AppendMesssage() { using (var perf = new Perf()) { var data = StringHelper.ValidString(); perf.Append(data); Assert.AreEqual <string>(data, perf.Content); } }
void ReplicateDependencies(ref NetMsgs.ReplicatedObjectData packet) { Perf.Begin("ActorReplicationChannel.ReplicateDependencies"); // Serialize referenced actors. objectRefs2.Clear(); while (objectRefs.Values.Count > 0) { Utils.Swap(ref objectRefs, ref objectRefs2); for (int i = 0; i < objectRefs2.Values.Count; ++i) { int netIDHashCode = objectRefs2.Values[i]; var obj = connection.world.GetObjectByNetIDHashCode(netIDHashCode); bool isOwner = true; bool isRelevant = true; var actor = obj as Actor; ObjectReplicator replicator = null; if (actor != null) { Assert.IsFalse(actor.disposed); if (actor.internal_NetTearOff) { continue; } isOwner = actor.ownerConnectionID == _connection.id; if (!isOwner && actor.ownerOnly) { // actor is not replicated on this channel. continue; } if (!CheckRelevancy(actor, out replicator, out isRelevant)) { // actor is not replicated on this channel. continue; } } else { var component = obj as ActorComponent; if (component != null) { isOwner = component.owner.ownerConnectionID == _connection.id; if (!isOwner && component.owner.ownerOnly) { // only replicate to owner. continue; } } } ReplicateObject(0f, obj, actor, replicator, isOwner, isRelevant, ref packet); #if !PACKET_COMBINE packet = packet.Flush(connection); #endif } objectRefs2.Clear(); } Perf.End(); }
public void ReplicateRPC(SerializableObject context, int rpcID, ObjectRPCSerializer serializer, params object[] args) { if (!_connection.isValid) { return; } Perf.Begin("ActorReplicationChannel.ReplicateRPC"); if (isServer) { if (!didHandshake) { // client hasn't finished connecting Perf.End(); return; } if ((clientLevel == null) || (clientLevel != _connection.world.currentLevel)) { Perf.End(); return; } } else if (_connection.world.isTraveling) { Perf.End(); return; } if (context.internal_GetReplicator(connection) == null) { // has not been replicated. Perf.End(); return; } var actor = context as Actor; if ((actor != null) && isServer && serializer.rpcInfo.CheckRelevancy && !actor.IsNetRelevantFor(this)) { // not relevant Perf.End(); return; } Assert.IsFalse((actor != null) ? actor.netTornOff : false); objectRefs.Clear(); var netMsg = NetMsgs.ReplicatedObjectRPC.New(context.netID, (ushort)rpcID); serializer.Write(netMsg.archive, this, args); if (_connection.world is Server.ServerWorld) { // send objects in the argument list first ReplicateDependencies(); } else { objectRefs.Clear(); } _connection.SendReliable(netMsg); Perf.End(); }
public void Write(NetArchive archive, ISerializableObjectReferenceCollector collector, object fieldVal, bool deltaField) { Perf.Begin("FieldState.Write"); fieldSpec.serializer.Serialize(archive, collector, ref fieldVal, deltaField ? lastState : null); if (deltaField) { lastState = fieldSpec.serializer.Copy(fieldVal); } Perf.End(); }
static void Main() { var appDetails = new MetaAppDetails("MonoDragons.Core", "1.0", Environment.OSVersion.VersionString); var fatalErrorReporter = new ReportErrorHandler(appDetails); Metric.AppDetails = appDetails; Error.HandleAsync(() => { using (var game = Perf.Time("Startup", () => new NeedlesslyComplexMainGame(appDetails.Name, "Logo", new Display(1600, 900, false), SetupScene(), CreateKeyboardController(), fatalErrorReporter))) game.Run(); }, x => fatalErrorReporter.ResolveError(x)).GetAwaiter().GetResult(); }
public void AppendFormat() { using (var perf = new Perf()) { var format = "{0}{1}"; var first = StringHelper.ValidString(); var second = StringHelper.ValidString(); var output = format.FormatWithCulture(first, second); perf.Append(format, first, second); Assert.AreEqual <string>(output, perf.Content); } }
/// <summary> /// Associates the service handler with a message router by registering /// the necessary application message handlers. /// </summary> /// <param name="router">The message router.</param> /// <param name="settings">The configuration settings.</param> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> /// <remarks> /// <para> /// Applications that expose performance counters will pass a non-<c>null</c> <b>perfCounters</b> /// instance. The service handler should add any counters it implements to this set. /// If <paramref name="perfPrefix" /> is not <c>null</c> then any counters added should prefix their /// names with this parameter. /// </para> /// </remarks> public void Start(MsgRouter router, GeoTrackerServerSettings settings, PerfCounterSet perfCounters, string perfPrefix) { if (this.isRunning) { throw new InvalidOperationException("This node has already been started."); } if (router == null) { throw new ArgumentNullException("router"); } // Initialize the performance counters this.startTime = DateTime.UtcNow; this.perf = new Perf(perfCounters, perfPrefix); // General initialization this.settings = settings; this.bkTimer = new GatedTimer(new TimerCallback(OnBkTimer), null, settings.BkInterval); this.ipGeocoder = new IPGeocoder(this); this.clusterClient = Helper.CreateInstance <ITopologyProvider>(settings.ClusterTopology); this.clusterServer = Helper.CreateInstance <ITopologyProvider>(settings.ClusterTopology); this.fixCache = new GeoFixCache(settings); this.archiver = Helper.CreateInstance <IGeoFixArchiver>(settings.GeoFixArchiver); EntityState.MaxEntityFixes = settings.MaxEntityGeoFixes; try { // Initialize the router this.router = router; this.router.Dispatcher.AddTarget(this, "GeoTrackerServerEP", new SimpleEPMunger(settings.ServerEP), null); // Initialize the cluster this.clusterClient.OpenClient(router, settings.ClusterEP, settings.ClusterArgs); this.clusterServer.OpenServer(router, "GeoTrackerClusterEP", settings.ClusterEP, this, settings.ClusterArgs); // Start the archiver. archiver.Start(this, settings.GeoFixArchiverArgs); this.isRunning = true; } catch { Stop(); throw; } }
internal void SendReliable(LocalGameNetDriverConnection conn, byte[] buffer, int numBytes) { Perf.Begin("LocalGameNetDriver.SendReliable"); if (conn == serverSend) { WriteMessage(buffer, numBytes, serverSendBuffer, ref serverSendOfs); } else { Assert.IsNotNull(clientSend); WriteMessage(buffer, numBytes, clientSendBuffer, ref clientSendOfs); } Perf.End(); }
async void Fn_GurdaPerfil() { HttpResponseMessage _responphp = new HttpResponseMessage(); Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; _perf.v_letra = v_infoPago.v_letra; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); //crear el cliente HttpClient _clien = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; StringContent _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _responphp = await _clien.PostAsync(_DirEnviar, _content); string _resp = await _responphp.Content.ReadAsStringAsync(); //await DisplayAlert("llega ",_perf.Fn_GetDatos() +" "+ _resp, "aceptar"); Personas.C_PerfilGen _nuePer = JsonConvert.DeserializeObject <Personas.C_PerfilGen>(_resp); //await DisplayAlert("perfil general", _resp, "aceptar"); App.Fn_GuardarDatos(_nuePer, v_infoPago.v_membresia, App.v_folio, App.v_letra); _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _responphp = await _clien.PostAsync(_DirEnviar, _content); _resp = await _responphp.Content.ReadAsStringAsync(); //await DisplayAlert("perfil medico", _resp, "aceptar"); Personas.C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <Personas.C_PerfilMed>(_resp); //await DisplayAlert("perfil medico", _resp, "sad"); App.Fn_GuardarDatos(_nuePerMEd, v_infoPago.v_membresia, App.v_folio, App.v_letra); } catch (HttpRequestException exception) { await DisplayAlert("Error", exception.Message, "Aceptar"); } } catch (HttpRequestException exception) { await DisplayAlert("Error", exception.Message, "Aceptar"); } }
/// <summary> /// Establishes a session with the authentication extension. /// </summary> /// <param name="args">The extension specific arguments (see the remarks).</param> /// <param name="query">Ignored for this extension.</param> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> /// <remarks> /// <para> /// This extension recognises the following arguments: /// </para> /// <list type="table"> /// <item> /// <term>Servers</term> /// <description> /// Specifies the list of RADIUS server network bindings specifying the /// IP address or host name of the server as well as the port number /// or well-known port name. Each server binding is formatted as /// described by <see cref="NetworkBinding.Parse" /> and the server /// bindings are separated by commas. This argument must be present. /// </description> /// </item> /// <item> /// <term>Secret</term> /// <description> /// The shared secret to be used to secure RADIUS packets delivered /// between this client and the any of the RADIUS servers. This /// string may include any valid characters besides semi-colons. /// This argument must be present. /// </description> /// </item> /// <item> /// <term>SocketBuffer</term> /// <description> /// Byte size of the client socket's send and receive buffers. Default /// value is 32K. /// </description> /// </item> /// <item> /// <term>NetworkBinding</term> /// <description> /// <para> /// Specifies the IP address of the network card the client is /// and port bindings. Use an IP address of ANY to bind to /// all network interfaces. ANY is suitable for single homed machines. /// Machines that are actually connected to multiple networks should /// specify a specific network binding here to ensure that the NAS-IP-Address /// of RADIUS authentication packets are initialized properly. /// </para> /// <para> /// A specific port number may be selected or 0 can be specified, /// indicating that the operating system should select a free port. /// </para> /// <para> /// Default value is ANY:0. /// </para> /// </description> /// </item> /// <item> /// <term>PortCount</term> /// <description> /// The number of RADIUS client UDP ports to open. Multiple ports may /// be required under high authentication loads. Default value is 4. /// </description> /// </item> /// <item> /// <term>RetryInterval</term> /// <description> /// Maximum time to wait for a response packet from a RADIUS before retransmitting /// an authentication request. Default is 5 seconds. /// </description> /// </item> /// <item> /// <term></term> /// <description> /// </description> /// </item> /// <item> /// <term>BkTaskInterval</term> /// <description> /// The interval at which background tasks such as retransmitting /// a request should be processed. Default is 1 second. /// </description> /// </item> /// <item> /// <term>MaxTransmissions</term> /// <description> /// The maximum number of authentication transmission attempts before aborting /// with an authentication with a timeout. Default is 4. /// </description> /// </item> /// <item> /// <term>RealmFormat</term> /// <description> /// Specifies how user names are to be generated from the /// <b>realm</b> and <b>account</b> components. See /// <see cref="RealmFormat" /> for more information. /// The possible values are: <b>Slash</b> and <b>Email</b>. /// Default is <b>Email</b>. /// </description> /// </item> /// <item> /// <term>MaxCacheTime</term> /// <description> /// Specifies the maximum time clients should retain authentication information. /// This is expressed in the same format as timespans parsed by <see cref="Config.Parse(string,TimeSpan)" />. /// This argument defaults to "5m". /// </description> /// </item> /// <item> /// <term>LockoutCount</term> /// <description> /// Specifies the limiting failed authentication count. Accounts /// will be locked when the fail count reaches this number. /// </description> /// </item> /// <item> /// <term>LockoutThreshold</term> /// <description> /// The period of time that can elapse between failed authentication /// attempts where the failed attempts will <b>not</b> be counted against the /// <b>LockoutCount</b>. Set this to <see cref="TimeSpan.Zero" /> /// to disable account lockout for the realm. /// </description> /// </item> /// <item> /// <term>LockoutTime</term> /// <description> /// The period of time an account will remain locked after being locked /// out due to too many failed authentication attempts. /// </description> /// </item> /// </list> /// <note> /// All calls to <see cref="Open" /> must be matched with a call /// to <see cref="Close" /> or <see cref="Dispose" />. /// </note> /// </remarks> public void Open(ArgCollection args, string query, PerfCounterSet perfCounters, string perfPrefix) { RadiusClientSettings settings; string[] rawBindings; List <NetworkBinding> bindings; string secret; using (TimedLock.Lock(this)) { if (IsOpen) { throw new AuthenticationException("Authentication extension is already open."); } perf = new Perf(perfCounters, perfPrefix); rawBindings = args.Get("servers", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (rawBindings.Length == 0) { throw new AuthenticationException("RADUIS authentication extension requires at least one server network binding."); } bindings = new List <NetworkBinding>(rawBindings.Length); for (int i = 0; i < rawBindings.Length; i++) { bindings.Add(NetworkBinding.Parse(rawBindings[i])); } secret = args.Get("secret", (string)null); if (secret == null || secret.Length == 0) { throw new AuthenticationException("RADIUS authentication extension requires a shared NAS secret."); } settings = new RadiusClientSettings(bindings.ToArray(), secret); settings.SocketBuffer = args.Get("SocketBuffer", settings.SocketBuffer); settings.NetworkBinding = args.Get("NetworkBinding", settings.NetworkBinding); settings.PortCount = args.Get("PortCount", settings.PortCount); settings.RetryInterval = args.Get("RetryInterval", settings.RetryInterval); settings.BkTaskInterval = args.Get("BkTaskInterval", settings.BkTaskInterval); settings.MaxTransmissions = args.Get("settings.MaxTransmissions", settings.MaxTransmissions); settings.RealmFormat = args.Get <RealmFormat>("RealmFormat", settings.RealmFormat); maxCacheTime = args.Get("MaxCacheTime", TimeSpan.FromMinutes(5)); radiusClient.Open(settings); } }
/// <summary> /// Establishes a session with the authentication extension. /// </summary> /// <param name="args">The extension specific arguments (see the remarks).</param> /// <param name="query">Not used.</param> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> /// <remarks> /// <para> /// This extension recognises the following arguments: /// </para> /// <list type="table"> /// <item> /// <term>IsAD</term> /// <description> /// Set this to "true" or "yes" if the directory server is Microsoft Active Directory. /// This argument defaults to "true". /// </description> /// </item> /// <item> /// <term>AuthType</term> /// <description> /// Specifies the authentication method. The possible values are <b>Basic</b>, <b>Digest</b>, /// <b>DPA</b>, <b>External</b>, <b>Kerberos</b>, <b>MSN</b>, <b>Negotiate</b>, <b>NTLM</b>, /// or <b>Sicily</b>. This argument defaults to "Digest". /// </description> /// </item> /// <item> /// <term>Servers</term> /// <description> /// Specifies zero or more LDAP server host names or IP addresses separated by commas. /// This argument defaults an empty list. <b>Note that due to an unresolved bug with /// default Active Directory support, at least one LDAP server must be explicitly /// specified in the current build.</b> /// </description> /// </item> /// <item> /// <term>DNSHost</term> /// <description> /// Set this to "true" or "yes" if the host names specified by <b>Servers</b> should be /// interpreted as fully qualified DNS host names. If set to "no" or "false", the /// host names can be interpreted as an IP address or a DNS host name and if no host /// is specified, then an Active Directory server associated with the computer account /// will be used. This argument defaults to "false". /// </description> /// </item> /// <item> /// <term>UDP</term> /// <description> /// Set this to "true" or "yes" to enable UDP the connection over UDP, rather than over TCP/IP. /// This argument defaults to "false". /// </description> /// </item> /// <item> /// <term>MaxCacheTime</term> /// <description> /// Specifies the maximum time clients should retain authentication information. /// This is expressed in the same format as timespans parsed by <see cref="Config.Parse(string,TimeSpan)" />. /// This argument defaults to "5m". /// </description> /// </item> /// <item> /// <term>LockoutCount</term> /// <description> /// Specifies the limiting failed authentication count. Accounts /// will be locked when the fail count reaches this number. /// </description> /// </item> /// <item> /// <term>LockoutThreshold</term> /// <description> /// The period of time that can elapse between failed authentication /// attempts where the failed attempts will <b>not</b> be counted against the /// <b>LockoutCount</b>. Set this to <see cref="TimeSpan.Zero" /> /// to disable account lockout for the realm. /// </description> /// </item> /// <item> /// <term>LockoutTime</term> /// <description> /// The period of time an account will remain locked after being locked /// out due to too many failed authentication attempts. /// </description> /// </item> /// </list> /// <para> /// The defaults values for the arguments were selected so that ommiting all arguments /// will configure the extension so that it authenticates against the Active Directory /// domain the computer belongs to. There are some problems with some combinations of /// parameters. /// </para> /// <note> /// All calls to <see cref="Open" /> must be matched with a call /// to <see cref="Close" /> or <see cref="Dispose" />. /// </note> /// </remarks> public void Open(ArgCollection args, string query, PerfCounterSet perfCounters, string perfPrefix) { using (TimedLock.Lock(this)) { if (IsOpen) { throw new AuthenticationException("Authentication extension is already open."); } perf = new Perf(perfCounters, perfPrefix); // Load the arguments isAD = args.Get("IsAD", true); switch (args.Get("AuthType", "Digest").ToUpper()) { case "BASIC": authType = AuthType.Basic; break; case "DIGEST": authType = AuthType.Digest; break; case "DPA": authType = AuthType.Dpa; break; case "EXTERNAL": authType = AuthType.External; break; case "KERBEROS": authType = AuthType.Kerberos; break; case "MSN": authType = AuthType.Msn; break; case "NEGOTIATE": authType = AuthType.Negotiate; break; case "NTLM": authType = AuthType.Ntlm; break; case "SICILY": authType = AuthType.Sicily; break; default: throw new AuthenticationException("Unexpected authentication type argument [{0}].", args.Get("AuthType", "Negotiate")); } servers = args.Get("Servers", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < servers.Length; i++) { servers[i] = servers[i].Trim(); } dnsHosts = args.Get("DNSHost", false); udp = args.Get("UDP", false); maxCacheTime = args.Get("MaxCacheTime", TimeSpan.FromMinutes(5)); } }
public async void Fn_CargaQuery() { Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); //HACIENDO EL QUERY para la info del GENERAL HttpClient _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; StringContent _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post try { HttpResponseMessage _respuestphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilGen _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); App.Fn_GuardarDatos(_nuePer, App.v_membresia, App.v_folio, App.v_letra); try { //carga la info del PERFIL MEDICO _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post HttpResponseMessage v_respuestphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await v_respuestphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); App.Fn_GuardarDatos(_nuePerMEd, App.v_membresia, App.v_folio, App.v_letra); } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } await Task.Delay(100); }
private void SampleForm_FormClosing(object sender, FormClosingEventArgs e) { // Query graph performance using VX_GRAPH_PERFORMANCE and print timing // in milliseconds. Note that time units of vx_perf_t fields are nanoseconds. Perf perfHarris = new Perf(), perfTrack = new Perf(); VX.Query(_GraphHarris, GraphAttribute.Performance, out perfHarris); VX.Query(_GraphTrack, GraphAttribute.Performance, out perfTrack); // Release all the OpenVX objects created in this exercise, and make the context as the last one to release. // To release an OpenVX object, you need to call vxRelease<Object> API which takes a pointer to the object. // If the release operation is successful, the OpenVX framework will reset the object to NULL. VX.Release(ref _Context); }
bool CheckRelevancy(Actor actor, out ObjectReplicator repl, out bool isRelevant) { Perf.Begin("CheckRelevancy"); isRelevant = actor.IsNetRelevantFor(this); repl = actor.internal_GetReplicator(connection); if (repl != null) { if (repl.wasRelevant != isRelevant) { Perf.End(); return true; } } Perf.End(); return isRelevant; }