Ejemplo n.º 1
0
        public static DrawNumberData Load(string file)
        {
            using (FileStream fs = File.OpenRead(file))
            {
                byte[] itemLenArray = new byte[4];
                fs.Read(itemLenArray, 0, 4);

                int itemLen = BitConverter.ToInt32(itemLenArray, 0);

                byte[] itemData = new byte[itemLen];
                fs.Read(itemData, 0, itemData.Length);

                MemoryStream   ms         = new MemoryStream(itemData);
                DrawNumberItem puzzleItem = DrawNumberItem.FromStream(ms);
                ms.Dispose();

                byte[] imageLenArray = new byte[4];
                fs.Read(imageLenArray, 0, 4);

                int imageSize = BitConverter.ToInt32(imageLenArray, 0);

                byte[] imageData = new byte[imageSize];
                fs.Read(imageData, 0, imageSize);

                fs.Read(imageLenArray, 0, 4);

                imageSize = BitConverter.ToInt32(imageLenArray, 0);

                byte[] numberImageData = new byte[imageSize];
                fs.Read(numberImageData, 0, imageSize);

                return(new DrawNumberData(puzzleItem, imageData, numberImageData));
            }
        }
Ejemplo n.º 2
0
        private ThumbnailItem win_DataItemLoadedEvent(string file)
        {
            DrawNumberItem item = DrawNumberData.LoadDrawNumberItem(file);

            item.DataFile = file;
            this.drawNumberCollection.Add(item);
            return(item);
        }
        private ThumbnailItem win_DataItemLoadedEvent(string file)
        {
            DrawNumberItem item = DrawNumberData.LoadDrawNumberItem(file);

            item.DataFile = file;
            string key = item.PointCollection.Count.ToString("000");

            if (this.sortedDrawNumberItemList.ContainsKey(key))
            {
                key += Guid.NewGuid().ToString("N");
            }
            this.sortedDrawNumberItemList.Add(key, item);
            return(item);
        }
Ejemplo n.º 4
0
        public static DrawNumberItem LoadDrawNumberItem(string file)
        {
            using (FileStream fs = File.OpenRead(file))
            {
                byte[] itemLenArray = new byte[4];
                fs.Read(itemLenArray, 0, 4);

                int itemLen = BitConverter.ToInt32(itemLenArray, 0);

                byte[] itemData = new byte[itemLen];
                fs.Read(itemData, 0, itemData.Length);

                MemoryStream   ms   = new MemoryStream(itemData);
                DrawNumberItem item = DrawNumberItem.FromStream(ms);
                ms.Dispose();

                return(item);
            }
        }
Ejemplo n.º 5
0
        private void Update()
        {
            if (!this.update)
            {
                return;
            }

            DrawNumberItem item = ControlMgr.Instance.DataMgr.SelectedItem;

            if (item == null)
            {
                return;
            }

            DrawNumberControl.Instance.SelectedStage = ControlMgr.Instance.DataMgr.CurrentIndex;

            this.drawNumberData = DrawNumberData.Load(item.DataFile);

            Size imgSize = new Size();

            imgSize.Width  = this.drawNumberData.DrawNumberItem.CanvasWidth;
            imgSize.Height = this.drawNumberData.DrawNumberItem.CanvasHeight;
            if (imgSize.Width < 1.0f)
            {
                imgSize.Width = this.drawNumberData.DrawNumberItem.CanvasWidth;
            }
            if (imgSize.Height < 1.0f)
            {
                imgSize.Height = this.drawNumberData.DrawNumberItem.CanvasHeight;
            }
            Vector vec = GC_UIHelper.MatchImageToWnd(imgSize, new Size(panelGrid.ActualWidth, panelGrid.ActualHeight));

            this.drawNumberCanvas.Width  = vec.X; // this.drawNumberData.DrawNumberItem.CanvasWidth;
            this.drawNumberCanvas.Height = vec.Y; // this.drawNumberData.DrawNumberItem.CanvasHeight;

            this.drawNumberCanvas.Data = this.drawNumberData;
            this.update = false;
        }
Ejemplo n.º 6
0
 internal void Add(DrawNumberItem item)
 {
     this.drawNumberCollection.Add(item);
 }
Ejemplo n.º 7
0
 public DrawNumberData(DrawNumberItem item, byte[] bkImageData, byte[] drawNumberImageData)
 {
     this.item = item;
     this.backgroundImageData = bkImageData;
     this.drawNumberImageData = drawNumberImageData;
 }
Ejemplo n.º 8
0
 public DrawNumberData()
 {
     this.item = new DrawNumberItem();
 }