Ejemplo n.º 1
0
        public bool Read(string name)
        {
            string fileName = GetRootPath() + "\\" + name;

            try
            {
                if (File.Exists(fileName))
                {
                    XmlSerializer  ser = new XmlSerializer(GetType());
                    FileStream     fs  = new FileStream(fileName, FileMode.Open);
                    CellsParameter var = ser.Deserialize(fs) as CellsParameter;
                    fs.Close();
                    this.Copy(var);
                    return(true);
                }
                else
                {
                    this.Add(new Pattern("初始图形", 50));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("读取文件失败:" + e.Message);
            }
            return(false);
        }
Ejemplo n.º 2
0
 public virtual void Copy(CellsParameter other)
 {
     Clear();
     for (int i = 0; i < other.Count; ++i)
     {
         Pattern item = other[i].Clone();
         Add(item);
     }
 }
Ejemplo n.º 3
0
        public virtual CellsParameter Clone()
        {
            CellsParameter clone = Activator.CreateInstance(GetType()) as CellsParameter;

            foreach (var i in this)
            {
                clone.Add(i.Clone());
            }
            return(clone);
        }