Horizon – Diff between revs 23 and 25

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 23 Rev 25
Line 5... Line 5...
5 using System.Drawing.Imaging; 5 using System.Drawing.Imaging;
6 using System.Globalization; 6 using System.Globalization;
7 using System.IO; 7 using System.IO;
8 using System.IO.Compression; 8 using System.IO.Compression;
9 using System.Runtime.CompilerServices; 9 using System.Runtime.CompilerServices;
-   10 using System.Security.AccessControl;
10 using System.Security.Cryptography; 11 using System.Security.Cryptography;
11 using System.Threading; 12 using System.Threading;
12 using System.Threading.Tasks; 13 using System.Threading.Tasks;
13 using Horizon.Snapshots; 14 using Horizon.Snapshots;
14 using Horizon.Utilities; 15 using Horizon.Utilities;
Line 1086... Line 1087...
1086   1087  
1087 switch (atomic) 1088 switch (atomic)
1088 { 1089 {
1089 case true: 1090 case true:
1090 // Atomic 1091 // Atomic
1091 var temp = Path.Combine(Path.GetDirectoryName(path), 1092 var temp = Path.Combine(dir,
Line 1092... Line 1093...
1092 $"{Path.GetFileName(path)}.temp"); 1093 $"{Path.GetFileName(path)}.temp");
1093   1094  
1094 using (var readStream = sqlDataReader.GetStream(2)) 1095 using (var readStream = sqlDataReader.GetStream(2))
Line 1098... Line 1099...
1098 FileShare.None)) 1099 FileShare.None))
1099 { 1100 {
1100 using (var zipStream = 1101 using (var zipStream =
1101 new GZipStream(readStream, CompressionMode.Decompress)) 1102 new GZipStream(readStream, CompressionMode.Decompress))
1102 { 1103 {
1103 zipStream.CopyTo(fileStream); 1104 await zipStream.CopyToAsync(fileStream);
-   1105 zipStream.Close();
1104 } 1106 }
-   1107
-   1108 fileStream.Close();
1105 } 1109 }
-   1110
-   1111 readStream.Close();
1106 } 1112 }
Line 1107... Line 1113...
1107   1113  
1108 try 1114 try
-   1115 {
-   1116 if (!File.Exists(path))
-   1117 {
-   1118 File.Create(path).Close();
-   1119 }
1109 { 1120  
1110 File.Replace(temp, path, null, true); 1121 File.Replace(temp, path, null, true);
1111 } 1122 }
1112 catch 1123 catch(Exception e1)
-   1124 {
1113 { 1125 var a = e1;
1114 try 1126 try
1115 { 1127 {
1116 File.Delete(temp); 1128 File.Delete(temp);
1117 } 1129 }