Example #1
0
        public void StoreNew(Data_AppUserWallet data, out bool fileArleadyUsed, IMyLog log)
        {
            fileArleadyUsed = false;
            string file = getWalletFullPath(data.Email);

            if (File.Exists(file))
            {
                fileArleadyUsed = true;
                return;
            }

            try
            {
                using (BinaryWriter bw = new BinaryWriter(OpenFile.ForWrite(file, log)))
                {
                    data.WriteToStream(bw);
                }
            }
            catch (IOException)
            { }
        }
Example #2
0
        public void UpdateAll(
            string Email,
            string Title,
            string[] DisplayLines,
            Data_AppUserFile.eUserStatus RequestedType,
            AmountAndPrice Numbers,
            AmountAndPrice Messages,
            AmountAndPrice Month,
            AmountAndPrice Setup,
            AmountAndPrice FullPayment,
            IMyLog log)
        {
            string filePath = getWalletFullPath(Email);

            using (Stream stream = OpenFile.ForRead(filePath, true, true, log))
            {
                Data_AppUserWallet r = Data_AppUserWallet.CreateBlank();

                //1) read it in
                BinaryReader br = new BinaryReader(stream);
                r.ReadFromStream(br);

                //2) update values
                r.Email         = Email;
                r.Title         = Title;
                r.DisplayLines  = DisplayLines.MyClone();
                r.RequestedType = RequestedType;
                r.Numbers       = Numbers.Clone();
                r.Messages      = Messages.Clone();
                r.Month         = Month.Clone();
                r.Setup         = Setup.Clone();
                r.FullPayment   = FullPayment.Clone();

                //3) write it back
                stream.Seek(0, SeekOrigin.Begin);
                BinaryWriter bw = new BinaryWriter(stream);
                r.WriteToStream(bw);
            }
        }