Skip to content

Commit

Permalink
-update code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeromusXYZ committed Feb 22, 2022
1 parent f274117 commit 1178983
Show file tree
Hide file tree
Showing 21 changed files with 352 additions and 301 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.VieweD/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.VieweD/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.VieweD/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.VieweD/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Engine/Common/DataLookupList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class DataLookupList

public virtual string GetValue(UInt64 id, string defaultValue = "")
{
if (defaultValue == null)
defaultValue = string.Empty;

var res = GetValue(id);
if (res == "")
{
Expand Down
13 changes: 6 additions & 7 deletions Engine/Common/DataLookups.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ public bool LoadLookups(string engineId, bool initialLoading = true)
AllLoadErrors = string.Empty ;
bool noErrors = true;
var lookupPath = DefaultLookupPath(engineId);
DirectoryInfo DI = new DirectoryInfo(lookupPath);
DirectoryInfo di = new DirectoryInfo(lookupPath);
if (Directory.Exists(lookupPath))
{
foreach (var fi in DI.GetFiles())
foreach (var fi in di.GetFiles())
{
if (!LoadLookupFile(fi.FullName))
noErrors = false;
Expand All @@ -301,15 +301,14 @@ public DataLookupList NLU(string lookupName,string lookupOffsetString = "")
*/
if ((lookupOffsetString != string.Empty) && (lookupName.ToLower() == "@math"))
{
if (lookupOffsetString.IndexOf("?") < 0)
if (!lookupOffsetString.StartsWith("?"))
lookupOffsetString = "? " + lookupOffsetString;
MathList.EvalString = lookupOffsetString;
return MathList;
}
else
{
DataLookupList res;
if (LookupLists.TryGetValue(lookupName, out res))
if (LookupLists.TryGetValue(lookupName, out var res))
return res;
}
return NullList;
Expand Down Expand Up @@ -344,9 +343,9 @@ public void RegisterCustomLookup(string customListName, UInt64 customId, string
return;
if (customListName.StartsWith("§"))
{
if ((customListName == "§playerid") && (GameViewForm.GV != null))
if ((customListName == @"§playerid") && (GameViewForm.GV != null))
{
GameViewForm.GV.gbPlayer.Text = "Player 0x" + customId.ToString("X8");
GameViewForm.GV.gbPlayer.Text = @"Player 0x" + customId.ToString("X8");
GameViewForm.GV.lPlayerName.Text = customValue;
}
return;
Expand Down
15 changes: 6 additions & 9 deletions Engine/Common/EngineBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ public class EngineBase : IComparable<EngineBase>
/// <summary>
/// List of possible Decrypt IDs
/// </summary>
public List<string> DecryptorList { get; } = new List<string>();
public virtual List<string> DecryptorList { get; } = new List<string>();
/// <summary>
/// List of supported file extension that this engine supports (extension, description)
/// </summary>
public Dictionary<string,string> FileExtensions { get; protected set; }
public virtual Dictionary<string,string> FileExtensions { get; protected set; } = new Dictionary<string,string>();

/// <summary>
/// List containing all data types for this engine to insert (old style)
/// </summary>
public List<string> EditorDataTypes { get; protected set; } = new List<string>();
public virtual List<string> EditorDataTypes { get; protected set; } = new List<string>();

/// <summary>
/// List of names of possible tools that need to be added to the menu
/// </summary>
public List<string> ToolNamesList { get; protected set; } = new List<string>();
public virtual List<string> ToolNamesList { get; protected set; } = new List<string>();

/// <summary>
/// Lookup Data for this engine
Expand Down Expand Up @@ -78,7 +78,6 @@ public static string StripSpacer(string s)
public EngineBase()
{
ParentTab = null;
FileExtensions = new Dictionary<string,string>();
}

/// <summary>
Expand All @@ -88,8 +87,6 @@ public EngineBase()
public EngineBase(PacketTabPage parent)
{
ParentTab = parent; // Is set to null in case of registration
FileExtensions = new Dictionary<string, string>();
// FileExtensions.Add(".txt", "Text File");
}

/// <summary>
Expand All @@ -99,7 +96,7 @@ public EngineBase(PacketTabPage parent)
/// <returns></returns>
int IComparable<EngineBase>.CompareTo(EngineBase other)
{
return string.Compare(this.EngineName, other.EngineName);
return string.CompareOrdinal(this.EngineName, other.EngineName);
}

/// <summary>
Expand Down Expand Up @@ -128,7 +125,7 @@ public virtual void GetLoadListBoxFlavor(out string text, ref Color color)
/// </summary>
public virtual void Init()
{
DataLookups.LoadLookups(EngineId, true);
DataLookups.LoadLookups(EngineId);
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Engine/Common/EngineSettingsTab.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Windows.Forms;
using System.Windows.Forms;

namespace VieweD.Engine.Common
{
// ReSharper disable once ClassWithVirtualMembersNeverInherited.Global
public class EngineSettingsTab : TabPage
{
protected GroupBox panel;
Expand All @@ -14,7 +14,7 @@ public EngineSettingsTab(TabControl parent)
panel = new GroupBox();
Controls.Add(panel);
panel.Dock = DockStyle.Fill;
panel.Text = " Plugin Settings ";
panel.Text = @" Plugin Settings ";
}

/// <summary>
Expand Down
Loading

0 comments on commit 1178983

Please sign in to comment.