Skip to content

Commit d714b68

Browse files
committed
Code cleanup
1 parent 999c563 commit d714b68

1 file changed

Lines changed: 15 additions & 85 deletions

File tree

src/WGet.NET/Components/WinGetPackageManager.cs

Lines changed: 15 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,12 +1397,7 @@ public bool Download(string packageId, string directory)
13971397
_processManager.ExecuteWingetProcess(
13981398
string.Format(_downloadCmd, packageId, directory));
13991399

1400-
if (!result.Success)
1401-
{
1402-
return false;
1403-
}
1404-
1405-
return true;
1400+
return result.Success;
14061401
}
14071402
catch (Win32Exception)
14081403
{
@@ -1524,12 +1519,7 @@ public async Task<bool> DownloadAsync(string packageId, string directory)
15241519
await _processManager.ExecuteWingetProcessAsync(
15251520
string.Format(_downloadCmd, packageId, directory));
15261521

1527-
if (!result.Success)
1528-
{
1529-
return false;
1530-
}
1531-
1532-
return true;
1522+
return result.Success;
15331523
}
15341524
catch (Win32Exception)
15351525
{
@@ -1656,16 +1646,10 @@ public bool PinAdd(string packageId, bool blocking = false)
16561646
cmd += " --blocking";
16571647
}
16581648

1659-
16601649
ProcessResult result =
16611650
_processManager.ExecuteWingetProcess(cmd);
16621651

1663-
if (!result.Success)
1664-
{
1665-
return false;
1666-
}
1667-
1668-
return true;
1652+
return result.Success;
16691653
}
16701654
catch (Win32Exception)
16711655
{
@@ -1711,12 +1695,7 @@ public bool PinAdd(string packageId, string version)
17111695
_processManager.ExecuteWingetProcess(
17121696
string.Format(_pinAddByVersionCmd, packageId, version));
17131697

1714-
if (!result.Success)
1715-
{
1716-
return false;
1717-
}
1718-
1719-
return true;
1698+
return result.Success;
17201699
}
17211700
catch (Win32Exception)
17221701
{
@@ -1825,12 +1804,7 @@ public async Task<bool> PinAddAsync(string packageId, bool blocking = false)
18251804
ProcessResult result =
18261805
await _processManager.ExecuteWingetProcessAsync(cmd);
18271806

1828-
if (!result.Success)
1829-
{
1830-
return false;
1831-
}
1832-
1833-
return true;
1807+
return result.Success;
18341808
}
18351809
catch (Win32Exception)
18361810
{
@@ -1876,12 +1850,7 @@ public async Task<bool> PinAddAsync(string packageId, string version)
18761850
await _processManager.ExecuteWingetProcessAsync(
18771851
string.Format(_pinAddByVersionCmd, packageId, version));
18781852

1879-
if (!result.Success)
1880-
{
1881-
return false;
1882-
}
1883-
1884-
return true;
1853+
return result.Success;
18851854
}
18861855
catch (Win32Exception)
18871856
{
@@ -1990,12 +1959,7 @@ public bool PinAddInstalled(string packageId, bool blocking = false)
19901959
ProcessResult result =
19911960
_processManager.ExecuteWingetProcess(cmd);
19921961

1993-
if (!result.Success)
1994-
{
1995-
return false;
1996-
}
1997-
1998-
return true;
1962+
return result.Success;
19991963
}
20001964
catch (Win32Exception)
20011965
{
@@ -2041,12 +2005,7 @@ public bool PinAddInstalled(string packageId, string version)
20412005
_processManager.ExecuteWingetProcess(
20422006
string.Format(_pinAddInstalledByVersionCmd, packageId, version));
20432007

2044-
if (!result.Success)
2045-
{
2046-
return false;
2047-
}
2048-
2049-
return true;
2008+
return result.Success;
20502009
}
20512010
catch (Win32Exception)
20522011
{
@@ -2155,12 +2114,7 @@ public async Task<bool> PinAddInstalledAsync(string packageId, bool blocking = f
21552114
ProcessResult result =
21562115
await _processManager.ExecuteWingetProcessAsync(cmd);
21572116

2158-
if (!result.Success)
2159-
{
2160-
return false;
2161-
}
2162-
2163-
return true;
2117+
return result.Success;
21642118
}
21652119
catch (Win32Exception)
21662120
{
@@ -2206,12 +2160,7 @@ public async Task<bool> PinAddInstalledAsync(string packageId, string version)
22062160
await _processManager.ExecuteWingetProcessAsync(
22072161
string.Format(_pinAddInstalledByVersionCmd, packageId, version));
22082162

2209-
if (!result.Success)
2210-
{
2211-
return false;
2212-
}
2213-
2214-
return true;
2163+
return result.Success;
22152164
}
22162165
catch (Win32Exception)
22172166
{
@@ -2314,12 +2263,8 @@ public bool PinRemove(string packageId)
23142263
_processManager.ExecuteWingetProcess(
23152264
string.Format(_pinRemoveCmd, packageId));
23162265

2317-
if (!result.Success)
2318-
{
2319-
return false;
2320-
}
23212266

2322-
return true;
2267+
return result.Success;
23232268
}
23242269
catch (Win32Exception)
23252270
{
@@ -2388,12 +2333,7 @@ public async Task<bool> PinRemoveAsync(string packageId)
23882333
await _processManager.ExecuteWingetProcessAsync(
23892334
string.Format(_pinRemoveCmd, packageId));
23902335

2391-
if (!result.Success)
2392-
{
2393-
return false;
2394-
}
2395-
2396-
return true;
2336+
return result.Success;
23972337
}
23982338
catch (Win32Exception)
23992339
{
@@ -2461,13 +2401,8 @@ public bool PinRemoveInstalled(string packageId)
24612401
ProcessResult result =
24622402
_processManager.ExecuteWingetProcess(
24632403
string.Format(_pinRemoveInstalledCmd, packageId));
2464-
2465-
if (!result.Success)
2466-
{
2467-
return false;
2468-
}
2469-
2470-
return true;
2404+
2405+
return result.Success;
24712406
}
24722407
catch (Win32Exception)
24732408
{
@@ -2536,12 +2471,7 @@ public async Task<bool> PinRemoveInstalledAsync(string packageId)
25362471
await _processManager.ExecuteWingetProcessAsync(
25372472
string.Format(_pinRemoveInstalledCmd, packageId));
25382473

2539-
if (!result.Success)
2540-
{
2541-
return false;
2542-
}
2543-
2544-
return true;
2474+
return result.Success;
25452475
}
25462476
catch (Win32Exception)
25472477
{

0 commit comments

Comments
 (0)