شائع شدہ سورس
سورس ZIP ڈاؤن لوڈ کریں
CH-J SM Mobile
ایپلیکیشن کی کسی مخصوص ریلیز کی ڈائریکٹریز اور فائلیں دیکھیں۔
CH-J / SM Mobile
175 فائلیں
sm-mobile-20261016T185235Z-8e93ecc1b59a
شامل کیا گیا: · بلڈ کیا گیا:
1
import 'dart:typed_data';2
import 'package:re_highlight/languages/apache.dart';3
import 'package:re_highlight/languages/bash.dart';4
import 'package:re_highlight/languages/c.dart';5
import 'package:re_highlight/languages/cmake.dart';6
import 'package:re_highlight/languages/cpp.dart';7
import 'package:re_highlight/languages/csharp.dart';8
import 'package:re_highlight/languages/css.dart';9
import 'package:re_highlight/languages/dart.dart';10
import 'package:re_highlight/languages/diff.dart';11
import 'package:re_highlight/languages/dockerfile.dart';12
import 'package:re_highlight/languages/dos.dart';13
import 'package:re_highlight/languages/go.dart';14
import 'package:re_highlight/languages/gradle.dart';15
import 'package:re_highlight/languages/graphql.dart';16
import 'package:re_highlight/languages/ini.dart';17
import 'package:re_highlight/languages/java.dart';18
import 'package:re_highlight/languages/javascript.dart';19
import 'package:re_highlight/languages/json.dart';20
import 'package:re_highlight/languages/kotlin.dart';21
import 'package:re_highlight/languages/less.dart';22
import 'package:re_highlight/languages/lua.dart';23
import 'package:re_highlight/languages/makefile.dart';24
import 'package:re_highlight/languages/markdown.dart';25
import 'package:re_highlight/languages/nginx.dart';26
import 'package:re_highlight/languages/perl.dart';27
import 'package:re_highlight/languages/php.dart';28
import 'package:re_highlight/languages/powershell.dart';29
import 'package:re_highlight/languages/properties.dart';30
import 'package:re_highlight/languages/protobuf.dart';31
import 'package:re_highlight/languages/python.dart';32
import 'package:re_highlight/languages/ruby.dart';33
import 'package:re_highlight/languages/rust.dart';34
import 'package:re_highlight/languages/scss.dart';35
import 'package:re_highlight/languages/sql.dart';36
import 'package:re_highlight/languages/swift.dart';37
import 'package:re_highlight/languages/typescript.dart';38
import 'package:re_highlight/languages/xml.dart';39
import 'package:re_highlight/languages/yaml.dart';40
import 'package:re_highlight/re_highlight.dart' show Mode;42
/// A syntax the editor offers. [grammar] is the Re-Highlight grammar used43
/// to colour it; null means plain text (no grammar exists for it, and none44
/// is pretended).45
class Syntax {46
final String id, label;47
final String? grammar;48
const Syntax(this.id, this.label, [this.grammar]);49
bool get highlighted => grammar != null;50
}52
/// Grammars bundled from Re-Highlight. Embedded languages (CSS/JS inside53
/// HTML, HTML around PHP) are not coloured: the editor highlights with54
/// exactly one grammar.55
final Map<String, Mode> grammars = {56
'apache': langApache,57
'bash': langBash,58
'c': langC,59
'cmake': langCmake,60
'cpp': langCpp,61
'csharp': langCsharp,62
'css': langCss,63
'dart': langDart,64
'diff': langDiff,65
'dockerfile': langDockerfile,66
'dos': langDos,67
'go': langGo,68
'gradle': langGradle,69
'graphql': langGraphql,70
'ini': langIni,71
'java': langJava,72
'javascript': langJavascript,73
'json': langJson,74
'kotlin': langKotlin,75
'less': langLess,76
'lua': langLua,77
'makefile': langMakefile,78
'markdown': langMarkdown,79
'nginx': langNginx,80
'perl': langPerl,81
'php': langPhp,82
'powershell': langPowershell,83
'properties': langProperties,84
'protobuf': langProtobuf,85
'python': langPython,86
'ruby': langRuby,87
'rust': langRust,88
'scss': langScss,89
'sql': langSql,90
'swift': langSwift,91
'typescript': langTypescript,92
'xml': langXml,93
'yaml': langYaml,94
};96
const plainText = Syntax('text', 'Text');98
/// Every syntax the user can pick by hand, by label.99
const syntaxes = <Syntax>[100
plainText,101
Syntax('apache', 'Apache config', 'apache'),102
Syntax('bash', 'Shell (Bash/sh/zsh)', 'bash'),103
Syntax('batch', 'Batch (cmd)', 'dos'),104
Syntax('c', 'C', 'c'),105
Syntax('cpp', 'C++', 'cpp'),106
Syntax('csharp', 'C#', 'csharp'),107
Syntax('cmake', 'CMake', 'cmake'),108
Syntax('css', 'CSS', 'css'),109
Syntax('csv', 'CSV / TSV'),110
Syntax('dart', 'Dart', 'dart'),111
Syntax('diff', 'Diff / patch', 'diff'),112
Syntax('dockerfile', 'Dockerfile', 'dockerfile'),113
Syntax('env', '.env', 'properties'),114
Syntax('fish', 'fish'),115
Syntax('go', 'Go', 'go'),116
Syntax('gradle', 'Gradle', 'gradle'),117
Syntax('graphql', 'GraphQL', 'graphql'),118
Syntax('hcl', 'Terraform (HCL)'),119
Syntax('html', 'HTML', 'xml'),120
Syntax('ini', 'INI / config', 'ini'),121
Syntax('java', 'Java', 'java'),122
Syntax('javascript', 'JavaScript', 'javascript'),123
Syntax('json', 'JSON', 'json'),124
Syntax('jsonl', 'JSON Lines', 'json'),125
Syntax('kotlin', 'Kotlin', 'kotlin'),126
Syntax('less', 'Less', 'less'),127
Syntax('log', 'Log'),128
Syntax('lua', 'Lua', 'lua'),129
Syntax('makefile', 'Makefile', 'makefile'),130
Syntax('markdown', 'Markdown', 'markdown'),131
Syntax('nginx', 'NGINX', 'nginx'),132
Syntax('perl', 'Perl', 'perl'),133
Syntax('php', 'PHP', 'php'),134
Syntax('plist', 'Property list (XML)', 'xml'),135
Syntax('powershell', 'PowerShell', 'powershell'),136
Syntax('properties', 'Properties', 'properties'),137
Syntax('protobuf', 'Protocol Buffers', 'protobuf'),138
Syntax('python', 'Python', 'python'),139
Syntax('ruby', 'Ruby', 'ruby'),140
Syntax('rust', 'Rust', 'rust'),141
Syntax('sass', 'Sass (indented)'),142
Syntax('scss', 'SCSS', 'scss'),143
Syntax('sql', 'SQL', 'sql'),144
Syntax('sshconfig', 'SSH config'),145
Syntax('svg', 'SVG (XML)', 'xml'),146
Syntax('swift', 'Swift', 'swift'),147
Syntax('systemd', 'systemd unit', 'ini'),148
Syntax('toml', 'TOML', 'ini'),149
Syntax('typescript', 'TypeScript', 'typescript'),150
Syntax('xml', 'XML', 'xml'),151
Syntax('yaml', 'YAML', 'yaml'),152
Syntax('pem', 'PEM / key / certificate'),153
Syntax('unixconfig', 'Unix config'),154
];156
Syntax syntaxById(String id) =>157
syntaxes.firstWhere((s) => s.id == id, orElse: () => plainText);159
const _byName = <String, String>{160
'dockerfile': 'dockerfile',161
'containerfile': 'dockerfile',162
'makefile': 'makefile',163
'gnumakefile': 'makefile',164
'cmakelists.txt': 'cmake',165
'nginx.conf': 'nginx',166
'httpd.conf': 'apache',167
'apache2.conf': 'apache',168
'.htaccess': 'apache',169
'.htpasswd': 'unixconfig',170
'sshd_config': 'sshconfig',171
'ssh_config': 'sshconfig',172
'.bashrc': 'bash',173
'.bash_profile': 'bash',174
'.bash_aliases': 'bash',175
'.bash_logout': 'bash',176
'.zshrc': 'bash',177
'.zprofile': 'bash',178
'.profile': 'bash',179
'.gitignore': 'unixconfig',180
'.dockerignore': 'unixconfig',181
'.gitattributes': 'unixconfig',182
'.gitconfig': 'ini',183
'.editorconfig': 'ini',184
'.npmrc': 'ini',185
'.env': 'env',186
'hosts': 'unixconfig',187
'fstab': 'unixconfig',188
'crontab': 'unixconfig',189
'authorized_keys': 'unixconfig',190
'known_hosts': 'unixconfig',191
};193
const _byExtension = <String, String>{194
'html': 'html', 'htm': 'html', 'xhtml': 'html', //195
'php': 'php', 'phtml': 'php', 'php5': 'php',196
'css': 'css', 'scss': 'scss', 'sass': 'sass', 'less': 'less',197
'js': 'javascript', 'mjs': 'javascript', 'cjs': 'javascript',198
'jsx': 'javascript',199
'ts': 'typescript', 'tsx': 'typescript',200
'json': 'json', 'jsonc': 'json', 'jsonl': 'jsonl', 'ndjson': 'jsonl',201
'ipynb': 'json',202
'xml': 'xml', 'xsd': 'xml', 'xsl': 'xml', 'xslt': 'xml',203
'plist': 'plist', 'svg': 'svg',204
'yaml': 'yaml', 'yml': 'yaml',205
'md': 'markdown', 'markdown': 'markdown',206
'py': 'python', 'pyw': 'python',207
'dart': 'dart', 'java': 'java', 'kt': 'kotlin', 'kts': 'kotlin',208
'swift': 'swift', 'rs': 'rust', 'go': 'go',209
'c': 'c', 'h': 'c',210
'cpp': 'cpp', 'hpp': 'cpp', 'cc': 'cpp', 'cxx': 'cpp', 'hh': 'cpp',211
'cs': 'csharp', 'rb': 'ruby', 'pl': 'perl', 'pm': 'perl', 'lua': 'lua',212
'ps1': 'powershell', 'psm1': 'powershell',213
'sh': 'bash', 'bash': 'bash', 'zsh': 'bash', 'fish': 'fish',214
'sql': 'sql', 'graphql': 'graphql', 'gql': 'graphql',215
'conf': 'ini', 'config': 'ini', 'cfg': 'ini', 'ini': 'ini',216
'properties': 'properties', 'env': 'env', 'toml': 'toml',217
'service': 'systemd', 'timer': 'systemd', 'socket': 'systemd',218
'mount': 'systemd', 'target': 'systemd', 'path': 'systemd',219
'desktop': 'systemd',220
'txt': 'text', 'log': 'log', 'csv': 'csv', 'tsv': 'csv',221
'diff': 'diff', 'patch': 'diff',222
'pem': 'pem', 'crt': 'pem', 'cer': 'pem', 'pub': 'pem', 'csr': 'pem',223
'key': 'pem', 'asc': 'pem', 'gpg': 'pem',224
'tf': 'hcl', 'tfvars': 'hcl',225
'gradle': 'gradle', 'proto': 'protobuf',226
'bat': 'batch', 'cmd': 'batch',227
};229
String _base(String name) {230
final slash = name.lastIndexOf('/');231
return slash < 0 ? name : name.substring(slash + 1);232
}234
String extensionOf(String name) {235
final base = _base(name);236
final dot = base.lastIndexOf('.');237
return dot <= 0 ? '' : base.substring(dot + 1).toLowerCase();238
}240
/// Picks the syntax for a file: exact name first, then extension, then the241
/// shebang line, then a look at the content. Unknown files are plain text.242
Syntax detectSyntax(String path, {String? content}) {243
final base = _base(path);244
final lower = base.toLowerCase();245
final byName = _byName[lower];246
if (byName != null) return syntaxById(byName);247
if (lower.startsWith('dockerfile.')) return syntaxById('dockerfile');248
if (lower.startsWith('.env.')) return syntaxById('env');249
if (path.endsWith('.ssh/config')) return syntaxById('sshconfig');250
if (lower.endsWith('.conf') &&251
(path.contains('/nginx/') || lower.startsWith('nginx'))) {252
return syntaxById('nginx');253
}254
if (lower.endsWith('.conf') &&255
(path.contains('/apache2/') || path.contains('/httpd/'))) {256
return syntaxById('apache');257
}258
final byExtension = _byExtension[extensionOf(base)];259
if (byExtension != null) return syntaxById(byExtension);260
if (content != null) {261
final first = content.split('\n').first.trim();262
if (first.startsWith('#!')) {263
for (final (word, id) in const [264
('python', 'python'),265
('node', 'javascript'),266
('deno', 'typescript'),267
('perl', 'perl'),268
('ruby', 'ruby'),269
('php', 'php'),270
('fish', 'fish'),271
('pwsh', 'powershell'),272
('bash', 'bash'),273
('zsh', 'bash'),274
('/sh', 'bash'),275
(' sh', 'bash'),276
]) {277
if (first.contains(word)) return syntaxById(id);278
}279
}280
final start = content.trimLeft();281
if (start.startsWith('<?xml')) return syntaxById('xml');282
if (start.toLowerCase().startsWith('<!doctype html')) {283
return syntaxById('html');284
}285
if (start.startsWith('<?php')) return syntaxById('php');286
if (start.startsWith('---\n') || start.startsWith('%YAML')) {287
return syntaxById('yaml');288
}289
if (start.startsWith('[Unit]') || start.startsWith('[Service]')) {290
return syntaxById('systemd');291
}292
if (start.startsWith('-----BEGIN ')) return syntaxById('pem');293
}294
return plainText;295
}297
/// How a file is opened.298
enum FileKind {299
text,300
image,301
svg,302
pdf,303
office,304
archive,305
audio,306
video,307
notebook,308
certificate,309
binary,310
}312
const _kinds = <String, FileKind>{313
'png': FileKind.image, 'jpg': FileKind.image, 'jpeg': FileKind.image, //314
'gif': FileKind.image, 'webp': FileKind.image, 'bmp': FileKind.image,315
'heic': FileKind.image, 'heif': FileKind.image, 'ico': FileKind.image,316
'svg': FileKind.svg,317
'pdf': FileKind.pdf,318
'doc': FileKind.office, 'docx': FileKind.office, 'xls': FileKind.office,319
'xlsx': FileKind.office, 'ppt': FileKind.office, 'pptx': FileKind.office,320
'odt': FileKind.office, 'ods': FileKind.office, 'odp': FileKind.office,321
'rtf': FileKind.office, 'pages': FileKind.office,322
'numbers': FileKind.office, 'key': FileKind.certificate,323
'zip': FileKind.archive, 'tar': FileKind.archive, 'gz': FileKind.archive,324
'tgz': FileKind.archive, 'bz2': FileKind.archive, 'tbz2': FileKind.archive,325
'xz': FileKind.archive, 'txz': FileKind.archive, '7z': FileKind.archive,326
'rar': FileKind.archive, 'jar': FileKind.archive, 'apk': FileKind.archive,327
'ipa': FileKind.archive, 'aab': FileKind.archive,328
'mp3': FileKind.audio, 'm4a': FileKind.audio, 'aac': FileKind.audio,329
'wav': FileKind.audio, 'flac': FileKind.audio, 'ogg': FileKind.audio,330
'opus': FileKind.audio, 'aiff': FileKind.audio,331
'mp4': FileKind.video, 'mov': FileKind.video, 'm4v': FileKind.video,332
'webm': FileKind.video, 'mkv': FileKind.video, 'avi': FileKind.video,333
'3gp': FileKind.video,334
'ipynb': FileKind.notebook,335
'pem': FileKind.certificate, 'crt': FileKind.certificate,336
'cer': FileKind.certificate, 'der': FileKind.certificate,337
'p12': FileKind.certificate, 'pfx': FileKind.certificate,338
'csr': FileKind.certificate, 'pub': FileKind.certificate,339
'asc': FileKind.certificate, 'gpg': FileKind.certificate,340
};342
/// The viewer for [name]; [head] (the first bytes) separates text from343
/// binary for unknown extensions.344
FileKind fileKind(String name, {Uint8List? head}) {345
final kind = _kinds[extensionOf(name)];346
if (kind != null) return kind;347
if (head != null && head.isNotEmpty) {348
if (_magic(head, const [0x89, 0x50, 0x4e, 0x47])) return FileKind.image;349
if (_magic(head, const [0xff, 0xd8, 0xff])) return FileKind.image;350
if (_magic(head, const [0x47, 0x49, 0x46, 0x38])) return FileKind.image;351
if (_magic(head, const [0x25, 0x50, 0x44, 0x46])) return FileKind.pdf;352
if (_magic(head, const [0x50, 0x4b, 0x03, 0x04])) return FileKind.archive;353
if (_magic(head, const [0x1f, 0x8b])) return FileKind.archive;354
}355
return FileKind.text;356
}358
bool _magic(Uint8List b, List<int> m) {359
if (b.length < m.length) return false;360
for (var i = 0; i < m.length; i++) {361
if (b[i] != m[i]) return false;362
}363
return true;364
}366
/// MIME type for sharing, saving and system viewers.367
String mimeOf(String name) => switch (extensionOf(name)) {368
'txt' || 'log' || 'conf' || 'cfg' || 'ini' || '' => 'text/plain',369
'html' || 'htm' => 'text/html',370
'css' => 'text/css',371
'csv' => 'text/csv',372
'js' || 'mjs' => 'text/javascript',373
'json' => 'application/json',374
'xml' => 'application/xml',375
'yaml' || 'yml' => 'application/yaml',376
'md' => 'text/markdown',377
'png' => 'image/png',378
'jpg' || 'jpeg' => 'image/jpeg',379
'gif' => 'image/gif',380
'webp' => 'image/webp',381
'bmp' => 'image/bmp',382
'heic' => 'image/heic',383
'heif' => 'image/heif',384
'svg' => 'image/svg+xml',385
'pdf' => 'application/pdf',386
'doc' => 'application/msword',387
'docx' =>388
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',389
'xls' => 'application/vnd.ms-excel',390
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',391
'ppt' => 'application/vnd.ms-powerpoint',392
'pptx' =>393
'application/vnd.openxmlformats-officedocument.presentationml.presentation',394
'odt' => 'application/vnd.oasis.opendocument.text',395
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',396
'odp' => 'application/vnd.oasis.opendocument.presentation',397
'rtf' => 'application/rtf',398
'zip' => 'application/zip',399
'gz' || 'tgz' => 'application/gzip',400
'tar' => 'application/x-tar',401
'mp3' => 'audio/mpeg',402
'm4a' || 'aac' => 'audio/mp4',403
'wav' => 'audio/wav',404
'flac' => 'audio/flac',405
'ogg' || 'opus' => 'audio/ogg',406
'mp4' || 'm4v' => 'video/mp4',407
'mov' => 'video/quicktime',408
'webm' => 'video/webm',409
'mkv' => 'video/x-matroska',410
_ => 'application/octet-stream',411
};SHA-256
b5f3e00d877b056de93c5cff3f22b7e6c83a6f7ba50f0e075ab61d228c20f9d0CH-J Proprietary Software License 1.14 · سورس CH-J Proprietary Software License 1.14 کے تحت فراہم کیا جاتا ہے۔ اس کی دستیابی لائسنس کی شرائط نہیں بدلتی اور نہ ہی اضافی حقوق دیتی ہے۔
آرکائیو کا SHA-256
46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655