From a35467f8d2f796adffd33ce43c5111a65691065d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Fri, 4 Aug 2023 00:06:41 +0800 Subject: [PATCH] init --- .gitignore | 7 + .idea/.gitignore | 8 + .idea/libraries/Dart_Packages.xml | 388 +++++++++++++++++++++++++++ .idea/libraries/Dart_SDK.xml | 28 ++ .idea/misc.xml | 9 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + CHANGELOG.md | 3 + README.md | 39 +++ analysis_options.yaml | 30 +++ example/jtorrent_example.dart | 1 + jtorrent.iml | 14 + lib/jtorrent.dart | 1 + lib/src/manager/torrent_manager.dart | 1 + lib/src/model/torrent.dart | 12 + lib/src/model/torrent_file.dart | 8 + pubspec.yaml | 14 + test/jtorrent_test.dart | 12 + 18 files changed, 589 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/libraries/Dart_Packages.xml create mode 100644 .idea/libraries/Dart_SDK.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 analysis_options.yaml create mode 100644 example/jtorrent_example.dart create mode 100644 jtorrent.iml create mode 100644 lib/jtorrent.dart create mode 100644 lib/src/manager/torrent_manager.dart create mode 100644 lib/src/model/torrent.dart create mode 100644 lib/src/model/torrent_file.dart create mode 100644 pubspec.yaml create mode 100644 test/jtorrent_test.dart diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cceda5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml new file mode 100644 index 0000000..44e7e9e --- /dev/null +++ b/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml new file mode 100644 index 0000000..5670ac7 --- /dev/null +++ b/.idea/libraries/Dart_SDK.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9924b68 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..22ced9c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b55e73 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/example/jtorrent_example.dart b/example/jtorrent_example.dart new file mode 100644 index 0000000..ab73b3a --- /dev/null +++ b/example/jtorrent_example.dart @@ -0,0 +1 @@ +void main() {} diff --git a/jtorrent.iml b/jtorrent.iml new file mode 100644 index 0000000..75734c9 --- /dev/null +++ b/jtorrent.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/jtorrent.dart b/lib/jtorrent.dart new file mode 100644 index 0000000..06e11d4 --- /dev/null +++ b/lib/jtorrent.dart @@ -0,0 +1 @@ +library; \ No newline at end of file diff --git a/lib/src/manager/torrent_manager.dart b/lib/src/manager/torrent_manager.dart new file mode 100644 index 0000000..a9c0109 --- /dev/null +++ b/lib/src/manager/torrent_manager.dart @@ -0,0 +1 @@ +class TorrentManager {} diff --git a/lib/src/model/torrent.dart b/lib/src/model/torrent.dart new file mode 100644 index 0000000..0a0b35d --- /dev/null +++ b/lib/src/model/torrent.dart @@ -0,0 +1,12 @@ +import 'package:jtorrent/src/model/torrent_file.dart'; + +/// http://bittorrent.org/beps/bep_0003.html +class Torrent { + Set? _announces; + + /// Single file : name of the file + /// Multiple files : name of the directory + String? name; + + final List files; +} diff --git a/lib/src/model/torrent_file.dart b/lib/src/model/torrent_file.dart new file mode 100644 index 0000000..f1fbfbd --- /dev/null +++ b/lib/src/model/torrent_file.dart @@ -0,0 +1,8 @@ +/// File content described in torrent file +class TorrentFile { + /// File path, the last of which is the actual file name + final String path; + + /// The length of the file in bytes + final int length; +} diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..04af3e9 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,14 @@ +name: jtorrent +description: BitTorrent client written in pure Dart +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: ^3.0.6 + +# Add regular dependencies here. +dependencies: + +dev_dependencies: + lints: ^2.0.0 + test: ^1.21.0 diff --git a/test/jtorrent_test.dart b/test/jtorrent_test.dart new file mode 100644 index 0000000..303a30b --- /dev/null +++ b/test/jtorrent_test.dart @@ -0,0 +1,12 @@ +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + }); + }); +}