コード例 #1
0
        public bool ReadCamera(Location location)
        {
            ArchiveFileEntry caEntry = (ArchiveFileEntry)_locationDirectory.Childs.TryGetValue(_name + ".ca");

            if (caEntry == null)
            {
                return(true);
            }

            using (CaFileReader caReader = new CaFileReader(caEntry.OpenReadableContentStream()))
            {
                FieldCameras cameras = new FieldCameras(caReader.Rects.Length);
                foreach (CaCamera rect in caReader.Rects)
                {
                    FieldCamera camera = new FieldCamera
                    {
                        XAxis    = rect.XAxis,
                        YAxis    = rect.YAxis,
                        ZAxis    = rect.ZAxis,
                        Position = rect.Position,
                        Zoom     = rect.Zoom
                    };
                    cameras.Add(camera);
                }
                location.FieldCameras = cameras;
            }

            location.SaveRequest &= ~LocationProperty.FieldCamera;
            location.Importable  &= ~LocationProperty.FieldCamera;
            return(true);
        }
コード例 #2
0
 private void Write(FieldCamera camera, XmlElement node)
 {
     Write(camera.XAxis, node.CreateChildElement("XAxis"));
     Write(camera.YAxis, node.CreateChildElement("YAxis"));
     Write(camera.ZAxis, node.CreateChildElement("ZAxis"));
     Write(camera.Position, node.CreateChildElement("Position"));
     node.SetInt16("Zoom", camera.Zoom);
 }