Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Jun 20, 2024
1 parent 8f2afa8 commit c32a7c6
Show file tree
Hide file tree
Showing 9 changed files with 975 additions and 571 deletions.
474 changes: 474 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

33 changes: 14 additions & 19 deletions .github/workflows/AutoBuild.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: autobuild
name: publish

on:
push:
Expand All @@ -7,7 +7,9 @@ on:

env:
PROJECT_NAME: "ASFItemDropper"
DOTNET_SDK_VERSION: 7.0.x
REPO_NAME: "ASFItemDropper"
TARGET_FILTER : "ASFItemDropper.dll"
DOTNET_SDK_VERSION: 8.0.x

jobs:
build:
Expand Down Expand Up @@ -58,24 +60,17 @@ jobs:
path: out

- name: Create ${{ env.PROJECT_NAME }} GitHub release
id: github_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ncipollo/release-action@v1.12.0
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ env.PROJECT_NAME }} ${{ github.ref_name }}
body: |
release created bt github actions
artifacts: "out/*"
makeLatest: false
prerelease: true
tag: ${{ github.ref_name }}
name: ${{ env.PROJECT_NAME }} ${{ github.ref_name }}
body: |
![Release](https://img.shields.io/badge/${{ env.REPO_NAME }}-${{ github.ref_name }}-brightgreen) ![Downloads](https://img.shields.io/github/downloads/chr233/${{ env.REPO_NAME }}/${{ github.ref_name }}/total?label=Downloads)
- name: Upload ${{ env.PROJECT_NAME }} to GitHub release
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.github_release.outputs.upload_url }}
asset_path: out/${{ env.PROJECT_NAME }}.zip
asset_name: ${{ env.PROJECT_NAME }}.zip
asset_content_type: application/zip
---
release created bt github actions
435 changes: 217 additions & 218 deletions ASFItemDropper/ASFItemDropManager.cs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions ASFItemDropper/ASFItemDropper.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
Expand All @@ -13,8 +13,12 @@
<PackageReference Include="SteamKit2" IncludeAssets="compile" />
</ItemGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="..\ArchiSteamFarm\ArchiSteamFarm\bin\$(Configuration)\$(TargetFramework)\plugins\" SkipUnchangedFiles="true" />
</Target>

</Project>
499 changes: 228 additions & 271 deletions ASFItemDropper/ItemDropHandler.cs

Large diffs are not rendered by default.

59 changes: 18 additions & 41 deletions ASFItemDropper/ItemList.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@

// Generated by https://quicktype.io
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace QuickType;

namespace ASFItemDropper;

public partial class ItemList
public class ItemList
{
[JsonPropertyName("accountid")]
public string? Accountid { get; set; }
Expand Down Expand Up @@ -40,59 +35,41 @@ public partial class ItemList

[JsonPropertyName("state_changed_timestamp")]
public string? StateChangedTimestamp { get; set; }
}

public partial class ItemList
{
public static ItemList[] FromJson(string json)
{
return JsonSerializer.Deserialize<ItemList[]>(json, Converter.Settings) ?? Array.Empty<ItemList>();
return JsonSerializer.Deserialize<ItemList[]>(json, Converter.Settings) ?? [];
}
}

public static class Serialize
{
public static string ToJson(this ItemList[] self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings);
public static string ToJson(this ItemList[] self) => JsonSerializer.Serialize(self, Converter.Settings);
}

internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new()
public static readonly JsonSerializerOptions Settings = new JsonSerializerOptions
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters = {
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
Converters = { new ParseStringConverter() },
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
}

internal class ParseStringConverter : JsonConverter
internal class ParseStringConverter : JsonConverter<long>
{
public override bool CanConvert(Type t) => t == typeof(long) || t == typeof(long?);

public override object? ReadJson(JsonReader reader, Type t, object? existingValue, JsonSerializer serializer)
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
if (long.TryParse(value, out var l))
{
return l;
}
throw new Exception("Cannot unmarshal type long");
if (reader.TokenType == JsonTokenType.Null)
return 0;
var value = reader.GetString();
if (long.TryParse(value, out var result))
return result;
throw new JsonException("Cannot unmarshal type long");
}

public override void WriteJson(JsonWriter writer, object? untypedValue, JsonSerializer serializer)
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (long)untypedValue;
serializer.Serialize(writer, value.ToString());
return;
writer.WriteStringValue(value.ToString());
}

public static readonly ParseStringConverter Singleton = new();
}
}
23 changes: 11 additions & 12 deletions ASFItemDropper/StatData.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
namespace ASFItemDropManager
namespace ASFItemDropper;

class StatData
{
class StatData
{
public uint StatNum { get; set; }
public int BitNum { get; set; }
public bool IsSet { get; set; }
public bool Restricted { get; set; }
public uint Dependancy { get; set; }
public uint DependancyValue { get; set; }
public string? DependancyName { get; set; }
public string? Name { get; set; }
}
public uint StatNum { get; set; }
public int BitNum { get; set; }
public bool IsSet { get; set; }
public bool Restricted { get; set; }
public uint Dependancy { get; set; }
public uint DependancyValue { get; set; }
public string? DependancyName { get; set; }
public string? Name { get; set; }
}
13 changes: 6 additions & 7 deletions ASFItemDropper/StoredResponse.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using SteamKit2.Internal;
using SteamKit2.Internal;

namespace ASFItemDropManager
namespace ASFItemDropper;

class StoredResponse
{
class StoredResponse
{
public bool Success { get; set; }
public CMsgClientGetUserStatsResponse? Response { get; set; }
}
public bool Success { get; set; }
public CMsgClientGetUserStatsResponse? Response { get; set; }
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.3.5.3</Version>
<Version>0.3.6.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit c32a7c6

Please sign in to comment.