Exemplo n.º 1
0
        public DGJMain()
        {
            try
            {
                var info = Directory.CreateDirectory(Utilities.BinDirectoryPath);
                info.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
            }
            catch (Exception) { }
            AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;

            PluginName = "点歌姬";
            PluginVer  = BuildInfo.Version;
            PluginDesc = "使用弹幕点播歌曲";
            PluginAuth = "Genteure";
            PluginCont = "*****@*****.**";

            try
            {
                Directory.CreateDirectory(Utilities.DataDirectoryPath);
            }
            catch (Exception) { }
            window         = new DGJWindow(this);
            versionChecker = new VersionChecker("DGJv3");
            SELF           = this;
            Task.Run(() =>
            {
                if (versionChecker.FetchInfo())
                {
                    Version current = new Version(BuildInfo.Version);

                    if (versionChecker.HasNewVersion(current))
                    {
                        Log("插件有新版本" + Environment.NewLine +
                            $"当前版本:{BuildInfo.Version}" + Environment.NewLine +
                            $"最新版本:{versionChecker.Version.ToString()} 更新时间:{versionChecker.UpdateDateTime.ToShortDateString()}" + Environment.NewLine +
                            versionChecker.UpdateDescription);
                    }
                }
                else
                {
                    Log("版本检查出错:" + versionChecker?.LastException?.Message);
                }
            });
            ///base.Start();感觉逻辑上不能因为懒惰急着自动启动
        }