Пример #1
0
        public ServersCommand()
        {
            Trigger        = "servers";
            IsSteamCommand = true;

            GameServers = Steam.Instance.UnifiedMessages.CreateService <IGameServers>();
        }
Пример #2
0
        public ServersCommand()
        {
            Trigger        = "servers";
            IsSteamCommand = true;

            GameServers = Steam.Instance.Client.GetHandler <SteamUnifiedMessages>().CreateService <IGameServers>();
        }
Пример #3
0
        public PubFileCommand()
        {
            Trigger        = "pubfile";
            IsSteamCommand = true;

            PublishedFiles = Steam.Instance.UnifiedMessages.CreateService <IPublishedFile>();
        }
Пример #4
0
        public Steam3Session(SteamUser.LogOnDetails details)
        {
            this.logonDetails = details;

            this.authenticatedUser          = details.Username != null;
            this.credentials                = new Credentials();
            this.bConnected                 = false;
            this.bConnecting                = false;
            this.bAborted                   = false;
            this.bExpectingDisconnectRemote = false;
            this.bDidDisconnect             = false;
            this.bDidReceiveLoginKey        = false;
            this.seq = 0;

            this.AppTickets       = new Dictionary <uint, byte[]>();
            this.AppTokens        = new Dictionary <uint, ulong>();
            this.DepotKeys        = new Dictionary <uint, byte[]>();
            this.CDNAuthTokens    = new ConcurrentDictionary <string, TaskCompletionSource <SteamApps.CDNAuthTokenCallback> >();
            this.AppInfo          = new Dictionary <uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();
            this.PackageInfo      = new Dictionary <uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();
            this.AppBetaPasswords = new Dictionary <string, byte[]>();

            this.steamClient = new SteamClient();

            this.steamUser = this.steamClient.GetHandler <SteamUser>();
            this.steamApps = this.steamClient.GetHandler <SteamApps>();
            var steamUnifiedMessages = this.steamClient.GetHandler <SteamUnifiedMessages>();

            this.steamPublishedFile = steamUnifiedMessages.CreateService <IPublishedFile>();

            this.callbacks = new CallbackManager(this.steamClient);

            this.callbacks.Subscribe <SteamClient.ConnectedCallback>(ConnectedCallback);
            this.callbacks.Subscribe <SteamClient.DisconnectedCallback>(DisconnectedCallback);
            this.callbacks.Subscribe <SteamUser.LoggedOnCallback>(LogOnCallback);
            this.callbacks.Subscribe <SteamUser.SessionTokenCallback>(SessionTokenCallback);
            this.callbacks.Subscribe <SteamApps.LicenseListCallback>(LicenseListCallback);
            this.callbacks.Subscribe <SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback);
            this.callbacks.Subscribe <SteamUser.LoginKeyCallback>(LoginKeyCallback);

            Console.Write("Connecting to Steam3...");

            if (authenticatedUser)
            {
                FileInfo fi = new FileInfo(String.Format("{0}.sentryFile", logonDetails.Username));
                if (AccountSettingsStore.Instance.SentryData != null && AccountSettingsStore.Instance.SentryData.ContainsKey(logonDetails.Username))
                {
                    logonDetails.SentryFileHash = Util.SHAHash(AccountSettingsStore.Instance.SentryData[logonDetails.Username]);
                }
                else if (fi.Exists && fi.Length > 0)
                {
                    var sentryData = File.ReadAllBytes(fi.FullName);
                    logonDetails.SentryFileHash = Util.SHAHash(sentryData);
                    AccountSettingsStore.Instance.SentryData[logonDetails.Username] = sentryData;
                    AccountSettingsStore.Save();
                }
            }

            Connect();
        }
Пример #5
0
        internal async Task <string> checkTime(uint appid, uint itemdefid)
        {
            CInventory_ConsumePlaytime_Request reponse = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();

            var responce = await _inventoryService.SendMessage(x => x.ConsumePlaytime(reponse));

            var result = responce.GetDeserializedResponse <CInventory_Response>();

            if (result.item_json != "[]")
            {
                try
                {
                    Console.WriteLine(result.item_json);
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(result.item_json))
                    {
                        summstring += $"Item droped {Client.SteamID} while {item.Origin} game:{appid} => {item.Quantity}x {item.Itemdefid} @ {item.StateChangedTimestamp}\n";
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            return($"No Item dropped for {Client.SteamID}");
        }
Пример #6
0
        public ServersCommand()
        {
            Trigger = "servers";
            IsSteamCommand = true;

            GameServers = Steam.Instance.Client.GetHandler<SteamUnifiedMessages>().CreateService<IGameServers>();
        }
Пример #7
0
        public async Task <bool> LoginPrompt(bool background = false, string username = null, string password = null, string authCode = null, string emailCode = null)
        {
            UserConfig.RegisterConfig("steam");

            this.background = background;
            this.username   = username;
            this.password   = password;
            this.authCode   = authCode;
            this.emailCode  = emailCode;

            client  = new SteamClient();
            manager = new CallbackManager(client);
            user    = client.GetHandler <SteamUser>();
            friends = client.GetHandler <SteamFriends>();
            manager.Subscribe <SteamClient.ConnectedCallback>(OnConnected);
            manager.Subscribe <SteamClient.DisconnectedCallback>(OnDisconnected);

            manager.Subscribe <SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe <SteamUser.LoggedOffCallback>(OnLoggedOff);
            manager.Subscribe <SteamUser.LoginKeyCallback>(OnLoginKey);

            //manager.Subscribe<SteamFriends.FriendsListCallback>(OnFriendList);
            manager.Subscribe <SteamUnifiedMessages.ServiceMethodResponse>(OnMethodResponse);

            unifiedMessages = client.GetHandler <SteamUnifiedMessages>();
            servicePlayer   = unifiedMessages.CreateService <IPlayer>();

            loginStatus = LOGIN_STATUS.AWAITING;
            Debug.WriteLine("Connecting to steam..");
            client.Connect();

            cancelCallbackTok = new CancellationTokenSource();
            Task callbackTask = new Task(() =>
            {
                while (!cancelCallbackTok.IsCancellationRequested)
                {
                    try
                    {
                        manager.RunCallbacks();
                    }
                    catch (Exception e) {
                        Console.WriteLine("Error! : " + e.Message);
                    }
                }
            }, cancelCallbackTok.Token);

            callbackTask.Start();

            return(await Task <bool> .Run(() =>
            {
                while (loginStatus == LOGIN_STATUS.AWAITING)
                {
                }
                return loginStatus == LOGIN_STATUS.SUCCESS;
            }));
        }
Пример #8
0
        static void Main( string[] args )
        {
            if ( args.Length < 2 )
            {
                Console.WriteLine( "Sample8: No username and password specified!" );
                return;
            }

            // save our logon details
            user = args[0];
            pass = args[1];

            // create our steamclient instance
            steamClient = new SteamClient();
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();

            // get the steam unified messages handler, which is used for sending and receiving responses from the unified service api
            steamUnifiedMessages = steamClient.GetHandler<SteamUnifiedMessages>();

            // we also want to create our local service interface, which will help us build requests to the unified api
            playerService = steamUnifiedMessages.CreateService<IPlayer>();


            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            manager.Subscribe<SteamClient.ConnectedCallback>( OnConnected );
            manager.Subscribe<SteamClient.DisconnectedCallback>( OnDisconnected );

            manager.Subscribe<SteamUser.LoggedOnCallback>( OnLoggedOn );
            manager.Subscribe<SteamUser.LoggedOffCallback>( OnLoggedOff );

            // we use the following callbacks for unified service responses
            manager.Subscribe<SteamUnifiedMessages.ServiceMethodResponse>( OnMethodResponse );

            isRunning = true;

            Console.WriteLine( "Connecting to Steam..." );

            // initiate the connection
            steamClient.Connect();

            // create our callback handling loop
            while ( isRunning )
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks( TimeSpan.FromSeconds( 1 ) );
            }
        }
Пример #9
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Sample8: No username and password specified!");
                return;
            }

            // save our logon details
            user = args[0];
            pass = args[1];

            // create our steamclient instance
            steamClient = new SteamClient();
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager(steamClient);

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler <SteamUser>();

            // get the steam unified messages handler, which is used for sending and receiving responses from the unified service api
            steamUnifiedMessages = steamClient.GetHandler <SteamUnifiedMessages>();

            // we also want to create our local service interface, which will help us build requests to the unified api
            playerService = steamUnifiedMessages.CreateService <IPlayer>();


            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            manager.Subscribe <SteamClient.ConnectedCallback>(OnConnected);
            manager.Subscribe <SteamClient.DisconnectedCallback>(OnDisconnected);

            manager.Subscribe <SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe <SteamUser.LoggedOffCallback>(OnLoggedOff);

            // we use the following callbacks for unified service responses
            manager.Subscribe <SteamUnifiedMessages.ServiceMethodResponse>(OnMethodResponse);

            isRunning = true;

            Console.WriteLine("Connecting to Steam...");

            // initiate the connection
            steamClient.Connect();

            // create our callback handling loop
            while (isRunning)
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
            }
        }
Пример #10
0
        public PubFileCommand()
        {
            Trigger        = "pubfile";
            IsSteamCommand = true;

            SharedFileMatch = new Regex(
                @"(?:^|/|\.)steamcommunity\.com/sharedfiles/filedetails/(?:\?id=|comments/|changelog/|discussions/|)(?<pubfileid>[0-9]{1,20})",
                RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture
                );

            PublishedFiles = Steam.Instance.UnifiedMessages.CreateService <IPublishedFile>();
        }
Пример #11
0
    internal ArchiHandler(ArchiLogger archiLogger, SteamUnifiedMessages steamUnifiedMessages)
    {
        ArgumentNullException.ThrowIfNull(steamUnifiedMessages);

        ArchiLogger                  = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger));
        UnifiedChatRoomService       = steamUnifiedMessages.CreateService <IChatRoom>();
        UnifiedClanChatRoomsService  = steamUnifiedMessages.CreateService <IClanChatRooms>();
        UnifiedEconService           = steamUnifiedMessages.CreateService <IEcon>();
        UnifiedFriendMessagesService = steamUnifiedMessages.CreateService <IFriendMessages>();
        UnifiedPlayerService         = steamUnifiedMessages.CreateService <IPlayer>();
        UnifiedTwoFactorService      = steamUnifiedMessages.CreateService <ITwoFactor>();
    }
Пример #12
0
        public PubFileCommand()
        {
            Trigger = "pubfile";
            IsSteamCommand = true;

            SharedFileMatch = new Regex(
                @"(?:^|/|\.)steamcommunity\.com/sharedfiles/filedetails/(?:\?id=|comments/|changelog/|discussions/|)(?<pubfileid>[0-9]+)",
                RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture
            );

            PublishedFiles = Steam.Instance.Client.GetHandler<SteamUnifiedMessages>().CreateService<IPublishedFile>();
        }
Пример #13
0
        internal ArchiHandler(ArchiLogger archiLogger, SteamUnifiedMessages steamUnifiedMessages)
        {
            if ((archiLogger == null) || (steamUnifiedMessages == null))
            {
                throw new ArgumentNullException(nameof(archiLogger) + " || " + nameof(steamUnifiedMessages));
            }

            ArchiLogger                  = archiLogger;
            UnifiedChatRoomService       = steamUnifiedMessages.CreateService <IChatRoom>();
            UnifiedClanChatRoomsService  = steamUnifiedMessages.CreateService <IClanChatRooms>();
            UnifiedFriendMessagesService = steamUnifiedMessages.CreateService <IFriendMessages>();
            UnifiedPlayerService         = steamUnifiedMessages.CreateService <IPlayer>();
        }
Пример #14
0
        internal SCHandler([NotNull] Logger logger, [NotNull] SteamUnifiedMessages steamUnifiedMessages)
        {
            if (logger == null || steamUnifiedMessages == null)
            {
                throw new ArgumentNullException(nameof(logger) + " || " + nameof(steamUnifiedMessages));
            }

            Logger = logger;
            UnifiedChatRoomService       = steamUnifiedMessages.CreateService <IChatRoom>();
            UnifiedClanChatRoomsService  = steamUnifiedMessages.CreateService <IClanChatRooms>();
            UnifiedEconService           = steamUnifiedMessages.CreateService <IEcon>();
            UnifiedFriendMessagesService = steamUnifiedMessages.CreateService <IFriendMessages>();
            UnifiedPlayerService         = steamUnifiedMessages.CreateService <IPlayer>();
        }
Пример #15
0
        internal async Task <string> checkTime(uint appid, uint itemdefid, Bot bot)
        {
            CInventory_ConsumePlaytime_Request playtimeResponse = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };
            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_played_free_games = true
            };

            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();
            _PlayerService    = steamUnifiedMessages.CreateService <IPlayer>();

            var consumePlaytimeResponse = await _inventoryService.SendMessage(x => x.ConsumePlaytime(playtimeResponse));

            var consumePlaytime = consumePlaytimeResponse.GetDeserializedResponse <CInventory_Response>();

            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var resultGamesPlayed      = consumePlaytimeResponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();
            var resultFilteredGameById = resultGamesPlayed.games.Find(game => game.appid == appid);
            var appidPlaytimeForever   = 0;

            if (resultGamesPlayed != null && resultFilteredGameById != null)
            {
                appidPlaytimeForever = resultFilteredGameById.playtime_forever;
            }


            if (consumePlaytime.item_json != "[]")
            {
                try
                {
                    Console.WriteLine(consumePlaytime.item_json);
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(consumePlaytime.item_json))
                    {
                        summstring += $"Item drop @ {item.StateChangedTimestamp} => i.ID: {appid}_{item.Itemid}, i.Def: {item.Itemdefid} (playtime: {appidPlaytimeForever})";
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            return($"No item drop for game {appid} with playtime {appidPlaytimeForever}.");
        }
Пример #16
0
        internal ArchiHandler([JetBrains.Annotations.NotNull] ArchiLogger archiLogger, [JetBrains.Annotations.NotNull] SteamUnifiedMessages steamUnifiedMessages)
        {
            if ((archiLogger == null) || (steamUnifiedMessages == null))
            {
                throw new ArgumentNullException(nameof(archiLogger) + " || " + nameof(steamUnifiedMessages));
            }

            ArchiLogger                  = archiLogger;
            UnifiedChatRoomService       = steamUnifiedMessages.CreateService <IChatRoom>();
            UnifiedClanChatRoomsService  = steamUnifiedMessages.CreateService <IClanChatRooms>();
            UnifiedEconService           = steamUnifiedMessages.CreateService <IEcon>();
            UnifiedFriendMessagesService = steamUnifiedMessages.CreateService <IFriendMessages>();
            UnifiedPlayerService         = steamUnifiedMessages.CreateService <IPlayer>();
            UnifiedTwoFactorService      = steamUnifiedMessages.CreateService <ITwoFactor>();
        }
Пример #17
0
        internal async Task <string> checkPlaytime(uint appid, Bot bot)
        {
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            if (steamUnifiedMessages == null)
            {
                bot.ArchiLogger.LogNullError(nameof(steamUnifiedMessages));
                return("SteamUnifiedMessages Error");
            }

            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_appinfo = true, include_free_sub = true, include_played_free_games = true
            };

            _PlayerService = steamUnifiedMessages.CreateService <IPlayer>();
            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var consumePlaytime = ownedReponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();

            consumePlaytime.games.ForEach(action => bot.ArchiLogger.LogGenericInfo(message: $"{action.appid} - {action.has_community_visible_stats} - {action.name} - {action.playtime_forever}"));
            var resultFilteredGameById = consumePlaytime.games.Find(game => game.appid == ((int)appid));

            if (consumePlaytime.games == null)
            {
                bot.ArchiLogger.LogNullError(nameof(consumePlaytime.games));
            }
            if (resultFilteredGameById == null)
            {
                bot.ArchiLogger.LogNullError("resultFilteredGameById");
            }

            uint appidPlaytimeForever = 0;

            bot.ArchiLogger.LogGenericDebug(message: $"Playtime for {resultFilteredGameById.name} is: {resultFilteredGameById.playtime_forever}");
            appidPlaytimeForever = Convert.ToUInt32(resultFilteredGameById.playtime_forever);
            uint   appidPlaytimeHours   = appidPlaytimeForever / 60;
            byte   appidPlaytimeMinutes = Convert.ToByte(appidPlaytimeForever % 60);
            string PTMinutes            = appidPlaytimeForever.ToString("N0", CultureInfo.InvariantCulture);
            string PTHours = appidPlaytimeHours.ToString("N0", CultureInfo.InvariantCulture);

            var summstring = "";

            summstring += $"Playtime for game '{resultFilteredGameById.name}' is {PTMinutes}m = {PTHours}h {appidPlaytimeMinutes}m";

            return(summstring);
        }
Пример #18
0
        public SteamMachine(AccountConfig steamAccount)
        {
            _client            = new SteamClient();
            SteamConfiguration = _client.Configuration;
            var manager = new CallbackManager(_client);


            var steamUnifiedMessages = _client.GetHandler <SteamUnifiedMessages>();

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();
            _deviceService    = steamUnifiedMessages.CreateService <IDeviceAuth>();
            _steamAccount     = steamAccount;
            _loginHandler     = new SteamLoginHandler(_steamAccount, _client, manager);
            _steamApps        = _client.GetHandler <SteamApps>();


            Task.Run(() =>
            {
                while (_work)
                {
                    manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
                }
            });
        }
Пример #19
0
        public Steam3Session(SteamClient steamClient, CallbackManager callbackManager)
        {
            this.bConnected  = false;
            this.bConnecting = false;
            this.bAborted    = false;

            this.steamClient = steamClient;

            this.steamUser = this.steamClient.GetHandler <SteamUser>();
            this.steamApps = this.steamClient.GetHandler <SteamApps>();
            var steamUnifiedMessages = this.steamClient.GetHandler <SteamUnifiedMessages>();

            this.steamPublishedFile = steamUnifiedMessages.CreateService <IPublishedFile>();

            this.callbacks = callbackManager;

            this.callbacks.Subscribe <SteamClient.ConnectedCallback>(ConnectedCallback);
            this.callbacks.Subscribe <SteamClient.DisconnectedCallback>(DisconnectedCallback);
            this.callbacks.Subscribe <SteamUser.LoggedOnCallback>(LogOnCallback);
            this.callbacks.Subscribe <SteamUser.SessionTokenCallback>(SessionTokenCallback);
            this.callbacks.Subscribe <SteamApps.LicenseListCallback>(LicenseListCallback);
            this.callbacks.Subscribe <SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback);
            this.callbacks.Subscribe <SteamUser.LoginKeyCallback>(LoginKeyCallback);
        }
Пример #20
0
        internal async Task <string> checkTime(uint appid, uint itemdefid, Bot bot, bool longoutput)
        {
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            if (steamUnifiedMessages == null)
            {
                bot.ArchiLogger.LogNullError(nameof(steamUnifiedMessages));
                return("SteamUnifiedMessages Error");
            }

            CInventory_ConsumePlaytime_Request playtimeRequest = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();
            var playtimeResponse = await _inventoryService.SendMessage(x => x.ConsumePlaytime(playtimeRequest));

            var resultGamesPlayed = playtimeResponse.GetDeserializedResponse <CInventory_Response>();


            if (resultGamesPlayed.item_json == null)
            {
                bot.ArchiLogger.LogGenericWarning(message: $"{resultGamesPlayed.item_json}");
            }
            if (resultGamesPlayed == null)
            {
                bot.ArchiLogger.LogNullError("resultGamesPlayed");
            }


            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_appinfo = true, include_free_sub = true, include_played_free_games = true
            };

            _PlayerService = steamUnifiedMessages.CreateService <IPlayer>();
            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var consumePlaytime = ownedReponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();

            consumePlaytime.games.ForEach(action => bot.ArchiLogger.LogGenericInfo(message: $"{action.appid} - {action.has_community_visible_stats} - {action.name} - {action.playtime_forever}"));
            var resultFilteredGameById = consumePlaytime.games.Find(game => game.appid == ((int)appid));

            if (consumePlaytime.games == null)
            {
                bot.ArchiLogger.LogNullError(nameof(consumePlaytime.games));
            }
            if (resultFilteredGameById == null)
            {
                bot.ArchiLogger.LogNullError("resultFilteredGameById ");
            }

            var appidPlaytimeForever = 0;

            if (resultGamesPlayed != null && resultFilteredGameById != null)
            {
                bot.ArchiLogger.LogGenericDebug(message: $"Playtime for {resultFilteredGameById.name} is: {resultFilteredGameById.playtime_forever}");
                appidPlaytimeForever = resultFilteredGameById.playtime_forever;
            }


            // proceed only when the player has played the request game id
            if (resultGamesPlayed != null && resultGamesPlayed.item_json != "[]")
            {
                try
                {
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(resultGamesPlayed.item_json))
                    {
                        if (longoutput)
                        {
                            summstring += $"Item drop @{item.StateChangedTimestamp} => i.ID: {appid}_{item.Itemid}, i.Def: {item.Itemdefid} (a.PT: {appidPlaytimeForever}m)";
                        }
                        else
                        {
                            summstring += $"Item drop @{item.StateChangedTimestamp}";
                        }

                        // item drop time taken from Steam, to be added to newline
                        string new_v0 = item.StateChangedTimestamp;

                        // Creating iDrop_Logfile if not exists and write a header
                        string iDrop_Logfile = "";
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                        {
                            // setting filename for Linux OS
                            iDrop_Logfile = $"plugins/ASFItemDropper/droplogs/{bot.BotName}_{appid}.log";
                        }
                        else
                        {
                            // setting filename for Windows OS
                            iDrop_Logfile = $"plugins\\ASFItemDropper\\droplogs\\{bot.BotName}_{appid}.log";
                        }

                        if (!File.Exists(iDrop_Logfile))
                        {
                            using (StreamWriter sw = File.AppendText(iDrop_Logfile))
                            {
                                // writing header information and first dummy data
                                sw.WriteLine($"# Droplog for bot '{bot.BotName}' and AppID {appid} ({resultFilteredGameById.name})");
                                sw.WriteLine($"# Timestamp;TimeDiff;Playtime;PlaytimeDiff");
                                sw.WriteLine($"{new_v0};0.00:00:00;0;0");
                            }
                        }

                        string   newline    = "";
                        string   lastline   = File.ReadLines(iDrop_Logfile).Last();
                        string[] old_values = lastline.Split(';', StringSplitOptions.TrimEntries);

                        // date format of item drop time from Steam, needed for converting
                        string format = "yyyyMMdd'T'HHmmss'Z'";

                        // converting item drop times back to UTC for later calculation
                        DateTime new_v0utc = DateTime.ParseExact(new_v0, format, CultureInfo.InvariantCulture);
                        DateTime old_v0utc = DateTime.ParseExact(old_values[0], format, CultureInfo.InvariantCulture);

                        // calculating difference between last two item drops (newline - lastline)
                        TimeSpan duration = new_v0utc.Subtract(old_v0utc);
                        string   new_v1   = duration.ToString(@"d\.hh\:mm\:ss", CultureInfo.InvariantCulture);

                        // setting and converting appidPlaytimeForever of game for later calculation
                        uint new_v2 = Convert.ToUInt32(appidPlaytimeForever);

                        // calculating the playtime difference from newline to lastline
                        uint new_v3 = new_v2 - Convert.ToUInt32(old_values[2]);

                        // setup and append newline to droplogfile
                        newline = $"{new_v0};{new_v1};{new_v2};{new_v3}";

                        using (StreamWriter sw = File.AppendText(iDrop_Logfile))
                        {
                            sw.WriteLine($"{newline}");
                        }
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    bot.ArchiLogger.LogGenericError(message: e.Message);
                    return("Error while parse consumePlaytime");
                }
            }
            else
            {
                if (longoutput)
                {
                    return($"No item drop for game '{resultFilteredGameById.name}' with playtime {appidPlaytimeForever}m.");
                }
                else
                {
                    return($"No item drop.");
                }
            }
        }