コード例 #1
0
ファイル: PolygonData.cs プロジェクト: Arnyev/GK
 public void SetDataFromDto(PolygonDTO polygonDto)
 {
     _points = polygonDto.Points;
     _verticalHorizontals = polygonDto.VerticalHorizontals;
     _maxSizes            = polygonDto.MaxSizes;
     _currentPointCount   = polygonDto.CurrentPointCount;
 }
コード例 #2
0
ファイル: PolygonData.cs プロジェクト: Arnyev/GK
        public PolygonDTO GetPolygonDTO()
        {
            var polygonDto = new PolygonDTO
            {
                Points = _points,
                VerticalHorizontals = _verticalHorizontals,
                MaxSizes            = _maxSizes,
                CurrentPointCount   = _currentPointCount
            };

            return(polygonDto);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: Arnyev/GK
        private void SaveButton_Click(object sender, EventArgs e)
        {
            var fileDialog = new SaveFileDialog();

            if (fileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var serializer = new BinaryFormatter();

            var path = fileDialog.FileName;
            var file = File.Create(path);

            var polygonsDto = new PolygonDTO[PolygonCount];

            for (int i = 0; i < PolygonCount; i++)
            {
                polygonsDto[i] = _polygons[i].GetPolygonDTO();
            }

            serializer.Serialize(file, polygonsDto);
            file.Close();
        }