Exemplo n.º 1
0
        public async Task CreateAndThenEditFile()
        {
            PublishedFileId fileid;

            //
            // Make a file
            //
            {
                var result = await Ugc.Editor.NewCommunityFile
                             .WithTitle("Unedited File")
                             .SubmitAsync();

                Assert.IsTrue(result.Success);
                Assert.AreNotEqual(result.FileId.Value, 0);

                fileid = result.FileId;
            }

            await Task.Delay(1000);

            //
            // Edit it
            //
            {
                var editor = new Ugc.Editor(fileid);
                editor = editor.WithTitle("An Edited File");
                var result = await editor.SubmitAsync();

                Assert.IsTrue(result.Success);
                Assert.AreEqual(result.FileId, fileid);
            }

            await Task.Delay(1000);

            //
            // Make sure the edited file matches
            //
            {
                var details = await SteamUGC.QueryFileAsync(fileid) ?? throw new Exception("Somethign went wrong");

                Assert.AreEqual(details.Id, fileid);
                Assert.AreEqual(details.Title, "An Edited File");
            }

            //
            // Clean up
            //
            var deleted = await SteamUGC.DeleteFileAsync(fileid);

            Assert.IsTrue(deleted);
        }
Exemplo n.º 2
0
        public async Task QuerySpecificFile()
        {
            var item = await SteamUGC.QueryFileAsync(1734427277);

            Assert.IsTrue(item.HasValue);
            Assert.IsNotNull(item.Value.Title);

            Console.WriteLine($"Title: {item?.Title}");
            Console.WriteLine($"Desc: {item?.Description}");
            Console.WriteLine($"Tags: {string.Join( ",", item?.Tags )}");
            Console.WriteLine($"Author: {item?.Owner.Name} [{item?.Owner.Id}]");
            Console.WriteLine($"PreviewImageUrl: {item?.PreviewImageUrl}");
            Console.WriteLine($"NumComments: {item?.NumComments}");
            Console.WriteLine($"Url: {item?.Url}");
            Console.WriteLine($"Directory: {item?.Directory}");
            Console.WriteLine($"IsInstalled: {item?.IsInstalled}");
            Console.WriteLine($"IsAcceptedForUse: {item?.IsAcceptedForUse}");
            Console.WriteLine($"IsPublic: {item?.IsPublic}");
            Console.WriteLine($"Created: {item?.Created}");
            Console.WriteLine($"Updated: {item?.Updated}");
            Console.WriteLine($"Score: {item?.Score}");
        }