예제 #1
0
파일: CodeMap.cs 프로젝트: Xambey/MAIDE
        public CodeMap()
        {
            DoubleBuffered = true;
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            mainBlock = createBlock();
            mainBlock.Title = "Main";
            mainBlock.Fill = true;
        }
예제 #2
0
파일: CodeMap.cs 프로젝트: Xambey/MAIDE
        public void Load(string fileName)
        {
            FileName = fileName;
            Modified = false;
            Controls.Clear();

            FileStream fs = File.OpenRead(fileName);
            char b1 = (char)fs.ReadByte();
            char b2 = (char)fs.ReadByte();
            fs.Seek(0, SeekOrigin.Begin);

            if (b1 == '<' && b2 == '?')
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(fs);

                XmlNode n_blocks = doc.DocumentElement.ChildNodes.Get("blocks");

                foreach (XmlNode b in n_blocks.ChildNodes)
                {
                    CodeBlock block = createBlock();
                    block.Load(b);
                }
            }
            else
            {
                byte[] data = new byte[fs.Length];
                fs.Read(data, 0, (int)fs.Length);

                mainBlock = createBlock();
                mainBlock.Title = "Main";
                mainBlock.CodeEditBox.Text = System.Text.Encoding.UTF8.GetString(data);
                mainBlock.Fill = true;
            }
            fs.Close();
        }
예제 #3
0
파일: CodeMap.cs 프로젝트: Xambey/MAIDE
 private CodeBlock createBlock()
 {
     CodeBlock block = new CodeBlock();
     block.CodeEditBox.TextChanged += CodeEditBox_TextChanged;
     block.Drag += Block_Drag;
     Controls.Add(block);
     return block;
 }