void SteamTest()
        {
            steam = Steam.Initialize();
            steam = Steam.Instance;

            b = steam.IsAvailable;
            appID = steam.AppID;
            Settings setting = steam.Settings;
            ICloud cloud = steam.Cloud;
            IStats stats = steam.Stats;
            IUser user = steam.User;

            steam.Shutdown();
            steam.Update();
            steam.ReleaseManagedResources();
        }
 public bool InitGameServer(uint ip, ushort gamePort, ushort queryPort, uint flags, AppID gameAppId, string versionString)
 {
     //CheckIfUsable();
     return NativeMethods.GameServer_InitGameServer(ip, gamePort, queryPort, flags, gameAppId.AsUInt32, versionString);
 }
 public bool RemoveFavoriteGame(AppID appID, uint ip, ushort connPort, ushort queryPort, uint flags)
 {
     CheckIfUsable();
     return NativeMethods.MatchMaking_RemoveFavoriteGame(appID.AsUInt32, ip, connPort, queryPort, flags);
 }
 public bool GetFavoriteGame(int game, out AppID appID, out uint ip, out ushort connPort, out ushort port, out uint flags, out uint time32LastPlayedOnServer)
 {
     CheckIfUsable();
     ip = 0;
     connPort = 0;
     port = 0;
     flags = 0;
     time32LastPlayedOnServer = 0;
     uint localAppID = 0;
     bool returnValue = NativeMethods.MatchMaking_GetFavoriteGame(game, ref localAppID, ref ip, ref connPort, ref port, ref flags, ref time32LastPlayedOnServer);
     appID = new AppID(localAppID);
     return returnValue;
 }
 public ServerListRequestHandle RequestSpectatorServerList(AppID appID, MatchMakingKeyValuePair[] filters,
     MatchmakingServerListResponse requestServersResponse)
 {
     return ServerRequest(ServerRequestType.Spectator, appID, filters, requestServersResponse);
 }
 public void PublishVideo(WorkshopVideoProviders videoProviders, string videoAccount, string videoIdentifier, 
     string previewFile, AppID consumerAppId, string title, string description, 
     RemoteStoragePublishedFileVisibility visibility, IList<string> tags)
 {
     CheckIfUsable();
     using (SteamParamStringArray tagArray = new SteamParamStringArray(tags))
     {
         NativeMethods.Cloud_PublishVideo((int)videoProviders, videoAccount, videoIdentifier, previewFile, consumerAppId.AsUInt32, title,
             description, (int)visibility, tagArray.UnmanagedMemory);
     }
 }
        /// <summary>
        /// 
        /// </summary>
        public bool GetUGCDetails(UGCHandle handle, out AppID appID, out string name,
            out int fileSize, out SteamID creator)
        {
            CheckIfUsable();

            IntPtr stringPointer = IntPtr.Zero;
            uint rawAppID = 0;
            ulong rawCreator = 0;

            fileSize = 0;

            bool result = NativeMethods.Cloud_GetUGCDetails(handle.AsUInt64, ref rawAppID, ref stringPointer,
                ref fileSize, ref rawCreator);

            appID = new AppID(rawAppID);
            name = NativeHelpers.ToStringAnsi(stringPointer);
            creator = new SteamID(rawCreator);

            return result;
        }
 public void ActivateGameOverlayToStore(AppID appID, OverlayToStoreFlag flag)
 {
     CheckIfUsable();
     NativeMethods.Friends_ActivateGameOverlayToStore(appID.AsUInt32, (int)flag);
 }
 public uint GetEarliestPurchaseUnixTime(AppID appID)
 {
     CheckIfUsable();
     return NativeMethods.Apps_GetEarliestPurchaseUnixTime( appID.AsUInt32 );
 }
 public bool IsDlcInstalled(AppID appID)
 {
     CheckIfUsable();
     return NativeMethods.Apps_IsDlcInstalled( appID.AsUInt32 );
 }
 public bool IsSubscribedApp(AppID appID)
 {
     CheckIfUsable();
     return NativeMethods.Apps_IsSubscribedApp( appID.AsUInt32 );
 }
Beispiel #12
0
 public static void SetAppID(AppID newAppID)
 {
     s_programAppID = newAppID;
 }
 public override int GetHashCode()
 {
     return(Clsid.GetHashCode() ^ Name.GetSafeHashCode() ^ TreatAs.GetHashCode()
            ^ AppID.GetHashCode() ^ TypeLib.GetHashCode() ^ Servers.Values.GetEnumHashCode()
            ^ Elevation.GetSafeHashCode() ^ ActivatableFromApp.GetHashCode() ^ TrustedMarshaller.GetHashCode());
 }
Beispiel #14
0
 public static void SetAppID(AppID newAppID)
 {
   Utility.s_programAppID = newAppID;
 }
Beispiel #15
0
 public static void SetAppID(AppID newAppID)
 {
     Utility.s_programAppID = newAppID;
 }
Beispiel #16
0
 public static void SetAppID(AppID newAppID)
 {
     s_programAppID = newAppID;
 }
        public bool GetDLCDataByIndex(int iDLC, out AppID pAppID, out bool pbAvailable, out string pchName)
        {
            CheckIfUsable();
            using (NativeBuffer buffer = new NativeBuffer(Constants.Apps.MaxAchievementNameLength))
            {
                uint localAppId = 0;
                pbAvailable = false;
                
                bool result = NativeMethods.Apps_GetDLCDataByIndex(iDLC, ref localAppId, ref pbAvailable, buffer.UnmanagedMemory, buffer.UnmanagedSize);
                pAppID = new AppID(localAppId);

                pchName = NativeHelpers.ToStringAnsi(buffer.UnmanagedMemory);

                return result;
            }
        }
 public void UninstallDLC(AppID appID)
 {
     CheckIfUsable();
     NativeMethods.Apps_UninstallDLC( appID.AsUInt32 );
 }
 public void RequestAppProofOfPurchaseKey(AppID appID)
 {
     CheckIfUsable();
     NativeMethods.Apps_RequestAppProofOfPurchaseKey( appID.AsUInt32 );
 }
 public void PublishWorkshopFile(string fileName, string previewFile, AppID consumerAppId,
     string title, string description, RemoteStoragePublishedFileVisibility visibility,
     IList<string> tags, WorkshopFileType workshopFileType)
 {
     CheckIfUsable();
     using (SteamParamStringArray tagsArray = new SteamParamStringArray(tags))
     {
         NativeMethods.Cloud_PublishWorkshopFile(fileName, previewFile, consumerAppId.AsUInt32,
             title, description, (int)visibility, tagsArray.UnmanagedMemory, (int)workshopFileType);
     }
 }
        public uint GetInstalledDepots(AppID appID, out DepotID pDepotID, uint maxDepots)
        {
            CheckIfUsable();

            uint localDepotId = 0;

            uint result = NativeMethods.Apps_GetInstalledDepots(appID.AsUInt32, ref localDepotId, maxDepots);

            pDepotID = new DepotID(localDepotId);

            return result;
        }
 public ServerListRequestHandle RequestLANServerList(AppID appID,
     MatchmakingServerListResponse requestServersResponse)
 {
     return new ServerListRequestHandle(NativeMethods.MatchmakingServers_RequestLANServerList(
         appID.AsUInt32, requestServersResponse.ObjectId));
 }
 public void SetProgramAppID(AppID programAppID)
 {
 }
        private ServerListRequestHandle ServerRequest(ServerRequestType requestType, AppID appID,
            MatchMakingKeyValuePair[] filters, MatchmakingServerListResponse requestResponse)
        {
            // Code reuse FTW!

            // Allocate an array that will hold addresses to native MatchMakingKeyValuePair objects
            using (NativeBuffer arrayBuffer = new NativeBuffer(Marshal.SizeOf(typeof(IntPtr)) * filters.Length))
            {
                NativeBuffer[] nativeObjects = new NativeBuffer[filters.Length];
                // Fill each array slot with an address to an actual object
                try
                {
                    for (int i = 0; i < filters.Length; i++)
                    {
                        // Copy the managed objects to native memory
                        NativeBuffer buffer = NativeBuffer.CopyToNative(filters[i]);
                        nativeObjects[i] = buffer;
                        // Add the native address to the array
                        Marshal.WriteInt32(arrayBuffer.UnmanagedMemory, i * Marshal.SizeOf(typeof(int)), buffer.UnmanagedMemory.ToInt32());
                    }

                    // Now do the actual request

                    switch (requestType)
                    {
                        case ServerRequestType.Internet:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestInternetServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Friends:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestFriendsServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Favorites:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestFavoritesServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.History:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestHistoryServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Spectator:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestSpectatorServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        default:
                            // This should never happen as our code can not be allowed to make this error
                            throw new ArgumentException();
                    }
                }
                finally
                {
                    // Cleanup in all cases. Exception or not.
                    foreach (var item in nativeObjects)
                    {
                        if (item != null)
                        {
                            item.Dispose();
                        }
                    }
                }
            }
        }
Beispiel #25
0
        public async Task <ActionResult> VK()
        {
            //http://minecraft-sodeon.ru/#access_token=6a744edc0b862ee6d2d52a0a95a3097fc7b8726ce199260ab62e5e0e4b41150658edc9ac73c9f90bab83f&expires_in=86400&user_id=114224258
            //https://api.vk.com/method/users.get.xml?user_ids=210700286&fields=bdate&v=5.69
            //https://oauth.vk.com/access_token?client_id=1&client_secret=H2Pk8htyFD8024mZaPHm&redirect_uri=http://mysite.ru&code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a
            string jsonToken = null;

            try
            {
                string path = Request.Url.AbsoluteUri;
                string code = path.Split('=')[1];

                AppID appID = null;
                using (AppIDContext db = new AppIDContext())
                {
                    appID = db.AppID.FirstOrDefault();
                }

                string domain = System.Web.HttpContext.Current.Request.Url.Authority;
                string url    = "https://oauth.vk.com/access_token?client_id=" + appID.appID + "&client_secret=" + appID.PrivateKey + "&redirect_uri=http://localhost:54106/Account/VK&code=" + code;
                jsonToken = await GetAccessToken(url);
            }
            catch
            {
                using (ErrorsContext db = new ErrorsContext())
                {
                    db.Errors.Add(new Error {
                        ErrorText = "VK: Неверный VKAppID!"
                    });
                }
            }

            //"{\"access_token\": \"20972fdda2157fe9dcbf61754cd999bf1c03930ef45ebf8d62925a756d05340996805433e53d17010889d\", \"expires_in\": 86400, \"user_id\": 114224258}"
            //"{\"response\": [{\"first_name\": \"Антон\", \"id\": 114224258, \"last_name\": \"Репетухо\", \"photo_200_orig\": \"https://pp.userapi.com/c836636/v836636617/49c88/lyxqzBnvsuI.jpg\"}]}"
            if (jsonToken != null)
            {
                jsonToken = jsonToken.Split(' ')[5];
                string userID = jsonToken.Split('}')[0];
                if (userID != jsonToken)
                {
                    string url      = "https://api.vk.com/method/users.get.json?user_ids=" + userID + "&fields=photo_200_orig&v=5.69";
                    string jsonUser = await GetAccessToken(url);

                    string firstName = jsonUser.Split('\"')[5];
                    string lastName  = jsonUser.Split('\"')[11];
                    string idUser    = jsonUser.Split(',')[1];
                    idUser = idUser.Split(' ')[2];
                    string photo = jsonUser.Split('\"')[15];

                    User user = null;
                    using (UserContext db = new UserContext())
                    {
                        user = db.Users.FirstOrDefault(u => u.UserID == idUser);
                    }
                    if (user == null)
                    {
                        // создаем нового пользователя
                        using (UserContext db = new UserContext())
                        {
                            db.Users.Add(new User {
                                Name = firstName + " " + lastName, UserID = idUser, Image = photo
                            });
                            db.SaveChanges();

                            user = db.Users.Where(u => u.UserID == idUser).FirstOrDefault();
                        }
                        // если пользователь удачно добавлен в бд
                        if (user != null)
                        {
                            FormsAuthentication.SetAuthCookie(firstName + " " + lastName, true);
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                    else
                    {
                        FormsAuthentication.SetAuthCookie(firstName + " " + lastName, true);
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    using (ErrorsContext db = new ErrorsContext())
                    {
                        db.Errors.Add(new Error {
                            ErrorText = "VK: Ошибка получения Токена (ID)!"
                        });
                    }
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
 public int AddFavoriteGame(AppID appID, uint ip, ushort connPort, ushort queryPort, uint flags, uint time32LastPlayedOnServer)
 {
     CheckIfUsable();
     return NativeMethods.MatchMaking_AddFavoriteGame(appID.AsUInt32, ip, connPort, queryPort, flags, time32LastPlayedOnServer);
 }
        public UGCQueryHandle CreateQueryUserUGCRequest(AccountID accountId, UserUGCList listType, EUGCMatchingUGCType matchingUGCType, EUserUGCListSortOrder sortOrder, AppID creatorAppID, AppID consumerAppID, uint page)
        {
            CheckIfUsable();

            return new UGCQueryHandle(NativeMethods.UGC_CreateQueryUserUGCRequest(accountId.AsUInt32, (int)listType, (int)matchingUGCType, (int)sortOrder, creatorAppID.AsUInt32, creatorAppID.AsUInt32, page));
        }
Beispiel #28
0
 public static void SetAppID(AppID newAppID)
 {
 }
        public UGCQueryHandle CreateQueryAllUGCRequest(EUGCQuery queryType, EUGCMatchingUGCType matchingeMatchingUGCTypeFileType, AppID creatorAppID, AppID consumerAppID, uint page)
        {
            CheckIfUsable();

            return new UGCQueryHandle(NativeMethods.UGC_CreateQueryAllUGCRequest((int)queryType, (int)matchingeMatchingUGCTypeFileType, creatorAppID.AsUInt32, consumerAppID.AsUInt32, page));
        }
 public UserHasLicenseForAppResult UserHasLicenseForApp(SteamID steamID, AppID appID)
 {
     //CheckIfUsable();
     int tempreturn = NativeMethods.GameServer_UserHasLicenseForApp(steamID.AsUInt64, appID.AsUInt32);
     return (UserHasLicenseForAppResult)tempreturn;
 }
 public UserHasLicenseForAppResult UserHasLicenseForApp(SteamID steamID, AppID appID)
 {
     CheckIfUsable();
     return (UserHasLicenseForAppResult)NativeMethods.User_UserHasLicenseForApp(steamID.AsUInt64, appID.AsUInt32);
 }