Skip to content

Commit

Permalink
Readme's updated
Browse files Browse the repository at this point in the history
  • Loading branch information
g0dzZz-coder committed Aug 8, 2023
1 parent 2edfe98 commit 370eb8a
Show file tree
Hide file tree
Showing 3 changed files with 287 additions and 1 deletion.
142 changes: 142 additions & 0 deletions Docs/README.RU.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Depra.Assets

<div align="center">
<strong><a href="README.md">English</a> | <a href="README.RU.md">Русский</a></strong>
</div>

<details>
<summary>Оглавление</summary>

- [Введение](#введение)
- [Особенности](#особенности)
- [Установка](#установка)
- [Интерфейсы](#интерфейсы)
- [Классы](#классы)
- [Примеры использования](#примеры-использования)
- [Поддержка](#поддержка)
- [Лицензия](#лицензия)

</details>

## Введение

Данная библиотека предоставляет набор интерфейсов и классов для управления ресурсами.
Она позволяет создавать группы ресурсов, загружать и выгружать их,
а также предоставляет асинхронную загрузку с обратной связью о прогрессе.

### Особенности:

- ООП-подход к управлению ресурсами
- Поддержка различных типов ресурсов
- Поддержка событий
- Расширяемость

## Установка

### Ручная

Добавьте файл **.dll** из последнего релиза в свой проект.

### Через NuGet

Добавьте `Depra.Assets` в свой проект с помощью **NuGet**.

## Интерфейсы

### `IAssetFile`

Интерфейс, представляющий базовую информацию о файле ресурса.

- `Ident`: Идентификатор ресурса.
- `Size`: Размер файла ресурса.

### `ILoadableAsset<TAsset>`

Интерфейс, предоставляющий методы для загрузки и выгрузки ресурса.

- `IsLoaded`: Возвращает `true`, если ресурс загружен, иначе `false`.
- `Load()`: Загружает ресурс синхронно.
- `Unload()`: Выгружает ресурс.
- `LoadAsync(onProgress, cancellationToken)`: Загружает ресурс асинхронно с обратной связью о прогрессе.

### `IAssetIdent`

Интерфейс для идентификатора ресурса.

- `Uri`: Абсолютный URI ресурса.
- `RelativeUri`: Относительный URI ресурса.

## Классы

### `AssetName`

Класс, представляющий имя ресурса.

- `Name`: Имя ресурса.
- `Uri`: Абсолютный URI ресурса.
- `RelativeUri`: Относительный URI ресурса.

### `AssetGroup<TAsset>`

Класс для управления группой ресурсов.

- `Name`: Имя группы ресурсов.
- `Ident`: Идентификатор группы ресурсов.
- `Size`: Общий размер группы ресурсов.
- `IsLoaded`: Возвращает `true`, если все ресурсы в группе загружены.
- `Children`: Коллекция дочерних ресурсов в группе.
- `AddAsset(asset)`: Добавляет ресурс в группу.
- `Load()`: Загружает все ресурсы в группе синхронно.
- `LoadAsync(onProgress, cancellationToken)`: Загружает все ресурсы в группе асинхронно с обратной связью о прогрессе.
- `Unload()`: Выгружает все ресурсы в группе.
- `GetEnumerator()`: Возвращает перечислитель дочерних ресурсов.

## Примеры использования

```csharp
// Пример создания группы ресурсов.
var groupName = new AssetName("textures");
var assetGroup = new AssetGroup<Texture>(groupName);

// Добавление ресурсов в группу.
assetGroup.AddAsset(new TextureAsset("texture1.png"));
assetGroup.AddAsset(new TextureAsset("texture2.png"));

// Загрузка ресурсов группы.
assetGroup.Load();

// Итерация по загруженным ресурсам.
foreach (var texture in assetGroup)
{
// Использование загруженных текстур.
}

// Выгрузка ресурсов группы.
assetGroup.Unload();

// Асинхронная загрузка ресурсов группы.
await assetGroup.LoadAsync(
onProgress: (progress) =>
{
// Обратная связь о прогрессе загрузки.
},
cancellationToken: default
);

assetGroup.Unload();
```

## Поддержка

Я независимый разработчик,
и большая часть разработки этого проекта выполняется в свободное время.
Если вы заинтересованы в сотрудничестве или найме меня для проекта,
ознакомьтесь с моим [портфолио](https://github.com/Depression-aggression)
и [свяжитесь со мной](mailto:[email protected])!

## Лицензия

Этот проект распространяется под лицензией **Apache-2.0**

Copyright (c) 2023 Николай Мельников
[[email protected]](mailto:[email protected])
145 changes: 145 additions & 0 deletions Docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Depra.Assets

<div align="center">
<strong><a href="README.md">English</a> | <a href="README.RU.md">Русский</a></strong>
</div>

<details>
<summary>Table of Contents</summary>

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Interfaces](#interfaces)
- [Classes](#classes)
- [Usage Examples](#usage-examples)
- [Support](#support)
- [License](#license)

</details>

## Introduction

This library provides a set of interfaces and classes for managing resources.
It allows you to create resource groups, load and unload them,
and also provides asynchronous loading with progress feedback.

### Features:

- Object-oriented approach to resource management
- Support for various types of resources
- Event support
- Extensibility

## Installation

### Manual

Add the **.dll** file from the latest release to your project.

### Via NuGet

Add `Depra.Assets` to your project using **NuGet**.

## Interfaces

### `IAssetFile`

An interface representing basic information about a resource file.

- `Ident`: Resource identifier.
- `Size`: Resource file size.

### `ILoadableAsset<TAsset>`

An interface providing methods for loading and unloading a resource.

- `IsLoaded`: Returns `true` if the resource is loaded, otherwise `false`.
- `Load()`: Loads the resource synchronously.
- `Unload()`: Unloads the resource.
- `LoadAsync(onProgress, cancellationToken)`: Loads the resource asynchronously with progress feedback.

### `IAssetIdent`

An interface for a resource identifier.

- `Uri`: Absolute URI of the resource.
- `RelativeUri`: Relative URI of the resource.

## Classes

### `AssetName`

A class representing the name of a resource.

- `Name`: Resource name.
- `Uri`: Absolute URI of the resource.
- `RelativeUri`: Relative URI of the resource.

### `AssetGroup<TAsset>`

A class for managing a group of resources.

- `Name`: Group name of resources.
- `Ident`: Group resource identifier.
- `Size`: Total size of the group of resources.
- `IsLoaded`: Returns `true` if all resources in the group are loaded.
- `Children`: Collection of child resources in the group.
- `AddAsset(asset)`: Adds a resource to the group.
- `Load()`: Loads all resources in the group synchronously.
- `LoadAsync(onProgress, cancellationToken)`: Loads all resources in the group asynchronously with progress feedback.
- `Unload()`: Unloads all resources in the group.
- `GetEnumerator()`: Returns an enumerator of child resources.

## Usage Examples

```csharp
// Example of creating a resource group.
var groupName = new AssetName("textures");
var assetGroup = new AssetGroup<Texture>(groupName);

// Adding resources to the group.
assetGroup.AddAsset(new TextureAsset("texture1.png"));
assetGroup.AddAsset(new TextureAsset("texture2.png"));

// Loading resources of the group.
assetGroup.Load();

// Iterating through loaded resources.
foreach (var texture in assetGroup)
{
// Using the loaded textures.
}

// Unloading resources of the group.
assetGroup.Unload();

// Asynchronously loading resources of the group.
await assetGroup.LoadAsync(
onProgress: (progress) =>
{
// Progress feedback during loading.
},
cancellationToken: default
);

assetGroup.Unload();
```

## Support

I am an independent developer,
and most of the development on this project is done in my spare time.
If you're interested in collaborating or hiring me for a project, check
out [my portfolio](https://github.com/Depression-aggression) and [reach out](mailto:[email protected])!

## License

This project is licensed under the **Apache-2.0 License**.

Copyright (c) 2022-2023 Nikolay Melnikov
[[email protected]](mailto:[email protected])




1 change: 0 additions & 1 deletion README.md

This file was deleted.

0 comments on commit 370eb8a

Please sign in to comment.