Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit 760f80f

Browse files
committed
Add the lost
1 parent 98db921 commit 760f80f

File tree

6 files changed

+226
-5
lines changed

6 files changed

+226
-5
lines changed

TidyBackups/Debugging/Admin.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of TidyBackups
3+
*
4+
* TidyBackups is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* TidyBackups is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with TidyBackups. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System.Security.Principal;
19+
using System.Threading;
20+
21+
namespace TidyBackups.Debug
22+
{
23+
internal class Admin
24+
{
25+
protected internal static bool IsAdmin
26+
{
27+
get
28+
{
29+
Thread.GetDomain().SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
30+
return ((WindowsPrincipal)Thread.CurrentPrincipal).IsInRole(WindowsBuiltInRole.Administrator);
31+
}
32+
}
33+
}
34+
}

TidyBackups/Debugging/Assembly.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This file is part of TidyBackups
3+
*
4+
* TidyBackups is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* TidyBackups is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with TidyBackups. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System.IO;
19+
using System.Reflection;
20+
21+
namespace TidyBackups.Debug
22+
{
23+
internal class Assembly
24+
{
25+
protected internal static string Version
26+
{
27+
get
28+
{
29+
return ((object)System.Reflection.Assembly.GetExecutingAssembly().GetName().Version).ToString();
30+
}
31+
}
32+
33+
protected internal static string Title
34+
{
35+
get
36+
{
37+
object[] customAttributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
38+
if (customAttributes.Length > 0)
39+
{
40+
AssemblyTitleAttribute assemblyTitleAttribute = (AssemblyTitleAttribute)customAttributes[0];
41+
if (assemblyTitleAttribute.Title != "")
42+
return assemblyTitleAttribute.Title;
43+
}
44+
return Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
45+
}
46+
}
47+
}
48+
}

TidyBackups/Debugging/Files.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of TidyBackups
3+
*
4+
* TidyBackups is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* TidyBackups is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with TidyBackups. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System.IO;
19+
using TidyBackups;
20+
using TidyBackups.Item;
21+
22+
namespace TidyBackups.Debug
23+
{
24+
internal class Files
25+
{
26+
protected internal static void Filtered(string path)
27+
{
28+
foreach (string str in Directory.GetFiles(path))
29+
{
30+
if (Name.Type(str))
31+
Message.Print(" " + (object)str + " - Age:" + (string)(object)Days.Age(str) + "days");
32+
else
33+
Message.Print(" IGNORING: " + str);
34+
}
35+
}
36+
}
37+
}

TidyBackups/Debugging/OS.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* This file is part of TidyBackups
3+
*
4+
* TidyBackups is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* TidyBackups is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with TidyBackups. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System;
19+
20+
namespace TidyBackups.Debug
21+
{
22+
internal class Os
23+
{
24+
protected internal static string Version
25+
{
26+
get
27+
{
28+
return Environment.OSVersion.VersionString;
29+
}
30+
}
31+
}
32+
}

TidyBackups/Debugging/Output.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* This file is part of TidyBackups
3+
*
4+
* TidyBackups is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* TidyBackups is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with TidyBackups. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System;
19+
using TidyBackups;
20+
using TidyBackups.Item;
21+
22+
namespace TidyBackups.Debug
23+
{
24+
internal class Output
25+
{
26+
internal static void Info(string[] args, bool compress, int days, string path, int preserve, bool safe)
27+
{
28+
Message.Print(Assembly.Title + " - " + Assembly.Version);
29+
Message.Print("Admin: " + (object)(bool)(Admin.IsAdmin ? 1 : 0));
30+
Message.Print("OS Version: " + Os.Version);
31+
Message.Print("Disc letter: " + Disc.GetDriveName(path));
32+
Message.Print("Disc label: " + Disc.Label(path));
33+
Message.Print("Disc format: " + Disc.Format(path));
34+
Message.Print("Local disc: " + (object)(bool)(Disc.IsLocalDrive(Disc.GetDriveName(path)) ? 1 : 0));
35+
Message.Print("Disc type: " + Disc.Type(path));
36+
Message.Print("Disc ready: " + Disc.Ready(path));
37+
Message.Print("Disc size: " + Disc.TotalSpace(path));
38+
Message.Print("Free space: " + Disc.FreeSpace(path));
39+
Message.Print("Username: " + Environment.UserName);
40+
Message.Print("Domain: " + Environment.UserDomainName);
41+
Message.Print("Arguments:" + Output.StrArg(args));
42+
Message.Print("Days: " + (object)days);
43+
Message.Print("Path: " + path);
44+
Files.Filtered(path);
45+
Message.Print("Path permission: " + Permissions.View(path));
46+
Message.Print("Preserve: " + (object)preserve);
47+
Message.Print("Safe: " + (object)(bool)(safe ? 1 : 0));
48+
Message.Print("Archive: " + (object)(bool)(compress ? 1 : 0));
49+
bool flag = true;
50+
if (Message.Logfile == "")
51+
flag = false;
52+
Message.Print("Log: " + (object)(bool)(flag ? 1 : 0));
53+
if (!flag)
54+
return;
55+
Message.Print("Log path: " + Message.Logfile);
56+
Message.Print("Log permission: " + Permissions.View(Message.Logfile));
57+
}
58+
59+
private static string StrArg(string[] args)
60+
{
61+
string str1 = "";
62+
for (int index = 0; index < args.Length; ++index)
63+
{
64+
string str2 = args[index].ToUpper();
65+
str1 = str1 + " " + str2;
66+
}
67+
return str1;
68+
}
69+
}
70+
}

TidyBackups/TidyBackups.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4444
<ItemGroup>
4545
<Compile Include="Days.cs" />
46-
<Compile Include="Debug\Files.cs" />
47-
<Compile Include="Debug\Output.cs" />
46+
<Compile Include="Debugging\Files.cs" />
47+
<Compile Include="Debugging\Output.cs" />
4848
<Compile Include="Item\Permissions.cs" />
4949
<Compile Include="Filter.cs" />
5050
<Compile Include="Global.cs" />
@@ -103,9 +103,9 @@
103103
<Compile Include="Item\Stamp.cs" />
104104
<Compile Include="Item\Name.cs" />
105105
<Compile Include="Item\Disc.cs" />
106-
<Compile Include="Debug\OS.cs" />
107-
<Compile Include="Debug\Admin.cs" />
108-
<Compile Include="Debug\Assembly.cs" />
106+
<Compile Include="Debugging\OS.cs" />
107+
<Compile Include="Debugging\Admin.cs" />
108+
<Compile Include="Debugging\Assembly.cs" />
109109
</ItemGroup>
110110
<ItemGroup>
111111
<Reference Include="System" />

0 commit comments

Comments
 (0)