Giter Site home page Giter Site logo

Comments (9)

ItsNovaHere avatar ItsNovaHere commented on June 19, 2024

I've started work on it, should I put the enum-to-string class/method in the same .cs file or separate it?

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

Yeah moving the regions to enums is definitely something that I intended to do. Probably the thing to do is rather than having a ToString on it, I have a json converter in another project that will just convert it to a string at serialization so we just deal with it as the enum and then let newtonsoft take care of converting it to a string behind the scenes.

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

My mistake actually it's built into Json.Net I'll use the game modes for example

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

    [JsonConverter(typeof(StringEnumConverter))]
    public enum PubgGameMode
    {
        [EnumMember(Value = "squad")]
        Squad,
        [EnumMember(Value = "solo")]
        Solo,
        [EnumMember(Value = "duo")]
        Duo
    }

When that's serialized it'll output the value specified in the enum member attribute, saves having to write anything extra

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

And yeah definitely any suggestions you can come up with feel free to throw in an issue or DM me on Discord

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

I'll be out for the rest of the night (I'm in GMT) but I'll respond first thing in the morning

from pubg-dotnet.

ItsNovaHere avatar ItsNovaHere commented on June 19, 2024

Ah okay. I'll use the JsonConverter then.

from pubg-dotnet.

ItsNovaHere avatar ItsNovaHere commented on June 19, 2024

I don't know enough about GitHub, but do you think you could give me permissions to push to the repository? Both GitHub desktop and the Visual Studio plugin like to fuck me over.

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

Added you as a Contributor, will review the PR now

from pubg-dotnet.

GavinPower747 avatar GavinPower747 commented on June 19, 2024

PR Merged Closing

from pubg-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.