EP 0.1.1 语句分界线尚未完成
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Convention.EasySave.Types
|
||||
{
|
||||
if(!reader.StartReadCollectionItem())
|
||||
break;
|
||||
stack.Push(reader.Read<T>(elementType));
|
||||
stack.CompleteLine(reader.Read<T>(elementType));
|
||||
if(reader.EndReadCollectionItem())
|
||||
break;
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ namespace Convention.EasySave.Types
|
||||
}
|
||||
else if (type == typeof(EasySaveStackType))
|
||||
{
|
||||
var method = baseType.type.GetMethod("Push");
|
||||
var method = baseType.type.GetMethod("CompleteLine");
|
||||
foreach (var item in loaded)
|
||||
method.Invoke(obj, new object[] { item });
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ namespace Convention
|
||||
{
|
||||
private string FullPath;
|
||||
private FileSystemInfo OriginInfo;
|
||||
public FileStream OriginControlStream { get; private set; }
|
||||
public ToolFile(string path)
|
||||
{
|
||||
FullPath = path;
|
||||
@@ -127,19 +126,10 @@ namespace Convention
|
||||
}
|
||||
private void SaveAsText(string data)
|
||||
{
|
||||
if (OriginControlStream != null && OriginControlStream.CanWrite)
|
||||
{
|
||||
using var sw = new StreamWriter(OriginControlStream);
|
||||
sw.Write(data);
|
||||
sw.Flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
using var fs = new FileStream(FullPath, FileMode.CreateNew, FileAccess.Write);
|
||||
using var sw = new StreamWriter(fs);
|
||||
sw.Write(data);
|
||||
sw.Flush();
|
||||
}
|
||||
using var fs = new FileStream(FullPath, FileMode.CreateNew, FileAccess.Write);
|
||||
using var sw = new StreamWriter(fs);
|
||||
sw.Write(data);
|
||||
sw.Flush();
|
||||
}
|
||||
public static void SaveDataAsBinary(string path, byte[] outdata, FileStream Stream = null)
|
||||
{
|
||||
@@ -158,7 +148,7 @@ namespace Convention
|
||||
|
||||
public void SaveAsBinary(byte[] data)
|
||||
{
|
||||
SaveDataAsBinary(FullPath, data, OriginControlStream);
|
||||
SaveDataAsBinary(FullPath, data, (OriginInfo as FileInfo).OpenWrite());
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -201,15 +191,8 @@ namespace Convention
|
||||
Refresh();
|
||||
return this;
|
||||
}
|
||||
public ToolFile Open(FileMode mode)
|
||||
{
|
||||
this.Close();
|
||||
OriginControlStream = new FileStream(this.FullPath, mode);
|
||||
return this;
|
||||
}
|
||||
public ToolFile Close()
|
||||
{
|
||||
OriginControlStream?.Close();
|
||||
return this;
|
||||
}
|
||||
public ToolFile Create()
|
||||
|
@@ -16,7 +16,6 @@ namespace Convention
|
||||
|
||||
public static void GenerateEmptyConfigJson(ToolFile file)
|
||||
{
|
||||
file.Open(System.IO.FileMode.CreateNew);
|
||||
file.SaveAsRawJson<Dictionary<string, object>>(new()
|
||||
{
|
||||
{ "properties",new Dictionary<string, object>() }
|
||||
@@ -71,12 +70,9 @@ namespace Convention
|
||||
var file = DataDir | path;
|
||||
if (file.Exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
file.Open(System.IO.FileMode.Create);
|
||||
return true;
|
||||
}
|
||||
catch (Exception) { }
|
||||
file.Delete();
|
||||
file.Create();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user