示例#1
0
        /// <summary>
        /// Serialize method.
        /// </summary>
        public void Serialize <T>(T obj, string path)
        {
            ISerialiser serialiser = (ISerialiser)Serialiser;

            if (CheckISerialize)
            {
                if (obj is MarkerISerialize.ISerialize)
                {
                    serialiser.Serialize(obj, path);
                }
                else
                {
                    throw new System.InvalidCastException();
                }
            }
            else
            {
                serialiser.Serialize(obj, path);
            }
        }
示例#2
0
        private void buttonSerialize_Click(object sender, EventArgs e)

        {
            if (this.listBoxItems.Items.Count != 0)
            {
                this.openFileDialogSr.Title = "Выберите файл";
                if (openFileDialogSr.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                if (openFileDialogSr.FileName != string.Empty)
                {
                    serialiser.Serialize(openFileDialogSr.FileName, mainList, types);
                }
                MessageBox.Show("Сериализация выполнена");
            }
            else
            {
                MessageBox.Show("Нечего сериализовать :(");
            }
        }
示例#3
0
 public void Serialize <T>(string fullPath, T sourceData)
 {
     _curSerialiser.Serialize(fullPath, sourceData);
 }