/
InfoExtensions.cs
39 lines (33 loc) · 1011 Bytes
/
InfoExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleApplicationWPF
{
public static class InfoExtensions
{
public static string SetAttributes(this System.IO.FileSystemInfo __file)
{
string attributes = "";
if (__file.Attributes.HasFlag(FileAttributes.ReadOnly))
attributes += "r";
else
attributes += "-";
if (__file.Attributes.HasFlag(FileAttributes.Archive))
attributes += "a";
else
attributes += "-";
if (__file.Attributes.HasFlag(FileAttributes.Hidden))
attributes += "h";
else
attributes += "-";
if (__file.Attributes.HasFlag(FileAttributes.System))
attributes += "s";
else
attributes += "-";
return attributes;
}
}
}