コード例 #1
0
        private void buttonItem4_Click(object sender, EventArgs e)
        {
            Stream         StreamRead;
            OpenFileDialog DialogueCharger = new OpenFileDialog();

            DialogueCharger.DefaultExt = "shape";
            DialogueCharger.Title      = "Load shape";
            DialogueCharger.Filter     = "frame files (*.shape)|*.shape|All files (*.*)|*.*";
            if (DialogueCharger.ShowDialog() == DialogResult.OK)
            {
                if ((StreamRead = DialogueCharger.OpenFile()) != null)
                {
                    BinaryFormatter BinaryRead           = new BinaryFormatter();
                    Base_Function.BASE_COMMON.Class1 cls = new Base_Function.BASE_COMMON.Class1();
                    cls = (Base_Function.BASE_COMMON.Class1)BinaryRead.Deserialize(StreamRead);
                    StreamRead.Close();
                    if (isChild)
                    {
                        this.phChild.dbList = cls.List;
                    }
                    else
                    {
                        this.ph.dbList = cls.List;
                    }
                    this.ppcPreview.InvalidatePreview();
                }
            }
        }
コード例 #2
0
 public bool LoadObj()
 {
     try
     {
         Stream         StreamRead;
         OpenFileDialog DialogueCharger = new OpenFileDialog();
         DialogueCharger.DefaultExt = "sobj";
         DialogueCharger.Title      = "Load sobj";
         DialogueCharger.Filter     = "frame files (*.sobj)|*.sobj|All files (*.*)|*.*";
         if (DialogueCharger.ShowDialog() == DialogResult.OK)
         {
             if ((StreamRead = DialogueCharger.OpenFile()) != null)
             {
                 BinaryFormatter BinaryRead = new BinaryFormatter();
                 ArrayList       a          = (ArrayList)BinaryRead.Deserialize(StreamRead);
                 //this.s = (ArrayList)BinaryRead.Deserialize(StreamRead);
                 this.s.setList(a);
                 StreamRead.Close();
                 this.s.afterLoad();
                 this.redraw(true);
                 return(true);
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Exception:" + e.ToString(), "Load error:");
     }
     return(false);
 }