Esempio n. 1
0
        private static void Main()
        {
            // Create pattern.
            ChannelSimple channel1 = new ChannelSimple(7);

            channel1.Set(1, true);
            channel1.Set(3, true);
            channel1.Set(5, true);

            ChannelSimple channel2 = new ChannelSimple(4);

            channel2.Set(0, true);
            channel2.Set(3, true);

            ChannelSimple channel3 = new ChannelSimple(3);

            channel3.Set(2, true);

            PatternSimple patternOut = new PatternSimple(channel1, channel2, channel3);

            // Write pattern bits.
            Console.WriteLine(patternOut);
            File.WriteAllBytes("Test", patternOut.ToBitArray().ToBytes());

            // Read pattern bits.
            PatternSimple patternIn = PatternSimple.FromBitArray(new BitArray(File.ReadAllBytes("Test")));

            Console.WriteLine(patternIn);
        }
Esempio n. 2
0
        public void MostPopular_ItemDatabound(object sender, RepeaterItemEventArgs e)
        {
            ChannelSimple channel = (ChannelSimple)e.Item.DataItem;

            if (channel == null)
            {
                return;
            }

            Label     ChannelNumber = (Label)e.Item.FindControl("ChannelNumber");
            HyperLink ChannelName   = (HyperLink)e.Item.FindControl("ChannelName");

            ChannelNumber.Text      = _mostPopularCounter.ToString();
            ChannelName.Text        = channel.ChannelName;
            ChannelName.ToolTip     = channel.ChannelName;
            ChannelName.NavigateUrl = "~/ChannelDetails.aspx?a=v&channelID=" + channel.ChannelID;

            _mostPopularCounter++;
        }
Esempio n. 3
0
        public static PatternSimple FromBitArray(BitArray bitArray)
        {
            int  arrayPos     = 0;
            byte channelCount = (byte)(bitArray.GetBits(ref arrayPos, 2) + 1);

            ChannelSimple[] channels = new ChannelSimple[channelCount];
            for (int i = 0; i < channelCount; i++)
            {
                channels[i] = new ChannelSimple((byte)(bitArray.GetBits(ref arrayPos, 4) + 1));
            }

            for (int i = 0; i < channelCount; i++)
            {
                for (int j = 0; j < channels[i].Length; j++)
                {
                    channels[i].Notes[j] = bitArray.Get(arrayPos++);
                }
            }

            return(new PatternSimple(channels));
        }
Esempio n. 4
0
        public void Channels_Databound(object sender, RepeaterItemEventArgs e)
        {
            ChannelSimple channel = (ChannelSimple)e.Item.DataItem;

            if (channel == null)
            {
                return;
            }

            HyperLink ChannelLink      = (HyperLink)e.Item.FindControl("ChannelLink");
            Literal   SiteMapListRight = (Literal)e.Item.FindControl("SiteMapListRight");

            ChannelLink.Text        = channel.ChannelName;
            ChannelLink.NavigateUrl = "~/ChannelDetails.aspx?a=v&channelID=" + channel.ChannelID;

            if (_channelCounter == 31)
            {
                SiteMapListRight.Text = "</div><div class=\"SiteMapListRight\">";
            }

            _channelCounter++;
        }