teper' done

This commit is contained in:
Галина Федоренко 2023-11-22 09:46:13 +04:00
parent c711032928
commit 602107fced

View File

@ -2,6 +2,7 @@
using Hydroplane.MovementStrategy;
using System;
using System.Collections.Generic;
using System.DirectoryServices.ActiveDirectory;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -79,50 +80,51 @@ namespace Hydroplane.Generics
{
return false;
}
string bufferTextFromFile = "";
using (FileStream fs = new(filename, FileMode.Open))
using (StreamReader fs = File.OpenText(filename))
{
byte[] b = new byte[fs.Length];
UTF8Encoding temp = new(true);
while (fs.Read(b, 0, b.Length) > 0)
string str = fs.ReadLine();
if (str == null || str.Length == 0)
{
bufferTextFromFile += temp.GetString(b);
return false;
}
}
var strs = bufferTextFromFile.Split(new char[] { '\n', '\r' },
StringSplitOptions.RemoveEmptyEntries);
if (strs.Length == 0 || strs == null)
{
return false;
}
if (!strs[0].StartsWith("PlaneStorage"))
{
return false;
}
_planeStorages.Clear();
foreach (string data in strs)
{
string[] record = data.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
if (record.Length != 2)
if (!str.StartsWith("PlaneStorage"))
{
continue;
return false;
}
PlanesGenericCollection<DrawningPlane, DrawningObjectPlane> collection = new(_pictureWidth, _pictureHeight);
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set)
_planeStorages.Clear();
string strs = "";
while ((strs = fs.ReadLine()) != null)
{
DrawningPlane? plane = elem.CreateDrawningPlane(_separatorForObject, _pictureWidth, _pictureHeight);
if (plane != null)
if (strs == null)
{
if (!(collection + plane))
return false;
}
string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
if (record.Length != 2)
{
continue;
}
PlanesGenericCollection<DrawningPlane, DrawningObjectPlane> collection = new(_pictureWidth, _pictureHeight);
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set)
{
DrawningPlane? plane = elem?.CreateDrawningPlane(_separatorForObject, _pictureWidth, _pictureHeight);
if (plane != null)
{
return false;
if (!(collection + plane))
{
return false;
}
}
}
_planeStorages.Add(record[0], collection);
}
_planeStorages.Add(record[0], collection);
return true;
}
return true;
}
}
}
}