Ejemplo n.º 1
0
        internal static Dictionary <string, string> GetProperties(SteamInventoryResult_t result, int index)
        {
            var sb     = Helpers.TakeStringBuilder();
            var strlen = (uint)sb.Capacity;

            if (!SteamInventory.Internal.GetResultItemProperty(result, (uint)index, null, sb, ref strlen))
            {
                return(null);
            }

            var propNames = sb.ToString();

            var props = new Dictionary <string, string>();

            foreach (var propertyName in propNames.Split(','))
            {
                strlen = (uint)sb.Capacity;

                if (SteamInventory.Internal.GetResultItemProperty(result, (uint)index, propertyName, sb, ref strlen))
                {
                    props.Add(propertyName, sb.ToString());
                }
            }

            return(props);
        }
        internal static Dictionary <string, string> GetProperties(SteamInventoryResult_t result, int index)
        {
            Dictionary <string, string> strs;
            StringBuilder stringBuilder = Helpers.TakeStringBuilder();
            uint          capacity      = (uint)stringBuilder.Capacity;

            if (SteamInventory.Internal.GetResultItemProperty(result, (uint)index, null, stringBuilder, ref capacity))
            {
                string str = stringBuilder.ToString();
                Dictionary <string, string> strs1 = new Dictionary <string, string>();
                string[] strArray = str.Split(new Char[] { ',' });
                for (int i = 0; i < (int)strArray.Length; i++)
                {
                    string str1 = strArray[i];
                    capacity = (uint)stringBuilder.Capacity;
                    if (SteamInventory.Internal.GetResultItemProperty(result, (uint)index, str1, stringBuilder, ref capacity))
                    {
                        strs1.Add(str1, stringBuilder.ToString());
                    }
                }
                strs = strs1;
            }
            else
            {
                strs = null;
            }
            return(strs);
        }
        /// <summary>
        /// Get a specific property by name
        /// </summary>
        public string GetProperty(string name)
        {
            if (_properties != null && _properties.TryGetValue(name, out string val))
            {
                return(val);
            }

            var  sb = Helpers.TakeStringBuilder();
            uint _  = (uint)sb.Capacity;

            if (!SteamInventory.Internal.GetItemDefinitionProperty(Id, name, sb, ref _))
            {
                return(null);
            }

            if (_properties == null)
            {
                _properties = new Dictionary <string, string>();
            }

            var vl = sb.ToString();

            _properties[name] = vl;

            return(vl);
        }
Ejemplo n.º 4
0
        public string GetProperty(string name)
        {
            string str = null;
            string str1;

            if ((this._properties == null ? true : !this._properties.TryGetValue(name, out str)))
            {
                StringBuilder stringBuilder = Helpers.TakeStringBuilder();
                uint          capacity      = (uint)stringBuilder.Capacity;
                if (SteamInventory.Internal.GetItemDefinitionProperty(this.Id, name, stringBuilder, ref capacity))
                {
                    if (this._properties == null)
                    {
                        this._properties = new Dictionary <string, string>();
                    }
                    string str2 = stringBuilder.ToString();
                    this._properties[name] = str2;
                    str1 = str2;
                }
                else
                {
                    str1 = null;
                }
            }
            else
            {
                str1 = str;
            }
            return(str1);
        }
        /// <summary>
        /// Get a specific property by name
        /// </summary>
        public string GetProperty(string name)
        {
            var  sb = Helpers.TakeStringBuilder();
            uint _  = (uint)sb.Capacity;

            if (!SteamInventory.Internal.GetItemDefinitionProperty(Id, name, sb, ref _))
            {
                return(null);
            }

            return(sb.ToString());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the install folder for a specific AppID.
        /// This works even if the application is not installed, based on where the game would be installed with the default Steam library location.
        /// </summary>
        public static string AppInstallDir(AppId appid = default)
        {
            if (appid == 0)
            {
                appid = SteamClient.AppId;
            }

            var sb = Helpers.TakeStringBuilder();

            if (Internal.GetAppInstallDir(appid.Value, sb, (uint)sb.Capacity) == 0)
            {
                return(null);
            }

            return(sb.ToString());
        }
Ejemplo n.º 7
0
        public static string GetEnteredGamepadText()
        {
            string empty;
            uint   enteredGamepadTextLength = SteamUtils.Internal.GetEnteredGamepadTextLength();

            if (enteredGamepadTextLength != 0)
            {
                StringBuilder stringBuilder = Helpers.TakeStringBuilder();
                empty = (SteamUtils.Internal.GetEnteredGamepadTextInput(stringBuilder, enteredGamepadTextLength) ? stringBuilder.ToString() : String.Empty);
            }
            else
            {
                empty = String.Empty;
            }
            return(empty);
        }
Ejemplo n.º 8
0
        public static string AppInstallDir(AppId appid = null)
        {
            string str;

            if (appid == 0)
            {
                appid = SteamClient.AppId;
            }
            StringBuilder stringBuilder = Helpers.TakeStringBuilder();

            if (SteamApps.Internal.GetAppInstallDir(appid.Value, stringBuilder, (uint)stringBuilder.Capacity) != 0)
            {
                str = stringBuilder.ToString();
            }
            else
            {
                str = null;
            }
            return(str);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns metadata for all available DLC
        /// </summary>
        public static IEnumerable <DlcInformation> DlcInformation()
        {
            var appid     = default(AppId);
            var available = false;

            for (int i = 0; i < Internal.GetDLCCount(); i++)
            {
                var sb = Helpers.TakeStringBuilder();

                if (!Internal.BGetDLCDataByIndex(i, ref appid, ref available, sb, sb.Capacity))
                {
                    continue;
                }

                yield return(new DlcInformation
                {
                    AppId = appid.Value,
                    Name = sb.ToString(),
                    Available = available
                });
            }
        }
Ejemplo n.º 10
0
        public static IEnumerable <DlcInformation> DlcInformation()
        {
            AppId appId = new AppId();
            bool  flag  = false;

            for (int i = 0; i < SteamApps.Internal.GetDLCCount(); i++)
            {
                StringBuilder stringBuilder = Helpers.TakeStringBuilder();
                if (SteamApps.Internal.BGetDLCDataByIndex(i, ref appId, ref flag, stringBuilder, stringBuilder.Capacity))
                {
                    DlcInformation dlcInformation = new DlcInformation()
                    {
                        AppId     = appId.Value,
                        Name      = stringBuilder.ToString(),
                        Available = flag
                    };
                    yield return(dlcInformation);

                    stringBuilder = null;
                }
            }
        }