Exemple #1
0
 public Circuit(BlockArray a)
 {
     blockArray = a;
     nodes      = new List <Node>();
     nodeToJoin = new List <List <Node> >();
     makeCircuit();
 }
Exemple #2
0
 public Form1(int height, int width)
 {
     InitializeComponent();
     Block.generateImagesList();
     form        = this;
     blockArray  = new BlockArray(height, width);
     projectStep = true;
     thisBlock   = null;
 }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #7
0
        //private BlockArray blockArray;

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