コード例 #1
0
ファイル: ListSample.cs プロジェクト: HaKDMoDz/geff
        public void LoadSample(Channel channel)
        {
            //--- Charge la liste des samples
            ListUIChildren.Clear();

            Vector2 vec = new Vector2(Rec.X + Ribbon.MARGE, Rec.Y + Ribbon.MARGE);

            foreach (Sample sample in channel.ListSample)
            {
                ClickableText txtSample = AddItem(sample.Name, sample);

                txtSample.ClickText += new ClickableText.ClickTextHandler(txtSample_ClickText);
                txtSample.MiddleButtonClickText += new ClickableText.MiddleButtonClickTextHandler(txtSample_MiddleButtonClickText);
                txtSample.MouseEnter += new ClickableText.MouseEnterHandler(txtSample_MouseEnter);
                txtSample.MouseLeave += new ClickableText.MouseLeaveHandler(txtSample_MouseLeave);

                if (IsCheckable && ListUIChildren.Count == 1)
                {
                    txtSample.IsChecked = true;
                    OnSelectedItemChanged(sample);
                }
            }
            //---

            UpdateScrollbar();
            UpdateScrollValue();
        }
コード例 #2
0
ファイル: ChannelsView.xaml.cs プロジェクト: legator/SovokTV
 /// <summary>
 /// Grouped chennels
 /// </summary>
 private void Grouped()
 {
     _groups = new ObservableCollection<GroupChannel>();
     foreach (ChannelGroup item in App.ViewModel.UserAccount.channel_group)
     {
         ComboBoxItem cbi = new ComboBoxItem();
         cbi.Name = item.name;
         cbi.Content = item.name;
         ind++;
         var g = new GroupChannel { GroupName = item.name };
         foreach (Channel it in item.Channels)
         {
             Channel c = new Channel();
             c = it;
             c.icon = "http://sovok.tv" + c.icon;
             g.Channels.Add(c);
         }
         _groups.Add(g);
     }
     ComboBoxItem fcbi = new ComboBoxItem();
     fcbi.Content = fcbi.Name = "Favorite";
     ind++;
     CList.Source = _groups;
     App.ViewModel.ChanneLisrRange = ChannelListView.Items.Count;
 }
コード例 #3
0
 public void can_enumerate_closed_channel()
 {
     var ch = new Channel<int>(1);
     ch.Close();
     var e = ch.GetEnumerator();
     Assert.IsFalse(e.MoveNext());
 }
コード例 #4
0
ファイル: SelectTests.cs プロジェクト: busterwood/NetChan
 public void can_read_after_select_on_queued_Channels()
 {
     var ch1 = new Channel<int>(1);
     var ch2 = new Channel<bool>(1);
     ThreadPool.QueueUserWorkItem(state => {
         ch1.Send(123);
         ch2.Send(true);
         ch2.Close();
         ch1.Send(124);
         ch1.Close();
     });
     using (var select = new Channels(Op.Recv(ch1), Op.Recv(ch2))) {
         var got = select.Select();
         Debug.Print("got.Index = " + got.Index);
         if (got.Index == 0) {
             Assert.AreEqual(123, got.Value, "got.Value");
             Assert.AreEqual(Maybe<bool>.Some(true), ch2.Recv());
         }
         else {
             Assert.AreEqual(1, got.Index, "got.Index");
             Assert.AreEqual(true, got.Value, "got.Value");
             Assert.AreEqual(Maybe<int>.Some(123), ch1.Recv());
         }
         select.ClearAt(1);
         got = select.Select();
         Assert.AreEqual(0, got.Index, "got.Index, value =" + got.Value);
         Assert.AreEqual(124, got.Value, "got.Value");
     }
 }
コード例 #5
0
 public void can_recv_one_item_before_closing()
 {
     var ch = new Channel<int>(1);
     ThreadPool.QueueUserWorkItem(state => { ch.Send(123); ch.Close(); });
     Assert.AreEqual(Maybe<int>.Some(123), ch.Recv());
     Assert.AreEqual(Maybe<int>.None(), ch.TryRecv());
 }
コード例 #6
0
 public ChatServerCopyMessage(Channel chan, string message, Global.Character target)
     : base(PacketID.ChatServerCopyMessage)
 {
     Channel = chan;
     Message = message;
     Target = target;
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: rayx999/libmaid
        static void Main(string[] args)
        {
            Channel channel = new Channel();
            HelloService service = new HelloService();
            channel.AddMethod<HelloRequest, HelloSerializer>("maid.example.HelloService.HelloNotify", service.HelloNotify);
            channel.AddMethod<HelloRequest, HelloSerializer, HelloResponse, HelloSerializer>("maid.example.HelloService.HelloRpc", service.HelloRpc);
            channel.ConnectedCallback.Add(() =>
            {
                Console.WriteLine("连接上了");
            });

            channel.Connect("192.168.0.99", 8888);

            while (true)
            {
                channel.Update();

                HelloRequest request = new HelloRequest();
                request.message = "this message from protobuf-net";
                try
                {
                    channel.CallMethod("maid.example.HelloService.HelloNotify", request);
                    channel.CallMethod("maid.example.HelloService.HelloRpc", request);
                }
                catch (Exception ){ }
                if (channel.Connecting)
                {
                    Console.WriteLine("连接中");
                }
            }
        }
        public FeedDetailsViewModel()
        {
            RootChannel = new Channel();
            RootChannel.Title = "Titre du channel";
            RootChannel.Description =   "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet eleifend ante." +
                                        "In vel mauris metus, ac viverra lectus. Aenean dui sapien, pretium eu gravida ut, sollicitudin" +
                                        "et nisi. In hac habitasse platea dictumst. Quisque egestas ligula in lorem sodales sed" +
                                        " congue turpis varius. Maecenas vel quam at tortor viverra tristique vitae at lorem. Maecenas" +
                                        " augue augue, convallis tristique congue ut, porta sed felis. Nam nisi libero, vehicula" +
                                        " ac ultricies quis, imperdiet lobortis tellus.";
            RootChannel.Link = "http://www.google.com";

            Items = new List<Item>();
            for (int i = 0; i < 20; ++i)
            {
                Item item = new Item();
                item.Title = "Titre de l'item " + i.ToString();
                item.Description =  "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet eleifend ante." +
                                    "In vel mauris metus, ac viverra lectus. Aenean dui sapien, pretium eu gravida ut, sollicitudin" +
                                    "et nisi. In hac habitasse platea dictumst. Quisque egestas ligula in lorem sodales sed" +
                                    " congue turpis varius. Maecenas vel quam at tortor viverra tristique vitae at lorem. Maecenas" +
                                    " augue augue, convallis tristique congue ut, porta sed felis. Nam nisi libero, vehicula" +
                                    " ac ultricies quis, imperdiet lobortis tellus.";
                item.PubDate = DateTime.Now;
                Items.Add(item);

            }

            ReadItem = new RelayCommand((param) => ReadItemBody(param as Item));
            //feedDetailsDataModel = new FeedDetailsDataModel();
        }
コード例 #9
0
        public CommandContext(Client irc, UserCollection users, User from, Channel channel, string message)
        {
            this._irc = irc;
            this._users = users;

            this.From = from;
            this._channel = channel;

            if (message[0] == '!' || message[0] == '.')
            {
                this._replyNotice = true;
            }
            else
            {
                this._replyNotice = false;
            }

            if (message[0] == '!' || message[0] == '.' || message[0] == '@')
            {
                this.Message = message.Substring(1);
            }
            else
            {
                this.Message = message;
            }
        }
コード例 #10
0
ファイル: BasicExamples.cs プロジェクト: GWBasic/retlang
        public void Batching()
        {
            using (var fiber = new ThreadFiber())
            {
                fiber.Start();
                var counter = new Channel<int>();
                var reset = new ManualResetEvent(false);
                var total = 0;
                Action<IList<int>> cb = delegate(IList<int> batch)
                                            {
                                                total += batch.Count;
                                                if (total == 10)
                                                {
                                                    reset.Set();
                                                }
                                            };

                counter.SubscribeToBatch(fiber, cb, 1);

                for (var i = 0; i < 10; i++)
                {
                    counter.Publish(i);
                }

                Assert.IsTrue(reset.WaitOne(10000, false));
            }
        }
コード例 #11
0
ファイル: BasicExamples.cs プロジェクト: GWBasic/retlang
        public void BatchingWithKey()
        {
            using (var fiber = new ThreadFiber())
            {
                fiber.Start();
                var counter = new Channel<int>();
                var reset = new ManualResetEvent(false);
                Action<IDictionary<String, int>> cb = delegate(IDictionary<String, int> batch)
                {
                    if (batch.ContainsKey("9"))
                    {
                        reset.Set();
                    }
                };

                Converter<int, String> keyResolver = x => x.ToString();
                counter.SubscribeToKeyedBatch<int, String>(fiber, cb, keyResolver, 0);

                for (var i = 0; i < 10; i++)
                {
                    counter.Publish(i);
                }

                Assert.IsTrue(reset.WaitOne(10000, false));
            }
        }
コード例 #12
0
ファイル: ChannelTests.cs プロジェクト: AArnott/IronPigeon
 public void DefaultCtor()
 {
     var channel = new Channel();
     Assert.Null(channel.CloudBlobStorage);
     Assert.NotNull(channel.CryptoServices);
     Assert.Null(channel.Endpoint);
 }
コード例 #13
0
 public override void Init(Channel ch, ProtocolHeader hdr)
 {
     if (hdr.Major != 0 && hdr.Minor != 10)
     {
         throw new ProtocolVersionException((sbyte) hdr.Major, (sbyte) hdr.Minor);
     }
 }
コード例 #14
0
        internal static void RegisterExtension(Channel channel, StandardOpenIdExtensionFactory.CreateDelegate extensionFactory)
        {
            ErrorUtilities.VerifyArgumentNotNull(channel, "channel");

            var factory = (OpenIdExtensionFactoryAggregator)channel.BindingElements.OfType<ExtensionsBindingElement>().Single().ExtensionFactory;
            factory.Factories.OfType<StandardOpenIdExtensionFactory>().Single().RegisterExtension(extensionFactory);
        }
コード例 #15
0
ファイル: ChatServerMessage.cs プロジェクト: Emudofus/Aldos
 public ChatServerMessage(Channel chan, string message, Global.Character actor)
     : base(PacketType.ChatServerMessage)
 {
     Channel = chan;
     Message = message;
     Actor = actor;
 }
コード例 #16
0
                public void Find(Channel.Path path, ref List<Channel> results)
                {
                    int key = path.raw[depth];

                    if (path.raw.Length - 1 == depth)
                    {
                        if (items.ContainsKey(key))
                            results.Add(items[key]);
                        else if (key == Channel.Path.asterisk)
                        {
                            foreach (var item in items)
                                results.Add(item.Value);
                        }
                    }
                    else if (key == Channel.Path.asterisk)
                    {
                        foreach (var child in children)
                        {
                            child.Value.Find(path, ref results);
                        }
                    }
                    else if (children.ContainsKey(key))
                    {
                        children[key].Find(path, ref results);
                    }
                }
コード例 #17
0
ファイル: Translate.cs プロジェクト: reviforks/wikimedia-bot
 public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
 {
     if (message.StartsWith(Configuration.System.CommandPrefix + "translate "))
     {
         message = message.Substring(11);
         List<string> parts = new List<string>(message.Split(' '));
         if (parts.Count < 3)
         {
             IRC.DeliverMessage("Invalid number of parameters", channel);
             return;
         }
         string target = null;
         string source_language = parts[0];
         string target_language = parts[1];
         if (!IsValid(source_language) || !IsValid(target_language))
         {
             IRC.DeliverMessage(invoker.Nick + ": invalid language!", channel);
             return;
         }
         string text = message.Substring(message.IndexOf(parts[1]) + parts[1].Length + 1);
         if (text.Contains("|"))
         {
             target = text.Substring(text.IndexOf("|") + 1).Trim();
             text = text.Substring(0, text.IndexOf("|"));
         }
         // schedule a message
         Ring.Add(new Buffer.Item(channel, source_language, target_language, target, text));
     }
 }
コード例 #18
0
 /// <summary>
 /// Default BotJoinHandler. When the bot joins a channel run a /WHO
 /// to make sure we cache the addresses of everyone.
 /// </summary>
 /// <param name="serverid">The server id.</param>
 /// <param name="c">The channel joined.</param>
 /// <returns>The commands to execute.</returns>
 public static string[] BotJoinHandler(int serverid, Channel c)
 {
     return new string[] {
         "NAMES " + c.Name,
         "WHO " + c.Name,
     };
 }
コード例 #19
0
 private void SeedChannels(MessagesDbContext context)
 {
     var channel = new Channel()
     {
         Name = "Channel1"
     };
     context.Channels.Add(channel);
     context.SaveChanges();
     //var message = new ChannelMessage()
     //{
     //    Text = "New message",
     //    DateSent = DateTime.Now,
     //    Sender = context.Users.FirstOrDefault(),
     //    Channel = channel
     //};
     //context.ChannelMessages.Add(message);
     //context.SaveChanges();
     var channel2 = new Channel()
         {
             Name = "Channel2",
             ChannelMessages = new HashSet<ChannelMessage>()
         };
     context.Channels.Add(channel2);
     context.SaveChanges();
 }
コード例 #20
0
ファイル: TimeTest1.cs プロジェクト: mono/mono-microthreads
        static void Main()
        {
            DateTime time1 = DateTime.Now;

            s_channel = new Channel<int>();

            MicroThread t2 = new MicroThread(run2);
            t2.Start();

            MicroThread t3 = new MicroThread(run2);
            t3.Start();

            MicroThread t1 = new MicroThread(run1);
            t1.Start();

            Console.WriteLine("Starting producer/consumer test, loops {0}", s_loops);

            Scheduler.Run();

            DateTime time2 = DateTime.Now;

            Console.WriteLine("total {0}", res);
            Console.WriteLine("time {0}ms", (time2 - time1).TotalMilliseconds);
            Console.WriteLine("END");
        }
コード例 #21
0
        /// <summary>
        /// Read null terminated Unicode string from the current position of channel
        /// </summary>
        /// <param name="channel">The ptf channel</param>
        /// <returns>The read string, when read from the channel, the null terminator will be consumed,
        /// but it will not be included in the return string</returns>
        /// <exception cref="System.InvalidOperationException">Thrown when can't get the string</exception>
        public static string ReadNtUnicodeString(Channel channel)
        {
            byte[] stringBuffer = ReadNtUnicodeStringBuffer(channel);

            // '\0' is not returned
            return Encoding.Unicode.GetString(stringBuffer).TrimEnd('\0');
        }
コード例 #22
0
ファイル: ModuleRC.cs プロジェクト: benapetr/wikimedia-bot
 public override string Extension_DumpHtml(Channel channel)
 {
     string HTML = "";
     DebugLog("Getting html for " + channel.Name);
     try
     {
         if (GetConfig(channel, "RC.Enabled", false))
         {
             RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
             if (rc != null)
             {
                 HTML = rc.ToTable();
             }
             else
             {
                 Syslog.ErrorLog("NULL rc for " + channel.Name);
             }
         }
         else
         {
             DebugLog("RC is disabled for " + channel.Name, 2);
         }
     }
     catch (Exception fail)
     {
         HandleException(fail);
     }
     return HTML;
 }
コード例 #23
0
        public double GetMillivolts(Channel channel, Gain gain = Gain.Volt5, SamplesPerSecond sps = SamplesPerSecond.SPS1600) {
            lock (deviceLock) {

                byte[] result = new byte[2];

                // Set disable comparator and set "single shot" mode	
                config = 0x0003 | 0x8000; // | 0x100;
                config |= (ushort)SamplePerSecondMap[(int)sps];
                config |= (ushort)channel;
                config |= (ushort)programmableGainMap[(int)gain];

                data[0] = REG_CFG;
                data[1] = (byte)((config >> 8) & 0xFF);
                data[2] = (byte)(config & 0xFF);


                I2CDevice.Write(data);
                // delay in milliseconds
                //int delay = (1000.0 / SamplesPerSecondRate[(int)sps] + .1;
            //    int delay = 1;
                Task.Delay(TimeSpan.FromMilliseconds(.5)).Wait();

                I2CDevice.WriteRead(new byte[] { (byte)REG_CONV, 0x00 }, result);

                //var r = (((result[0] << 8) | result[1]) >> 4);

                //Debug.WriteLine(r.ToString());

                return (ushort)(((result[0] << 8) | result[1]) >> 4) * programmableGain_Scaler[(int)gain] / 2048;
            }
        }
コード例 #24
0
        public void Start(Channel channel, int numWorkerThreads)
        {
            channelReceiver = channelFactory.GetReceiver(channel.Type);

            channelReceiver.DataReceived += DataReceivedOnChannel;
            channelReceiver.Start(channel.Address,numWorkerThreads);
        }
コード例 #25
0
ファイル: YPitchBendCube.cs プロジェクト: probuilderz/balloon
        public YPitchBendCube(Point3D center, double radius, 
                Pitch pitch, Instrument instrument, OutputDevice device, Channel channel)
            : base(center, radius, new InstrumentNoteAction(device, channel, pitch)) {

                outputDevice = device;
                this.channel = channel;
        }
コード例 #26
0
ファイル: ChannelFunctions.cs プロジェクト: AlphaBlend/VNet
 protected void AttemptToCloseChannel(Channel channel)
 {
     if (channel.UserCount == 0
         && channel != Channel_Main
         && channel != Channel_Void)
         Channels.Remove(channel);
 }
コード例 #27
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ProtocolFaultResponseException"/> class
		/// such that it can be sent as a protocol message response to a remote caller.
		/// </summary>
		/// <param name="channel">The channel to use when encoding the response message.</param>
		/// <param name="errorResponse">The message to send back to the HTTP client.</param>
		/// <param name="faultedMessage">The message that was the cause of the exception.  May be null.</param>
		/// <param name="innerException">The inner exception.</param>
		/// <param name="message">The message for the exception.</param>
		protected internal ProtocolFaultResponseException(Channel channel, IDirectResponseProtocolMessage errorResponse, IProtocolMessage faultedMessage = null, Exception innerException = null, string message = null)
			: base(message ?? (innerException != null ? innerException.Message : null), faultedMessage, innerException) {
			Requires.NotNull(channel, "channel");
			Requires.NotNull(errorResponse, "errorResponse");
			this.channel = channel;
			this.ErrorResponseMessage = errorResponse;
		}
コード例 #28
0
 private void _AddChannel(Channel channel)
 {
     ChannelColorStateControl control = new ChannelColorStateControl(channel.Name);
     _channelControls[channel.Id] = control;
     control.Dock = DockStyle.Top;
     Controls.Add(control);
 }
コード例 #29
0
        public void Start(Channel channel)
        {
            channelReceiver = (IChannelReceiver)builder.Build(channel.Receiver);

            channelReceiver.DataReceived += DataReceivedOnChannel;
            channelReceiver.Start(channel.ReceiveAddress, channel.NumWorkerThreads);
        }
コード例 #30
0
ファイル: PingPong_Specs.cs プロジェクト: Nangal/Stact
			public void Ping(Channel<Ping> channel)
			{
				channel.Send(new Ping
					{
						ResponseChannel = PongChannel
					});
			}
コード例 #31
0
 public List <FamilyDto> GetAll(bool getOnlyActive)
 {
     return(Channel.GetAll(getOnlyActive));
 }
コード例 #32
0
        protected void CustomerCreateManagerment(string CustomerInforStr, SocketServiceReadWriteChannel InputSocketServiceReadWriteChannel)
        {
            string ReplyCommandMessageStr = "customercreate";
            //----1------------------------------------------------------------------------------------------------
            string ActionID = CustomerInforStr.Substring(0, CustomerInforStr.IndexOf(":"));

            if (ActionID == "authenlockid")
            {
                int         IndexStart    = CustomerInforStr.IndexOf(":") + 1;
                string      LockID        = CustomerInforStr.Substring(IndexStart, CustomerInforStr.IndexOf("-") - IndexStart);
                LockManager MyLockManager = new LockManager();
                Lock        MyLock        = MyLockManager.FindLock(LockID);
                if (MyLock == null)
                {
                    //MessageBox.Show("此锁ID号不存在!");
                    ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[110]!");
                }
                if (MyLock.Status != 2)
                {
                    //MessageBox.Show("此锁ID号不没有出售或授权!");
                    ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[120]!");
                }
                else
                {
                    string TempStr       = CustomerInforStr.Substring(CustomerInforStr.IndexOf("-") + 1);
                    string RegsisterCode = TempStr;//循环截取

                    RegisterCodeCRUD MyRegisterCodeCRUD = new RegisterCodeCRUD();
                    RegisterCode     MyRegisterCode     = MyRegisterCodeCRUD.FindRegisterCode(LockID);
                    if (MyRegisterCode == null)
                    {
                        //MessageBox.Show("此注册号码不存在!");
                        ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[130]!");
                    }
                    if (MyRegisterCode.RegisterCodeStr != RegsisterCode)
                    {
                        //MessageBox.Show("此注册号码有错误!");
                        ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[140]!");
                    }
                    else
                    {
                        ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#true[0]!");
                    }
                }
            }

            if (ActionID == "authenloginid")
            {
                int             IndexStart        = CustomerInforStr.IndexOf(":") + 1;
                string          LockID            = CustomerInforStr.Substring(IndexStart, CustomerInforStr.IndexOf("-") - IndexStart);
                string          TempStr           = CustomerInforStr.Substring(CustomerInforStr.IndexOf("-") + 1);
                string          CustomerLoginID   = TempStr;//循环截取
                CustomerManager MyCustomerManager = new CustomerManager();
                Customer        MyCustomer        = MyCustomerManager.FindCustomer(CustomerLoginID);

                if (MyCustomer != null)
                {
                    //已经注册;
                    ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[210]!");
                }
                else
                {
                    //还没有注册;
                    ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#true[0]!");
                }
            }


            if (ActionID == "createcustomer")
            {
                int    IndexStart = CustomerInforStr.IndexOf(":") + 1;
                string LockID     = CustomerInforStr.Substring(IndexStart, CustomerInforStr.IndexOf(",") - IndexStart);

                IndexStart = CustomerInforStr.IndexOf(",") + 1;
                string TempStr       = CustomerInforStr.Substring(IndexStart);
                string RegsisterCode = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取

                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string CustomerName = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取

                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string LoginName = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取

                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string PassWord = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取

                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string PersonID = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取

                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string TeleCode = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取


                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string EMail = TempStr.Substring(0, TempStr.IndexOf(",")); //循环截取


                IndexStart = TempStr.IndexOf(",") + 1;
                TempStr    = TempStr.Substring(IndexStart);
                string Address = TempStr; //最后截取

                Channel MyChannel;
                MyChannel                 = new Channel();
                MyChannel.LockID          = LockID;
                MyChannel.RegisterCodeStr = RegsisterCode;

                Customer MyNewCustomer = new Customer();;

                MyNewCustomer.CustomerName = CustomerName;
                MyNewCustomer.LoginName    = LoginName;
                MyNewCustomer.PersonID     = PersonID;
                MyNewCustomer.TeleCode     = TeleCode;
                MyNewCustomer.Password     = PassWord;
                MyNewCustomer.EMail        = EMail;
                MyNewCustomer.Address      = Address;


                CustomerManager MyCustomerManager = new CustomerManager();

                string MobileID = MyCustomerManager.InsertCustomerExxx(MyNewCustomer, MyChannel);
                if (MobileID != null)
                {
                    Customer MyCustomer;
                    MyCustomer = MyCustomerManager.FindCustomerEx(MobileID);
                    if (MyCustomer != null)
                    {
                        // 注册操作成功,客户ID:" + MyCustomer.CustomerID + " ,云锁ID:" + MyChannel.LockID + ", 移动端ID:" + MobileID + "\r\n");
                        ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#true[{0}]!", MyCustomer.CustomerID + "," + MyChannel.LockID + "," + MobileID);
                    }
                    else
                    {
                        //注册操作失败!;
                        ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[310]!");
                    }
                }
                else
                {
                    //注册操作失败!;
                    ReplyCommandMessageStr = string.Format(ReplyCommandMessageStr + "#false[320]!");
                }
            }
            //----2.Reply-----------------------------------------------------------------------------
            ResponseToSynchClient(InputSocketServiceReadWriteChannel, ReplyCommandMessageStr);
        }
コード例 #33
0
        public void Run_Internal_JSON_Config_Test_Offset_Added_To_Parent_Channel()
        {
            var te = new TestEnvironment(ppType: PostProcessType.NONE);

            Arguments.grabingTempFolder = Path.Combine(Path.GetTempPath(), "wgmulti_tests");
            Arguments.configDir         = Arguments.grabingTempFolder;
            Arguments.webGrabFolder     = Environment.GetEnvironmentVariable("wgpath");
            Arguments.useJsonConfig     = true;

            // Create new config and overwrite the wgmilti.config.json
            Config conf    = new Config();
            var    siteini = new SiteIni("siteini", "channel_1");
            var    channel = new Channel();

            channel.name     = "Канал 1";
            channel.xmltv_id = "Канал 1 ID";
            channel.update   = UpdateType.Incremental;
            channel.siteinis = new List <SiteIni>()
            {
                siteini
            };
            channel.offset = 5.5;
            conf.channels.Add(channel);

            var timeshifted = new Channel();

            timeshifted.name     = "Канал 1 +1";
            timeshifted.xmltv_id = "Канал 1 +1 ID";
            timeshifted.offset   = 1;
            timeshifted.same_as  = "Канал 1 ID";
            channel.timeshifts   = new List <Channel>();
            channel.timeshifts.Add(timeshifted);

            var content = conf.Serialize(true);

            File.WriteAllText(te.configFileJson, content);

            Application.Run(te.configFolder);

            var root = XDocument.Load(te.outputEpg);
            var tv   = root.Element("tv");

            Func <String, String> GetStartHour = delegate(String id)
            {
                try
                {
                    return(tv.Elements("programme")
                           .Where(p => p.Attribute("channel").Value
                                  .Equals(id))
                           .First().Attribute("start").Value.Substring(8, 4));
                }
                catch { return(""); }
            };

            // Select the start time of first program for 'Канал 1' and first program of 'Channel2ID'
            var time = GetStartHour(channel.xmltv_id);

            if (time != "0530")
            {
                Assert.Fail(String.Format("Start time of first program in channel {0} is {1}, 0500 was expected since channel has offset=5.5", channel.name, time));
            }

            // Select the start time of first timeshifted program for 'Канал 1 +1' and first program of 'Channel2ID'
            time = GetStartHour(timeshifted.xmltv_id);
            if (time != "0630")
            {
                Assert.Fail(String.Format("Start time of first program in channel {0} is {1}, 0600 was expected since channel has offset=1 and the parent channel has offset=5.5", channel.name, time));
            }
        }
コード例 #34
0
 internal Func<Transaction, Metadata?, DateTime?, CancellationToken, AsyncUnaryCall<TransactionResponse>> InstantiateNetworkRequestMethod(Channel channel)
 {
     return dataCase_ switch
     {
         DataOneofCase.ContractCall => new SmartContractService.SmartContractServiceClient(channel).contractCallMethodAsync,
         DataOneofCase.ContractCreateInstance => new SmartContractService.SmartContractServiceClient(channel).createContractAsync,
         DataOneofCase.ContractUpdateInstance => new SmartContractService.SmartContractServiceClient(channel).updateContractAsync,
         DataOneofCase.ContractDeleteInstance => new SmartContractService.SmartContractServiceClient(channel).deleteContractAsync,
         //QueryOneofCase.CryptoAddLiveHash = 10,
         DataOneofCase.CryptoCreateAccount => new CryptoService.CryptoServiceClient(channel).createAccountAsync,
         DataOneofCase.CryptoDelete => new CryptoService.CryptoServiceClient(channel).cryptoDeleteAsync,
         //QueryOneofCase.CryptoDeleteLiveHash = 13,
         DataOneofCase.CryptoTransfer => new CryptoService.CryptoServiceClient(channel).cryptoTransferAsync,
         DataOneofCase.CryptoUpdateAccount => new CryptoService.CryptoServiceClient(channel).updateAccountAsync,
         DataOneofCase.FileAppend => new FileService.FileServiceClient(channel).appendContentAsync,
         DataOneofCase.FileCreate => new FileService.FileServiceClient(channel).createFileAsync,
         DataOneofCase.FileDelete => new FileService.FileServiceClient(channel).deleteFileAsync,
         DataOneofCase.FileUpdate => new FileService.FileServiceClient(channel).updateFileAsync,
         DataOneofCase.SystemDelete when SystemDelete.FileID is not null => new FileService.FileServiceClient(channel).systemDeleteAsync,
         DataOneofCase.SystemDelete when SystemDelete.ContractID is not null => new SmartContractService.SmartContractServiceClient(channel).systemDeleteAsync,
         DataOneofCase.SystemUndelete when SystemUndelete.FileID is not null => new FileService.FileServiceClient(channel).systemUndeleteAsync,
         DataOneofCase.SystemUndelete when SystemUndelete.ContractID is not null => new SmartContractService.SmartContractServiceClient(channel).systemUndeleteAsync,
         DataOneofCase.Freeze => new FreezeService.FreezeServiceClient(channel).freezeAsync,
         DataOneofCase.ConsensusCreateTopic => new ConsensusService.ConsensusServiceClient(channel).createTopicAsync,
         DataOneofCase.ConsensusUpdateTopic => new ConsensusService.ConsensusServiceClient(channel).updateTopicAsync,
         DataOneofCase.ConsensusDeleteTopic => new ConsensusService.ConsensusServiceClient(channel).deleteTopicAsync,
         DataOneofCase.ConsensusSubmitMessage => new ConsensusService.ConsensusServiceClient(channel).submitMessageAsync,
         DataOneofCase.UncheckedSubmit => new NetworkService.NetworkServiceClient(channel).uncheckedSubmitAsync,
         DataOneofCase.TokenCreation => new TokenService.TokenServiceClient(channel).createTokenAsync,
         DataOneofCase.TokenFreeze => new TokenService.TokenServiceClient(channel).freezeTokenAccountAsync,
         DataOneofCase.TokenUnfreeze => new TokenService.TokenServiceClient(channel).unfreezeTokenAccountAsync,
         DataOneofCase.TokenGrantKyc => new TokenService.TokenServiceClient(channel).grantKycToTokenAccountAsync,
         DataOneofCase.TokenRevokeKyc => new TokenService.TokenServiceClient(channel).revokeKycFromTokenAccountAsync,
         DataOneofCase.TokenDeletion => new TokenService.TokenServiceClient(channel).deleteTokenAsync,
         DataOneofCase.TokenUpdate => new TokenService.TokenServiceClient(channel).updateTokenAsync,
         DataOneofCase.TokenMint => new TokenService.TokenServiceClient(channel).mintTokenAsync,
         DataOneofCase.TokenBurn => new TokenService.TokenServiceClient(channel).burnTokenAsync,
         DataOneofCase.TokenWipe => new TokenService.TokenServiceClient(channel).wipeTokenAccountAsync,
         DataOneofCase.TokenAssociate => new TokenService.TokenServiceClient(channel).associateTokensAsync,
         DataOneofCase.TokenDissociate => new TokenService.TokenServiceClient(channel).dissociateTokensAsync,
         _ => throw new InvalidOperationException("Transaction has No Type Set, unable to find Network Request Method for Unknown Transaction Type.")
     };
 }
コード例 #35
0
 public void InvokeSendMethod(string service, string method, int tenant, params object[] parameters)
 {
     Channel.InvokeSendMethod(service, method, tenant, parameters);
 }
コード例 #36
0
 public void SendNotifyMessage(NotifyMessage m)
 {
     Channel.SendNotifyMessage(m);
 }
コード例 #37
0
 public List <FamilyMember> GetNotActiveMembersStoredProcedure(int familyId)
 {
     return(Channel.GetNotActiveMembersStoredProcedure(familyId));
 }
コード例 #38
0
        private static void CheckPublishedFiles(TreeNode node, Channel sourceCh, Channel destCh,
                                                Uri curWavUri_, MemoryStream curAudioData, PCMFormatInfo curPCMFormat)
        {
            Uri curWavUri = (curWavUri_ == null ? null : new Uri(curWavUri_.ToString()));

            if (node.HasProperties(typeof(ChannelsProperty)))
            {
                ChannelsProperty   chProp = node.GetProperty <ChannelsProperty>();
                ManagedAudioMedia  mam    = chProp.GetMedia(sourceCh) as ManagedAudioMedia;
                ExternalAudioMedia eam    = chProp.GetMedia(destCh) as ExternalAudioMedia;

                Assert.AreEqual(mam == null, eam == null,
                                "There may be external audio media if and only if there is managed audio media");

                if (mam != null && eam != null)
                {
                    Assert.IsTrue(mam.Duration.IsEqualTo(eam.Duration),
                                  "Duration of managed and external audio media differs");

                    if (eam.Uri != null)
                    {
                        FileStream wavFS_         = new FileStream(eam.Uri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.None);
                        Stream     manAudioStream = mam.AudioMediaData.OpenPcmInputStream();
                        try
                        {
                            uint dataLength;
                            AudioLibPCMFormat pcmInfo = AudioLibPCMFormat.RiffHeaderParse(wavFS_, out dataLength);

                            Assert.IsTrue(pcmInfo.IsCompatibleWith(mam.AudioMediaData.PCMFormat.Data),
                                          "External audio has incompatible pcm format");

                            wavFS_.Position += pcmInfo.ConvertTimeToBytes(eam.ClipBegin.TimeAsMillisecondFloat);

                            Assert.IsTrue(
                                AudioLibPCMFormat.CompareStreamData(manAudioStream, wavFS_, (int)manAudioStream.Length),
                                "External audio contains wrong data");
                        }
                        finally
                        {
                            wavFS_.Close();
                            manAudioStream.Close();
                        }
                    }

                    if (curWavUri != null)
                    {
                        FileStream wavFS = new FileStream(curWavUri.LocalPath, FileMode.Open, FileAccess.Read,
                                                          FileShare.None);
                        try
                        {
                            uint dataLength;
                            AudioLibPCMFormat pcmInfo = AudioLibPCMFormat.RiffHeaderParse(wavFS, out dataLength);

                            Assert.IsTrue(pcmInfo.IsCompatibleWith(curPCMFormat.Data),
                                          "External audio has incompatible pcm format");

                            curAudioData.Position = 0;

                            Assert.AreEqual(curAudioData.Length, (long)dataLength,
                                            "External audio has unexpected length");
                            Assert.IsTrue(
                                AudioLibPCMFormat.CompareStreamData(curAudioData, wavFS, (int)curAudioData.Length),
                                "External audio contains wrong data");
                        }
                        finally
                        {
                            wavFS.Close();
                        }
                    }

                    if (curWavUri == null)
                    {
                        curWavUri    = new Uri(eam.Uri.ToString());
                        curAudioData = new MemoryStream();
                        curPCMFormat = mam.AudioMediaData.PCMFormat;
                    }
                    else if (curWavUri.ToString() != eam.Uri.ToString())
                    {
                        curWavUri    = new Uri(eam.Uri.ToString());
                        curAudioData = new MemoryStream();
                        curPCMFormat = mam.AudioMediaData.PCMFormat;
                    }

                    Assert.IsTrue(curPCMFormat.ValueEquals(mam.AudioMediaData.PCMFormat),
                                  "Managed audio has incompatible pcm format");

                    Stream manAudio = mam.AudioMediaData.OpenPcmInputStream();
                    try
                    {
                        media.data.StreamUtils.CopyData(manAudio, curAudioData);
                    }
                    finally
                    {
                        manAudio.Close();
                    }
                }
            }
            foreach (TreeNode child in node.Children.ContentsAs_YieldEnumerable)
            {
                CheckPublishedFiles(child, sourceCh, destCh, curWavUri, curAudioData, curPCMFormat);
            }
        }
コード例 #39
0
        /// <summary>
        /// This method will try to start the epg grabber for the channel and tuning details specified
        /// Epg grabbing can only be started if there is a card idle which can receive the channel specified
        /// </summary>
        /// <param name="channel">channel to grab/param>
        /// <param name="tuning">tuning information</param>
        /// <param name="card">card to use for grabbing</param>
        /// <returns>true if grabbing has started else false</returns>
        private bool GrabEpgForChannel(Channel channel, IChannel tuning, Card card)
        {
            if (channel == null)
            {
                Log.Error("Epg: invalid channel");
                return(false);
            }
            if (tuning == null)
            {
                Log.Error("Epg: invalid tuning");
                return(false);
            }
            if (card == null)
            {
                Log.Error("Epg: invalid card");
                return(false);
            }
            if (_tvController == null)
            {
                Log.Error("Epg: invalid tvcontroller");
                return(false);
            }
            if (_user == null)
            {
                Log.Error("Epg: invalid user");
                return(false);
            }
            //remove following check to enable multi-card epg grabbing (still beta)
            if (_tvController.AllCardsIdle == false)
            {
                Log.Epg("Epg: card:{0} cards are not idle", Card.IdCard);
                return(false);
            }

            TvResult result = TvResult.UnknownError;
            //handle ATSC
            ATSCChannel atscChannel = tuning as ATSCChannel;

            if (atscChannel != null)
            {
                if (_tvController.Type(Card.IdCard) == CardType.Atsc)
                {
                    if (IsCardIdle(Card.IdCard) == false)
                    {
                        Log.Epg("Epg: card:{0} atsc card is not idle", Card.IdCard);
                        return(false); //card is busy
                    }
                    return(TuneEPGgrabber(channel, tuning, card, result));
                }
                Log.Epg("Epg: card:{0} could not tune to atsc channel:{1}", Card.IdCard, tuning.ToString());
                return(false);
            }

            //handle DVBC
            DVBCChannel dvbcChannel = tuning as DVBCChannel;

            if (dvbcChannel != null)
            {
                if (_tvController.Type(Card.IdCard) == CardType.DvbC)
                {
                    if (IsCardIdle(Card.IdCard) == false)
                    {
                        Log.Epg("Epg: card:{0} dvbc card is not idle", Card.IdCard);
                        return(false); //card is busy
                    }
                    return(TuneEPGgrabber(channel, tuning, card, result));
                }
                Log.Epg("Epg: card:{0} could not tune to dvbc channel:{1}", Card.IdCard, tuning.ToString());
                return(false);
            }

            //handle DVBS
            DVBSChannel dvbsChannel = tuning as DVBSChannel;

            if (dvbsChannel != null)
            {
                if (_tvController.Type(Card.IdCard) == CardType.DvbS)
                {
                    if (IsCardIdle(Card.IdCard) == false)
                    {
                        Log.Epg("Epg: card:{0} dvbs card is not idle", Card.IdCard);
                        return(false); //card is busy
                    }
                    return(TuneEPGgrabber(channel, tuning, card, result));
                }
                Log.Epg("Epg: card:{0} could not tune to dvbs channel:{1}", Card.IdCard, tuning.ToString());
                return(false);
            }

            //handle DVBT
            DVBTChannel dvbtChannel = tuning as DVBTChannel;

            if (dvbtChannel != null)
            {
                if (_tvController.Type(Card.IdCard) == CardType.DvbT)
                {
                    if (IsCardIdle(Card.IdCard) == false)
                    {
                        Log.Epg("Epg: card:{0} dvbt card is not idle", Card.IdCard);
                        return(false); //card is busy
                    }

                    return(TuneEPGgrabber(channel, tuning, card, result));
                }
                Log.Epg("Epg: card:{0} could not tune to dvbt channel:{1}", Card.IdCard, tuning.ToString());
                return(false);
            }

            //handle DVBIP
            DVBIPChannel dvbipChannel = tuning as DVBIPChannel;

            if (dvbipChannel != null)
            {
                if (_tvController.Type(Card.IdCard) == CardType.DvbIP)
                {
                    if (IsCardIdle(Card.IdCard) == false)
                    {
                        Log.Epg("Epg: card:{0} dvbip card is not idle", Card.IdCard);
                        return(false); //card is busy
                    }
                    return(TuneEPGgrabber(channel, tuning, card, result));
                }
                else
                {
                    Log.Epg("Epg: card:{0} could not tune to dvbip channel:{1}", Card.IdCard, tuning.ToString());
                }
                return(false);
            }
            Log.Epg("Epg: card:{0} could not tune to channel:{1}", Card.IdCard, tuning.ToString());
            return(false);
        }
コード例 #40
0
 public Family Add(Family family)
 {
     return(Channel.Add(family));
 }
コード例 #41
0
        private static List <TuningDetail> GetTuningDetailsByCardType(Channel channel, CardType cardType, bool enableDVBS2)
        {
            List <TuningDetail> result = new List <TuningDetail>();

            foreach (TuningDetail tDetail in channel.ReferringTuningDetail())
            {
                switch (cardType)
                {
                case CardType.Analog:
                    if (tDetail.ChannelType == 0)
                    {
                        result.Add(tDetail);
                    }
                    break;

                case CardType.Atsc:
                    if (tDetail.ChannelType == 1)
                    {
                        result.Add(tDetail);
                    }
                    break;

                case CardType.DvbC:
                    if (tDetail.ChannelType == 2)
                    {
                        result.Add(tDetail);
                    }
                    break;

                case CardType.DvbS:
                    if (tDetail.ChannelType == 3)
                    {
                        if (!enableDVBS2 && (tDetail.Pilot > -1 || tDetail.RollOff > -1))
                        {
                            Log.Debug(String.Format(
                                          "Imported channel {0} detected as DVB-S2. Skipped! \n Enable \"DVB-S2 tuning\" option in your TV-Card properties to be able to map these channels.",
                                          tDetail.Name));
                        }
                        else
                        {
                            result.Add(tDetail);
                        }
                    }
                    break;

                case CardType.DvbT:
                    if (tDetail.ChannelType == 4)
                    {
                        result.Add(tDetail);
                    }
                    break;

                case CardType.DvbIP:
                    if (tDetail.ChannelType == 7)
                    {
                        result.Add(tDetail);
                    }
                    break;

                case CardType.RadioWebStream:
                    if (tDetail.ChannelType == 5)
                    {
                        result.Add(tDetail);
                    }
                    break;

                default:
                    break;
                }
            }
            return(result);
        }
コード例 #42
0
 internal Info(Channel channel)
 {
     _infoServiceClient = new InfoService.InfoServiceClient(channel);
 }
コード例 #43
0
        public void SaveChannel(Channel channel)
        {
            string json = JsonConvert.SerializeObject(channel);

            File.AppendAllText(@"chanels.txt", json);
        }
コード例 #44
0
 public void SetVolume(Channel channel, float value)
 {
     MainMixer.SetFloat(exposedVolumeParameters[(int)channel], value);
 }
コード例 #45
0
 public static void ToggleDefaultVoice(ChatUser from, Channel channel, string param)
 {
     channel.VoiceRestricted = !channel.VoiceRestricted;
 }
コード例 #46
0
        private void mpComboBoxCard_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            mpListViewChannels.BeginUpdate();
            mpListViewMapped.BeginUpdate();
            try
            {
                mpListViewMapped.Items.Clear();
                mpListViewChannels.Items.Clear();

                SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel));
                sb.AddOrderByField(true, "sortOrder");
                SqlStatement    stmt     = sb.GetStatement(true);
                IList <Channel> channels = ObjectFactory.GetCollection <Channel>(stmt.Execute());

                Card card = ((CardInfo)mpComboBoxCard.SelectedItem).Card;
                IList <ChannelMap> maps = card.ReferringChannelMap();

                // get cardtype, dvb, analogue etc.
                CardType        cardType    = RemoteControl.Instance.Type(card.IdCard);
                TvBusinessLayer layer       = new TvBusinessLayer();
                bool            enableDVBS2 = (layer.GetSetting("dvbs" + card.IdCard + "enabledvbs2", "false").Value == "true");

                List <ListViewItem> items = new List <ListViewItem>();
                foreach (ChannelMap map in maps)
                {
                    Channel channel = null;
                    try
                    {
                        channel = map.ReferencedChannel();
                    }
                    catch (Exception) {}
                    if (channel == null)
                    {
                        continue;
                    }
                    if (channel.IsRadio == false)
                    {
                        continue;
                    }


                    List <TuningDetail> tuningDetails = GetTuningDetailsByCardType(channel, cardType, enableDVBS2);
                    bool foundValidTuningDetail       = tuningDetails.Count > 0;
                    if (foundValidTuningDetail)
                    {
                        int    imageIndex  = GetImageIndex(tuningDetails);
                        string displayName = channel.DisplayName;
                        if (map.EpgOnly)
                        {
                            displayName = channel.DisplayName + " (EPG Only)";
                        }
                        ListViewItem item = new ListViewItem(displayName, imageIndex);
                        item.Tag = map;
                        items.Add(item);

                        foreach (Channel ch in channels)
                        {
                            if (ch.IdChannel == channel.IdChannel)
                            {
                                //No risk of concurrent modification so remove it directly.
                                channels.Remove(ch);
                                break;
                            }
                        }
                    }
                    else
                    {
                        map.Delete();
                    }
                }
                mpListViewMapped.Items.AddRange(items.ToArray());

                items = new List <ListViewItem>();
                foreach (Channel channel in channels)
                {
                    if (!channel.IsRadio)
                    {
                        continue;
                    }
                    List <TuningDetail> tuningDetails = GetTuningDetailsByCardType(channel, cardType, enableDVBS2);
                    // only add channel that is tuneable on the device selected.
                    bool foundValidTuningDetail = tuningDetails.Count > 0;
                    if (foundValidTuningDetail)
                    {
                        int          imageIndex = GetImageIndex(tuningDetails);
                        ListViewItem item       = new ListViewItem(channel.DisplayName, imageIndex);
                        item.Tag = channel;
                        items.Add(item);
                    }
                }
                mpListViewChannels.Items.AddRange(items.ToArray());
                mpListViewChannels.Sort();
            }
            finally
            {
                mpListViewChannels.EndUpdate();
                mpListViewMapped.EndUpdate();
            }
        }
コード例 #47
0
 public static void RenameChannel(ChatUser from, Channel channel, string param)
 {
     channel.Name = param;
 }
コード例 #48
0
ファイル: TestChannel.cs プロジェクト: tppApe/UfcppSample
        public void Channelの基本動作()
        {
            const int NumExecuteLoop = 30;

            var c = new Channel <Message>();
            ISender <Holder <Message> > s = c;

            var list = new List <Holder <Message> >();

            int count = 0;

            s.Subscribe((m, ct) =>
            {
                list.Add(m);

                if (!m.IsArray)
                {
                    var b = m.Value as MessageB;
                    if (b != null)
                    {
                        ++count;
                        b.SetResult(count);
                    }
                }

                return(Task.CompletedTask);
            });

            int sum = 0;

            Func <CancellableReceiver <Message>, Task> executor = async r =>
            {
                await Task.Run(() => { }).ConfigureAwait(false);

                for (int i = 0; i < NumExecuteLoop; i++)
                {
                    await Task.Delay(1);

                    await r.SendAsync(new MessageA("abc"));

                    var res = (await r.SendAsync(new MessageB(0, i))).GetResponse();
                    sum += res.Value;
                }
            };

            c.Execute(executor, CancellationToken.None);
            c.Completed.Wait();

            Assert.AreEqual(2 * NumExecuteLoop, list.Count);
            Assert.AreEqual(NumExecuteLoop, count);
            Assert.AreEqual(Sum1To(NumExecuteLoop), sum);

            for (int i = 0; i < 10; i++)
            {
                var a = list[2 * i];
                Assert.IsFalse(a.IsArray);
                Assert.IsTrue(a.Value is MessageA);

                var b = list[2 * i + 1];
                Assert.IsFalse(b.IsArray);
                Assert.IsTrue(b.Value is MessageB);
                Assert.AreEqual(i, ((MessageB)b.Value).Value);
            }
        }
コード例 #49
0
 public static void HideCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = true;
     from.SendMessage(
         40); // You are no longer showing your character name to any players who inquire with the whois command.
 }
コード例 #50
0
 public static void DisableDefaultVoice(ChatUser from, Channel channel, string param)
 {
     channel.VoiceRestricted = true;
 }
コード例 #51
0
 public static void TogglePrivateMessages(ChatUser from, Channel channel, string param)
 {
     from.IgnorePrivateMessage = !from.IgnorePrivateMessage;
     from.SendMessage(from.IgnorePrivateMessage ? 38 : 37); // See above for messages
 }
コード例 #52
0
 public static void ToggleCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = !from.Anonymous;
     from.SendMessage(from.Anonymous ? 40 : 39); // See above for messages
 }
コード例 #53
0
 public static void ChangeChannelPassword(ChatUser from, Channel channel, string param)
 {
     channel.Password = param;
     from.SendMessage(60); // The password to the conference has been changed.
 }
コード例 #54
0
 public static void ShowCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = false;
     from.SendMessage(
         39); // You are now showing your character name to any players who inquire with the whois command.
 }
コード例 #55
0
 internal IChannel GetChannelProvider(Channel channel)
 {
     return(GetAllChannels().First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase)));
 }
コード例 #56
0
 public static void AllowPrivateMessages(ChatUser from, Channel channel, string param)
 {
     from.IgnorePrivateMessage = false;
     from.SendMessage(37); // You can now receive private messages.
 }
コード例 #57
0
 public DrawableChannel(Channel channel)
 {
     Channel          = channel;
     RelativeSizeAxes = Axes.Both;
 }
コード例 #58
0
 public static void LeaveChat(ChatUser from, Channel channel, string param)
 {
     ChatUser.RemoveChatUser(from);
 }
コード例 #59
0
 /// <summary>
 ///     Constructs a Note On message.
 /// </summary>
 /// <param name="device">The device associated with this message.</param>
 /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param>
 /// <param name="pitch">The pitch for this note message.</param>
 /// <param name="velocity">Velocity, 0..127.</param>
 /// <param name="time">The timestamp for this message.</param>
 public NoteOnMessage(IDeviceBase device, Channel channel, Pitch pitch, int velocity,
                      float time)
     : base(device, channel, pitch, velocity, time)
 {
 }
コード例 #60
0
        private async Task <BaseItem> GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Channel internalChannel, CancellationToken cancellationToken)
        {
            BaseItem item;
            Guid     id;
            var      isNew = false;

            var idToHash = GetIdToHash(info.Id, channelProvider);

            if (info.Type == ChannelItemType.Folder)
            {
                id = idToHash.GetMBId(typeof(ChannelFolderItem));

                item = _libraryManager.GetItemById(id) as ChannelFolderItem;

                if (item == null)
                {
                    isNew = true;
                    item  = new ChannelFolderItem();
                }
            }
            else if (info.MediaType == ChannelMediaType.Audio)
            {
                id = idToHash.GetMBId(typeof(ChannelAudioItem));

                item = _libraryManager.GetItemById(id) as ChannelAudioItem;

                if (item == null)
                {
                    isNew = true;
                    item  = new ChannelAudioItem();
                }
            }
            else
            {
                id = idToHash.GetMBId(typeof(ChannelVideoItem));

                item = _libraryManager.GetItemById(id) as ChannelVideoItem;

                if (item == null)
                {
                    isNew = true;
                    item  = new ChannelVideoItem();
                }
            }

            item.Id           = id;
            item.RunTimeTicks = info.RunTimeTicks;

            if (isNew)
            {
                item.Name            = info.Name;
                item.Genres          = info.Genres;
                item.Studios         = info.Studios;
                item.CommunityRating = info.CommunityRating;
                item.OfficialRating  = info.OfficialRating;
                item.Overview        = info.Overview;
                item.People          = info.People;
                item.PremiereDate    = info.PremiereDate;
                item.ProductionYear  = info.ProductionYear;
                item.ProviderIds     = info.ProviderIds;

                if (info.DateCreated.HasValue)
                {
                    item.DateCreated = info.DateCreated.Value;
                }
            }

            var channelItem = (IChannelItem)item;

            channelItem.OriginalImageUrl = info.ImageUrl;
            channelItem.ExternalId       = info.Id;
            channelItem.ChannelId        = internalChannel.Id.ToString("N");
            channelItem.ChannelItemType  = info.Type;

            if (isNew)
            {
                channelItem.Tags = info.Tags;
            }

            var channelMediaItem = item as IChannelMediaItem;

            if (channelMediaItem != null)
            {
                channelMediaItem.IsInfiniteStream    = info.IsInfiniteStream;
                channelMediaItem.ContentType         = info.ContentType;
                channelMediaItem.ChannelMediaSources = info.MediaSources;

                var mediaSource = info.MediaSources.FirstOrDefault();

                item.Path = mediaSource == null ? null : mediaSource.Path;
            }

            if (isNew)
            {
                await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);

                _libraryManager.RegisterItem(item);
            }

            return(item);
        }