Esempio n. 1
0
        public IEnumerable <Cookie> GetSteamCookies()
        {
            var    cookies      = new List <Cookie>();
            string steamCookies = $@"{HOME_CONFIG}/Steam/cookies.cfg";

            try
            {
                if (File.Exists(steamCookies))
                {
                    var str = File.ReadAllText(steamCookies);


                    if (str == null || str.Length == 0)
                    {
                        throw new ReadCookieException("Can`t add cookie from 'cookies.cfg' - file is empty!");
                    }

                    var data = SteamCookie.FromJson(str);

                    foreach (var d in data)
                    {
                        cookies.Add(new Cookie(d.Name, d.Value, d.Path, d.Domain));
                    }
                }
                else
                {
                    throw new FileNotFoundException($@"File {steamCookies} not found!");
                }
            }catch (FileNotFoundException ex)
            {
                CLog.Print(LogType.FATAL, ex.Message);
            }

            return(cookies);
        }
Esempio n. 2
0
 public void Logout()
 {
     Cookies = new SteamCookie();
     Enabled = false;
 }
Esempio n. 3
0
 public Steam()
 {
     Cookies = new SteamCookie();
 }