public void SetSenderFactory <TSender>(Func <IReadOnlyConfiguration, ErrorCallback, TSender> createSender) where TSender : ISender { sender_create_fn create_fn = (IntPtr configuration, error_fn error_callback, IntPtr error_context) => { ErrorCallback errorCallback = new ErrorCallback(error_callback, error_context); Configuration readableConfig = new Configuration(configuration); TSender sender = createSender((IReadOnlyConfiguration)readableConfig, errorCallback); SenderAdapter adapter = new SenderAdapter(sender); // Unpinning this happens inside of SenderAdapter when Release is invoked GCHandle adapterHandle = GCHandle.Alloc(adapter); return(GCHandle.ToIntPtr(adapterHandle)); }; GCHandleLifetime localCreateHandle = new GCHandleLifetime(create_fn, GCHandleType.Normal); SetFactoryContextBindingSenderFactory(this.DangerousGetHandle(), create_fn, SenderAdapter.VTable); Interlocked.Exchange(ref this.registeredSenderCreateHandle, localCreateHandle); // GCHandleLifetime cleans itself up, and does not need to be explicitly .Dispose()d. }
/// <summary> /// Sends a request to master server, to register an existing spawner with given options /// </summary> public void Register(RegisterSpawnerCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("Not connected"); return; } _logger.Info("Registering Spawner..."); Client.SendMessage((ushort)OpCodes.RegisterSpawner, new SpawnerOptions { MaxProcesses = _config.MaxProcesses, Region = _config.Region }, (status, response) => { if (status != ResponseStatus.Success) { errorCallback.Invoke(response.AsString("Unknown Error")); return; } SpawnerId = response.AsInt(); callback.Invoke(SpawnerId); }); }
/// <summary> /// Forcefully unregister all listeners /// Used for testing or shutdown /// </summary> public static void ForceUnregisterAll() { ApiRequestHandlers.Clear(); ApiResponseHandlers.Clear(); CallbackInstances.Clear(); GlobalErrorHandler = null; }
public FlacReader(Stream input, WavWriter output) { if (output == null) { throw new ArgumentNullException("output"); } stream = input; writer = output; context = _flacStreamDecoderNew(); if (context == IntPtr.Zero) { throw new ApplicationException("FLAC: Could not initialize stream decoder!"); } write = Write; metadata = Metadata; error = Error; read = Read; seek = Seek; tell = Tell; length = Length; eof = Eof; if (_flacStreamDecoderInitStream(context, read, seek, tell, length, eof, write, metadata, error, IntPtr.Zero) != 0) { throw new ApplicationException("FLAC: Could not open stream for reading!"); } }
public void requestLoginFacebook(string token, SuccessCallback successCallback, ErrorCallback errorCallback) { Debug.Log(TAG + ": " + "requestLoginFacebook"); LoginFacebookRequest request = new LoginFacebookRequest(URL + URI_LOGIN_FACEBOOK, token, successCallback, errorCallback); request.SendRequest(); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, PlayerLeftCallback resultCallback, ErrorCallback errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action<string,PlayFabError> callback = delegate(string responseStr, PlayFabError pfError) { PlayerLeftResponse result = null; ResultContainer<PlayerLeftResponse>.HandleResults(responseStr, ref pfError, out result); if(pfError != null && errorCallback != null) { errorCallback(pfError); } if(result != null) { result.CustomData = customData; result.Request = request; if(resultCallback != null) { resultCallback(result); } } }; PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Matchmaker/PlayerLeft", serializedJSON, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback); }
private static object InsertEntity(object entity, DataStrategy dataStrategy, string tableName, ErrorCallback onError, bool resultRequired) { var dictionary = entity as IDictionary<string, object>; if (dictionary != null) return dataStrategy.Insert(tableName, dictionary, resultRequired); var list = entity as IEnumerable<IDictionary<string, object>>; if (list != null) return dataStrategy.InsertMany(tableName, list, onError, resultRequired); var entityList = entity as IEnumerable; if (entityList != null) { var array = entityList.Cast<object>().ToArray(); var rows = new List<IDictionary<string, object>>(); foreach (var o in array) { dictionary = (o as IDictionary<string, object>) ?? o.ObjectToDictionary(); if (dictionary.Count == 0) { throw new SimpleDataException("Could not discover data in object."); } rows.Add(dictionary); } return dataStrategy.InsertMany(tableName, rows, onError, resultRequired); } dictionary = entity.ObjectToDictionary(); if (dictionary.Count == 0) throw new SimpleDataException("Could not discover data in object."); return dataStrategy.Insert(tableName, dictionary, resultRequired); }
/// <summary> /// Sends a request to destroy a room of a given room id /// </summary> public void DestroyRoom(int roomId, SuccessCallback successCallback, ErrorCallback errorCallback, IClient client) { if (!client.IsConnected) { errorCallback.Invoke("Not connected"); return; } client.SendMessage((ushort)OpCodes.DestroyRoom, roomId, (status, response) => { if (status != ResponseStatus.Success) { errorCallback.Invoke(response.AsString("Unknown Error")); return; } _localCreatedRooms.TryGetValue(roomId, out var destroyedRoom); _localCreatedRooms.Remove(roomId); successCallback.Invoke(); // Invoke event if (destroyedRoom != null) { RoomDestroyed?.Invoke(destroyedRoom); } }); }
public void ParseMessage(string cipher, MessageCallback mcb, ErrorCallback ecb, bool retry = true) { bool success = true; try { var line = aes.Decipher(cipher); var json = Json.JsonDecode(line, ref success); if (success && json is Dictionary <string, object> ) { var data = json as Dictionary <string, object>; var message = new Message(); message.From = data["from"] as string; message.Time = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds( long.Parse(data["time"].ToString().Split(new[] { '.' })[0]) ).ToLocalTime(); if (data.ContainsKey("type")) { message.Type = data["type"] as string; } if (data.ContainsKey("body")) { message.Body = data["body"] as string; } if (data.ContainsKey("otr")) { message.OTR = true.Equals(data["otr"]); } if (data.ContainsKey("typing")) { message.Typing = true.Equals(data["typing"]); } message.Outbound = false; mcb(message); } else { ecb("Invalid JSON"); } } catch (NullReferenceException) { ecb("Invalid JSON"); } catch (System.Security.Cryptography.CryptographicException) { // Get key again if (retry) { GetKey( key => ParseMessage(cipher, mcb, ecb, false), error => ecb(error) ); } else { ecb("Invalid decryption key"); } } }
public FlacReader(string input, WavWriter output) { if (output == null) { throw new ArgumentNullException("WavWriter"); } stream = File.OpenRead(input); reader = new BinaryReader(stream); writer = output; context = FLAC__stream_decoder_new(); if (context == IntPtr.Zero) { throw new ApplicationException("FLAC: Could not initialize stream decoder!"); } write = new WriteCallback(Write); metadata = new MetadataCallback(Metadata); error = new ErrorCallback(Error); if (FLAC__stream_decoder_init_file(context, input, write, metadata, error, IntPtr.Zero) != 0) { throw new ApplicationException("FLAC: Could not open stream for reading!"); } }
public void OneTimeSetUp() { Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); callback = delegate(string what) { throw new Exception(what); }; NativeMethods.dlib_set_error_redirect(callback); }
/** * Speichert den Score */ public void writeScore(ErrorCallback ecb, string playerName, int score, int level, long time, int mode) { time /= 10000; this.ecb = ecb; XDocument doc = new XDocument( new XElement("scoreentry", new XElement("playername", playerName), new XElement("score", score), new XElement("level", level), new XElement("time", time), new XElement("mode", mode) ) ); postData = doc.ToString(); try { WebRequest request = WebRequest.Create(proxy); request.Method = "POST"; request.ContentType = "text/xml"; request.BeginGetRequestStream(new AsyncCallback(RequestReady), request); } catch (Exception e) { ecb(e.Message); } }
//[HandleProcessCorruptedStateExceptions] public void Close() { try { m_bRunning = false; int nTry = 200; while (true && m_ThreadCamera != null && m_bException == false) { nTry--; System.Windows.Forms.Application.DoEvents(); bool bret = m_ThreadCamera == null || m_ThreadCamera.Join(10); if (bret || nTry <= 0) { break; } } m_cbFrame = null; m_ThreadCamera = null; //make sure the camera is closed if (m_nOpenCount > 0) { m_nOpenCount = 0; CloseCamera(m_nID); } } catch (System.Exception ex) { m_bException = true; ProcessException(m_nID, FUNC_CLOSE, ex.ToString()); } m_cbError = null; }
/// <summary> /// Sends a request to register a room to master server /// </summary> public void RegisterRoom(RoomOptions options, RoomCreationCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("Not connected"); return; } Client.SendMessage((ushort)OpCodes.RegisterRoom, options, (status, response) => { if (status != ResponseStatus.Success) { // Failed to register room errorCallback.Invoke(response.AsString("Unknown Error")); return; } var roomId = response.AsInt(); var controller = new RoomController(this, roomId, Client, options); // Save the reference _localCreatedRooms[roomId] = controller; callback.Invoke(controller); // Invoke event RoomRegistered?.Invoke(controller); }); }
/// <summary> /// Retrieves the relevant details for a specified user, based upon a match against a supplied unique identifier /// </summary> public static void GetUserAccountInfo(LookupUserAccountInfoRequest request, GetUserAccountInfoCallback resultCallback, ErrorCallback errorCallback) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action<string,string> callback = delegate(string responseStr, string errorStr) { LookupUserAccountInfoResult result = null; PlayFabError error = null; ResultContainer<LookupUserAccountInfoResult>.HandleResults(responseStr, errorStr, out result, out error); if(error != null && errorCallback != null) { errorCallback(error); } if(result != null) { if(resultCallback != null) { resultCallback(result); } } }; PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Admin/GetUserAccountInfo", serializedJSON, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback); }
private Physics CreatePhysics(ErrorCallback errorCallback = null) { if (Physics.Instantiated) { Assert.Fail("Physics is still created"); } if (errorCallback == null) { errorCallback = _errorLog = new ErrorLog(); } if (_physics != null) { _physics.Dispose(); _physics = null; } if (_foundation != null) { _foundation.Dispose(); _foundation = null; } _foundation = new Foundation(errorCallback); _physics = new Physics(_foundation, checkRuntimeFiles: true); return(_physics); }
private Physics CreatePhysics(ErrorCallback errorCallback = null) { if (Physics.Instantiated) Assert.Fail("Physics is still created"); if (errorCallback == null) errorCallback = _errorLog = new ErrorLog(); if (_physics != null) { _physics.Dispose(); _physics = null; } if (_foundation != null) { _foundation.Dispose(); _foundation = null; } _foundation = new Foundation(errorCallback); _physics = new Physics(_foundation, checkRuntimeFiles: true); return _physics; }
public void SendAsynchronously(ErrorCallback onError = null, bool suppressSMTPErrorNotification = false) { Thread thread = new Thread(() => SendThreadProc(onError, suppressSMTPErrorNotification)); thread.Priority = ThreadPriority.Normal; thread.Start(); }
public void ShouldHandleInternalErrorsAndNotifyCallbacks() { IClientOperation errorSubscribeOperation = Substitute.For <IClientOperation>(); errorSubscribeOperation.ToJson().Returns(x => throw new Exception("forced error")); ParseQuery <ParseObject> query = new ParseQuery <ParseObject>(); _subscriptionFactory.CreateSubscriptionFunction = () => new TestSubscription(1, query) { CreateSubscribeClientOperationFunction = _ => errorSubscribeOperation }; LiveQueryException exception = null; ErrorCallback <ParseObject> errorCallback = Substitute.For <ErrorCallback <ParseObject> >(); errorCallback.Invoke(query, Arg.Do <LiveQueryException>(e => exception = e)); _parseLiveQueryClient.Subscribe(query).HandleError(errorCallback); _webSocketClientCallback.OnMessage(MockConnectedMessage()); // Trigger a re-subscribe // This will never get a chance to call op=subscribe, because an exception was thrown _webSocketClient.DidNotReceive().Send(Arg.Any <string>()); errorCallback.Received().Invoke(query, exception); Assert.AreEqual("Error when subscribing", exception.Message); Assert.NotNull(exception.GetBaseException()); }
/// <summary> /// Sends a request to server, to ask for an e-mail confirmation code /// </summary> public void RequestEmailConfirmationCode(SuccessCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("Not connected to server"); return; } if (!IsLoggedIn) { errorCallback.Invoke("You're not logged in"); return; } Client.SendMessage((ushort)OpCodes.RequestEmailConfirmCode, (status, response) => { if (status != ResponseStatus.Success) { errorCallback.Invoke(response.AsString("Unknown error")); return; } callback.Invoke(); }); }
public void Login(string username, string password, LoginCallback scb, ErrorCallback ecb) { RequestData("user/login/?password="******"&username="******"status"]; Status status = Status.FAILURE; if (statusText.ToLower() == "ok") { status = Status.OK; } if (status == Status.OK) { //{"status":"ok","data":{"sessiontoken":"4aa6cbccca2ef5c7eac030af4ddb7bec","userid":111552,"username":"******"}} _sessionToken = (string)root["data"]["sessiontoken"]; int userId = (int)root["data"]["userid"]; string properUsername = (string)root["data"]["username"]; LoggedIn = true; User = new User() { Name = properUsername, UserID = userId }; scb(User); } else { ecb((string)root["message"], null); } }, ecb); }
private async Task <bool> PerformPowershellAsync(string command, bool importNavContainerHelper) { if (asyncScript.InvocationStateInfo.State == PSInvocationState.Running) { ErrorCallback?.Invoke(this, Resources.GlobalRessources.ErrorWaitForPreviousTask); return(false); } StringBuilder sb = new StringBuilder(); if (importNavContainerHelper) { sb.AppendLine("import-module navcontainerhelper"); } sb.AppendLine(command); asyncScript.AddScript(sb.ToString()); StartScriptCallback?.Invoke(this, command); var result = asyncScript.BeginInvoke <PSObject, PSObject>(null, pso); await Task.Factory.FromAsync(result, x => { }); if (asyncScript.HadErrors) { ErrorCallback?.Invoke(this, GlobalRessources.ErrorScriptCompletedWithError); } EndScriptCallback?.Invoke(this, null); return(true); }
// Use this for initialization. private void Start() { if (keyboardDelegate != null) { errorCallback = keyboardDelegate.OnKeyboardError; showCallback = keyboardDelegate.OnKeyboardShow; hideCallback = keyboardDelegate.OnKeyboardHide; updateCallback = keyboardDelegate.OnKeyboardUpdate; enterCallback = keyboardDelegate.OnKeyboardEnterPressed; keyboardDelegate.KeyboardHidden += KeyboardDelegate_KeyboardHidden; keyboardDelegate.KeyboardShown += KeyboardDelegate_KeyboardShown; } keyboardProvider.ReadState(keyboardState); if (IsValid) { if (keyboardProvider.Create(OnKeyboardCallback)) { keyboardProvider.SetInputMode(inputMode); } } else { Debug.LogError("Could not validate keyboard"); } }
/// <summary> /// This attempts to connect to the server at the ip provided. /// </summary> /// <param name="server">String ip of the server.</param> /// <param name="name">Name to send.</param> public void ConnectToServer(String server, String name = "Tarun") { // This is where we connect to the server for the first time. After the setup is done we // want our callback to be FirstContact. ClientNetworking.ConnectToServer(server, state => { SuccessfulConnection?.Invoke("Connected to host: " + server); _socketState = state; // Listen for when data is received on the socket. _socketState.DataReceived += DataReceived; // Listen for when the socket disconnects. _socketState.Disconnected += () => { Disconnected?.Invoke(); }; // Send the register message with the server. Debug.WriteLine(REGISTER, "sending register message"); AbstractNetworking.Send(state, REGISTER); // Wait for data. AbstractNetworking.GetData(state); }, reason => ErrorCallback?.Invoke(reason)); }
/** * Speichert den Score */ public void writeScore(ErrorCallback ecb, string playerName, int score, int level, long time, int mode) { time /= 10000; this.ecb = ecb; XDocument doc = new XDocument( new XElement("scoreentry", new XElement("playername", playerName), new XElement("score", score), new XElement("level", level), new XElement("time", time), new XElement("mode", mode) ) ); postData = doc.ToString(); try { WebRequest request = WebRequest.Create(proxy); request.Method = "POST"; request.ContentType = "text/xml"; request.BeginGetRequestStream(new AsyncCallback(RequestReady), request); } catch (Exception e) { ecb(e.Message); } }
public VideoView() { InitializeComponent(); FFmpeg = getInstance(); dataCallback = (data, width, height) => { Application.Current.Dispatcher.Invoke(() => { using MemoryStream memory = new MemoryStream(); if (writableBitmap == null) { writableBitmap = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgr24, BitmapPalettes.Gray256); } writableBitmap.Lock(); unsafe { if (data == IntPtr.Zero) { return; } NativeMethods.CopyMemory(writableBitmap.BackBuffer, data, (uint)(width * height * 3)); } //指定更改位图的区域 writableBitmap.AddDirtyRect(new Int32Rect(0, 0, width, height)); writableBitmap.Unlock(); image.Source = writableBitmap; image.RenderTransform = new RotateTransform(Rotate, image.ActualWidth / 2, image.ActualHeight / 2); }); }; errorCallback = (message) => { Console.WriteLine(message); }; }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> public void LogInAsGuest(LoginCallback callback, ErrorCallback errorCallback) { LogIn(new Dictionary <string, string>() { { "guest", "" } }, callback, errorCallback); }
/// <summary> /// Sends a request to join a lobby /// </summary> public void JoinLobby(int lobbyId, JoinLobbyCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("Not connected"); return; } // Send the message Client.SendMessage((ushort)OpCodes.JoinLobby, lobbyId, (status, response) => { if (status != ResponseStatus.Success) { errorCallback.Invoke(response.AsString("Unknown Error")); return; } var data = response.Deserialize <LobbyDataPacket>(); var joinedLobby = new JoinedLobby(this, data, Client); LastJoinedLobby = joinedLobby; callback.Invoke(joinedLobby); LobbyJoined?.Invoke(joinedLobby); }); }
private static object UpsertUsingKeys(DataStrategy dataStrategy, DynamicTable table, object[] args, bool isResultRequired) { var record = ObjectToDictionary(args[0]); var list = record as IList <IDictionary <string, object> >; if (list != null) { ErrorCallback errorCallback = (args.Length == 2 ? args[1] as ErrorCallback : null) ?? ((item, exception) => false); return(dataStrategy.Run.UpsertMany(table.GetQualifiedName(), list, isResultRequired, errorCallback)); } var dict = record as IDictionary <string, object>; if (dict == null) { throw new InvalidOperationException("Could not resolve data from passed object."); } var key = dataStrategy.GetAdapter().GetKey(table.GetQualifiedName(), dict); if (key == null) { throw new InvalidOperationException(string.Format("No key columns defined for table \"{0}\"", table.GetQualifiedName())); } if (key.Count == 0) { return(dataStrategy.Run.Insert(table.GetQualifiedName(), dict, isResultRequired)); } var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), key); return(dataStrategy.Run.Upsert(table.GetQualifiedName(), dict, criteria, isResultRequired)); }
public void GetGameCategories(ResultCallback <GetGameCategoriesRequest.Response, GetGameCategoriesRequest.RequestParams> callback = null, ErrorCallback errorCallback = null) { new GetGameCategoriesRequest(MarketToken) .WithCallback(callback) .WithErrorCallback(errorCallback) .Execute(ApiTransport); }
public bool RemoveErrorListener(ErrorCallback callback, object userData) { ErrorListener item = new ErrorListener(); item.SetCallback(callback); item.SetUserData(userData); return(this.m_errorListeners.Remove(item)); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void LogIn(string username, string password, LoginCallback callback, ErrorCallback errorCallback) { LogIn(new Dictionary <string, string> { { "username", username }, { "password", password } }, callback, errorCallback); }
public void GetAggregatedSellOffersByClassId(string classId, int limit = 0, int offset = 0, ResultCallback <GetGameClassSellOffersRequest.Response, GetGameClassSellOffersRequest.RequestParams> callback = null, ErrorCallback errorCallback = null) { new GetGameClassSellOffersRequest(classId, MarketToken, limit, offset) .WithCallback(callback) .WithErrorCallback(errorCallback) .Execute(ApiTransport); }
public BaseRequest (String method, String url, SuccessCallback successCallback, ErrorCallback errorCallback):base(method, url) { this.completedCallback = delegate(Request request) { onCompleteCallback(request); };; this.successCallback = successCallback; this.errorCallback = errorCallback; form = AddParams(); }
public void Listen(StatusCallback status_callback, ResultCallback result_callback, ErrorCallback error_callback) { listener_factory = new ListenerFactory(status_callback, result_callback, error_callback, connection.Reconnect); // force rebind for existing connection rebind(connection.Channel); }
public SubmitScoreRequest (String url, String score, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public BaseRequest(String method, String url, SuccessCallback successCallback, ErrorCallback errorCallback) : base(method, url) { this.completedCallback = delegate(Request request) { onCompleteCallback(request); };; this.successCallback = successCallback; this.errorCallback = errorCallback; form = AddParams(); }
public GenerateAnonymousAcountRequest (String url, string deviceId, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_DEVICE_ID, deviceId ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public GetHighScoresRequest (String url, String sessionKey, String level, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey ); hashtable.Add( GameConstants.REQUEST_KEY_LEVEL, level ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public LoginFacebookRequest (String url, string token, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_TOKEN, token ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
private Physics CreatePhysics(ErrorCallback errorCallback = null) { if (Physics.Instantiated) Assert.Fail("Physics is still created"); var foundation = new Foundation(errorCallback); var physics = new Physics(foundation, checkRuntimeFiles: true); return physics; }
public SubmitRequestAcceptRequest (String url, string sessionKey, string requestIds, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey ); hashtable.Add( GameConstants.REQUEST_KEY_REQUEST_IDS, requestIds ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public LoginRequest (String url, string userName, string password, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_USER_NAME, userName ); hashtable.Add( GameConstants.REQUEST_KEY_PASSWORD, password ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
internal static object UpsertByKeyFields(string tableName, DataStrategy dataStrategy, object entity, IEnumerable<string> keyFieldNames, bool isResultRequired, ErrorCallback errorCallback) { var record = UpdateCommand.ObjectToDictionary(entity); var list = record as IList<IDictionary<string, object>>; if (list != null) return dataStrategy.UpsertMany(tableName, list, keyFieldNames, isResultRequired, errorCallback); var dict = record as IDictionary<string, object>; var criteria = GetCriteria(keyFieldNames, dict); var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(tableName, criteria); return dataStrategy.Upsert(tableName, dict, criteriaExpression, isResultRequired); }
public GetFriendPlayedGameRequest (String url, String sessionKey, String page, String count, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey ); hashtable.Add( GameConstants.REQUEST_KEY_PAGE, page ); hashtable.Add( GameConstants.REQUEST_KEY_COUNT, count ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public UpdateAcountInfoRequest (String url, string sessionKey, string displayName, string avatar, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey ); hashtable.Add( GameConstants.REQUEST_KEY_DISPLAY_NAME, displayName ); hashtable.Add( GameConstants.REQUEST_KEY_AVATAR, avatar ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public ShareStoryRequest (String url, string uid, string type, string data, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_UID, uid ); hashtable.Add( GameConstants.REQUEST_KEY_TYPE, type ); hashtable.Add( GameConstants.RESPONE_KEY_DATA, data ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
/// <summary> /// Gets all the configurable properties of the specified element type. /// </summary> /// <param name="element">The element type. Must be a class with the <see cref="ConfigurableElementAttribute">ConfigurableElementAttribute</see> attribute.</param> /// <param name="errorCallback">An <see cref="ErrorCallback">ErrorCallback</see>.</param> /// <returns>All the configurable properties found on the element, or null if the element is not configurable.</returns> public static IEnumerable<IConfigurablePropertyInfo> GetProperties(Type element, ErrorCallback errorCallback) { if (!Attribute.IsDefined(element, typeof(ConfigurableElementAttribute))) return null; var t = typeof(ConfigurablePropertyInfo<object>).GetGenericTypeDefinition(); return from p in element.GetProperties() where Attribute.IsDefined(p, typeof(ConfigurablePropertyAttribute)) let a = p.GetAttribute<ConfigurablePropertyAttribute>() let r = TryUtils.TryGetResult(() => TryUtils.TryCreateInstance<IConfigurablePropertyInfo>(t.MakeGenericType(element), p, a), errorCallback) where r != null select r; }
public GetInviteFriendRequest (String url, String sessionKey, String limit, String next, SuccessCallback successCallback, ErrorCallback errorCallback): base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_SESSION_KEY, sessionKey ); hashtable.Add( GameConstants.REQUEST_KEY_LIMIT, limit ); hashtable.Add( GameConstants.REQUEST_KEY_NEXT, next ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public SocketWrap( ConnectCallback ccb, ListenCallback lcb, ReceiveCallback rcb, DisconnectCallback dcb, ErrorCallback ecb) { _ccb = ccb; _rcb = rcb; _ecb = ecb; _lcb = lcb; _dcb = dcb; _recvBuf = new byte[1024]; }
public SubmitDeviceRequest (String url, string platform, string model, string imei, string version, string appVersion, SuccessCallback successCallback, ErrorCallback errorCallback) : base(Method.POST, url, successCallback, errorCallback) { Hashtable hashtable = new Hashtable (); hashtable.Add( GameConstants.REQUEST_KEY_PLATFORM, platform ); hashtable.Add( GameConstants.REQUEST_KEY_MODEL, model ); hashtable.Add( GameConstants.REQUEST_KEY_IMEI, imei ); hashtable.Add( GameConstants.REQUEST_KEY_VERSION, version ); hashtable.Add( GameConstants.REQUEST_KEY_APP_VERSION, appVersion ); string json = Json.Serialize(hashtable ); this.form.AddField( GameConstants.REQUEST_KEY_PARAMS, Encryption.Encrypt(json) ); this.AddWWWForm(this.form); }
public ConnectionDemuxer(IConnectionListener listener, int maxAccepts, int maxPendingConnections, TimeSpan channelInitializationTimeout, TimeSpan idleTimeout, int maxPooledConnections, TransportSettingsCallback transportSettingsCallback, SingletonPreambleDemuxCallback singletonPreambleCallback, ServerSessionPreambleDemuxCallback serverSessionPreambleCallback, ErrorCallback errorCallback) { this.connectionReaders = new List<InitialServerConnectionReader>(); this.acceptor = new ConnectionAcceptor(listener, maxAccepts, maxPendingConnections, OnConnectionAvailable, errorCallback); this.channelInitializationTimeout = channelInitializationTimeout; this.idleTimeout = idleTimeout; this.maxPooledConnections = maxPooledConnections; this.onConnectionClosed = new ConnectionClosedCallback(OnConnectionClosed); this.transportSettingsCallback = transportSettingsCallback; this.singletonPreambleCallback = singletonPreambleCallback; this.serverSessionPreambleCallback = serverSessionPreambleCallback; }
public ConnectionAcceptor(IConnectionListener listener, int maxAccepts, int maxPendingConnections, ConnectionAvailableCallback callback, ErrorCallback errorCallback) { if (maxAccepts <= 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxAccepts", maxAccepts, SR.GetString(SR.ValueMustBePositive))); } Fx.Assert(maxPendingConnections > 0, "maxPendingConnections must be positive"); this.listener = listener; this.maxAccepts = maxAccepts; this.maxPendingConnections = maxPendingConnections; this.callback = callback; this.errorCallback = errorCallback; this.onConnectionDequeued = new Action(OnConnectionDequeued); this.acceptCompletedCallback = Fx.ThunkCallback(new AsyncCallback(AcceptCompletedCallback)); this.scheduleAcceptCallback = new Action<object>(ScheduleAcceptCallback); }
public FlacReader(string input, WavWriter output) { if (output == null) throw new ArgumentNullException("WavWriter"); stream = File.OpenRead(input); reader = new BinaryReader(stream); writer = output; context = FLAC__stream_decoder_new(); if (context == IntPtr.Zero) throw new ApplicationException("FLAC: Could not initialize stream decoder!"); write = new WriteCallback(Write); metadata = new MetadataCallback(Metadata); error = new ErrorCallback(Error); if (FLAC__stream_decoder_init_file(context, input, write, metadata, error, IntPtr.Zero) != 0) throw new ApplicationException("FLAC: Could not open stream for reading!"); }
public void readEntries(EntriesCallback successCallback, ErrorCallback errorCallback) {}
public static extern int ECF_SetOnErrorVendeItem(IntPtr ecfHandle, ErrorCallback method);
public static extern int ECF_SetOnErrorSuprimento(IntPtr ecfHandle, ErrorCallback method);
public static extern int ECF_SetOnErrorSubtotalizaNaoFiscal(IntPtr ecfHandle, ErrorCallback method);
public static extern int ECF_SetOnErrorSangria(IntPtr ecfHandle, ErrorCallback method);
public static extern int ECF_SetOnErrorReducaoZ(IntPtr ecfHandle, ErrorCallback method);