public async Task ExcecuteMarketTrade(NewOrderRequest orderRequest, AlpacaEnviornment type)
        {
            var tasks  = new List <Task>();
            var trades = new List <TradeTemplate>();
            var users  = await BR.GetAppUsers();

            users = users.Where(e => e.EnableLiveTrading == "Y").ToList();

            users.Where(asdfadf => asdfadf.EnablePaperTrading == "Y").ToList();
            foreach (var user in users)
            {
                var keys = new AlpacaKeys()
                {
                    LiveApiKey     = user.ApiKey,
                    LiveSecretKey  = user.SecretKey,
                    PaperApiKey    = user.PaperApiKey,
                    PaperSecretKey = user.PaperSecretKey
                };
                var template = new TradeTemplate(type, keys, orderRequest, user.UserId, user);
                trades.Add(template);
            }


            trades.ForEach(e => tasks.Add(e.ExecuteOrder()));
            await Task.WhenAll(tasks);

            Logger.Info("Trades");
        }
示例#2
0
        private static RSAParameters RSAParamatersFromBlob(byte[] blob)
        {
            RSAParameters key;

            var reader = new BR(blob);

            if (reader.ReadInt32() != 0x00000207)
                throw new CryptographicException("Private key expected");

            reader.ReadInt32(); // ALG_ID

            if (reader.ReadInt32() != 0x32415352) // 'RSA2'
                throw new CryptographicException("RSA key expected");

            int bitLen = reader.ReadInt32();
            if (bitLen % 16 != 0)
                throw new CryptographicException("Invalid bitLen");

            int byteLen = bitLen / 8;
            int halfLen = bitLen / 16;

            key.Exponent = reader.ReadBigInteger(4);
            key.Modulus = reader.ReadBigInteger(byteLen);
            key.P = reader.ReadBigInteger(halfLen);
            key.Q = reader.ReadBigInteger(halfLen);
            key.DP = reader.ReadBigInteger(halfLen);
            key.DQ = reader.ReadBigInteger(halfLen);
            key.InverseQ = reader.ReadBigInteger(halfLen);
            key.D = reader.ReadBigInteger(byteLen);

            return key;
        }
示例#3
0
        public String saveAllBR(List <BrightnessRequest> requests)
        {
            String toReturn = "FILE SAVING ERROR!!!";
            List <BrightnessRequest> hitList = new List <BrightnessRequest>();

            foreach (BrightnessRequest BR in requests)
            {
                if (!BR.isValid())
                {
                    hitList.Add(BR);
                }
            }
            foreach (BrightnessRequest toKill in hitList)
            {
                requests.Remove(toKill);
            }

            String[] reqsString = reqsToStrings(requests).ToArray();

            try
            {
                System.IO.File.WriteAllLines(this.filePath, reqsString);
                toReturn = "File Saved Successfully";
            }
            catch (Exception E)
            {
                toReturn = "FILE SAVING ERROR - " + E + "!!!";
            }
            return(toReturn);
        }
        public async Task <List <string> > GetUserEmails()
        {
            var appUsers = await BR.GetAppUsers();

            appUsers = appUsers.Where(e => e.EnableLiveTrading == "Y").ToList();
            return(appUsers.Select(e => e.Email).ToList());
        }
示例#5
0
        public async void InitializeClass()
        {
            var attribute = await BR.GetSystemDefault("Alpaca Keys");

            var keys = JsonConvert.DeserializeObject <EmailConfig>(attribute.AttributeValue);

            EmailConfig = keys;
        }
示例#6
0
 public override void StatuSecondEvent()
 {
     keep_time--;
     BR.GetDamage((int)DAMAGE_MAXHP_PRE_SECOND * BR.MaxHp, (int)DAMAGE_MAXHP_PRE_SECOND * BR.MaxHp);
     if (keep_time == 0)
     {
         Romove();
     }
 }
示例#7
0
        public async void SetKeys()
        {
            var attribute = await BR.GetSystemDefault("Alpaca Keys");

            var keys = JsonConvert.DeserializeObject <AlpacaKeys>(attribute.AttributeValue);

            API_KEY    = keys.PaperApiKey;
            API_SECRET = keys.PaperSecretKey;
        }
示例#8
0
 void FixedUpdate()
 {
     //forceVector = carBodyRB.transform.rotation * Vector3.forward * Torque * axisVertical * 10f;
     //carBodyRB.AddForce(forceVector);
     FR.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f);
     BR.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f);
     FL.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f);
     BL.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f);
 }
示例#9
0
 private void displayEvents()
 {
     richTextBox1.Clear();
     richTextBox1.AppendText("Current Brightness Settings:\n");
     foreach (BrightnessRequest BR in requests)
     {
         richTextBox1.AppendText("\n" + BR.toString());
     }
 }
示例#10
0
        /*
         * Button1_Click:
         * When a new request is added, the changes are first reflected in the savefile,
         * then the form is updated based on the savefile. There is likely a better way to do this,
         * but it ensures the save file is always up to date.
         */
        private void Button1_Click(object sender, EventArgs e) //As soon as the BrightnessRequest is added, changes are reflected in the file
        {
            running.stopThread();
            FileManager fm = new FileManager(fileLoc, fileNameR);

            String[] rawData         = null;
            double   inputBrightness = 1.0;

            //If the input is not valid
            if (!Time24Hours.isValid24HTime(textBox1.Text, ':') || !Time24Hours.isValid24HTime(textBox2.Text, ':') || !double.TryParse(textBox3.Text, out inputBrightness))
            {
                inputError1();
                return;
            }

            //Convert user input to time values
            Time24Hours startT = Time24Hours.stringTo24HTime(textBox1.Text + ":00", ':');
            Time24Hours endT   = Time24Hours.stringTo24HTime(textBox2.Text + ":00", ':');

            //Assemble request
            BrightnessRequest newReq = BrightnessRequest.fromString(0, startT.toFileString() + ";" + endT.toFileString() + ";" + inputBrightness.ToString());

            if (newReq != null && !newReq.isValid()) //Check if request is valid
            {
                inputError1();
                return;
            }


            foreach (BrightnessRequest BR in requests)
            {
                if (newReq.getStartTime().fallsInbetween(BR.getStartTime(), BR.getEndTime()) || newReq.getEndTime().fallsInbetween(BR.getStartTime(), BR.getEndTime()))
                {
                    inputError2(BR.orderNum);
                    return;
                }
                if (newReq.getStartTime().equals(BR.getStartTime()) || newReq.getEndTime().equals(BR.getEndTime()))
                {
                    inputError2(BR.orderNum);
                    return;
                }
            }
            requests.Add(newReq);       //Add request to list

            fm.saveAllBR(requests);     //Save all requests
            fm.initialize(ref rawData); //Load all requests to string
            loadRequests(rawData);      //Overwrite
            displayEvents();

            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();

            running.startThread();
        }
示例#11
0
 private void StartUp_Load(object sender, EventArgs e)
 {
     //PreLoaded in FindAccount Mode
     btnOk.Visible      = true;
     cmbAccount.Visible = true;
     txtAccount.Visible = false;
     txtPass.Enabled    = false;
     txtUser.Enabled    = false;
     ModifyToolStripMenuItem.Enabled = false;
     cmbAccount.DataSource           = BR.GetAccountsData();
 }
示例#12
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (cmbAccount.Visible == true)                     //'Find Account' selected
     {
         txtUser.Text = BR.GetUserData(cmbAccount.Text); //txtUser loaded with User data
         txtPass.Text = BR.GetPassData(cmbAccount.Text); //txtPass loaded with Password data
         ModifyToolStripMenuItem.Enabled = true;
     }
     else
     {                                    //'Add Account' selected
     }
 }
示例#13
0
        public async Task UpdateDailyPriceData()
        {
            var currentDate = DateTime.Now;
            var stocks      = await BR.QueryNightlyBars();

            stocks = stocks.OrderBy(e => e.MaxDate).ToList();
            stocks = stocks.Where(e => e.MaxDate.Date < DateTime.Now.Date).ToList();
            var stocksByBatch = SplitList(stocks, 200).ToList();

            foreach (var item in stocksByBatch)
            {
                await ProcessBatch(item, currentDate);
            }
        }
示例#14
0
        static void Main(string[] args)
        {
            Car c = new Car();

            c.id = 1;

            Office of1 = new Office();

            of1.idOffice = 1;
            of1.c        = c;
            of1.d        = DateTime.Today;

            bool aux = BR.TryInsertNewOffice(of1);
        }
示例#15
0
        private void serviceRequests()
        {
            if (toService == null)
            {
                return;
            }

            try
            {
                while (true)
                {
                    if (useRR && isValidRefreshRate(refreshRate))
                    {
                        System.Threading.Thread.Sleep(refreshRate);
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(3000);
                    }
                    Console.WriteLine("TICK\n");

                    DateTime    localDT   = DateTime.Now;
                    Time24Hours localTime = Time24Hours.stringTo24HTime(localDT.ToString("HH:mm:ss"), ':');
                    if (localTime != null)
                    {
                        bool defaultB = true;
                        foreach (BrightnessRequest BR in toService)
                        {
                            if (localTime.fallsInbetween(BR.getStartTime(), BR.getEndTime())) //If the current time is in any request in toService
                            {
                                setBrightness(BR.getBrightness());
                                defaultB = false;
                            }
                        }
                        if (defaultB && useDefBright)
                        {
                            setBrightness(this.defaultBrightness);
                        }
                    }
                }
            }
            catch (ThreadInterruptedException)
            {
                return;
            }
        }
示例#16
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();


        Bvaciar.ModifyBg(StateType.Normal, new Gdk.Color(150, 150, 150));
        BD.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BM.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BR.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BS.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BI.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        // color de la pantalla
        ModifyBg(StateType.Normal, new Gdk.Color(8, 8, 8));
        //     label1.ModifyBg(StateType.Normal, new Gdk.Color(231, 231, 231));

        operaciones resultado = new operaciones();
    }
    // Update is called once per frame
    void Update()
    {
        DroneHealth healthObj    = drone.GetComponent <DroneHealth>();
        float       currentRatio = healthObj.health / healthObj.maxHealth;

        if (currentRatio < 1)
        {
            if (currentRatio >= 0.75)
            {
                float value = (currentRatio - 0.75f) / 0.25f;
                setIndicatorAmount(TL, value);
            }
            else if (currentRatio >= 0.5)
            {
                float value = (currentRatio - 0.5f) / 0.25f;
                setIndicatorAmount(TL, 0);
                setIndicatorAmount(BL, value);
            }
            else if (currentRatio >= 0.25)
            {
                float value = (currentRatio - 0.25f) / 0.25f;
                setIndicatorAmount(TL, 0);
                setIndicatorAmount(BL, 0);
                setIndicatorAmount(BR, value);
            }
            else
            {
                float value = currentRatio / 0.25f;
                setIndicatorAmount(TL, 0);
                setIndicatorAmount(BL, 0);
                setIndicatorAmount(BR, 0);
                setIndicatorAmount(TR, value);
            }
        }
        if (currentRatio < 0.20)
        {
            TL.GetComponent <Image>().color          = dangerColor;
            BL.GetComponent <Image>().color          = dangerColor;
            TR.GetComponent <Image>().color          = dangerColor;
            BR.GetComponent <Image>().color          = dangerColor;
            GetComponentInParent <SVGImage>().sprite = dangerGraphic;
        }
    }
示例#18
0
        public async Task InsertStockBars(List <IAgg> bars, int symbolId)
        {
            var listCandles = new List <StockDashboard.Models.Candle>();

            foreach (var bar in bars)
            {
                var candle = new StockDashboard.Models.Candle()
                {
                    AdjustedClose = 0,
                    Close         = bar.Close,
                    High          = bar.High,
                    Low           = bar.Low,
                    Open          = bar.Open,
                    DateTime      = bar.Time.Date,
                    Volume        = bar.Volume
                };
                listCandles.Add(candle);
            }
            await BR.BulkBarInsert(listCandles, symbolId);
        }
示例#19
0
        private static RSAParameters RSAParamatersFromBlob(byte[] blob)
        {
            RSAParameters key;

            var reader = new BR(blob);

            if (reader.ReadInt32() != 0x00000207)
            {
                throw new CryptographicException("Private key expected");
            }

            reader.ReadInt32();                   // ALG_ID

            if (reader.ReadInt32() != 0x32415352) // 'RSA2'
            {
                throw new CryptographicException("RSA key expected");
            }

            int bitLen = reader.ReadInt32();

            if (bitLen % 16 != 0)
            {
                throw new CryptographicException("Invalid bitLen");
            }

            int byteLen = bitLen / 8;
            int halfLen = bitLen / 16;

            key.Exponent = reader.ReadBigInteger(4);
            key.Modulus  = reader.ReadBigInteger(byteLen);
            key.P        = reader.ReadBigInteger(halfLen);
            key.Q        = reader.ReadBigInteger(halfLen);
            key.DP       = reader.ReadBigInteger(halfLen);
            key.DQ       = reader.ReadBigInteger(halfLen);
            key.InverseQ = reader.ReadBigInteger(halfLen);
            key.D        = reader.ReadBigInteger(byteLen);

            return(key);
        }
        public async Task Start()
        {
            var list = new List <string>()
            {
                "AMD", "TSLA"
            };

            //var alpacaPriceMonitor = new AlpacaPriceMonitor(list, 5);
            //var monitoring = alpacaPriceMonitor.KickStartMonitoring();

            StockList = await BR.FindProcessedStocks();

            ActiveList = await BR.GetTradeNotifications();

            foreach (var active in ActiveList)
            {
                var symbol = StockList.Find(e => e.Id == active.SymbolId);
                list.Add(symbol.Symbol); // avoid repeat symbols
            }
            list       = list.Distinct().ToList();
            StringList = list;
            var alpacaPriceMonitor = new AlpacaPriceMonitor(StringList, RefreshFrequency);
            var monitoring         = alpacaPriceMonitor.KickStartMonitoring();

            do
            {
                Thread.Sleep(20000);
            } while (alpacaPriceMonitor.CycleCount == 0);

            while (true)
            {
                var start   = DateTime.Now;
                var results = alpacaPriceMonitor.RefreshResult;
                CheckRefreshResults(results);
                var timespan = new TimeSpan(DateTime.Now.Ticks - start.Ticks);
                Thread.Sleep((60000 * RefreshFrequency) - (int)timespan.TotalMilliseconds);
            }
        }
        /// <summary>
        /// Gets the current stock prices from an XML feed.
        /// </summary>
        /// <returns> Array of stock ticker symbols where the current price is less than the target sale price. </returns>
        private static string[] GetCurrentStockPrices()
        {
            Trace.TraceInformation("Entering Functions.GetCurrentStockPrices.");

            string[] belowTarget;

            Type     t = Type.GetType(System.Configuration.ConfigurationManager.AppSettings["Repository"]);
            Assembly a = Assembly.GetAssembly(t);

            Stocks.DataAccess.IRepository repository = (Stocks.DataAccess.IRepository)a.CreateInstance(t.FullName);
            BR br = new BR(repository);
            List <Position> positions = br.GetCurrent().Where(x => x.ID > 0).ToList <Position>();

            foreach (var position in positions)
            {
                try
                {
                    decimal price = FetchCurrentPrice(position.Symbol);

                    if (price > 0)
                    {
                        position.CurrentPrice = price;
                    }

                    br.UpdateStockPrice(position);
                }
                catch (Exception ex)
                {
                    Trace.TraceError(ex.Message);
                }
            }

            belowTarget = positions.Where(x => x.CurrentPrice <= x.TargetSalePrice).Select(x => x.Symbol).ToArray();

            Trace.TraceInformation("Exiting Functions.GetCurrentStockPrices.");
            return(belowTarget);
        }
示例#22
0
 public override System.Web.Mvc.ActionResult ForgotPassword(BR.ToteToToe.Web.ViewModels.ForgotPasswordViewModel viewModel)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ForgotPassword);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     ForgotPasswordOverride(callInfo, viewModel);
     return callInfo;
 }
示例#23
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.CategoryModel viewModel, System.Web.HttpPostedFileBase file);
示例#24
0
 partial void CreateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.BaseRefCreateUpdateViewModel viewModel);
示例#25
0
 partial void ExternalLoginConfirmationOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Models.RegisterExternalLoginModel model, string returnUrl);
示例#26
0
 partial void ManageOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Models.LocalPasswordModel model);
示例#27
0
 partial void ManageOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Controllers.AccountController.ManageMessageId? message);
示例#28
0
 partial void RegisterOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Models.RegisterModel model);
示例#29
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.MyAccountEditViewModel viewModel);
示例#30
0
 public override System.Web.Mvc.ActionResult VerifyEmail(BR.ToteToToe.Web.ViewModels.VerifyEmailViewModel viewModel)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.VerifyEmail);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     VerifyEmailOverride(callInfo, viewModel);
     return callInfo;
 }
示例#31
0
 public override System.Web.Mvc.ActionResult Shipping(BR.ToteToToe.Web.ViewModels.CheckoutShippingViewModel viewModel)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Shipping);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     ShippingOverride(callInfo, viewModel);
     return callInfo;
 }
示例#32
0
 partial void ShippingOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.CheckoutShippingViewModel viewModel);
示例#33
0
 partial void ForgotPasswordOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.ForgotPasswordViewModel viewModel);
示例#34
0
        public static MacroFolder Load(string PathName, string FolderName)
        {
            FileStream DATFile = null;

            if (File.Exists(PathName))
            {
                try { DATFile = new FileStream(PathName, FileMode.Open, FileAccess.Read, FileShare.Read); }
                catch { }
            }
            BinaryReader BR = null;

            if (DATFile != null)
            {
                try {
                    BR = new BinaryReader(DATFile, Encoding.ASCII);
                    if (BR.BaseStream.Length != 7624 || BR.ReadUInt32() != 1)
                    {
                        BR.Close();
                        BR = null;
                    }
                    if (BR != null)
                    {
                        BR.ReadUInt32();                     // Unknown - sometimes zero, sometimes 0x80000000
                        byte[] StoredMD5 = BR.ReadBytes(16); // MD5 Checksum of the rest of the data
#if VerifyChecksum
                        {
                            byte[] Data = BR.ReadBytes(7600);
                            BR.BaseStream.Seek(-7600, SeekOrigin.Current);
                            MD5    Hash        = new MD5CryptoServiceProvider();
                            byte[] ComputedMD5 = Hash.ComputeHash(Data);
                            for (int i = 0; i < 16; ++i)
                            {
                                if (StoredMD5[i] != ComputedMD5[i])
                                {
                                    string Message = String.Format("MD5 Checksum failure for {0}:\n- Stored Hash  :", PathName);
                                    for (int j = 0; j < 16; ++j)
                                    {
                                        Message += String.Format(" {0:X2}", StoredMD5[j]);
                                    }
                                    Message += "\n- Computed Hash:";
                                    for (int j = 0; j < 16; ++j)
                                    {
                                        Message += String.Format(" {0:X2}", ComputedMD5[j]);
                                    }
                                    Message += '\n';
                                    MessageBox.Show(null, Message, "Warning");
                                    break;
                                }
                            }
                        }
#endif
                    }
                } catch { }
            }
            MacroSet MS = new MacroSet(FolderName);
            MS.FileName_ = PathName;
            MS.Folders.Add(new MacroFolder("Top Bar (Control)"));
            MS.Folders.Add(new MacroFolder("Bottom Bar (Alt)"));
            Encoding E = new FFXIEncoding();
            for (int i = 0; i < 2; ++i)
            {
                for (int j = 0; j < 10; ++j)
                {
                    MS.Folders[i].Macros.Add((BR != null) ? Macro.ReadFromDATFile(BR, E) : new Macro());
                }
            }
            MS.LockTree();
            if (BR != null)
            {
                BR.Close();
            }
            return(MS);
        }
示例#35
0
 partial void CreateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.ColourDescModel viewModel);
示例#36
0
        private void bttOpen_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlgOpenFile = new Microsoft.Win32.OpenFileDialog();
            dlgOpenFile.Multiselect = false;
            dlgOpenFile.DefaultExt  = ".lqps";
            dlgOpenFile.Filter      = "Application extension (.lqps)|*.lqps";

            FileStream   fiStream = null;
            BinaryReader BR       = null;
            List <int[]> Sloaded  = null;
            string       file     = "";
            bool         binOk    = true;

            try
            {
                if (dlgOpenFile.ShowDialog() == true)
                {
                    // --- file Loading ---
                    file = dlgOpenFile.FileName;

                    fiStream = new FileStream(file, FileMode.Open);

                    BR = new BinaryReader(fiStream);

                    int SolNum = BR.ReadInt32();
                    int length = BR.ReadInt32();

                    Sloaded = new List <int[]>(SolNum);
                    int[] Solution;

                    for (int i = 0; i < SolNum; i++)
                    {
                        Solution = new int[length];

                        for (int j = 0; j < length; j++)
                        {
                            Solution[j] = BR.ReadInt32();
                        }

                        Sloaded.Add(Solution);
                    }
                }
                else
                {
                    binOk = false;  // nothing was selected
                }
            }
            catch (Exception exc)
            {
                binOk = false;
                MessageBox.Show(exc.ToString(), "Issues during loading", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            finally
            {
                if (BR != null)
                {
                    BR.Close();
                }
                if (fiStream != null)
                {
                    fiStream.Close();
                }
            }

            if (binOk)
            {
                file = System.IO.Path.GetFileNameWithoutExtension(file);

                Solutions = Sloaded;

                Length   = Solutions[0].Length;
                NumTotal = Math.Pow(Length, Length);

                txtInfo.Text = string.Format("{0}", file);

                DrawRangeSpreading();
            }
        }
示例#37
0
 partial void LoginOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Models.LoginModel model, string returnUrl);
示例#38
0
 partial void VerifyEmailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.VerifyEmailViewModel viewModel);
示例#39
0
 public override System.Web.Mvc.ActionResult Register(BR.ToteToToe.Web.Models.RegisterModel model)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Register);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
     RegisterOverride(callInfo, model);
     return callInfo;
 }
示例#40
0
 partial void RegisterOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.SignInViewModel viewModel);
示例#41
0
 public override System.Web.Mvc.ActionResult Manage(BR.ToteToToe.Web.Controllers.AccountController.ManageMessageId? message)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Manage);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "message", message);
     ManageOverride(callInfo, message);
     return callInfo;
 }
示例#42
0
 partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.TrendPriorityViewModel viewModel, System.Web.Mvc.FormCollection collection);
示例#43
0
 public override System.Web.Mvc.ActionResult Manage(BR.ToteToToe.Web.Models.LocalPasswordModel model)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Manage);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
     ManageOverride(callInfo, model);
     return callInfo;
 }
示例#44
0
 partial void DetailsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.ViewModels.ModelDetailsViewModel viewModel, System.Web.Mvc.FormCollection collection);
示例#45
0
 public override System.Web.Mvc.ActionResult ExternalLoginConfirmation(BR.ToteToToe.Web.Models.RegisterExternalLoginModel model, string returnUrl)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExternalLoginConfirmation);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "returnUrl", returnUrl);
     ExternalLoginConfirmationOverride(callInfo, model, returnUrl);
     return callInfo;
 }
示例#46
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.BrandModel viewModel);
示例#47
0
 public override System.Web.Mvc.ActionResult Create(BR.ToteToToe.Web.Areas.Admin.ViewModels.BaseRefCreateUpdateViewModel viewModel)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Create);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     CreateOverride(callInfo, viewModel);
     return callInfo;
 }
示例#48
0
 partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.CategoryViewModel viewModel);
示例#49
0
 public override System.Web.Mvc.ActionResult Index(BR.ToteToToe.Web.Areas.Admin.ViewModels.TrendPriorityViewModel viewModel, System.Web.Mvc.FormCollection collection)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "collection", collection);
     IndexOverride(callInfo, viewModel, collection);
     return callInfo;
 }
示例#50
0
            public bool Save(string fileName)
            {
                if ((fileName == null) || (fileName[0] == '\0'))
                {
                    // no filename to save it as.
                    return(false);
                }

                #region "Create Data Block, Byte By Byte For MD5 Encoding"
                // Create Macro File First before I start writing anything
                byte[] data = new byte[7600];
                int    cnt  = 0;
                #region Loop Through All The Macros In "this" Macro Set
                for (int mcrnum = 0; mcrnum < 20; mcrnum++)
                {
                    // 4 byte null header
                    data[cnt++] = 0;
                    data[cnt++] = 0;
                    data[cnt++] = 0;
                    data[cnt++] = 0;
                    #region "Loop Through The Series Of Lines... 6 Lines (61 Bytes Each)"
                    for (int mcrline = 0; mcrline < 6; mcrline++)
                    {
                        #region "Loop Through One Line Byte By Byte For 61 Bytes"
                        byte[] s = this.FFXIEncoding.GetBytes(this.Macros[mcrnum].Line[mcrline]); //.ToCharArray());
                        for (int linecnt = 0; linecnt < 61; linecnt++)
                        {
                            if ((s.Length == 0) || ((linecnt + 1) > s.Length) || (linecnt == 60))
                            {
                                data[cnt++] = 0;
                            }
                            else
                            {
                                data[cnt++] = s[linecnt];
                            }
                        }
                        #endregion
                    }
                    #endregion
                    byte[] t = this.FFXIEncoding.GetBytes(this.Macros[mcrnum].Name);
                    #region "Loop Through The Name Byte By Byte For 9 Bytes"
                    for (int namecnt = 0; namecnt < 9; namecnt++)
                    {
                        if ((namecnt + 1) > t.Length)
                        {
                            data[cnt++] = 0;
                        }
                        else
                        {
                            data[cnt++] = t[namecnt];
                        }
                    }
                    #endregion
                    data[cnt++] = 0; // final null byte
                }
                #endregion

                if (cnt != 7600)
                {
                    LogMessage.Log("CMacroFile.Save(): Data has only " + cnt + " bytes out of 7600. Not Saving!");
                    return(false);
                }
                #endregion

                #region "Create MD5 Hash From Data Block"
                // This is one implementation of the abstract class MD5.

                MD5 md5 = new MD5CryptoServiceProvider();
                this.MD5Digest = md5.ComputeHash(data);
                if (this.MD5Digest.Length != 16)
                {
                    MessageBox.Show("MD5 Hash has only " + this.MD5Digest.Length + " bytes instead of 16.");
                    return(false);
                }
                #endregion

                #region "Open The Binary File For Creation/Overwriting, Proceed To Write Everything"
                FileStream fs = null;
                try
                {
                    if (!Directory.Exists(Path.GetDirectoryName(fileName).TrimEnd('\\')))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(fileName).TrimEnd('\\'));
                    }

                    fs = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite);
                }
                //catch (DirectoryNotFoundException e)
                //{
                //    String[] fPath = fileName.Split('\\');
                //    Array.Resize(ref fPath, fPath.Length - 1);
                //    String pathtocreate = String.Empty;
                //    foreach (String x in fPath)
                //        pathtocreate += x + "\\";
                //    pathtocreate = pathtocreate.Trim('\\');
                //    LogMessage.Log("{0}: {1} not found, attempting to create.", e.Message, pathtocreate);
                //    try
                //    {
                //        Directory.CreateDirectory(pathtocreate);
                //        fs = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite);
                //        LogMessage.Log("..Success");
                //    }
                //    catch (Exception ex)
                //    {
                //        fs = null;
                //        LogMessage.Log("..Failed, {0} & {1}", e.Message, ex.Message);
                //        return false;
                //    }
                //}
                catch (Exception e)
                {
                    LogMessage.Log("Error: {0}", e.Message);
                    return(false);
                }
                BinaryWriter BR = null;
                if (fs != null)
                {
                    BR = new BinaryWriter(fs);
                }
                if ((fs != null) && (BR != null))    // Write the header to the new file
                {
                    BR.Write((ulong)1);              // Write the first of eight bytes with 0x01 then 7 0x00's
                    BR.Write(this.MD5Digest, 0, 16); // Write MD5 hash
                    BR.Write(data, 0, 7600);
                    BR.Close();
                    fs.Close();
                }
                else
                {
                    return(false);
                }
                #endregion
                this.Changed = false;
                return(true);
            }
示例#51
0
 public override System.Web.Mvc.ActionResult Details(BR.ToteToToe.Web.ViewModels.ModelDetailsViewModel viewModel, System.Web.Mvc.FormCollection collection)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Details);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "collection", collection);
     DetailsOverride(callInfo, viewModel, collection);
     return callInfo;
 }
示例#52
0
        private void MessageSap(string tt)
        {
            string[] mes = tt.Split('\t', '\r');

            switch (mes[0])
            {
            case "A0":

                string HAccX = mes[1] + mes[2];
                string HAccY = mes[3] + mes[4];
                string HAccZ = mes[5] + mes[6];;
                AcX           = (float)Hextoint(HAccX) / 16384;
                AcY           = (float)Hextoint(HAccY) / 16384;
                AcZ           = (float)Hextoint(HAccZ) / 16384;
                textBox4.Text = textBox4.Text = String.Format("{0:0.00}", AcX);;
                textBox5.Text = textBox5.Text = String.Format("{0:0.00}", AcY);;
                textBox6.Text = textBox6.Text = String.Format("{0:0.00}", AcZ);;
                this.chart2.Series["Side G"].Points.Add(AcX);
                linetxt = AcX.ToString() + '\t' + AcX.ToString() + '\t' + AcX.ToString() + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + "\r\n";
                break;

            case "B0":
                string HYaw = mes[4] + mes[3] + mes[2] + mes[1];
                Yaw           = (Hextofloat(HYaw) * (float)180 / (float)3.14);
                textBox7.Text = String.Format("{0:0.00}", Yaw);
                linetxt       = "-\t-\t-\t" + Yaw.ToString() + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + "\r\n";
                break;

            case "B1":
                string HPitch = mes[4] + mes[3] + mes[2] + mes[1];
                Pitch         = Hextofloat(HPitch) * (float)180 / (float)3.14;
                textBox8.Text = textBox8.Text = String.Format("{0:0.00}", Pitch);
                linetxt       = "-\t-\t-\t-\t" + Pitch.ToString() + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + "\r\n";
                break;

            case "B2":
                string HRoll = mes[4] + mes[3] + mes[2] + mes[1];
                Roll          = Hextofloat(HRoll) * (float)180 / (float)3.14;
                textBox9.Text = textBox9.Text = String.Format("{0:0.00}", Roll);
                linetxt       = "-\t-\t-\t-\t-\t" + Roll.ToString() + '\t' + '-' + '\t' + '-' + '\t' + '-' + '\t' + '-' + "\r\n";
                break;

            case "C0":
                string HLat = tt[2].ToString() + tt[3].ToString() + tt[4].ToString() + tt[5].ToString() + tt[6].ToString() + tt[7].ToString() + tt[8].ToString() + tt[9].ToString();
                // Lat = Hextofloat(HLat);
                textBox2.Text = Lat.ToString();
                linetxt       = "\r\n";
                break;

            case "C1":
                string HLong = tt[2].ToString() + tt[3].ToString() + tt[4].ToString() + tt[5].ToString() + tt[6].ToString() + tt[7].ToString() + tt[8].ToString() + tt[9].ToString();
                // Long = Hextofloat(HLong);
                textBox3.Text = Long.ToString();
                linetxt       = "\r\n";
                break;

            case "E0":
                string fEngine   = mes[1] + mes[2];
                string fSpeed    = mes[3] + mes[4];
                string fThrottle = mes[5] + mes[6];
                textBox1.AppendText(fEngine);
                textBox14.AppendText(fSpeed);
                textBox15.AppendText(fThrottle);
                break;

            case "E1":
                string fTime = mes[1] + mes[2];
                //Time=fTime.ToString;
                textBox16.AppendText(fTime);
                linetxt = "\r\n";
                break;

            case "F0":
                string HFR = mes[1] + mes[2];
                FR = Hextoint(HFR);
                Modelabsorber2(FR);
                textBox11.Text = FR.ToString();
                CFR            = 1;
                linetxt        = "-\t-\t-\t-\t-\t-\t" + FR.ToString() + '-' + '-' + '-' + "\r\n";
                break;

            case "F5":
                string HFL = mes[1] + mes[2];
                FL = Hextoint(HFL);
                Modelabsorber1(FL);
                textBox10.Text = FL.ToString();
                CFL            = 1;
                linetxt        = "-\t-\t-\t-\t-\t-\t-\t" + FL.ToString() + '\t' + '-' + '\t' + '-' + "\r\n";
                break;

            case "FA":
                string HBR = mes[1] + mes[2];
                BR = Hextoint(HBR);
                Modelabsorber4(BR);
                textBox13.Text = BR.ToString();
                CBR            = 1;
                linetxt        = "-\t-\t-\t-\t-\t-\t-\t-\t" + BR.ToString() + '\t' + '-' + "\r\n";
                break;

            case "FF":
                string HBL = mes[1] + mes[2];
                BL = Hextoint(HBL);
                Modelabsorber3(BL);
                textBox12.Text = BL.ToString();
                CBL            = 1;
                linetxt        = "-\t-\t-\t-\t-\t-\t-\t-\t-\t" + BL.ToString() + "\r\n";
                break;

            default: break;
            }
            if (CFR + CFL + CBR + CBL == 4)
            {
                this.chart1.Series["Front Right"].Points.Add(FR, yax);
                this.chart1.Series["Front Left"].Points.Add(FL, yax);
                this.chart1.Series["Back Right"].Points.Add(BR, yax);
                this.chart1.Series["Back Left"].Points.Add(BL, yax);
                yax++;
                CFR = 0;  CFL = 0; CBR = 0; CBL = 0;
            }
            //Create the file for real.
            using (System.IO.StreamWriter fileReal =
                       new System.IO.StreamWriter(@textBox18.Text + "Real", true))
            {
                fileReal.WriteLine(linetxt);
            }
            linetxt = "";
        }
示例#53
0
 public override System.Web.Mvc.ActionResult Edit(BR.ToteToToe.Web.Areas.Admin.ViewModels.BrandModel viewModel)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "viewModel", viewModel);
     EditOverride(callInfo, viewModel);
     return callInfo;
 }
示例#54
0
 partial void UpdateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, BR.ToteToToe.Web.Areas.Admin.ViewModels.OrderStatusViewModel viewModel);