コード例 #1
0
        public (RolandMemorySection closestSection, int distance) FindClosestToAddress(int address)
        {
            var closestSection = this;
            var distance       = Math.Abs(address - closestSection.StartAddress);

            foreach (var subStruct in Structs)
            {
                var result = subStruct.FindClosestToAddress(address);

                if (result.distance <= distance)
                {
                    closestSection = result.closestSection;
                    distance       = result.distance;
                }
            }

            foreach (var value in Values)
            {
                var result = value.FindClosestToAddress(address);

                if (result.distance <= distance)
                {
                    closestSection = result.closestSection;
                    distance       = result.distance;
                }
            }

            return(closestSection, distance);
        }
コード例 #2
0
 public RolandStruct(RolandMemorySection parent, XElement node)
 {
     Parent     = parent;
     SourceNode = node;
 }