public override byte[] GetPacketData() // 바이트형 패킷(송신용)
    {
        AccountSerializer serializer = new AccountSerializer();

        serializer.Serialize(m_data);
        return(serializer.GetSerializedData());
    }
Example #2
0
    public AccountPacket(byte[] data) // 패킷을 데이터로 변환(수신용)
    {
        AccountSerializer serializer = new AccountSerializer();

        serializer.SetDeserializedData(data);
        serializer.Deserialize(ref m_data);
    }
Example #3
0
        private async void OnChangeSerializer(object sender, RoutedEventArgs e)
        {
            if (sender == _rbtnTextSerializer)
            {
                _serializer = new AccountTextSerializer();
            }
            else if (sender == _rbtnObjectSerializer)
            {
                _serializer = new AccountObjectSerializer();
            }
            else if (sender == _rbtnJSONSerializer)
            {
                _serializer = new AccountJsonSerializer();
            }
            else if (sender == _rbtnSQLiteSerializer)
            {
                _serializer = new AccountSQLiteSerializer();
                MessageDialog noSqliteMsg = new MessageDialog("The SQLite serializer is not implemented. Please choose a different serializer", "Data Persistence");
                await noSqliteMsg.ShowAsync();

                return;
            }


            _txtAcctFileDataPath.Text = _serializer.DataDirectoryPath;

            MessageDialog msgDlg = new MessageDialog("Serializer type has been changed. The storage location was updated.", "Data Persistence");
            await msgDlg.ShowAsync();
        }
Example #4
0
        public MainPage()
        {
            InitializeComponent();

            _newBank    = null;
            _loadedBank = null;
            _serializer = null;

            //determine a default root folder where the application is allowed to write
            AccountSerializer.RootDirectory = ApplicationData.Current.LocalFolder.Path;

            //create the text serializer by default
            _serializer = new AccountTextSerializer();
            _txtAcctFileDataPath.Text = _serializer.DataDirectoryPath;

            //setup the radio buttons to change the serializer when checked
            _rbtnTextSerializer.Checked   += OnChangeSerializer;
            _rbtnObjectSerializer.Checked += OnChangeSerializer;
            _rbtnJSONSerializer.Checked   += OnChangeSerializer;
            _rbtnSQLiteSerializer.Checked += OnChangeSerializer;
        }