/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
src/oscript/Web/Multipart/PostFileDescription.cs
64 строки
2 KB
Andrey Ovsiankin
Рефакторинг неймспейсов
30 авг 2021, 16:41
30 авг 2021, 16:41
225528b
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using HttpMultipartParser; using OneScript.Contexts; using OneScript.StandardLibrary.Binary; using ScriptEngine.Machine.Contexts; namespace oscript.Web.Multipart { [ContextClass("ОписаниеФайлаPostЗапроса", "PostFileDecription")] class PostFileDescription : AutoContext<PostFileDescription> { private string _name; private string _filename; private string _content_disposition; private string _content_type; private long _content_size; private BinaryDataContext _data; internal PostFileDescription(FilePart filepart) { _name = filepart.Name; _filename = filepart.FileName; _content_disposition = filepart.ContentDisposition; _content_type = filepart.ContentType; _content_size = filepart.Data.Length; byte[] buf = new byte[_content_size]; filepart.Data.Read(buf, 0, (int)_content_size); _data = new BinaryDataContext(buf); } [ContextProperty("Имя", "Name")] public string Name { get { return _name; } } [ContextProperty("ИмяФайла", "FileName")] public string Filename { get { return _filename; } } [ContextProperty("РасположениеСодержимого", "ContentDisposition")] public string ContentDisposition { get { return _content_disposition; } } [ContextProperty("ТипСодержимого", "ContentType")] public string ContentType { get { return _content_type; } } [ContextProperty("Размер", "Size")] public decimal ContentSize { get { return _content_size; } } [ContextProperty("Данные", "Data")] public BinaryDataContext Data { get { return _data; } } } }