private void FormatTransferType()
 {
     cbProcessType.DataSource    = TransferType.GetTypes();
     cbProcessType.DisplayMember = "Description";
     cbProcessType.ValueMember   = "Id";
     cbProcessType.DropDownStyle = ComboBoxStyle.DropDownList;
 }
Esempio n. 2
0
 public DataTransferEventArgs(TransferType type, PacketFamily family, PacketAction action, byte[] rawData)
 {
     Type         = type;
     PacketFamily = family;
     PacketAction = action;
     RawByteData  = rawData;
 }
Esempio n. 3
0
 public DataTransferEventArgs(TransferType type, PacketFamily family, PacketAction action, byte[] rawData)
 {
     Type = type;
     PacketFamily = family;
     PacketAction = action;
     RawByteData = rawData;
 }
 public TransferForm(TransferType tt, List <ADBFile> myfiles, string path, FileManager fm)
 {
     InitializeComponent();
     IsChangeValue              = false;
     ExternalMethod.CounterEx   = 0;
     progressBar_transfer.Value = 0;
     Path       = path;
     MyFiles    = myfiles;
     FM         = fm;
     TransferTp = tt;
     progressBar_transfer.Maximum = 100;
     timer_5s.Start();
     label_totalFiles.Text = label_totalSize.Text = "•••";
     if (tt == TransferType.BackingUp)
     {
         DirectoryInfo di = new DirectoryInfo(path);
         label_transferTo.Text = "from => " + di.Name.DecodingText().Replace(@"\", "");
     }
     else
     {
         label_transferTo.Text = "to => " + path.DecodingText().Replace(@"\", "");
     }
     this.Text = tt.ToString();
     backgroundWorker_SetLabels.RunWorkerAsync();
 }
Esempio n. 5
0
        private void SelectConnection(TransferType type)
        {
            switch (type)
            {
            case TransferType.DEFAULT:
                _transfer = new DefaultTransfer(Settings.Instance().Server.IpAddress,
                                                Settings.Instance().Server.Port);
                break;

            case TransferType.SOCKS5:
                if (Settings.Instance().Server.Method.Name == "UnamePasswd")
                {
                    _transfer = new Socks5Transfer(Settings.Instance().Server.IpAddress,
                                                   Settings.Instance().Server.Port,
                                                   BaseConstants.Methods.UNAME_PASSWD);
                }
                else if (Settings.Instance().Server.Method.Name == "LoginHmac")
                {
                    _transfer = new Socks5Transfer(Settings.Instance().Server.IpAddress,
                                                   Settings.Instance().Server.Port,
                                                   BaseConstants.Methods.LOGIN_HMAC);
                }
                break;
            }
        }
Esempio n. 6
0
 public void SetTransferType(TransferType ttType)
 {
     try
     {
         if (ttType == TransferType.Binary)
         {
             this.SendCommand("TYPE I");
         }
         else
         {
             this.SendCommand("TYPE A");
         }
     }
     catch (Exception exception)
     {
         this.DisConnect();
         throw exception;
     }
     if (this._iReplyCode != 200)
     {
         this.DisConnect();
         throw new IOException(this._strReply.Substring(4));
     }
     this._trType = ttType;
 }
Esempio n. 7
0
        public int DoGridTransferAddItem(string text, TransferType TType, bool PutInTheQueue)
        {
            TransferEntry myTE = new TransferEntry()
            {
                Name       = text,
                SubmitTime = DateTime.Now,
                Type       = TType
            };

            dataGridViewTransfer.Invoke(new Action(() =>
            {
                _MyListTransfer.Add(myTE);
            }
                                                   ));
            int indexloc = _MyListTransfer.IndexOf(myTE);

            if (PutInTheQueue)
            {
                _MyListTransferQueue.Add(indexloc);
                myTE.processedinqueue = true;
                myTE.State            = TransferState.Queued;
            }
            else
            {
                myTE.processedinqueue = false;
                myTE.State            = TransferState.Processing;
                myTE.StartTime        = DateTime.Now;
            }

            // refresh number in tab
            tabPageTransfers.Invoke(new Action(() => tabPageTransfers.Text = string.Format(Constants.TabTransfers + " ({0})", _MyListTransfer.Count())));
            return(indexloc);
        }
        public bool Transfer(long from, long to, double amount, TransferType type)
        {
            var wallet   = GetCreditWalletByUserId(from);
            var toWallet = GetCreditWalletByUserId(to);

            if ((wallet != null) && (toWallet != null))
            {
                //Take money from the from wallet
                var walletMinusAmount = wallet.CurrentAmount - (decimal)amount;
                if (walletMinusAmount < 0)
                {
                    return(false);
                }
                //Continue if is updated
                var hasUpdatedFromWallet = UpdateWallet(wallet);
                if (hasUpdatedFromWallet)
                {
                    //Add transaction record for the from
                    _creditTransactionService.AddMoCreditsTransaction(to, from, amount, type, null);
                    //Add money to the to wallet
                    toWallet.CurrentAmount += (decimal)amount;
                    var hasUpdatedToWallet = UpdateWallet(toWallet);
                    //Add transaction record to the to
                    if (hasUpdatedToWallet)
                    {
                        _creditTransactionService.AddMoCreditsTransaction(to, from, amount, type, null);
                    }
                    return(true);
                }
            }
            return(false);
        }
        public TransferObjectModel(MegaSDK megaSdk, IMegaNode selectedNode, TransferType transferType,
                                   string filePath, string downloadFolderPath = null) : base(megaSdk)
        {
            switch (transferType)
            {
            case TransferType.Download:
            {
                DisplayName = selectedNode.Name;
                break;
            }

            case TransferType.Upload:
            {
                DisplayName = Path.GetFileName(filePath);
                break;
            }
            }

            Type                  = transferType;
            FilePath              = filePath;
            DownloadFolderPath    = downloadFolderPath;
            Status                = TransferStatus.NotStarted;
            SelectedNode          = selectedNode;
            CancelButtonState     = true;
            TransferButtonIcon    = new Uri("/Assets/Images/cancel transfers.Screen-WXGA.png", UriKind.Relative);
            AutoLoadImageOnFinish = false;
            CancelTransferCommand = new DelegateCommand(CancelTransfer);
            SetThumbnail();
        }
        private static List<int> _MyListTransferQueue; // List of transfers in the queue. It contains the index in the order of schedule

        #endregion Fields

        #region Methods

        public int DoGridTransferAddItem(string text, TransferType TType, bool PutInTheQueue)
        {
            TransferEntry myTE = new TransferEntry()
            {
                Name = text,
                SubmitTime = DateTime.Now,
                Type = TType
            };

            dataGridViewTransfer.Invoke(new Action(() =>
            {
                _MyListTransfer.Add(myTE);

            }
                ));
            int indexloc = _MyListTransfer.IndexOf(myTE);

            if (PutInTheQueue)
            {
                _MyListTransferQueue.Add(indexloc);
                myTE.processedinqueue = true;
                myTE.State = TransferState.Queued;

            }
            else
            {
                myTE.processedinqueue = false;
                myTE.State = TransferState.Processing;
                myTE.StartTime = DateTime.Now;
            }

            // refresh number in tab
            tabPageTransfers.Invoke(new Action(() => tabPageTransfers.Text = string.Format(Constants.TabTransfers + " ({0})", _MyListTransfer.Count())));
            return indexloc;
        }
Esempio n. 11
0
        public Search(string token, IWin32Window owner, TransferType transferType, bool closeOnTransfer)
        {
            _owner = (Form)owner;
            _token = token;
            _transferType = transferType;
            _closeOnTransfer = closeOnTransfer;

            if (!string.IsNullOrEmpty(token))
            {

                // instantiate our ChemSpider Search instance
                _cs = new ChemSpiderSearch.Search();

                // instantiate our ChemSpider InChI instance
                _ci = new ChemSpiderInChI.InChI();

                // setup event handlers
                _cs.ElementsSearchCompleted += (cs_ElementsSearchCompleted);
                _cs.IntrinsicPropertiesSearchCompleted += (cs_IntrinsicPropertiesSearchCompleted);
                _cs.LassoSearchCompleted += (cs_LassoSearchCompleted);
                _cs.PredictedPropertiesSearchCompleted += (cs_PredictedPropertiesSearchCompleted);
                _cs.SimilaritySearchCompleted += (cs_SimilaritySearchCompleted);
                _cs.SimpleSearchCompleted += (cs_SimpleSearchCompleted);
                _cs.StructureSearchCompleted += (cs_StructureSearchCompleted);
                _cs.SubstructureSearchCompleted += (cs_SubstructureSearchCompleted);
                _cs.GetAsyncSearchResultCompleted += (_cs_GetAsyncSearchResultCompleted);
                _cs.GetAsyncSearchResultPartCompleted += (_cs_GetAsyncSearchResultPartCompleted);
            }
            else
            {
                MessageBox.Show(owner, "ChemSpider token not set", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (VirtualAssetName.Length != 0)
            {
                hash ^= VirtualAssetName.GetHashCode();
            }
            if (TransferType != 0)
            {
                hash ^= TransferType.GetHashCode();
            }
            if (Amount.Length != 0)
            {
                hash ^= Amount.GetHashCode();
            }
            if (DestinationAddress.Length != 0)
            {
                hash ^= DestinationAddress.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 13
0
        public TransferType ConvertToBusinessLogicEntity(DalTransferType dataEntity)
        {
            var result = new TransferType(dataEntity.Id, dataEntity.Text);

            result.IsDirty = false;
            return(result);
        }
Esempio n. 14
0
        /// <summary>
        /// Prompts for details on new transfers
        /// </summary>
        /// <returns>A NewTransfer object containing info to send to server</returns>
        public NewTransfer PromptForTransfer(TransferType transferType)
        {
            //user to/from
            Console.Write($"Enter ID of user you are {(transferType == TransferType.Request ? "requesting from" : "sending to")}: ");
            string userInput = Console.ReadLine();

            if (!int.TryParse(userInput, out int otherUser))
            {
                Console.WriteLine("Invalid input. Please enter only a number.");
                return(null);
            }

            //amount
            Console.Write($"Enter amount to {transferType.ToString().ToLower()}: $");
            if (!decimal.TryParse(Console.ReadLine(), out decimal amount))
            {
                Console.WriteLine("Invalid input. Please enter only a number.");
                return(null);
            }

            int currentUser = UserService.GetUserId();

            NewTransfer newTransfer = new NewTransfer()
            {
                TransferType = transferType,
                UserFrom     = transferType == TransferType.Request ? otherUser : currentUser,
                UserTo       = transferType == TransferType.Request ? currentUser : otherUser,
                Amount       = amount
            };

            return(newTransfer);
        }
        //transfers a film from local file system to remote user account
        public TransferPacket(Production production, TransferType type)
        {
            ItemID = production.Film.ID;
            Parent = production;

            switch (type)
            {
            case TransferType.UploadFilmDirectory:
                SourcePath = ProductionPathHelper.GetLocalProductionHashDirectory(production);
                TargetPath = Settings.FtpHashSubdirectory;
                LoginData  = Settings.MasterLogin;
                break;

            case TransferType.UploadFilmPreviewDirectory:
                SourcePath = ProductionPathHelper.GetLocalProductionPreviewDirectory(production);
                TargetPath = ExternalPathHelper.GetProductionPreviewDirectory(production);
                LoginData  = Settings.MasterLogin;
                break;

            case TransferType.UploadProductPreviewDirectory:
                SourcePath = ProductionPathHelper.GetLocalProductPreviewProductionDirectory(production);
                TargetPath = Settings.FtpProductPreviewSubdirectory;
                LoginData  = Settings.MasterLogin;
                break;
            }

            Type = type;
        }
        public static OptionSetValue GetTransferType(TransferType transferType)
        {
            int value = -1;

            switch (transferType)
            {
            case TransferType.NotSpecified:
                value = 950000003;
                break;

            case TransferType.Inbound:
                value = 950000000;
                break;

            case TransferType.Outbound:
                value = 950000001;
                break;

            case TransferType.TransferBetweenHotels:
                value = 950000002;
                break;

            default:
                value = 950000003;
                break;
            }

            return(new OptionSetValue(value));
        }
Esempio n. 17
0
        public static Task StartTransferTypeAndErrorServer(
            TransferType transferType,
            TransferError transferError,
            out IPEndPoint localEndPoint)
        {
            return(CreateServerAsync((server, url) => AcceptSocketAsync(server, async(client, stream, reader, writer) =>
            {
                // Read past request headers.
                string line;
                while (!string.IsNullOrEmpty(line = reader.ReadLine()))
                {
                    ;
                }

                // Determine response transfer headers.
                string transferHeader = null;
                string content = "This is some response content.";
                if (transferType == TransferType.ContentLength)
                {
                    transferHeader = transferError == TransferError.ContentLengthTooLarge ?
                                     $"Content-Length: {content.Length + 42}\r\n" :
                                     $"Content-Length: {content.Length}\r\n";
                }
                else if (transferType == TransferType.Chunked)
                {
                    transferHeader = "Transfer-Encoding: chunked\r\n";
                }

                // Write response header
                await writer.WriteAsync("HTTP/1.1 200 OK\r\n").ConfigureAwait(false);
                await writer.WriteAsync($"Date: {DateTimeOffset.UtcNow:R}\r\n").ConfigureAwait(false);
                await writer.WriteAsync("Content-Type: text/plain\r\n").ConfigureAwait(false);
                if (!string.IsNullOrEmpty(transferHeader))
                {
                    await writer.WriteAsync(transferHeader).ConfigureAwait(false);
                }
                await writer.WriteAsync("\r\n").ConfigureAwait(false);

                // Write response body
                if (transferType == TransferType.Chunked)
                {
                    string chunkSizeInHex = string.Format(
                        "{0:x}\r\n",
                        content.Length + (transferError == TransferError.ChunkSizeTooLarge ? 42 : 0));
                    await writer.WriteAsync(chunkSizeInHex).ConfigureAwait(false);
                    await writer.WriteAsync($"{content}\r\n").ConfigureAwait(false);
                    if (transferError != TransferError.MissingChunkTerminator)
                    {
                        await writer.WriteAsync("0\r\n\r\n").ConfigureAwait(false);
                    }
                }
                else
                {
                    await writer.WriteAsync($"{content}\r\n").ConfigureAwait(false);
                }
                await writer.FlushAsync().ConfigureAwait(false);

                client.Shutdown(SocketShutdown.Both);
            }), out localEndPoint));
        }
Esempio n. 18
0
 public TransferForm(TransferType transfer_type, List <string> FilesForUpload, string path, DeviceData device)
 {
     InitializeComponent();
     ExternalMethod.CounterEx   = 0;
     progressBar_transfer.Value = 0;
     Path = path;
     FilesAndDirecoriesForUpload = FilesForUpload;
     FM         = new FileManager(device);
     TransferTp = transfer_type;
     progressBar_transfer.Maximum = 100;
     timer_5s.Interval            = 500;
     timer_5s.Start();
     label_totalFiles.Text = label_totalSize.Text = "•••";
     if (transfer_type == TransferType.BackingUp)
     {
         DirectoryInfo di = new DirectoryInfo(path);
         label_transferTo.Text = "From => " + di.Name.DecodingText().Replace(@"\", "");
     }
     else
     {
         label_transferTo.Text = "to => " + path.DecodingText().Replace(@"\", "");
     }
     this.Text = transfer_type.ToString();
     backgroundWorker_SetLabels.RunWorkerAsync();
 }
Esempio n. 19
0
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
            case "A":
                _connectionType = TransferType.Ascii;
                break;

            case "I":
                _connectionType = TransferType.Image;
                break;

            default:
                return("504 Command not implemented for that parameter");
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                case "N":
                    _formatControlType = FormatControlType.NonPrint;
                    break;

                default:
                    return("504 Command not implemented for that parameter");
                }
            }

            // eschew 'field assigned but its value is never used' warning
            System.Diagnostics.Debug.WriteLine($"_formatControlType = {_formatControlType}");
            return(string.Format("200 Type set to {0}", _connectionType));
        }
Esempio n. 20
0
 private void TransferSingleTaskSmallFile(FileTask task, TransferType taskType)
 {
     try
     {
         SocketClient client = SocketFactory.GenerateConnectedSocketClient(task, 1);
         if (taskType == TransferType.Upload)
         {
             int    pt           = 0;
             byte[] headerBytes  = BytesConverter.WriteString(new byte[4], task.RemotePath, ref pt);
             byte[] contentBytes = File.ReadAllBytes(task.LocalPath);
             byte[] bytes        = new byte[headerBytes.Length + contentBytes.Length];
             Array.Copy(headerBytes, 0, bytes, 0, headerBytes.Length);
             Array.Copy(contentBytes, 0, bytes, headerBytes.Length, contentBytes.Length);
             client.SendBytes(SocketPacketFlag.UploadRequest, bytes);
             client.ReceiveBytesWithHeaderFlag(SocketPacketFlag.UploadAllowed, out byte[] recvBytes);
             client.Close();
         }
         else
         {
             client.SendBytes(SocketPacketFlag.DownloadRequest, task.RemotePath);
             client.ReceiveBytesWithHeaderFlag(SocketPacketFlag.DownloadAllowed, out byte[] bytes);
             client.Close();
             File.WriteAllBytes(task.LocalPath, bytes);
         }
         this.Record.CurrentFinished = task.Length;
         task.Status = FileTaskStatus.Success;
     }
     catch (Exception ex)
     {
         task.Status = FileTaskStatus.Failed;
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
 }
Esempio n. 21
0
        public FrmSetCoordSys(TransferType m_CurrentType)
        {
            this.m_CurrentType = m_CurrentType;
            this.m_CoorSysString = "";

            InitializeComponent();
        }
Esempio n. 22
0
        public frmResults(int[] results, ChemSpiderSearch.Search cs, ChemSpiderInChI.InChI ci, string token, TransferType transferType, bool closeOnTransfer)
        {
            _cs = cs;
            _ci = ci;
            _token = token;
            _results = results;
            _transferType = transferType;
            _closeOnTransfer = closeOnTransfer;

            InitializeComponent();

            tsbTransfer.Enabled = (transferType != TransferType.None);

            if (_results.Length == 1)
            {
                tsbMovePrevious.Enabled = false;
                tsbMoveNext.Enabled = false;
                tsbMoveFirst.Enabled = false;
                tsbMoveLast.Enabled = false;
            }
            else
            {
                tsbMoveFirst.Enabled = false;
                tsbMovePrevious.Enabled = false;
                tsbMoveLast.Enabled = true;
                tsbMoveNext.Enabled = true;
            }
            Navigate(0);
        }
Esempio n. 23
0
 public DepositConfirmed Confirm(
     string playerAccountName,
     string playerAccountNumber,
     string referenceNumber,
     decimal amount,
     TransferType transferType,
     DepositMethod depositMethod,
     string remark,
     string confirmedBy,
     Guid?idFrontImage = null,
     Guid?idBackImage  = null,
     Guid?receiptImage = null)
 {
     Data.Confirmed           = DateTimeOffset.Now.ToBrandOffset(Data.Player.Brand.TimezoneId);
     Data.ConfirmedBy         = confirmedBy;
     Data.PlayerAccountName   = playerAccountName;
     Data.PlayerAccountNumber = playerAccountNumber;
     Data.BankReferenceNumber = referenceNumber;
     Data.Amount        = amount;
     Data.TransferType  = transferType;
     Data.DepositMethod = depositMethod;
     Data.IdFrontImage  = idFrontImage;
     Data.IdBackImage   = idBackImage;
     Data.ReceiptImage  = receiptImage;
     SetRemark(remark, false);
     ChangeState(OfflineDepositStatus.Processing);
     return(new DepositConfirmed
     {
         DepositId = Data.Id,
         PlayerId = Data.PlayerId,
         Amount = Data.Amount,
         Remarks = Data.Remark,
         DepositType = Data.DepositType
     });
 }
Esempio n. 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <param name="transferType"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public static TransferResult MakeTransfer(IBankAccount account, TransferType transferType, double amount)
        {
            switch (transferType)
            {
            case TransferType.deposit:
                if (amount > account.MaxTransactionLimit)
                {
                    return(TransferResult.MaxTransactionLimitExceeded);
                }

                else
                {
                    account.Deposit(amount);
                    return(TransferResult.TransferOK);
                }
            // return TransferResult.TransferOK;

            case TransferType.withdraw:
                if (amount > account.Balance)
                {
                    return(TransferResult.NotEnoughBalance);
                }
                else
                {
                    account.Withdraw(amount);
                    return(TransferResult.TransferOK);
                }
            }
            return(TransferResult.TransferOK);
        }
Esempio n. 25
0
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
            case "A":
                _connectionType = TransferType.Ascii;
                break;

            case "I":
                _connectionType = TransferType.Image;
                break;

            default:
                return("504 Command not implemented for that parameter");
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                case "N":
                    break;

                default:
                    return("504 Command not implemented for that parameter");
                }
            }

            return(string.Format("200 Type set to {0}", _connectionType));
        }
Esempio n. 26
0
        private async Task <bool> PutBytes(byte[] binary, byte index, TransferType transferType)
        {
            byte[] length = Util.GetBytes(binary.Length);

            //Get token
            byte[] header = Util.CombineArrays(new byte[] { 1 }, length, new[] { (byte)transferType, index });

            var rawMessageArgs = await SendMessageAsync <PutBytesResponse>(Endpoint.PutBytes, header);

            if (rawMessageArgs.Success == false)
            {
                return(false);
            }

            byte[] tokenResult = rawMessageArgs.Response;
            byte[] token       = tokenResult.Skip(1).ToArray();

            const int BUFFER_SIZE = 2000;

            //Send at most 2000 bytes at a time
            for (int i = 0; i <= binary.Length / BUFFER_SIZE; i++)
            {
                byte[] data       = binary.Skip(BUFFER_SIZE * i).Take(BUFFER_SIZE).ToArray();
                byte[] dataHeader = Util.CombineArrays(new byte[] { 2 }, token, Util.GetBytes(data.Length));
                var    result     = await SendMessageAsync <PutBytesResponse>(Endpoint.PutBytes, Util.CombineArrays(dataHeader, data));

                if (result.Success == false)
                {
                    await AbortPutBytesAsync(token);

                    return(false);
                }
            }

            //Send commit message
            uint crc = Crc32.Calculate(binary);

            byte[] crcBytes      = Util.GetBytes(crc);
            byte[] commitMessage = Util.CombineArrays(new byte[] { 3 }, token, crcBytes);
            var    commitResult  = await SendMessageAsync <PutBytesResponse>(Endpoint.PutBytes, commitMessage);

            if (commitResult.Success == false)
            {
                await AbortPutBytesAsync(token);

                return(false);
            }


            //Send complete message
            byte[] completeMessage = Util.CombineArrays(new byte[] { 5 }, token);
            var    completeResult  = await SendMessageAsync <PutBytesResponse>(Endpoint.PutBytes, completeMessage);

            if (completeResult.Success == false)
            {
                await AbortPutBytesAsync(token);
            }
            return(completeResult.Success);
        }
Esempio n. 27
0
 public Transfer(BankManager bankManager, IAccount account, string accountNumber, double amount)
 {
     this.bankManager = bankManager;
     FromAccount      = account;
     ToAccountNumber  = accountNumber;
     Amount           = amount;
     TransferType     = Bank.TransferType.Charge;
 }
 /// <summary>
 /// Initializes a new instance of the AvailableSkuRequest class.
 /// </summary>
 /// <param name="transferType">Type of the transfer. Possible values
 /// include: 'ImportToAzure', 'ExportFromAzure'</param>
 /// <param name="country">ISO country code. Country for hardware
 /// shipment. For codes check:
 /// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements</param>
 /// <param name="location">Location for data transfer. For locations
 /// check:
 /// https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01</param>
 /// <param name="skuNames">Sku Names to filter for available
 /// skus</param>
 public AvailableSkuRequest(TransferType transferType, string country, string location, IList <SkuName?> skuNames = default(IList <SkuName?>))
 {
     TransferType = transferType;
     Country      = country;
     Location     = location;
     SkuNames     = skuNames;
     CustomInit();
 }
 public void Update(TransferTypeViewModel transferTypeVM)
 {
     var TransferType = new TransferType
     {
         TransferTypeId   = transferTypeVM.TransferTypeId,
         TransferTypeName = transferTypeVM.TransferTypeName
     };
 }
 /// <summary>
 /// Initializes a new instance of the
 /// DataTransferDetailsValidationRequest class.
 /// </summary>
 /// <param name="deviceType">Device type. Possible values include:
 /// 'DataBox', 'DataBoxDisk', 'DataBoxHeavy'</param>
 /// <param name="transferType">Type of the transfer. Possible values
 /// include: 'ImportToAzure', 'ExportFromAzure'</param>
 /// <param name="dataExportDetails">List of DataTransfer details to be
 /// used to export data from azure.</param>
 /// <param name="dataImportDetails">List of DataTransfer details to be
 /// used to import data to azure.</param>
 public DataTransferDetailsValidationRequest(SkuName deviceType, TransferType transferType, IList <DataExportDetails> dataExportDetails = default(IList <DataExportDetails>), IList <DataImportDetails> dataImportDetails = default(IList <DataImportDetails>))
 {
     DataExportDetails = dataExportDetails;
     DataImportDetails = dataImportDetails;
     DeviceType        = deviceType;
     TransferType      = transferType;
     CustomInit();
 }
Esempio n. 31
0
 public FrmMain()
 {
     //this.m_PrjType = ProjectType.Unknown;
     this.m_CurrentType = TransferType.DaDiToZhiJiao; ;
     this.m_Central_Meridian = -1;
     this.inRecCount = 0;
     InitializeComponent();
 }
 /// <summary>
 /// Initializes a new instance of the SkuAvailabilityValidationRequest
 /// class.
 /// </summary>
 /// <param name="deviceType">Device type to be used for the job.
 /// Possible values include: 'DataBox', 'DataBoxDisk',
 /// 'DataBoxHeavy'</param>
 /// <param name="transferType">Type of the transfer. Possible values
 /// include: 'ImportToAzure', 'ExportFromAzure'</param>
 /// <param name="country">ISO country code. Country for hardware
 /// shipment. For codes check:
 /// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements</param>
 /// <param name="location">Location for data transfer. For locations
 /// check:
 /// https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01</param>
 public SkuAvailabilityValidationRequest(SkuName deviceType, TransferType transferType, string country, string location)
 {
     DeviceType   = deviceType;
     TransferType = transferType;
     Country      = country;
     Location     = location;
     CustomInit();
 }
Esempio n. 33
0
 public Form1()
 {
     InitializeComponent();
     _transferType = TransferType.All;
     if (String.IsNullOrEmpty(_token))
         _token = ChemSpiderClient.Search.SetToken(_token, this);
     _search = new ChemSpiderClient.Search(_token, this, _transferType, true);
     _search.StructureTransfered += (search_StructureTransfered);
 }
Esempio n. 34
0
        public static Task StartTransferTypeAndErrorServer(
            TransferType transferType,
            TransferError transferError,
            out IPEndPoint localEndPoint)
        {
            return CreateServerAsync((server, url) => AcceptSocketAsync(server, async (client, stream, reader, writer) =>
            {
                // Read past request headers.
                string line;
                while (!string.IsNullOrEmpty(line = reader.ReadLine())) ;

                // Determine response transfer headers.
                string transferHeader = null;
                string content = "This is some response content.";
                if (transferType == TransferType.ContentLength)
                {
                    transferHeader = transferError == TransferError.ContentLengthTooLarge ?
                        $"Content-Length: {content.Length + 42}\r\n" :
                        $"Content-Length: {content.Length}\r\n";
                }
                else if (transferType == TransferType.Chunked)
                {
                    transferHeader = "Transfer-Encoding: chunked\r\n";
                }

                // Write response header
                await writer.WriteAsync("HTTP/1.1 200 OK\r\n").ConfigureAwait(false);
                await writer.WriteAsync($"Date: {DateTimeOffset.UtcNow:R}\r\n").ConfigureAwait(false);
                await writer.WriteAsync("Content-Type: text/plain\r\n").ConfigureAwait(false);
                if (!string.IsNullOrEmpty(transferHeader))
                {
                    await writer.WriteAsync(transferHeader).ConfigureAwait(false);
                }
                await writer.WriteAsync("\r\n").ConfigureAwait(false);

                // Write response body
                if (transferType == TransferType.Chunked)
                {
                    string chunkSizeInHex = string.Format(
                        "{0:x}\r\n",
                        content.Length + (transferError == TransferError.ChunkSizeTooLarge ? 42 : 0));
                    await writer.WriteAsync(chunkSizeInHex).ConfigureAwait(false);
                    await writer.WriteAsync($"{content}\r\n").ConfigureAwait(false);
                    if (transferError != TransferError.MissingChunkTerminator)
                    {
                        await writer.WriteAsync("0\r\n\r\n").ConfigureAwait(false);
                    }
                }
                else
                {
                    await writer.WriteAsync($"{content}\r\n").ConfigureAwait(false);
                }
                await writer.FlushAsync().ConfigureAwait(false);

                client.Shutdown(SocketShutdown.Both);
            }), out localEndPoint);
        }
 public TransferRequest(
     VirtualAssetType virtualAssetType,
     TransferType transferType,
     string amount)
 {
     VirtualAssetType = virtualAssetType;
     TransferType     = transferType;
     Amount           = amount;
 }
Esempio n. 36
0
 public async Task ReadAsStreamAsync_InvalidServerResponse_ThrowsIOException(
     TransferType transferType,
     TransferError transferError)
 {
     await StartTransferTypeAndErrorServer(transferType, transferError, async uri =>
     {
         await Assert.ThrowsAsync <IOException>(() => ReadAsStreamHelper(uri));
     });
 }
Esempio n. 37
0
 public async Task ReadAsStreamAsync_ValidServerResponse_Success(
     TransferType transferType,
     TransferError transferError)
 {
     await StartTransferTypeAndErrorServer(transferType, transferError, async uri =>
     {
         await ReadAsStreamHelper(uri);
     });
 }
Esempio n. 38
0
 /// <summary>
 /// 设置传输模式
 /// </summary>
 /// <param name="ttType">传输模式</param>
 public void SetTransferType(TransferType ttType)
 {
     SendCommand(ttType == TransferType.Binary ? "TYPE I" : "TYPE A");
     if (_iReplyCode != 200)
     {
         throw new IOException(_strReply.Substring(4));
     }
     _trType = ttType;
 }
 public TransferTypeDto MapEntityToDto(TransferType transferType)
 {
     var res = new TransferTypeDto()
     {
         Id = transferType.Id,
         Code = transferType.Code,
         Name = transferType.Name
     };
     return res;
 }
 internal void BytesSent(int bytesUploaded, TransferType type)
 {
     lock (_locker)
     {
         if (type == TransferType.Data)
             _dataUp.AddDelta(bytesUploaded);
         else
             _protocolUp.AddDelta(bytesUploaded);
     }
 }
 internal void BytesReceived(int bytesDownloaded, TransferType type)
 {
     lock (locker)
     {
         if (type == TransferType.Data)
             dataDown.AddDelta(bytesDownloaded);
         else
             protocolDown.AddDelta(bytesDownloaded);
     }
 }
		public TransferRequest(string sourcePath, string destinationPath, TransferType type, bool deleteDestIfExists = false)
		{
			SourcePath = sourcePath;

			DestinationPath = destinationPath;

			DeleteDestIfExists = deleteDestIfExists;

			Type = type;
		}
Esempio n. 43
0
        public FareAttribute(CSVRowItem item)
        {
            mFareID = item.ValidateNotEmptyOrNull("fare_id");
            mPrice = decimal.Parse(item["price"]);
            mCurrencyType = item.ValidateNotEmptyOrNull("currency_type");

            mPaymentMethod = item["payment_method"].ToPaymentMethodType();
            mTransfers = item["transfers"].ToTransferType();

            int tDur;
            mTransferDuration = int.TryParse(item["transfer_duration"], out tDur) ? tDur : (int?)null;
        }
Esempio n. 44
0
        public bool Transfer(long id, string folderToArchive, TransferType transferType)
        {
            try
            {
                pipeProxy.Send(id, folderToArchive, transferType);
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("GTCloudClient.cs, failed to call calibration transfer service. Message: " + ex.Message);
            }

            return true;
        }
Esempio n. 45
0
 public PositionTransfer(bool aIsInternal, IAccountTypeInternal accountA, bool bIsInternal,
     IAccountTypeInternal accountB, TransferType typeOfTransfer, Money transferAmount,
     DateTime transferDate)
     : this()
 {
     this.AIsInternal = aIsInternal;
     if (aIsInternal) this.AccountA = accountA;
     this.BIsInternal = bIsInternal;
     if (bIsInternal) this.AccountB = accountB;
     this.TypeOfTransfer = typeOfTransfer;
     this.TransferAmount = transferAmount;
     this.TransferDate = transferDate;
     this.TransferStatus = TransferStatus.New;
 }
Esempio n. 46
0
 public Form1()
 {
     InitializeComponent();
     _transferType = TransferType.All;
     if (String.IsNullOrEmpty(_token))
         _token = ChemSpiderClient.Search.SetToken(_token, this);
     if (!String.IsNullOrEmpty(_token))
     {
         _search = new ChemSpiderClient.Search(_token, this, _transferType, true);
         _search.StructureTransfered += (search_StructureTransfered);
     }
     else
     {
         MessageBox.Show(this, "ChemSpider token not set", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 47
0
        public NuWmTransfer(decimal amount, DateTime createTime, string description, uint id, Purse targetPurse,
                uint ts, DateTime updateTime, decimal commission, uint invoiceId, bool isLocked, uint orderId,
                WmId partner, byte period, decimal rest, Purse sourcePurse, uint transferId, TransferType transferType)
        {
            Amount = (Amount) amount;
                CreateTime = createTime;
                Description = (Description)description;
                Id = id;
                TargetPurse = targetPurse;
                Ts = ts;
                UpdateTime = updateTime;

                Commission = (Amount)commission;
                InvoiceId = invoiceId;
                IsLocked = isLocked;
                OrderId = orderId;
                Partner = partner;
                Period = period;
                Rest = (Amount)rest;
                SourcePurse = sourcePurse;
                TransferId = transferId;
                TransferType = transferType;
        }
Esempio n. 48
0
 /// <summary>
 /// 给定一个输入流,解析FileTransferArgs结构
 /// </summary>
 /// <param name="buf">The buf.</param>
 public void Read(ByteBuffer buf)
 {
     // 跳过19个无用字节
     buf.Position = buf.Position + 19;
     // 读取传输类型
     TransferType = (TransferType)buf.Get();
     // 读取连接方式
     ConnectMode = (FileConnectMode)buf.Get();
     // 读取发送者外部ip
     InternetIP = buf.GetByteArray(4);
     // 读取发送者外部端口
     InternetPort = (int)buf.GetUShort();
     // 读取文件传送端口
     if (ConnectMode != FileConnectMode.DIRECT_TCP)
         MajorPort = (int)buf.GetUShort();
     else
         MajorPort = InternetPort;
     // 读取发送者真实ip
     LocalIP = buf.GetByteArray(4);
     // 读取发送者真实端口
     MinorPort = (int)buf.GetUShort();
 }
Esempio n. 49
0
 private void UpdateConfigMessage(TransferType configType, string comText)
 {
     TransferParams param = new TransferParams()
     {
         TranType = configType,
         Content = comText
     };
     _moniDatareader.UpdateConfigMessage(CommandTextParser.SerialCmdTextParamTo(param));
 }
Esempio n. 50
0
 private static void createTransferDetails(IPositionTransferPortfolio currentPortfolio, TransferType typeOfTransfer, decimal transferAmount, IPositionTransfer parent)
 {
     foreach (IPositionTransferPosition pos in currentPortfolio.Positions)
     {
         IPositionTransferDetail newDetail = new PositionTransferDetail(pos, typeOfTransfer, transferAmount);
         parent.TransferDetails.AddPosition(newDetail);
     }
 }
Esempio n. 51
0
 public PositionTransferDetails(IPositionTransfer transfer)
 {
     this.AIsInternal = transfer.AIsInternal;
     this.BIsInternal = transfer.BIsInternal;
     if (transfer.AccountA != null) this.AccountAID = transfer.AccountA.Key;
     if (transfer.AccountB != null) this.AccountBID = transfer.AccountB.Key;
     this.TransferDate = transfer.TransferDate;
     this.TypeOfTransfer = transfer.TypeOfTransfer;
     this.TransferAmount = transfer.TransferAmount == null ? 0 : transfer.TransferAmount.Quantity;
     this.Status = transfer.TransferStatus;
     this.IsInitialised = transfer.IsInitialised;
     this.IsEditable = transfer.IsEditable;
 }
Esempio n. 52
0
 private static uint FromTransferType(TransferType transferType)
 {
     switch(transferType)
     {
     case TransferType.Byte:
         return 0;
     case TransferType.Word:
         return 1;
     case TransferType.DoubleWord:
         return 2;
     }
     throw new InvalidOperationException("Should not reach here.");
 }
Esempio n. 53
0
 /// <summary>
 /// 设置传输模式
 /// </summary>
 /// <param name="ttType">传输模式</param>
 public void SetTransferType(TransferType ttType)
 {
     if (ttType == TransferType.Binary)
     {
         SendCommand("TYPE I");//binary类型传输
     }
     else
     {
         SendCommand("TYPE A");//ASCII类型传输
     }
     if (iReplyCode != 200)
     {
         throw new IOException(strReply.Substring(4));
     }
     else
     {
         trType = ttType;
     }
 }
Esempio n. 54
0
 protected void EmitMemoryLoadStore(InstructionNode node, MachineCodeEmitter emitter, TransferType transferType)
 {
     if (node.Operand2.IsConstant)
     {
         emitter.EmitSingleDataTransfer(
             node.ConditionCode,
             Indexing.Post,
             OffsetDirection.Up,
             TransferSize.Word,
             WriteBack.NoWriteBack,
             transferType,
             node.Operand1.Index,
             node.Result.Index,
             (uint)node.Operand2.ConstantUnsignedLongInteger
         );
     }
     else
     {
         emitter.EmitSingleDataTransfer(
               node.ConditionCode,
               Indexing.Post,
               OffsetDirection.Up,
               TransferSize.Word,
               WriteBack.NoWriteBack,
               transferType,
               node.Operand1.Index,
               node.Result.Index,
               node.Operand2.ShiftType,
               node.Operand3.Index
           );
     }
 }
Esempio n. 55
0
        private string Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
                case "A":
                    _connectionType = TransferType.Ascii;
                    break;
                case "I":
                    _connectionType = TransferType.Image;
                    break;
                default:
                    return "504 Command not implemented for that parameter";
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                    case "N":
                        _formatControlType = FormatControlType.NonPrint;
                        break;
                    default:
                        return "504 Command not implemented for that parameter";
                }
            }

            return string.Format("200 Type set to {0}", _connectionType);
        }
Esempio n. 56
0
        private void TransferResources(PartResourceDefinition resource, double amount, TransferType transferType)
        {
            try
            {
                var transferAmount = amount;
                var nearVessels = LogisticsTools.GetNearbyVessels(LogisticsRange, false, vessel);
                foreach (var v in nearVessels)
                {
                    if (transferAmount == 0) break;
                    //Can we find what we're looking for?
                    var partList = v.Parts.Where(
                        p => p.Resources.Contains(resource.name)
                        && p != part
                        && p.Modules.Contains("ProxyLogistics"));
                    foreach (var p in partList)
                    {
                        var pr = p.Resources[resource.name];
                        if (transferType == TransferType.TakeResources)
                        {
                            // RemotePartAmount:       200    -> 150
                            // LocalPartAmount:         10    -> 60
                            // TransferAmount:          50    -> 0
                            //
                            if (pr.amount >= transferAmount)
                            {
                                pr.amount -= transferAmount;
                                part.Resources[resource.name].amount += transferAmount;
                                transferAmount = 0;
                                break;
                            }
                            else
                            {
                                // RemotePartAmount:        10    -> 0
                                // LocalPartAmount:         10    -> 20
                                // TransferAmount:          50    -> 40
                                //
                                transferAmount -= pr.amount;
                                part.Resources[resource.name].amount += pr.amount;
                                pr.amount = 0;
                            }
                        }
                        else
                        {
                            var plMods = p.Modules.OfType<ProxyLogistics>().Where(m => m.IsLogisticsDistributor);

                            if (plMods.Any())
                            {
                                var storageSpace = pr.maxAmount - pr.amount;
                                if (storageSpace >= transferAmount)
                                {
                                    // SS: 100
                                    // RemotePartAmount:        400/500 -> 450/500
                                    // LocalPartAmount:         100     -> 50
                                    // TransferAmount:          50      -> 0
                                    pr.amount += transferAmount;
                                    part.Resources[resource.name].amount -= transferAmount;
                                    transferAmount = 0;
                                    break;
                                }
                                else
                                {
                                    // SS:10
                                    // RemotePartAmount:        490/500 -> 500/500
                                    // LocalPartAmount:         100     -> 90
                                    // TransferAmount:          50      -> 40
                                    transferAmount -= storageSpace;
                                    part.Resources[resource.name].amount -= storageSpace;
                                    pr.amount = pr.maxAmount;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print(String.Format("[MKS] - ERROR in TransferResources - {0}", ex.StackTrace));
            }
        }
Esempio n. 57
0
 public void SetTransferType(TransferType transferType)
 {
     EnsureLoggedIn();
       SendCommand(string.Format("TYPE {0}", transferType == TransferType.Ascii ? "A" : "I"), 200);
 }
        /// <summary>
        /// TYPE Command - RFC 959 - Section 4.1.2
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        private Response Type(string typeCode, string formatControl)
        {
            switch (typeCode.ToUpperInvariant())
            {
                case "A":
                    _connectionType = TransferType.Ascii;
                    break;
                case "I":
                    _connectionType = TransferType.Image;
                    break;
                default:
                    return GetResponse(FtpResponses.NOT_IMPLEMENTED_FOR_PARAMETER);
            }

            if (!string.IsNullOrWhiteSpace(formatControl))
            {
                switch (formatControl.ToUpperInvariant())
                {
                    case "N":
                        _formatControlType = FormatControlType.NonPrint;
                        break;
                    default:
                        return GetResponse(FtpResponses.NOT_IMPLEMENTED_FOR_PARAMETER);
                }
            }

            return GetResponse(FtpResponses.OK);
        }
Esempio n. 59
0
        public void EmitSingleDataTransfer(ConditionCode conditionCode, Indexing indexing, OffsetDirection offsetDirection, TransferSize transferSize, WriteBack writeBack, TransferType transferType, int firstRegister, int destinationRegister, ShiftType secondShiftType, int secondRegister)
        {
            Debug.Assert(destinationRegister <= 0xF);
            Debug.Assert(firstRegister <= 0xF);
            Debug.Assert(secondRegister <= 0xF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)(1 << 26);
            value |= (uint)(1 << 25);
            value |= (uint)((indexing == Indexing.Post ? 0 : 1) << 24);
            value |= (uint)((transferSize == TransferSize.Word ? 0 : 1) << 23);
            value |= (uint)((offsetDirection == OffsetDirection.Down ? 0 : 1) << 22);
            value |= (uint)((writeBack == WriteBack.NoWriteBack ? 0 : 1) << 21);
            value |= (uint)((transferType == TransferType.Store ? 0 : 1) << 20);
            value |= (uint)(destinationRegister << 12);
            value |= (uint)(firstRegister << 16);
            value |= (uint)(GetShiftTypeCode(secondShiftType) << 4);
            value |= (uint)secondRegister;

            Write(value);
        }
		/// <summary>
		/// Create a new item transfer dialog
		/// </summary>
		/// <param name="itemName">Name of the item to be displayed</param>
		/// <param name="transferType">Which transfer is being done (controls title)</param>
		/// <param name="totalAmount">Maximum amount that can be transferred</param>
		/// <param name="message">Resource ID of message to control displayed text</param>
		public ItemTransferDialog(string itemName, TransferType transferType, int totalAmount, DATCONST2 message = DATCONST2.DIALOG_TRANSFER_DROP)
		{
			_validateMessage(message);

			Texture2D weirdSpriteSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27);
			Rectangle sourceArea = new Rectangle(38, 0, 265, 170);

			//get bgTexture
			Color[] textureData = new Color[sourceArea.Width * sourceArea.Height];
			bgTexture = new Texture2D(Game.GraphicsDevice, sourceArea.Width, sourceArea.Height);
			weirdSpriteSheet.GetData(0, sourceArea, textureData, 0, textureData.Length);
			bgTexture.SetData(textureData);

			//get the title bar - for when it isn't drop items
			if (transferType != TransferType.DropItems)
			{
				Rectangle titleBarArea = new Rectangle(40, 172 + ((int)transferType - 1) * 24, 241, 22);
				Color[] titleBarData = new Color[titleBarArea.Width * titleBarArea.Height];
				m_titleBarGfx = new Texture2D(Game.GraphicsDevice, titleBarArea.Width, titleBarArea.Height);
				weirdSpriteSheet.GetData(0, titleBarArea, titleBarData, 0, titleBarData.Length);
				m_titleBarGfx.SetData(titleBarData);
			}

			//set the buttons here

			//ok/cancel buttons
			XNAButton ok = new XNAButton(smallButtonSheet, new Vector2(60, 125), _getSmallButtonOut(SmallButton.Ok), _getSmallButtonOver(SmallButton.Ok))
			{
				Visible = true
			};
			ok.OnClick += (s, e) => Close(ok, XNADialogResult.OK);
			ok.SetParent(this);
			dlgButtons.Add(ok);

			XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(153, 125), _getSmallButtonOut(SmallButton.Cancel), _getSmallButtonOver(SmallButton.Cancel))
			{
				Visible = true
			};
			cancel.OnClick += (s, e) => Close(cancel, XNADialogResult.Cancel);
			cancel.SetParent(this);
			dlgButtons.Add(cancel);

			XNALabel descLabel = new XNALabel(new Rectangle(20, 42, 231, 33), Constants.FontSize10)
			{
				ForeColor = Constants.LightGrayDialogMessage,
				TextWidth = 200,
				Text = string.Format("{0} {1} {2}", World.GetString(DATCONST2.DIALOG_TRANSFER_HOW_MUCH), itemName, World.GetString(message))
			};
			descLabel.SetParent(this);

			//set the text box here
			//starting coords are 163, 97
			m_amount = new XNATextBox(new Rectangle(163, 95, 77, 19), Game.Content.Load<Texture2D>("cursor"), Constants.FontSize08)
			{
				Visible = true,
				Enabled = true,
				MaxChars = 8, //max drop/junk at a time will be 99,999,999
				TextColor = Constants.LightBeigeText,
				Text = "1"
			};
			m_amount.SetParent(this);
			m_prevSubscriber = EOGame.Instance.Dispatcher.Subscriber;
			EOGame.Instance.Dispatcher.Subscriber = m_amount;
			DialogClosing += (o, e) => EOGame.Instance.Dispatcher.Subscriber = m_prevSubscriber;

			m_totalAmount = totalAmount;

			//slider control
			Texture2D src = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 29);
			//5th index when 'out', 6th index when 'over'
			Rectangle outText = new Rectangle(0, 15 * 5, 16, 15);
			Rectangle ovrText = new Rectangle(0, 15 * 6, 16, 15);
			Color[] outData = new Color[16 * 15];
			Color[] ovrData = new Color[16 * 15];
			Texture2D[] sliderTextures = new Texture2D[2];

			src.GetData(0, outText, outData, 0, outData.Length);
			src.GetData(0, ovrText, ovrData, 0, ovrData.Length);
			(sliderTextures[0] = new Texture2D(Game.GraphicsDevice, 16, 15)).SetData(outData);
			(sliderTextures[1] = new Texture2D(Game.GraphicsDevice, 16, 15)).SetData(ovrData);

			//starting coords are 25, 96; range rectangle is 122, 15
			XNAButton slider = new XNAButton(sliderTextures, new Vector2(25, 96));
			slider.OnClickDrag += (o, e) =>
			{
				s_sliderDragging = true; //ignores updates to slider location during text change
				MouseState st = Mouse.GetState();
				Rectangle sliderArea = new Rectangle(25, 96, 122 - slider.DrawArea.Width, 15);
				int newX = (st.X - PreviousMouseState.X) + (int)slider.DrawLocation.X;
				if (newX < sliderArea.X) newX = sliderArea.X;
				else if (newX > sliderArea.Width + sliderArea.X) newX = sliderArea.Width + sliderArea.X;
				slider.DrawLocation = new Vector2(newX, slider.DrawLocation.Y); //unchanged y coordinate, slides along x-axis

				float ratio = (newX - sliderArea.X) / (float)sliderArea.Width;
				m_amount.Text = ((int)Math.Round(ratio * m_totalAmount) + 1).ToString();
				s_sliderDragging = false;
			};
			slider.SetParent(this);

			m_amount.OnTextChanged += (sender, args) =>
			{
				int amt = 0;
				if (m_amount.Text != "" && (!int.TryParse(m_amount.Text, out amt) || amt > m_totalAmount))
				{
					amt = m_totalAmount;
					m_amount.Text = string.Format("{0}", m_totalAmount);
				}
				else if (m_amount.Text != "" && amt < 0)
				{
					amt = 1;
					m_amount.Text = string.Format("{0}", amt);
				}

				if (s_sliderDragging) return; //slider is being dragged - don't move its position

				//adjust the slider (created after m_amount) when the text changes
				if (amt <= 1) //NOT WORKING
				{
					slider.DrawLocation = new Vector2(25, 96);
				}
				else
				{
					int xCoord = (int)Math.Round((amt / (double)m_totalAmount) * (122 - slider.DrawArea.Width));
					slider.DrawLocation = new Vector2(25 + xCoord, 96);
				}
			};

			_setSize(bgTexture.Width, bgTexture.Height);
			DrawLocation = new Vector2(Game.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - bgTexture.Width / 2, 40); //only centered horizontally
			endConstructor(false);
		}