Ejemplo n.º 1
0
        public static BitmaskGroup Parse(string[] input)
        {
            var mask = new BitmaskGroup();

            mask.Mask = input.First().Split(" = ").Skip(1).First();

            foreach (var value in input.Skip(1))
            {
                var groups = regex.Match(value).Groups;
                var bits   = Convert.ToString(long.Parse(groups["value"].Value), 2);
                mask.Values[long.Parse(groups["addr"].Value)] = bits.PadLeft(36, '0');
            }

            return(mask);
        }
Ejemplo n.º 2
0
        public static Proccessor Parse(string[] input)
        {
            var processor = new Proccessor();
            var group     = new List <string>();

            for (var i = 0; i < input.Length; i++)
            {
                group.Add(input[i]);

                if (i == input.Length - 1 || input[i + 1].StartsWith("mask"))
                {
                    processor.Masks.Add(BitmaskGroup.Parse(group.ToArray()));
                    group = new List <string>();
                }
            }

            return(processor);
        }