mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-09 01:25:46 +00:00
Add std
This commit is contained in:
@@ -31,20 +31,7 @@ func Tesses.CrossLang.PackageManager()
|
||||
var configRoot = Env.CrossLangConfig;
|
||||
var packageCache = configRoot / "PackageCache";
|
||||
FS.Local.CreateDirectory(packageCache);
|
||||
func FileReadByteArray(fs,path)
|
||||
{
|
||||
var f = fs.OpenFile(path,"rb");
|
||||
var ms = FS.MemoryStream(true);
|
||||
f.CopyTo(ms);
|
||||
var buff = ms.GetBytes();
|
||||
f.Close();
|
||||
return buff;
|
||||
}
|
||||
func FileReadString (fs,path) {
|
||||
var buff = FileReadByteArray(fs,path).ToString();
|
||||
ms.Close();
|
||||
return text;
|
||||
}
|
||||
|
||||
return {
|
||||
Offline = false,
|
||||
ParseFileName,
|
||||
@@ -65,7 +52,7 @@ func Tesses.CrossLang.PackageManager()
|
||||
var pkgFile = packageCache / name / v.ToString();
|
||||
if(useCache && FS.Local.RegularFileExists(pkgFile))
|
||||
{
|
||||
return FileReadByteArray(FS.Local,pkgFile);
|
||||
return FS.ReadAllBytes(FS.Local,pkgFile);
|
||||
}
|
||||
if(this.Offline) return null;
|
||||
|
||||
@@ -77,7 +64,7 @@ func Tesses.CrossLang.PackageManager()
|
||||
var req = Net.Http.MakeRequest(uri);
|
||||
if(req.StatusCode == 200)
|
||||
{
|
||||
var strm = FS.MemoryStream(true);
|
||||
var strm = new MemoryStream(true);
|
||||
req.CopyToStream(strm);
|
||||
|
||||
if(useCache) {
|
||||
|
||||
@@ -94,7 +94,7 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
if(TypeOf(info.type) == "String" && info.type == "template")
|
||||
{
|
||||
//vfs, strm, name, version, info
|
||||
var subdir = FS.SubdirFilesystem(FS.Local,dir);
|
||||
var subdir = new SubdirFilesystem(FS.Local,dir);
|
||||
var output = $"{name}-{version}.crvm";
|
||||
var outFile = FS.Local.OpenFile(dir / outputDir / output,"wb");
|
||||
|
||||
@@ -166,7 +166,7 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
|
||||
env.LoadFileWithDependencies(FS.Local,newFile);
|
||||
env.GetDictionary().RunTool({
|
||||
Project = FS.SubdirFilesystem(FS.Local, dir),
|
||||
Project = new SubdirFilesystem(FS.Local, dir),
|
||||
ProjectInfo = info,
|
||||
GeneratedSource = sources,
|
||||
Config = this.Config
|
||||
@@ -236,7 +236,7 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
Info = Json.Encode(info),
|
||||
Icon = icon,
|
||||
Tools = file_tools,
|
||||
ResourceFileSystem = FS.SubdirFilesystem(FS.Local, dir / resDir),
|
||||
ResourceFileSystem = new SubdirFilesystem(FS.Local, dir / resDir),
|
||||
Dependencies = file_deps,
|
||||
Output = outFile
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user