Пример #1
0
 public Circuit(BlockArray a)
 {
     blockArray = a;
     nodes      = new List <Node>();
     nodeToJoin = new List <List <Node> >();
     makeCircuit();
 }
Пример #2
0
 public Form1(int height, int width)
 {
     InitializeComponent();
     Block.generateImagesList();
     form        = this;
     blockArray  = new BlockArray(height, width);
     projectStep = true;
     thisBlock   = null;
 }
Пример #3
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path = ofd.FileName;
                blockArray = FileXML.loadArray(blockArray, path);
            }
        }
Пример #4
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path = sfd.FileName;
                blockArray = FileXML.saveArray(blockArray, path);
            }
        }
Пример #5
0
        public static BlockArray saveArray(BlockArray blockArray, string path)
        {
            Type          type;
            XmlSerializer writer;
            //string path;
            StreamWriter file;

            type   = typeof(BlockArray);
            writer = new XmlSerializer(type);
            path  += ".xml";
            file   = new StreamWriter(path);

            writer.Serialize(file, blockArray);
            file.Close();
            return(blockArray);
        }
Пример #6
0
        public static BlockArray loadArray(BlockArray blockArray, string path)
        {
            Type          type;
            XmlSerializer writer;
            //string path;
            StreamReader  reader;
            BlockArray    newBlockArray;
            List <Button> buttons;

            type   = typeof(BlockArray);
            writer = new XmlSerializer(type);
            //path = @"D:\!Duperele\!Dysk Google\zz Pulpit\" + type.ToString() + ".xml";
            reader  = new StreamReader(path);
            buttons = new List <Button>();

            foreach (List <Block> list in blockArray.blocks)
            {
                foreach (Block block in list)
                {
                    buttons.Add(block.button);
                }
            }

            Block.clearCounter();
            newBlockArray = writer.Deserialize(reader) as BlockArray;
            reader.Close();

            int buttonIndex = 0;

            foreach (List <Block> list in newBlockArray.blocks)
            {
                foreach (Block block in list)
                {
                    block.blockArray = newBlockArray;
                    block.button     = buttons[buttonIndex];
                    block.changeImage(0);
                    block.rotateImage(block.rotateNumber);
                    block.setValue(block.value);
                    buttonIndex++;
                }
            }

            return(newBlockArray);
        }
Пример #7
0
        //private BlockArray blockArray;

        public FileXML(BlockArray bA)
        {
            //blockArray = bA;
        }