示例#1
0
        public virtual void Dispose()
        {
            if (disposed)
            {
                return;
            }

            Callbacks.Clear();

            foreach (var h in CallbackHandles)
            {
                h.Dispose();
            }
            CallbackHandles.Clear();

            foreach (var h in CallResults)
            {
                h.Dispose();
            }
            CallResults.Clear();

            if (Workshop != null)
            {
                Workshop.Dispose();
                Workshop = null;
            }

            if (Inventory != null)
            {
                Inventory.Dispose();
                Inventory = null;
            }

            if (Networking != null)
            {
                Networking.Dispose();
                Networking = null;
            }

            if (native != null)
            {
                try
                {
                    native.Dispose();
                }
                catch (DllNotFoundException e)
                {
                    System.Diagnostics.Debug.WriteLine("Disposing SteamWorks NativeInterface failed (" + e.Message + ")\n" + e.StackTrace);
                }
                native = null;
            }

            System.Environment.SetEnvironmentVariable("SteamAppId", null);
            System.Environment.SetEnvironmentVariable("SteamGameId", null);
            disposed = true;
        }
示例#2
0
        public virtual void Dispose()
        {
            if (disposed)
            {
                return;
            }

            Callbacks.Clear();

            foreach (var h in CallbackHandles)
            {
                h.Dispose();
            }
            CallbackHandles.Clear();

            foreach (var h in CallResults)
            {
                h.Dispose();
            }
            CallResults.Clear();

            if (Workshop != null)
            {
                Workshop.Dispose();
                Workshop = null;
            }

            if (Inventory != null)
            {
                Inventory.Dispose();
                Inventory = null;
            }

            if (Networking != null)
            {
                Networking.Dispose();
                Networking = null;
            }

            if (native != null)
            {
                native.Dispose();
                native = null;
            }

            System.Environment.SetEnvironmentVariable("SteamAppId", null);
            System.Environment.SetEnvironmentVariable("SteamGameId", null);
            disposed = true;
        }
            internal static Item From(SteamNative.SteamUGCDetails_t details, Workshop workshop)
            {
                var item = new Item(details.PublishedFileId, workshop);

                item.Title       = details.Title;
                item.Description = details.Description;
                item.OwnerId     = details.SteamIDOwner;
                item.Tags        = details.Tags.Split(',').Select(x => x.ToLower()).ToArray();
                item.Score       = details.Score;
                item.VotesUp     = details.VotesUp;
                item.VotesDown   = details.VotesDown;
                item.Modified    = new DateTime(details.TimeUpdated);
                item.Created     = new DateTime(details.TimeCreated);

                return(item);
            }
 public void SetupCommonInterfaces()
 {
     Networking = new Steamworks.Networking(this, native.networking);
     Inventory  = new Steamworks.Inventory(native.inventory, IsGameServer);
     Workshop   = new Steamworks.Workshop(this, native.ugc, native.remoteStorage);
 }
 public Item( ulong Id, Workshop workshop )
 {
     this.Id = Id;
     this.workshop = workshop;
 }