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