CH-J SM Mobileการจัดการเซิร์ฟเวอร์ผ่าน SSH
เมนู
ซอร์สที่เผยแพร่

CH-J SM Mobile

เรียกดูไดเรกทอรีและไฟล์ของรุ่นแอปพลิเคชันที่ระบุ

ดาวน์โหลด ZIP ของซอร์ส
CH-J / SM Mobile 175 ไฟล์
sm-mobile-20261016T185235Z-8e93ecc1b59a วันที่เพิ่ม: · วันที่บิลด์:
blob_store.dart วันที่เพิ่ม: ไม่ได้บันทึกวันที่ 2.0 KB · 60 บรรทัด
โค้ด ดาวน์โหลดไฟล์
1import 'dart:io';
2import 'dart:typed_data';
3import 'package:path_provider/path_provider.dart';
5/// Opaque binary records too large for the keychain, such as encrypted
6/// editor drafts. Callers encrypt before writing; nothing here is secret.
7abstract interface class BlobStore {
8 Future<Uint8List?> read(String name);
9 Future<void> write(String name, Uint8List bytes);
10 Future<void> delete(String name);
13class MemoryBlobStore implements BlobStore {
14 final values = <String, Uint8List>{};
15 @override
16 Future<Uint8List?> read(String name) async => values[name];
17 @override
18 Future<void> write(String name, Uint8List bytes) async =>
19 values[name] = Uint8List.fromList(bytes);
20 @override
21 Future<void> delete(String name) async => values.remove(name);
24/// Files in the app's private support directory, written atomically
25/// (temporary file, flush, rename) so a crash never leaves half a record.
26class FileBlobStore implements BlobStore {
27 Future<Directory>? _root;
28 Future<Directory> get root => _root ??= () async {
29 final base = await getApplicationSupportDirectory();
30 return Directory('${base.path}/sm-blobs').create(recursive: true);
31 }();
33 static String _check(String name) {
34 if (!RegExp(r'^[A-Za-z0-9_-]{1,80}$').hasMatch(name)) {
35 throw ArgumentError.value(name, 'name');
36 }
37 return name;
38 }
40 @override
41 Future<Uint8List?> read(String name) async {
42 final file = File('${(await root).path}/${_check(name)}');
43 return await file.exists() ? file.readAsBytes() : null;
44 }
46 @override
47 Future<void> write(String name, Uint8List bytes) async {
48 final dir = await root;
49 final target = File('${dir.path}/${_check(name)}');
50 final temp = File('${dir.path}/.${_check(name)}.tmp');
51 await temp.writeAsBytes(bytes, flush: true);
52 await temp.rename(target.path);
53 }
55 @override
56 Future<void> delete(String name) async {
57 final file = File('${(await root).path}/${_check(name)}');
58 if (await file.exists()) await file.delete();
59 }
SHA-256ae482658006380f09b655765829360a5614d19d84b1b6e9457c04f29eb06b7fa

CH-J Proprietary Software License 1.14 · ซอร์สโค้ดนี้ให้ไว้ภายใต้ CH-J Proprietary Software License 1.14 การเปิดให้เข้าถึงไม่ได้เปลี่ยนแปลงเงื่อนไขของสัญญาอนุญาตหรือให้สิทธิ์เพิ่มเติม

SHA-256 ของไฟล์บีบอัด46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
ไฟล์