Represents a handle for an instance of tox.
Inheritance: SafeHandleZeroOrMinusOneIsInvalid
Exemplo n.º 1
0
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="maxCalls"></param>
        public ToxAv(ToxHandle tox, int maxCalls)
        {
            _tox = tox;
            _toxAv = ToxAvFunctions.New(tox, maxCalls);

            if (_toxAv == null || _toxAv.IsInvalid)
                throw new Exception("Could not create a new instance of toxav.");

            MaxCalls = maxCalls;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of Tox. If no secret key is specified, toxcore will generate a new keypair.
        /// </summary>
        /// <param name="options">The options to initialize this instance of Tox with.</param>
        /// <param name="secretKey">Optionally, specify the secret key to initialize this instance of Tox with. Must be ToxConstants.SecretKeySize bytes in size.</param>
        public Tox(ToxOptions options, ToxKey secretKey = null)
        {
            var error = ToxErrorNew.Ok;
            var optionsStruct = options.Struct;

            if (secretKey != null)
                optionsStruct.SetData(secretKey.GetBytes(), ToxSaveDataType.SecretKey);

            _tox = ToxFunctions.New(ref optionsStruct, ref error);

            if (_tox == null || _tox.IsInvalid || error != ToxErrorNew.Ok)
                throw new Exception("Could not create a new instance of tox, error: " + error.ToString());

            optionsStruct.Free();
            Options = options;
        }
Exemplo n.º 3
0
 internal static extern bool SelfSetName(ToxHandle tox, byte[] name, uint length, ref ToxErrorSetInfo error);
Exemplo n.º 4
0
 internal static extern bool FriendGetStatusMessage(ToxHandle tox, uint friendNumber, byte[] message, ref ToxErrorFriendQuery error);
Exemplo n.º 5
0
 internal static extern int GroupSetTitle(ToxHandle tox, int groupnumber, byte[] title, byte length);
Exemplo n.º 6
0
 internal static extern uint FriendByPublicKey(ToxHandle tox, byte[] publicKey, ref ToxErrorFriendByPublicKey error);
Exemplo n.º 7
0
 internal static extern ulong FriendGetLastOnline(ToxHandle tox, uint friendNumber, ref ToxErrorFriendGetLastOnline error);
Exemplo n.º 8
0
 internal static extern int DelGroupchat(ToxHandle tox, int groupnumber);
Exemplo n.º 9
0
 internal static extern uint FileSend(ToxHandle tox, uint friendNumber, ToxFileKind kind, ulong fileSize, byte[] fileId, byte[] fileName, uint fileNameLength, ref ToxErrorFileSend error);
Exemplo n.º 10
0
 internal static extern void RegisterTypingChangeCallback(ToxHandle tox, ToxDelegates.CallbackTypingChangeDelegate callback, IntPtr userdata);
Exemplo n.º 11
0
 internal static extern void RegisterFriendConnectionStatusCallback(ToxHandle tox, ToxDelegates.CallbackFriendConnectionStatusDelegate callback, IntPtr userdata);
Exemplo n.º 12
0
 internal static extern void RegisterStatusMessageCallback(ToxHandle tox, ToxDelegates.CallbackStatusMessageDelegate callback, IntPtr userdata);
Exemplo n.º 13
0
 internal static extern void RegisterUserStatusCallback(ToxHandle tox, ToxDelegates.CallbackUserStatusDelegate callback, IntPtr userdata);
Exemplo n.º 14
0
 internal static extern int GroupPeerPubkey(ToxHandle tox, int groupnumber, int peernumber, byte[] pk);
Exemplo n.º 15
0
 internal static extern int GroupGetTitle(ToxHandle tox, int groupnumber, byte[] title, uint max_length);
Exemplo n.º 16
0
 internal static extern int GroupGetType(ToxHandle tox, int groupnumber);
Exemplo n.º 17
0
 internal static extern void SelfSetStatus(ToxHandle tox, ToxUserStatus status);
Exemplo n.º 18
0
 internal static extern void RegisterFriendReadReceiptCallback(ToxHandle tox, ToxDelegates.CallbackReadReceiptDelegate callback, IntPtr userdata);
Exemplo n.º 19
0
 internal static extern bool SelfSetTyping(ToxHandle tox, uint friendNumber, [MarshalAs(UnmanagedType.Bool)]bool is_typing, ref ToxErrorSetTyping error);
Exemplo n.º 20
0
 internal static extern void RegisterFileReceiveCallback(ToxHandle tox, ToxDelegates.CallbackFileReceiveDelegate callback, IntPtr userdata);
Exemplo n.º 21
0
 internal static extern bool FileGetFileId(ToxHandle tox, uint friendNumber, uint fileNumber, byte[] fileId, ref ToxErrorFileGet error);
Exemplo n.º 22
0
 internal static extern void RegisterFileControlRecvCallback(ToxHandle tox, ToxDelegates.CallbackFileControlDelegate callback, IntPtr userdata);
Exemplo n.º 23
0
 internal static extern uint FriendAdd(ToxHandle tox, byte[] address, byte[] message, uint length, ref ToxErrorFriendAdd error);
Exemplo n.º 24
0
 internal static extern void RegisterFileChunkRequestCallback(ToxHandle tox, ToxDelegates.CallbackFileRequestChunkDelegate callback, IntPtr userdata);
Exemplo n.º 25
0
 internal static extern bool FriendExists(ToxHandle tox, uint friendNumber);
Exemplo n.º 26
0
 internal static extern int GroupGetNames(ToxHandle tox, int groupnumber, byte[,] names, ushort[] lengths, ushort length);
Exemplo n.º 27
0
 internal static extern bool FriendGetPublicKey(ToxHandle tox, uint friendNumber, byte[] publicKey, ref ToxErrorFriendGetPublicKey error);
Exemplo n.º 28
0
 internal static extern uint SelfGetStatusMessageSize(ToxHandle tox);
Exemplo n.º 29
0
 internal static extern void RegisterFriendLosslessPacketCallback(ToxHandle tox, ToxDelegates.CallbackFriendPacketDelegate callback, IntPtr userdata);
Exemplo n.º 30
0
 internal static extern uint GroupPeerNumberIsOurs(ToxHandle tox, int groupnumber, int peernumber);
Exemplo n.º 31
0
 internal static extern void SelfGetStatusMessage(ToxHandle tox, byte[] status);
Exemplo n.º 32
0
 internal static extern void RegisterGroupTitleCallback(ToxHandle tox, ToxDelegates.CallbackGroupTitleDelegate callback, IntPtr userdata);
Exemplo n.º 33
0
 internal static extern ushort SelfGetUdpPort(ToxHandle tox, ref ToxErrorGetPort error);
Exemplo n.º 34
0
 internal static extern void ToxLogCallback(ToxHandle tox, ToxLogLevel level, string file, uint line, string func, string message, IntPtr userdata);
Exemplo n.º 35
0
 internal static extern void SelfSetNospam(ToxHandle tox, uint nospam);
Exemplo n.º 36
0
 internal static extern bool Bootstrap(ToxHandle tox, string host, ushort port, byte[] publicKey, ref ToxErrorBootstrap error);
Exemplo n.º 37
0
 internal static extern void SelfSetStatusMessage(ToxHandle tox, byte[] status, uint length, ref ToxErrorSetInfo error);
Exemplo n.º 38
0
 internal static extern ToxConnectionStatus SelfGetConnectionStatus(ToxHandle tox);
Exemplo n.º 39
0
 internal static extern bool Bootstrap(ToxHandle tox, string host, ushort port, byte[] publicKey, ref ToxErrorBootstrap error);
Exemplo n.º 40
0
 internal static extern void SelfGetAddress(ToxHandle tox, byte[] address);
Exemplo n.º 41
0
 internal static extern bool FileControl(ToxHandle tox, uint friendNumber, uint fileNumber, ToxFileControl control, ref ToxErrorFileControl error);
Exemplo n.º 42
0
 internal static extern uint FriendByPublicKey(ToxHandle tox, byte[] publicKey, ref ToxErrorFriendByPublicKey error);
Exemplo n.º 43
0
 internal static extern bool FileSeek(ToxHandle tox, uint friendNumber, uint fileNumber, ulong position, ref ToxErrorFileSeek error);
Exemplo n.º 44
0
 internal static extern bool FriendGetPublicKey(ToxHandle tox, uint friendNumber, byte[] publicKey, ref ToxErrorFriendGetPublicKey error);
Exemplo n.º 45
0
 internal static extern bool FileSendChunk(ToxHandle tox, uint friendNumber, uint fileNumber, ulong position, byte[] data, uint length, ref ToxErrorFileSendChunk error);
Exemplo n.º 46
0
 internal static extern void Iterate(ToxHandle tox);
Exemplo n.º 47
0
 internal static extern uint FriendAddNoRequest(ToxHandle tox, byte[] publicKey, ref ToxErrorFriendAdd error);
Exemplo n.º 48
0
 internal static extern uint IterationInterval(ToxHandle tox);
Exemplo n.º 49
0
 internal static extern bool FriendDelete(ToxHandle tox, uint friendNumber, ref ToxErrorFriendDelete error);
Exemplo n.º 50
0
 internal static extern bool FriendDelete(ToxHandle tox, uint friendNumber, ref ToxErrorFriendDelete error);
Exemplo n.º 51
0
 internal static extern ToxConnectionStatus FriendGetConnectionStatus(ToxHandle tox, uint friendNumber, ref ToxErrorFriendQuery error);
Exemplo n.º 52
0
 internal static extern ToxConnectionStatus FriendGetConnectionStatus(ToxHandle tox, uint friendNumber, ref ToxErrorFriendQuery error);
Exemplo n.º 53
0
 internal static extern bool FriendGetName(ToxHandle tox, uint friendNumber, byte[] name, ref ToxErrorFriendQuery error);
Exemplo n.º 54
0
 internal static extern ToxUserStatus FriendGetStatus(ToxHandle tox, uint friendNumber, ref ToxErrorFriendQuery error);
Exemplo n.º 55
0
 internal static extern ToxUserStatus FriendGetStatus(ToxHandle tox, uint friendNumber, ref ToxErrorFriendQuery error);
Exemplo n.º 56
0
 internal static extern ToxUserStatus SelfGetStatus(ToxHandle tox);
Exemplo n.º 57
0
 internal static extern uint FriendGetStatusMessageSize(ToxHandle tox, uint friendNumber, ref ToxErrorFriendQuery error);
Exemplo n.º 58
0
 internal static extern bool FriendExists(ToxHandle tox, uint friendNumber);
Exemplo n.º 59
0
        /// <summary>
        /// Initialises a new instance of toxav.
        /// </summary>
        /// <param name="tox"></param>
        /// <param name="settings"></param>
        /// <param name="max_calls"></param>
        public ToxAv(ToxHandle tox, ToxAvCodecSettings settings, int max_calls)
        {
            toxav = ToxAvFunctions.New(tox, max_calls);

            if (toxav == null || toxav.IsInvalid)
                throw new Exception("Could not create a new instance of toxav.");

            MaxCalls = max_calls;
            CodecSettings = settings;

            Invoker = new InvokeDelegate(dummyinvoker);

            callbacks();
        }
Exemplo n.º 60
0
 internal static extern int GroupNumberPeers(ToxHandle tox, int groupnumber);