Foxtrek_64
Foxtrek_64
CC#
Created by Foxtrek_64 on 6/6/2024 in #help
INumberBase<>.TryConvertFromTruncating()
static bool INumberBase<Bit>.TryConvertFromChecked<TOther>(TOther value, out Bit result)
{
result = FromNumber(value);
return true;
}

INumberBase<Bit>.TryConvertFromSaturating<TOther>(TOther value, out Bit result)
{
result = value != TOther.Zero ? One : Zero;
return true;
}

INumberBase<Bit>.TryConvertFromTruncating<TOther>(TOther value, out Bit result)
{
}

internal static Bit FromNumber<TNumber>(TNumber value)
where TNumber : INumberBase<TNumber>
=> TryFromNumber(value, out Bit? result)
? result
: ThrowOverflowException<Bit>();

internal static bool TryFromNumber<TNumber>(TNumber value, [NotNullWhen(true)] out Bit? result)
where TNumber : INumberBase<TNumber>
{
result = null;
if (value == TNumber.Zero)
{
result = Zero;
return true;
}
if (value == TNumber.One)
{
result = One;
return true;
}

return false;
}
static bool INumberBase<Bit>.TryConvertFromChecked<TOther>(TOther value, out Bit result)
{
result = FromNumber(value);
return true;
}

INumberBase<Bit>.TryConvertFromSaturating<TOther>(TOther value, out Bit result)
{
result = value != TOther.Zero ? One : Zero;
return true;
}

INumberBase<Bit>.TryConvertFromTruncating<TOther>(TOther value, out Bit result)
{
}

internal static Bit FromNumber<TNumber>(TNumber value)
where TNumber : INumberBase<TNumber>
=> TryFromNumber(value, out Bit? result)
? result
: ThrowOverflowException<Bit>();

internal static bool TryFromNumber<TNumber>(TNumber value, [NotNullWhen(true)] out Bit? result)
where TNumber : INumberBase<TNumber>
{
result = null;
if (value == TNumber.Zero)
{
result = Zero;
return true;
}
if (value == TNumber.One)
{
result = One;
return true;
}

return false;
}
8 replies
CC#
Created by Foxtrek_64 on 6/6/2024 in #help
INumberBase<>.TryConvertFromTruncating()
Still trying to figure this one out though
8 replies
CC#
Created by Foxtrek_64 on 6/6/2024 in #help
INumberBase<>.TryConvertFromTruncating()
Changed the base type of bit to be an IBinaryInteger because I felt it fit better
8 replies
CC#
Created by Foxtrek_64 on 6/6/2024 in #help
INumberBase<>.TryConvertFromTruncating()
Doesn't look like INumberBase supports the & operator so value & TOther.One doesn't work
8 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
I went ahead and pushed those changes, but I don't really have a good test platform for the older versions of .NET, so anyone who uses this packge for netfx do so at your own risk
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Forgot to hit enter
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
With MemoryMappedFile, you get to control the memory usage. By default I have it set to 2mb, but you can change that to whatever you want using the provided LengthsConstants or any long value representing the number of bytes
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Sound good. I'll push a new version here shortly with MIT + net461 support, which you should be able to use with net472
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Does the MIT license work for you?
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Available since 4.0 flat, so that should be fine
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Actually let me see when memorymappedfile is available before I offer that-
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
It targets netstandard2.1 so it should in theory be able to use that target. I can add an explicit net461 target if you need (that's the only one I have installed currently)
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
It's been published Also I don't mind relicensing. LGPL is just the default for Remora projects
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Do note the chunk iterator is disposable, so do wrap it in a using block/statement
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
The way that you'll use this is you'll init a new chunk iterator with the path to the file and the chunk lenght, then you can iterate through using a foreach loop or LINQ
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
It will be available here in a few minutes: https://www.nuget.org/packages/Tafs.Activities.FileChunks/0.1.0
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
I'll get this package published to nuget since I realized it's not there yet
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Includes a Chunk, a ChunkIterator, and a ReverseChunkIterator
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
Ah yes, so the TL;DR is you want to open the file as a MemoryMappedFile
50 replies