This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Bililive/dev
Release 3.0.1
- Loading branch information
Showing
16 changed files
with
360 additions
and
257 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,25 @@ namespace DGJv3 | |
{ | ||
public class DGJMain : DMPlugin | ||
{ | ||
private DGJWindow window; | ||
private readonly DGJWindow window; | ||
|
||
private VersionChecker versionChecker; | ||
|
||
public DGJMain() | ||
{ | ||
try | ||
{ | ||
var info = Directory.CreateDirectory(Utilities.BinDirectoryPath); | ||
info.Attributes = FileAttributes.Directory | FileAttributes.Hidden; | ||
} | ||
catch (Exception) { } | ||
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly; | ||
|
||
this.PluginName = "点歌姬"; | ||
this.PluginVer = BuildInfo.Version; | ||
this.PluginDesc = "使用弹幕点播歌曲"; | ||
this.PluginAuth = "Genteure"; | ||
this.PluginCont = "[email protected]"; | ||
PluginName = "点歌姬"; | ||
PluginVer = BuildInfo.Version; | ||
PluginDesc = "使用弹幕点播歌曲"; | ||
PluginAuth = "Genteure"; | ||
PluginCont = "[email protected]"; | ||
|
||
try | ||
{ | ||
|
@@ -59,23 +65,31 @@ public override void Admin() | |
|
||
public override void DeInit() => window.DeInit(); | ||
|
||
|
||
private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args) | ||
{ | ||
Assembly executingAssembly = Assembly.GetExecutingAssembly(); | ||
AssemblyName assemblyName = new AssemblyName(args.Name); | ||
|
||
var path = assemblyName.Name + ".dll"; | ||
if (assemblyName.CultureInfo?.Equals(CultureInfo.InvariantCulture) == false) path = String.Format(@"{0}\{1}", assemblyName.CultureInfo, path); | ||
string filepath = Path.Combine(Utilities.BinDirectoryPath, path); | ||
|
||
if (assemblyName.CultureInfo?.Equals(CultureInfo.InvariantCulture) == false) | ||
{ path = string.Format(@"{0}\{1}", assemblyName.CultureInfo, path); } | ||
|
||
using (Stream stream = executingAssembly.GetManifestResourceStream(path)) | ||
{ | ||
if (stream == null) return null; | ||
if (stream == null) { return null; } | ||
|
||
var assemblyRawBytes = new byte[stream.Length]; | ||
stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length); | ||
return Assembly.Load(assemblyRawBytes); | ||
try | ||
{ | ||
File.WriteAllBytes(filepath, assemblyRawBytes); | ||
} | ||
catch (Exception) { } | ||
} | ||
|
||
return Assembly.LoadFrom(filepath); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.