Example #1
0
        public void WriteCorrectNumOfLines()
        {
            CardArtDb.Write(_tempXml, CreateSampleDefs());
            var lineCount = File.ReadAllLines(_tempXml).Length;

            Assert.AreEqual(31, lineCount);
        }
Example #2
0
        private void SaveChanges()
        {
            var imgX = Canvas.GetLeft(ImgBase);
            var imgY = Canvas.GetTop(ImgBase);

            var rect = new Rectangle();

            rect.Width  = (int)Math.Round(512 / _imgScale);
            rect.Height = (int)Math.Round(117 / _imgScale);
            rect.X      = (int)Math.Round((imgX * -1) / _imgScale);
            var yFlip = (int)Math.Round((197.5 - imgY) / _imgScale);

            rect.Y = (int)Math.Round(512.0 - rect.Height - yFlip);

            var original = _barContext.GetRectangle();

            if (original != rect)
            {
                // rectangles are different save changes
                _barContext.SetRectangle(rect);
                _barContext.Save();
                StatusWrite($"Changes saved {_barContext.CardId}");
                // write the changes to the mapfile
                CardArtDb.Write(_mapFile, CardArtDb.Defs);
            }
        }