Ejemplo n.º 1
0
        private void SetupFileTransfer()
        {
            FileInfo f           = new FileInfo(file_path);
            ulong    file_length = (ulong)f.Length;

            // use new Requests interface to create channel.
            // Connection.RequestChannel is deprecated
            IDictionary <string, object> channel_specs = new Dictionary <string, object>();

            channel_specs.Add(Constants.CHANNEL_IFACE + ".ChannelType", Constants.CHANNEL_TYPE_FILETRANSFER);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetHandleType", HandleType.Contact);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetID", transfer_partner);
            channel_specs.Add(Constants.CHANNEL_TYPE_FILETRANSFER + ".ContentType", "application/octet-stream");
            channel_specs.Add(Constants.CHANNEL_TYPE_FILETRANSFER + ".Filename", file_path);
            channel_specs.Add(Constants.CHANNEL_TYPE_FILETRANSFER + ".Size", file_length);

            ObjectPath chann_op;
            IDictionary <string, object> chann_props;

            try {
                irequests.CreateChannel(channel_specs, out chann_op, out chann_props);
            }
            catch (Exception e) {
                Console.WriteLine(MSG_PREFIX + e);
            }
        }
Ejemplo n.º 2
0
        private void SetupTube()
        {
            // use new Requests interface to create channel.
            // Connection.RequestChannel is deprecated
            IDictionary <string, object> channel_specs = new Dictionary <string, object>();

            channel_specs.Add(Constants.CHANNEL_IFACE + ".ChannelType", Constants.CHANNEL_TYPE_DBUSTUBE);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetHandleType", HandleType.Contact);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetID", tube_partner);
            channel_specs.Add(Constants.CHANNEL_TYPE_DBUSTUBE + ".ServiceName", DTUBETEST_IFACE);

            ObjectPath chann_op;
            IDictionary <string, object> chann_props;

            try {
                irequests.CreateChannel(channel_specs, out chann_op, out chann_props);
            }
            catch (Exception e) {
                Console.WriteLine(MSG_PREFIX + e);
            }
        }