This commit is contained in:
Khalitova Angelina 2023-10-17 13:40:20 +04:00
parent 01395f5bdc
commit 40a64882cb
3 changed files with 67 additions and 4 deletions

63
distributed-computing.sln Normal file
View File

@ -0,0 +1,63 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tasks", "tasks", "{23830029-EFDC-4E62-B550-489217B1AE5D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "khalitova-am", "khalitova-am", "{9D7E9185-0597-4DC6-B355-F9BEE0D3767B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lab_2", "lab_2", "{D50FE5F5-027F-48A0-B15B-DB321333C7AF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "worker-1", "tasks\khalitova-am\lab_2\worker-1\worker-1.csproj", "{4A670397-6811-43A4-9A0B-D273B272D3AF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "worker-2", "tasks\khalitova-am\lab_2\worker-2\worker-2.csproj", "{9B8FD7F6-053D-440B-8ECB-0068932A6019}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "moiseev-vv", "moiseev-vv", "{13C76A1C-E281-49AA-96C0-6BB6FEB8F6FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lab_2", "lab_2", "{1A6E095C-F09F-45DC-BCC4-A71B41B9C911}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "worker-1", "tasks\moiseev-vv\lab_2\worker-1\worker-1.csproj", "{6F09F499-3699-4BE1-82FB-087ACAB9C46D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "worker-2", "tasks\moiseev-vv\lab_2\worker-2\worker-2.csproj", "{68B7A2B8-967F-4D0C-9667-4763A355576B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A670397-6811-43A4-9A0B-D273B272D3AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A670397-6811-43A4-9A0B-D273B272D3AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A670397-6811-43A4-9A0B-D273B272D3AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A670397-6811-43A4-9A0B-D273B272D3AF}.Release|Any CPU.Build.0 = Release|Any CPU
{9B8FD7F6-053D-440B-8ECB-0068932A6019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B8FD7F6-053D-440B-8ECB-0068932A6019}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B8FD7F6-053D-440B-8ECB-0068932A6019}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B8FD7F6-053D-440B-8ECB-0068932A6019}.Release|Any CPU.Build.0 = Release|Any CPU
{6F09F499-3699-4BE1-82FB-087ACAB9C46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F09F499-3699-4BE1-82FB-087ACAB9C46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F09F499-3699-4BE1-82FB-087ACAB9C46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F09F499-3699-4BE1-82FB-087ACAB9C46D}.Release|Any CPU.Build.0 = Release|Any CPU
{68B7A2B8-967F-4D0C-9667-4763A355576B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68B7A2B8-967F-4D0C-9667-4763A355576B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68B7A2B8-967F-4D0C-9667-4763A355576B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68B7A2B8-967F-4D0C-9667-4763A355576B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9D7E9185-0597-4DC6-B355-F9BEE0D3767B} = {23830029-EFDC-4E62-B550-489217B1AE5D}
{D50FE5F5-027F-48A0-B15B-DB321333C7AF} = {9D7E9185-0597-4DC6-B355-F9BEE0D3767B}
{4A670397-6811-43A4-9A0B-D273B272D3AF} = {D50FE5F5-027F-48A0-B15B-DB321333C7AF}
{9B8FD7F6-053D-440B-8ECB-0068932A6019} = {D50FE5F5-027F-48A0-B15B-DB321333C7AF}
{13C76A1C-E281-49AA-96C0-6BB6FEB8F6FC} = {23830029-EFDC-4E62-B550-489217B1AE5D}
{1A6E095C-F09F-45DC-BCC4-A71B41B9C911} = {13C76A1C-E281-49AA-96C0-6BB6FEB8F6FC}
{6F09F499-3699-4BE1-82FB-087ACAB9C46D} = {1A6E095C-F09F-45DC-BCC4-A71B41B9C911}
{68B7A2B8-967F-4D0C-9667-4763A355576B} = {1A6E095C-F09F-45DC-BCC4-A71B41B9C911}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B2DE817-CEB6-4A88-AB45-27AC288E5F43}
EndGlobalSection
EndGlobal

View File

@ -1,6 +1,6 @@
using System.Text; using System.Text;
string[] files = Directory.GetFiles("../../../../var/data"); string[] files = Directory.GetFiles("/var/data");
string maxFilePath = ""; string maxFilePath = "";
long maxFileLenght = 0; long maxFileLenght = 0;
foreach(var filePath in files){ foreach(var filePath in files){
@ -14,7 +14,7 @@ using (FileStream fstream = File.OpenRead(maxFilePath)){
byte[] buffer = new byte[fstream.Length]; byte[] buffer = new byte[fstream.Length];
await fstream.ReadAsync(buffer, 0, buffer.Length); await fstream.ReadAsync(buffer, 0, buffer.Length);
string text = Encoding.Default.GetString(buffer); string text = Encoding.Default.GetString(buffer);
using(FileStream fstream1 = new FileStream("../../../../var/result/data.txt", FileMode.OpenOrCreate)){ using(FileStream fstream1 = new FileStream("/var/result/data.txt", FileMode.OpenOrCreate)){
fstream1.SetLength(0); fstream1.SetLength(0);
byte[] buffer1 = Encoding.Default.GetBytes(text); byte[] buffer1 = Encoding.Default.GetBytes(text);
await fstream1.WriteAsync(buffer1, 0, buffer1.Length); await fstream1.WriteAsync(buffer1, 0, buffer1.Length);

View File

@ -1,6 +1,6 @@
using System.Text; using System.Text;
int[] numbers = File.ReadAllLines("../../../../var/data/data.txt").Select(x=> int.Parse(x)).ToArray(); int[] numbers = File.ReadAllLines("/var/data/data.txt").Select(x=> int.Parse(x)).ToArray();
int maxNumber = 0; int maxNumber = 0;
int maxNumberCount = 0; int maxNumberCount = 0;
foreach(var number in numbers){ foreach(var number in numbers){
@ -16,7 +16,7 @@ foreach(var number in numbers){
maxNumberCount = 1; maxNumberCount = 1;
} }
} }
using(FileStream fstream = new FileStream("../../../../var/result/result.txt", FileMode.OpenOrCreate)){ using(FileStream fstream = new FileStream("/var/result/result.txt", FileMode.OpenOrCreate)){
byte[] buffer = Encoding.Default.GetBytes(maxNumberCount.ToString()); byte[] buffer = Encoding.Default.GetBytes(maxNumberCount.ToString());
await fstream.WriteAsync(buffer, 0, buffer.Length); await fstream.WriteAsync(buffer, 0, buffer.Length);
} }