public List <group_comments> SelectAllGroupComments() { #region Подключенный режим //List<GroupComments> groupComments = new List<GroupComments>(); //DbCommand command = SqlConncetionHelper.Connection.CreateCommand(); //command.CommandText = "select * from group_comments"; //DbDataReader reader = command.ExecuteReader(); //while (reader.Read()) //{ // groupComments.Add(new GroupComments // { // Id = (int)reader["gc_id"], // UserId = (int)reader["user_id"], // GroupId = (int)reader["group_id"], // Text = reader["comment_text"].ToString(), // SendDate = (DateTime)reader["send_date"] // }); //} #endregion //Entity Framwork implementation List <group_comments> comments = new List <group_comments>(); using (var context = new SteamContext()) { comments = context.Group_comments.ToList(); } return(comments); }
public List <product_comments> SelectProductComments(product product) { List <ProductComment> comments = new List <ProductComment>(); SteamContext context = new SteamContext(); return(context.Product_comments.Where(comment => comment.product_id == product.products_id).ToList()); }
public List <product_comments> SelectUserProductComments(user user) { List <ProductComment> comments = new List <ProductComment>(); SteamContext context = new SteamContext(); return(context.Product_comments.Where(comment => comment.user_id == user.user_id).ToList()); }
private void BtnSubmit_Click(object sender, RoutedEventArgs e) { var userName = txtBoxUserName.Text; var userPswrd = txtBoxPassword.Text; using (var db = new SteamContext()) { var users = (from user in db.Users where user.nickname == userName && user.password == userPswrd select user).ToList(); if (users.Count == 1) { AuthenticationService authenticationService = new AuthenticationService(); authenticationService.SignIn(users[0]); MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } else { MessageBox.Show("Incorrect enter"); } } }
public static void Initialize(int appID) { FindResult = new APICallCallback <LeaderboardFindResult_t>(); ScoresDownloaded = new APICallCallback <LeaderboardScoresDownloaded_t>(); ScoreUploaded = new APICallCallback <LeaderboardScoreUploaded_t>(); Environment.SetEnvironmentVariable("SteamAppId", appID.ToString()); SteamContext.Initialize(false); DebugLog.AppendText("Getting ISteam interface: ISteamFriends008..."); Friends = SteamContext.SteamClient.GetISteamFriends <ISteamFriends008>( SteamContext.HSteamPipe, SteamContext.HSteamUser ); DebugLog.AppendText(string.Format("ISteamFriends008 = 0x{0:8x}", Friends)); DebugLog.AppendText("Getting ISteam interface: ISteamUserStats007..."); UserStats = SteamContext.SteamClient.GetISteamUserStats <ISteamUserStats007>( SteamContext.HSteamUser, SteamContext.HSteamPipe ); DebugLog.AppendText(string.Format("ISteamUserStats007 = 0x{0:8X}{1}", UserStats, Environment.NewLine)); }
//--------------------------------------------------------------------------------------------------------------- #region SELECT public List <friend_messages> SelectAllFriendMessages() { using (SteamContext db = new SteamContext()) { var result = db.Friend_messages.ToList(); return(result); } }
public decimal AddWallet(User use, long many) { using (var context = new SteamContext()) { wallet wallet = new wallet(); decimal walletMamy = wallet.balance += many; return(walletMamy); } }
public List <user> SelectUserWalletUser(User use) { using (var context = new SteamContext()) { List <user> users = new List <user>(); users = context.Users.Where(x => x.wallet_id == use.WalletId).ToList(); return(users); } }
public AdvancedSteamImportDialog() { SteamApps = new List <SteamLaunchable>(); //ListItems = new List<SteamLaunchableListViewitem>(); context = SteamContext.GetInstance(); InitializeComponent(); this.Icon = ((Icon)(new ComponentResourceManager(typeof(Resources)).GetObject("steam"))); lvGames.SmallImageList = new ImageList(); SetPlatforms(PluginHelper.DataManager.GetAllPlatforms()); }
public string GetUserNameById(int user_id) { using (SteamContext db = new SteamContext()) { var result = (from users in db.Users where users.user_id == user_id select users.nickname).ToList(); return(result[0]); } }
private static async Task <DbCommand> CreateSqlCommandAsync(SteamContext context) { var command = context.Apps.CreateDbCommand(); if (command.Connection.State == ConnectionState.Closed || command.Connection.State == ConnectionState.Broken) { await command.Connection.OpenAsync(); } return(command); }
public user FindUserByNickname(string nickname) { user findingUser = new user(); using (var context = new SteamContext()) { findingUser = context.Users.SingleOrDefault(x => x.nickname == nickname); } return(findingUser); }
public static void Initialize(int appId) { Environment.SetEnvironmentVariable("SteamAppId", appId.ToString()); SteamContext.Initialize(false); DebugLog.AppendText("Getting ISteam interface: ISteamScreenshots001..."); Screenshots = SteamContext.SteamClient.GetISteamGenericInterface <ISteamScreenshots001>( SteamContext.HSteamUser, SteamContext.HSteamPipe ); DebugLog.AppendText("ISteamScreenshots001 = 0x{0:8x}", Screenshots.Interface); }
static async Task Main() { AppDomain.CurrentDomain.ProcessExit += new EventHandler(onClose); steamService = OperatingSystem.IsWindows() ? new SteamServiceWindows() : new SteamServiceLinux(); string redirectUrl = @"http://localhost:8888/"; keySender = new InputSenderWindows(); keyFormatter = new KeyFormatterWindows(); pathResolver = new PathResolver(); requestsManager = new SpotifyRequestsManager("7633771350404368ac3e05c9cf73d187", "29bd9ec2676c4bf593f3cc2858099838", redirectUrl); process = new GameProcess(); process.Start(); steamContext = steamService.GetSteamContext(); var accounts = steamContext.GetAccounts(); Console.WriteLine("Awaiting user authorization..."); var server = new AuthServer(redirectUrl); string authUrl = requestsManager.GetAuthUrl().Replace("&", "^&"); Process.Start(new ProcessStartInfo("cmd", $"/c start {authUrl}") { CreateNoWindow = true }); string code = await server.GetAuthCode(); await requestsManager.StartTokenRequests(code); int accSteamId3 = accounts.FirstOrDefault((x) => x.Name == steamContext.LastAccount).SteamId3; string writePath = pathResolver.GetWritePath(process.CurrentProcess, steamContext.UserdataPath, accSteamId3.ToString()); configWriter = new ConfigWriter(writePath); Console.WriteLine("Press the bind key"); var consoleInput = Console.ReadKey(true); currentKeyVirtual = (ushort)consoleInput.Key; currentKey = keyFormatter.GetSourceKey(currentKeyVirtual); trackInfoUpdater = new SpotifyTrackUpdater(requestsManager); trackInfoUpdater.OnPlaybackStateUpdate += onPlaybackStateUpdate; trackInfoUpdater.StartPlaybackUpdate(); }
public bool GetIsValidForGame(IGame selectedGame) { if (SteamToolsContext.IsSteamGame(selectedGame)) { UInt64?GameIDNumber = SteamToolsContext.GetSteamGameID(selectedGame); if (GameIDNumber.HasValue) { SteamContext context = SteamContext.GetInstance(); bool? l_IsInstalled = SteamToolsContext.IsInstalled(GameIDNumber.Value, selectedGame); if (l_IsInstalled.HasValue && !l_IsInstalled.Value) { return(true); } } } return(false); }
public bool CreateProductComment(product_comments comment) { SteamContext context = new SteamContext(); product_comments newComment = new product_comments(); newComment.product_id = comment.product_id; newComment.user_id = comment.user_id; newComment.text = comment.text; newComment.send_date = comment.send_date; newComment.comment_mark = comment.comment_mark; context.Product_comments.Add(newComment); if (context.SaveChanges() == 0) { return(false); } return(true); }
private void RegisterButtonClick(object sender, RoutedEventArgs e) { if (ValidateRegistration()) { Service.CreateUsers(new User { Nickname = NicknameText.Text, Password = PasswordText.Text }); // Моментальная аутентификация после создания нового пользователя using (var context = new SteamContext()) { AuthenticationService authService = new AuthenticationService(); authService.SignIn(context.Users.Single(x => x.nickname == NicknameText.Text)); } Close(); } }
private void InstallWithSteamDialog(UInt64 GameIDNumber) { SteamToolsContext.InstallGame(GameIDNumber); try { Process steam = SteamContext.GetInstance().GetSteamProcess(); steam.Refresh(); string InstallWindowTitle = steam.MainWindowTitle; IntPtr InstallWindow = steam.MainWindowHandle; // try to get the install window int Timeout = 0; while (!InstallStrings.Any(name => InstallWindowTitle.StartsWith(name + @" - ")) && !InstallStringsEnd.Any(name => InstallWindowTitle.EndsWith(@" - " + name))) { if (Timeout > 10 * 5) { break; } Thread.Sleep(100); Timeout++; steam.Refresh(); InstallWindowTitle = steam.MainWindowTitle; InstallWindow = steam.MainWindowHandle; } // if we found the install window if (InstallStrings.Any(name => InstallWindowTitle.StartsWith(name + @" - ")) || InstallStringsEnd.Any(name => InstallWindowTitle.EndsWith(@" - " + name))) { while (IsWindow(InstallWindow)) { Thread.Sleep(100); } SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle); } } catch { } }
private void Button_Click_Delete_Row(object sender, RoutedEventArgs e) { int id = (FriendsDataGrid.SelectedItem as user).user_id; FriendService friendService = new FriendService(); using (SteamContext context = new SteamContext()) { user tmp = (from user in context.Users where user.user_id == id select user).SingleOrDefault(); friendService.DeleteFriends(tmp); } user user2 = new user() { user_id = 2, nickname = "EEE", register_date = new DateTime(1582, 10, 5), status_id = 1, IsDeleted = 0, password = "******", wallet_id = 1 }; var userFriends = friendService.GetUserFriends(user2); FriendsDataGrid.ItemsSource = userFriends; }
//Entity Framework implementation public List <group> SelectUserGroups(User user) { #region Подключенный режим //List<Group> groups = new List<Group>(); //DbCommand command = SqlConncetionHelper.Connection.CreateCommand(); //DbParameter userIdParameter = command.CreateParameter(); //userIdParameter.DbType = System.Data.DbType.Int32; //userIdParameter.ParameterName = "@UserId"; //userIdParameter.Value = user.Id; //command.Parameters.Add(userIdParameter); //command.CommandText = "select * from groups where user_id = @UserId"; //DbDataReader reader = command.ExecuteReader(); //while (reader.Read()) //{ // groups.Add(new Group // { // Id = (int)reader["group_id"], // Name = reader["group_name"].ToString(), // CreatedDate = (DateTime)reader["created_date"], // UserId = (int)reader["user_id"], // IsDeleted = (bool)reader["IsDeleted"] // }); //} //return groups; #endregion using (var context = new SteamContext()) { List <group> groups = new List <group>(); groups = context.Groups.Where(x => x.User_id == user.Id).ToList(); return(groups); } }
public MainWindow() { InitializeComponent(); HeaderBlock.CloseButton.MouseLeftButtonDown += new MouseButtonEventHandler((o, s) => Application.Current.Shutdown()); HeaderBlock.CollapseButton.MouseLeftButtonDown += new MouseButtonEventHandler((o, s) => WindowState = WindowState.Minimized); _spotify = new SpotifyRequestsManager("7633771350404368ac3e05c9cf73d187", "29bd9ec2676c4bf593f3cc2858099838", @"http://localhost:8888/"); _steamService = new SteamServiceWindows(); _pathResolver = new PathResolver(); _keySender = new InputSenderWindows(); _appConfigWorker = new UserSettingsWorker(); _appConfig = _appConfigWorker.ReadConfigFile(); _userContext = _steamService.GetSteamContext(); _accounts = _userContext.GetAccounts(); _gameProcess = new GameProcess(); _gameProcess.Start(); int steamid3 = _accounts.FirstOrDefault((x) => x.Name == _userContext.LastAccount).SteamId3; string writePath = _pathResolver.GetWritePath(_gameProcess.CurrentProcess, _userContext.UserdataPath, steamid3.ToString()); _configWriter = new ConfigWriter(writePath, _appConfig.CfgText); _playbackStateUpdater = new SpotifyTrackUpdater(_spotify); _playbackStateUpdater.OnPlaybackStateUpdate += UpdateTrackInfo; UserSettingsBlock.CurrentAccountText.Text = _userContext.LastAccount; UserSettingsBlock.UpdateKey(_appConfig.LastUsedKey); if (_appConfig.IsAutoSendEnabled) { UserSettingsBlock.AutosendCheck.Toggle(); } }
public static void Initialize() { SteamContext.Initialize(false); DebugLog.AppendText("Getting ISteam interface: ISteamRemoteStorage002..."); RemoteStorage = SteamContext.SteamClient.GetISteamRemoteStorage <ISteamRemoteStorage002>( SteamContext.HSteamUser, SteamContext.HSteamPipe ); DebugLog.AppendText(string.Format("ISteamRemoteStorage002 = 0x{0:8X}", RemoteStorage.Interface)); DebugLog.AppendText("Getting ISteam interface: ISteamRemoteStorage001..."); RemoteStorageOld = SteamContext.SteamClient.GetISteamRemoteStorage <ISteamRemoteStorage001>( SteamContext.HSteamUser, SteamContext.HSteamPipe ); DebugLog.AppendText(string.Format("ISteamRemoteStorage001 = 0x{0:8X}{1}", RemoteStorageOld.Interface, Environment.NewLine)); }
internal static void Init() { SteamToolsOptions.LoadConfig(); try { LaunchBoxPremiumLicenceFound = File.Exists(@"License.xml"); } catch { } lock (contextLock) { if (context == null) { context = SteamContext.GetInstance(); SteamSentinalToken = new CancellationTokenSource(); SteamSentinalThread = new Thread(new ThreadStart(CheckSteam)); SteamSentinalThread.Start(); SteamUpdateSentinalToken = new CancellationTokenSource(); SteamUpdateSentinalThread = new Thread(new ThreadStart(CheckSteamGames)); SteamUpdateSentinalThread.Start(); } } }
public DatabaseService(SteamContext context) { _context = context; }
public List <product> SelectAllProducts() { SteamContext ctx = new SteamContext(); return(ctx.Products.ToList()); }
public HttpHandler(SteamContext context, string defaultFile = null) { m_defaultFile = defaultFile; this.context = context; }
static void Main(string[] args) { int port = 0; if (args.Length > 0) { int.TryParse(args[0], out port); } if (port <= 0) { MessageBox.Show("Please supply a port paramater that is within the valid range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string namedPipeCustom = string.Empty; //if (args.Length > 1) //{ // namedPipeCustom = args[1].Trim(); //} //if(port == 0) { MenuItem mExit = new MenuItem("Exit", new EventHandler(Exit)); MenuItem mPort = new MenuItem($"Port: {port}"); mPort.Enabled = false; ContextMenu Menu = new ContextMenu(new MenuItem[] { mExit, mPort }); Tray = new NotifyIcon() { Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), Visible = true, Text = "Carbyne Steam Interop Server", ContextMenu = Menu }; } SteamContext context = SteamContext.GetInstance(); context.Init(); //OnEventRaisedSocketHandler = new WebSocketHandler(); FunctionHttpHandler = new HttpHandler(context); server = new HttpServer(port); server.AddHttpRequestHandler( "/", FunctionHttpHandler ); //server.AddWebSocketRequestHandler( // "/OnEventRaised/", // OnEventRaisedSocketHandler //); server.Start(); Application.Run(); /*while (!poison) * { * Thread.Sleep(1000); * }*/ server.Stop(); if (context != null) { context.Shutdown(); } if (Tray != null) { Tray.Dispose(); } }
public List <product_comments> SelectAllProductComments() { SteamContext context = new SteamContext(); return(context.Product_comments.ToList()); }
public static void Shutdown() { SteamContext.Shutdown(); }
public List <user> GetUserFriends(user user) { //достаем всех друзей юзера (не удаленных) //using (SteamContext db = new SteamContext()) //{ // var users = db.Users.ToList(); // var innerQuery = (from friends in db.Friends // where friends.user_id == user.user_id // select friends.friend_id).ToList(); // List<string> userFriends = new List<string>(); // for (int i = 0; i < users.Count; i++) // { // for (int j = 0; j < innerQuery.Count; j++) // { // if (users[i].user_id == innerQuery[j]) // { // userFriends.Add(users[i].nickname); // } // } // } // //var result = (from users in db.Users // // where innerQuery.Contains(users.user_id) // // select users).ToList(); // return userFriends; //} using (SteamContext db = new SteamContext()) { var users = db.Users.ToList(); var innerQuery = (from friends in db.Friends where friends.user_id == user.user_id select friends.friend_id).ToList(); List <user> userFriends = new List <user>(); for (int i = 0; i < users.Count; i++) { for (int j = 0; j < innerQuery.Count; j++) { if (users[i].user_id == innerQuery[j]) { userFriends.Add(users[i]); } } } //var result = (from users in db.Users // where innerQuery.Contains(users.user_id) // select users).ToList(); return(userFriends); } //------------------------------------------------------------------------------------------------------------------------ //List<User> friends = new List<User>(); //DbCommand command = SqlConncetionHelper.Connection.CreateCommand(); //DbParameter UserIdParameter = command.CreateParameter(); //UserIdParameter.DbType = System.Data.DbType.Int32; //UserIdParameter.IsNullable = false; //UserIdParameter.ParameterName = "@UserId"; //UserIdParameter.Value = user.Id; //command.Parameters.Add(UserIdParameter); //command.CommandText = "select * from [dbo].[users] where user_id IN (select friend_id from [dbo].[friends] user_id = @UserId)"; //DbDataReader reader = command.ExecuteReader(); //while (reader.Read()) //{ // friends.Add( // new User // { // Id = (int)reader["user_id"], // Nickname = (string)reader["nickname"], // RegisterDate = (DateTime)reader["register_date"], // WalletId = (int)reader["wallet_id"], // StatusId = (int)reader["status_id"], // IsDeleted = (bool)reader["IsDeleted"], // Password = (string)reader["password"] // } // ); //} //return friends; }