Coder Social home page Coder Social logo

linksplatform / io Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 2.04 MB

LinksPlatform's Platform.IO Class Library

Home Page: https://linksplatform.github.io/IO

License: The Unlicense

C# 81.03% C++ 18.97%
linksplatform dotnet-standard dotnet-framework csharp nuget-package class-library

io's Introduction

io's People

Contributors

codacy-badger avatar dependabot-preview[bot] avatar dependabot[bot] avatar freephoenix888 avatar konard avatar mitron57 avatar namelessptr avatar nassipkali avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

uselessgoddess

io's Issues

Make sure `TemproryFile` is as good as `tmpfile` from C/C++ or better.

/// <summary>
/// <para>Represents a self-deleting temporary file.</para>
/// <para>Представляет самоудаляющийся временный файл.</para>
/// </summary>
public class TemporaryFile : DisposableBase
{
/// <summary>
/// <para>Gets a temporary file path.</para>
/// <para>Возвращает путь к временному файлу.</para>
/// </summary>
public readonly string Filename;
/// <summary>
/// <para>Converts the <see cref="TemporaryFile"/> instance to <see cref="string"/> using the <see cref="Filename"/> field value.</para>
/// <para>Преобразует экземпляр <see cref="TemporaryFile"/> в <see cref="string"/> используя поле <see cref="Filename"/>.</para>
/// </summary>
/// <param name="file">
/// <para>A <see cref="TemporaryFile"/> instance.</para>
/// <para>Экземпляр <see cref="TemporaryFile"/>.</para>
/// </param>
/// <returns>
/// <para>Path to the temporary file.</para>
/// <para>Путь к временному файлу.</para>
/// </returns>
public static implicit operator string(TemporaryFile file) => file.Filename;
/// <summary>
/// <para>Initializes a <see cref="TemporaryFile"/> instance.</para>
/// <para>Инициализирует экземпляр класса <see cref="TemporaryFile"/>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public TemporaryFile() => Filename = TemporaryFiles.UseNew();
/// <summary>
/// <para>Deletes the temporary file.</para>
/// <para>Удаляет временный файл.</para>
/// </summary>
/// <param name="manual">
/// <para>A <see cref="Boolean"/> value that determines whether the disposal was triggered manually (by the developer's code) or was executed automatically without an explicit indication from a developer.</para>
/// <para>Значение типа <see cref="Boolean"/>, определяющие было ли высвобождение вызвано вручную (кодом разработчика) или же выполнилось автоматически без явного указания со стороны разработчика.</para>
/// </param>
/// <param name="wasDisposed">
/// <para>A <see cref="Boolean"/> value that determines whether the <see cref="TemporaryFile"/> was released before a call to this method.</para>
/// <para>Значение типа <see cref="Boolean"/>, определяющие были ли освобождены ресурсы, используемые <see cref="TemporaryFile"/> до вызова данного метода.</para>
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override void Dispose(bool manual, bool wasDisposed)
{
if (!wasDisposed)
{
File.Delete(Filename);
}
}
}

Make all these members public

private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt";
private static readonly object UsedFilesListLock = new();
private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void AddToUsedFilesList(string filename)

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.