mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Code style fixes. Removal of unused code.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
558897740d
commit
9e8a8a77a5
@ -38,7 +38,7 @@ namespace XenAdmin.Controls.CustomGridView
|
||||
{
|
||||
public class GridRow : IComparable<GridRow>
|
||||
{
|
||||
public Dictionary<string, GridItemBase> Items { get; }= new Dictionary<string, GridItemBase>();
|
||||
public Dictionary<string, GridItemBase> Items { get; } = new Dictionary<string, GridItemBase>();
|
||||
public List<GridRow> Rows { get; } = new List<GridRow>();
|
||||
|
||||
private Image Image => Expanded
|
||||
|
@ -29,10 +29,9 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.XenSearch;
|
||||
using System.Drawing;
|
||||
using XenAPI;
|
||||
using XenCenterLib;
|
||||
|
||||
@ -135,7 +134,7 @@ namespace XenAdmin.Core
|
||||
}
|
||||
|
||||
private static void PopulateMenuWith(ToolStripSplitButton button, LimitedStack<HistoryItem> history,
|
||||
HistoryNavigationDelegate historyNaviagtionDelegate)
|
||||
HistoryNavigationDelegate historyNavigationDelegate)
|
||||
{
|
||||
button.DropDownItems.Clear();
|
||||
|
||||
@ -143,14 +142,13 @@ namespace XenAdmin.Core
|
||||
foreach (HistoryItem item in history)
|
||||
{
|
||||
int j = ++i;
|
||||
ToolStripMenuItem menuItem = new ToolStripMenuItem();
|
||||
menuItem.Text = item.Name.EscapeAmpersands();
|
||||
menuItem.Image = item.Image;
|
||||
menuItem.ImageScaling = ToolStripItemImageScaling.None;
|
||||
menuItem.Click += delegate(Object sender, EventArgs e)
|
||||
var menuItem = new ToolStripMenuItem
|
||||
{
|
||||
historyNaviagtionDelegate(j);
|
||||
Text = item.Name.EscapeAmpersands(),
|
||||
Image = item.Image,
|
||||
ImageScaling = ToolStripItemImageScaling.None
|
||||
};
|
||||
menuItem.Click += (sender, e) => historyNavigationDelegate(j);
|
||||
|
||||
button.DropDownItems.Add(menuItem);
|
||||
}
|
||||
@ -207,13 +205,7 @@ namespace XenAdmin.Core
|
||||
public override string Name => string.Format("{0}, ({1})",
|
||||
o == null ? BrandManager.BrandConsole : Helpers.GetName(o), tab.Text);
|
||||
|
||||
public override Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return o == null ? Images.GetImage16For(Icons.XenCenter) : Images.GetImage16For(o);
|
||||
}
|
||||
}
|
||||
public override Image Image => o == null ? Images.GetImage16For(Icons.XenCenter) : Images.GetImage16For(o);
|
||||
}
|
||||
|
||||
internal class SearchHistoryItem : HistoryItem
|
||||
@ -244,21 +236,9 @@ namespace XenAdmin.Core
|
||||
return search.GetHashCode();
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return search.Name;
|
||||
}
|
||||
}
|
||||
public override string Name => search.Name;
|
||||
|
||||
public override Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return Images.GetImage16For(search);
|
||||
}
|
||||
}
|
||||
public override Image Image => Images.GetImage16For(search);
|
||||
}
|
||||
|
||||
internal class ModifiedSearchHistoryItem : HistoryItem
|
||||
@ -307,12 +287,6 @@ namespace XenAdmin.Core
|
||||
public override string Name => string.Format("{0}, ({1})",
|
||||
o == null ? BrandManager.BrandConsole : Helpers.GetName(o), Program.MainWindow.TabPageSearch.Text);
|
||||
|
||||
public override Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return o == null ? Images.GetImage16For(Icons.XenCenter) : Images.GetImage16For(o);
|
||||
}
|
||||
}
|
||||
public override Image Image => o == null ? Images.GetImage16For(Icons.XenCenter) : Images.GetImage16For(o);
|
||||
}
|
||||
}
|
||||
|
@ -120,34 +120,6 @@ namespace XenAdmin.Core
|
||||
userAgent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// It does exactly what CheckForUpdates(true) does, but this is sync and shows an ActionProgressDialog while running
|
||||
/// </summary>
|
||||
/// <returns>true if the action has succeeded</returns>
|
||||
public static bool CheckForUpdatesSync(Control parentForProgressDialog)
|
||||
{
|
||||
if (Helpers.CommonCriteriaCertificationRelease)
|
||||
return false;
|
||||
|
||||
var action = CreateDownloadUpdatesXmlAction(true, true, true);
|
||||
action.Completed += actionCompleted;
|
||||
|
||||
if (CheckForUpdatesStarted != null)
|
||||
CheckForUpdatesStarted();
|
||||
|
||||
if (parentForProgressDialog != null)
|
||||
{
|
||||
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
|
||||
dialog.ShowDialog(parentForProgressDialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
action.RunSync(action.Session);
|
||||
}
|
||||
|
||||
return action.Succeeded;
|
||||
}
|
||||
|
||||
private static void actionCompleted(ActionBase sender)
|
||||
{
|
||||
Program.AssertOffEventThread();
|
||||
|
@ -128,11 +128,14 @@ namespace XenCenterLib
|
||||
{
|
||||
byte[] saltBytes = GetSalt();
|
||||
|
||||
using (var alg = new AesManaged())
|
||||
using (var alg = new AesManaged
|
||||
{
|
||||
Key = keyBytes,
|
||||
IV = saltBytes,
|
||||
Padding = PaddingMode.PKCS7,//default value
|
||||
Mode = CipherMode.CBC//default value
|
||||
})
|
||||
{
|
||||
alg.Key = keyBytes;
|
||||
alg.IV = saltBytes;
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
using (var cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write))
|
||||
{
|
||||
@ -161,12 +164,14 @@ namespace XenCenterLib
|
||||
|
||||
try
|
||||
{
|
||||
using (var alg = new AesManaged())
|
||||
{
|
||||
alg.IV = saltBytes;
|
||||
alg.Key = ComputeHash(key);
|
||||
using (var alg = new AesManaged
|
||||
{
|
||||
IV = saltBytes,
|
||||
Key = ComputeHash(key),
|
||||
Padding = PaddingMode.PKCS7,//default value
|
||||
Mode = CipherMode.CBC//default value
|
||||
})
|
||||
return DecryptString(cipherBytes, alg);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user