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