GithubHelp home page GithubHelp logo

zencq / libnom.io Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 2.0 122.54 MB

A .NET class library to read and write save files from the game No Man's Sky for all possible platforms as well as related actions.

License: GNU General Public License v3.0

C# 100.00%
libnom nms no-mans-sky nomansky nomanskygame nomanssky

libnom.io's People

Contributors

cengelha avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libnom.io's Issues

compile errors

Apologies if this is a newbie error, I've not used .NET though I have programming experience with Python. My goal is to build and use the CLI on Mac (currently MacOS 14). However, I get the same error below on Windows too.

The DLL builds but I get the following errors when building libNOM.cli:

dotnet build
MSBuild version 17.9.8+b34f75857 for .NET
  Determining projects to restore...
  Restored /Users/dev/libNOM.io/libNOM.cli/libNOM.cli.csproj (in 404 ms).
  1 of 2 projects are up-to-date for restore.
  libNOM.io -> /Users/dev/libNOM.io/libNOM.io/bin/Debug/net8.0/libNOM.io.dll
/Users/dev/libNOM.io/libNOM.cli/Executor_FileOperation.cs(42,29): error CS0266: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<(libNOM.io.Interfaces.IContainer First, libNOM.io.Interfaces.IContainer Second)>' to 'System.Collections.Generic.IEnumerable<(libNOM.io.Container Source, libNOM.io.Container Destination)>'. An explicit conversion exists (are you missing a cast?) [/Users/dev/libNOM.io/libNOM.cli/libNOM.cli.csproj::TargetFramework=net8.0]
/Users/dev/libNOM.io/libNOM.cli/Executor_FileOperation.cs(62,24): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<(libNOM.io.Container Source, libNOM.io.Container Destination)>' to 'System.Collections.Generic.IEnumerable<(libNOM.io.Interfaces.IContainer Source, libNOM.io.Interfaces.IContainer Destination)>' [/Users/dev/libNOM.io/libNOM.cli/libNOM.cli.csproj::TargetFramework=net8.0]
/Users/dev/libNOM.io/libNOM.cli/Executor_FileOperation.cs(87,24): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<(libNOM.io.Container Source, libNOM.io.Container Destination)>' to 'System.Collections.Generic.IEnumerable<(libNOM.io.Interfaces.IContainer Source, libNOM.io.Interfaces.IContainer Destination)>' [/Users/dev/libNOM.io/libNOM.cli/libNOM.cli.csproj::TargetFramework=net8.0]
/Users/dev/libNOM.io/libNOM.cli/Executor_FileOperation.cs(98,24): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<(libNOM.io.Container Source, libNOM.io.Container Destination)>' to 'System.Collections.Generic.IEnumerable<(libNOM.io.Interfaces.IContainer Source, libNOM.io.Interfaces.IContainer Destination)>' [/Users/dev/libNOM.io/libNOM.cli/libNOM.cli.csproj::TargetFramework=net8.0]

Build FAILED.

Consider Span<byte> over IEnumerable<byte>

IEnumerable<byte> is super-slow. Span<byte> is super-fast. Both allow you to access sub-sections of a byte array, but Span<byte> is a much better tool for that. You can use spans in netstandard2.0 by taking a dependency on the System.Memory nuget package for that target platform.

For example, this...

var bytes = File.ReadAllBytes(path);
var headerInteger = bytes.Take(4).GetUInt32().FirstOrDefault();
var headerString = bytes.Take(8).GetString();

...would be a great deal faster and more memory-efficient if it were implemented like this:

// no array allocation/copying!
Span<byte> bytes = File.ReadAllBytes(path);
var headerInteger = MemoryMarshal.Cast<byte, uint>(bytes[..4])[0];
var headerString = Encoding.UTF8.GetString(bytes[..8]);

MemoryMarshal.Cast and the overload of UTF8.GetString that accepts a Span both do not exist in netstandard2.0, but they are so much better than IEnumerable that in my opinion it would be worth a little conditional compilation to take advantage of this. The netstandard2.0 version can use the current code, or it can use Spans from the System.Memory nuget package, and call the ToArray() method before passing things to older API's that accept arrays but not spans.

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.