Skip to content

Commit

Permalink
Added global Menu.RootMenus to access the root menu of other assemblies
Browse files Browse the repository at this point in the history
+ fixed csproj
  • Loading branch information
h3h3 committed May 29, 2015
1 parent f1b5584 commit 346c3f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions LeagueSharp.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="clipper_library">
<HintPath>..\LeagueSharp\System\clipper_library.dll</HintPath>
<HintPath>C:\Program Files (x86)\LeagueSharp\System\clipper_library.dll</HintPath>
</Reference>
<Reference Include="LeagueSharp">
<HintPath>..\LeagueSharp\System\LeagueSharp.dll</HintPath>
<HintPath>C:\Program Files (x86)\LeagueSharp\System\LeagueSharp.dll</HintPath>
</Reference>
<Reference Include="LeagueSharp.Sandbox">
<HintPath>..\LeagueSharp\System\LeagueSharp.Sandbox.dll</HintPath>
<HintPath>C:\Program Files (x86)\LeagueSharp\System\LeagueSharp.Sandbox.dll</HintPath>
</Reference>
<Reference Include="SharpDX">
<HintPath>..\LeagueSharp\System\SharpDX.dll</HintPath>
<HintPath>C:\Program Files (x86)\LeagueSharp\System\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D9">
<HintPath>..\LeagueSharp\System\SharpDX.Direct3D9.dll</HintPath>
<HintPath>C:\Program Files (x86)\LeagueSharp\System\SharpDX.Direct3D9.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
18 changes: 18 additions & 0 deletions Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ public class Menu
public List<MenuItem> Items = new List<MenuItem>();
public string Name;
public Menu Parent;
public static Dictionary<string, Menu> RootMenus = new Dictionary<string, Menu>();
private string uniqueId;

public Menu(string displayName, string name, bool isRootMenu = false)
Expand All @@ -371,6 +372,23 @@ public Menu(string displayName, string name, bool isRootMenu = false)
Game.OnEnd += delegate { SaveAll(); };
AppDomain.CurrentDomain.DomainUnload += delegate { SaveAll(); };
AppDomain.CurrentDomain.ProcessExit += delegate { SaveAll(); };

var rootName = Assembly.GetCallingAssembly().GetName().Name + "." + name;

if (RootMenus.ContainsKey(rootName))
{
throw new ArgumentException("Root Menu [" + rootName + "] with the same name exists", "name");
}

RootMenus.Add(rootName, this);
}
}

~Menu()
{
if (RootMenus.ContainsKey(Name))
{
RootMenus.Remove(Name);
}
}

Expand Down

0 comments on commit 346c3f9

Please sign in to comment.