Пример #1
0
        public Update(string apiToken)
        {
            if (string.IsNullOrWhiteSpace(apiToken))
            {
                return;
            }

            au = new AutoUpdater(apiToken);
        }
Пример #2
0
        public LauncherWindow()
        {
            InitializeComponent();

            Trace.WriteLine("Initialzing Launch Window.");
            InitTheme();
            Trace.WriteLine("Done: Theme load.");

            //            WelcomeMessage.Text += $" {Config.Instance.PlayerAccount.Username}";
            //            TitleTextBlock.Text +=
            //                $" {Config.LauncherVersion}{(Config.Admins.Any(u => u == Config.Instance.PlayerAccount.Username) ? " 管理" : string.Empty)}";

            try
            {
                var result1 = ServerInfoGetter.GetServerInfoAsync();
                result1.Wait(2000); // 避免由服务器错误引起的无限等待
                if (result1.IsCompleted)
                {
                    Trace.WriteLine("Done: Server info get.");
                    var result = result1.Result;
                    ServerMessage.Text    = $"服务器在线人数 {result.players.online}";
                    ServerMessage.ToolTip = result.players.sample != null?string.Join("\r\n", result.players.sample.Select(p => p.name)) : "现在没有人..点这里来刷新!";
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
            }

#if !DEBUG
            try
            {
                if (AutoUpdater.HasUpdate)
                {
                    var version = AutoUpdater.GetVersion();
                    if (version - Config.LauncherVersion > 10) // 开玩笑
                    {
                        AutoUpdater.Update();
                        return;
                    }
                    MainSnackbar.MessageQueue.Enqueue($"启动器有更新啦! {version}", "立即更新", AutoUpdater.Update);
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
            }
#endif
            Trace.WriteLine("Auto update check done.");

            Task.Run(() =>
            {
                Thread.Sleep(300);
                Dispatcher.Invoke(() =>
                {
                    var doubleAnimation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(1)));
                    MainCard.BeginAnimation(OpacityProperty, doubleAnimation);
                    MainTransitioner.SelectedIndex = 1;
                });
            });

            Trace.WriteLine("Launch Window loaded.");
        }
Пример #3
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //Uncomment below lines to handle parsing logic of non XML AppCast file.

            //AutoUpdater.ParseUpdateInfoEvent += AutoUpdaterOnParseUpdateInfoEvent;
            //AutoUpdater.Start("https://rbsoft.org/updates/AutoUpdaterTest.json");

            //Uncomment below line to run update process using non administrator account.

            //AutoUpdater.RunUpdateAsAdmin = false;

            //Uncomment below line to see russian version

            //Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("ru");

            //If you want to open download page when user click on download button uncomment below line.

            //AutoUpdater.OpenDownloadPage = true;

            //Don't want user to select remind later time in AutoUpdater notification window then uncomment 3 lines below so default remind later time will be set to 2 days.

            //AutoUpdater.LetUserSelectRemindLater = false;
            //AutoUpdater.RemindLaterTimeSpan = RemindLaterFormat.Minutes;
            //AutoUpdater.RemindLaterAt = 1;

            //Don't want to show Skip button then uncomment below line.

            //AutoUpdater.ShowSkipButton = false;

            //Don't want to show Remind Later button then uncomment below line.

            //AutoUpdater.ShowRemindLaterButton = false;

            //Want to show custom application title then uncomment below line.

            //AutoUpdater.AppTitle = "My Custom Application Title";

            //Want to show errors then uncomment below line.

            //AutoUpdater.ReportErrors = true;

            //Want to handle how your application will exit when application finished downloading then uncomment below line.

            AutoUpdater.ApplicationExitEvent += AutoUpdater_ApplicationExitEvent;

            //Want to handle update logic yourself then uncomment below line.

            //AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;

            //Want to use XML and Update file served only through Proxy.

            //var proxy = new WebProxy("localproxyIP:8080", true) {Credentials = new NetworkCredential("domain\\user", "password")};

            //AutoUpdater.Proxy = proxy;

            //Want to check for updates frequently then uncomment following lines.

            //System.Timers.Timer timer = new System.Timers.Timer
            //{
            //    Interval = 2 * 60 * 1000,
            //    SynchronizingObject = this
            //};
            //timer.Elapsed += delegate
            //{
            //    AutoUpdater.Start("https://rbsoft.org/updates/AutoUpdaterTest.xml");
            //};
            //timer.Start();

            //Uncomment following lines to provide basic authentication credetials to use.

            //BasicAuthentication basicAuthentication = new BasicAuthentication("myUserName", "myPassword");
            //AutoUpdater.BasicAuthXML = AutoUpdater.BasicAuthDownload = basicAuthentication;

            //Uncomment following lines to enable forced updates.

            //AutoUpdater.Mandatory = true;
            //AutoUpdater.UpdateMode = Mode.Forced;

            //Want to change update form size then uncomment below line.

            //AutoUpdater.UpdateFormSize = new System.Drawing.Size(800, 600);

            //Uncomment following if you want to update using FTP.
            //AutoUpdater.Start("ftp://rbsoft.org/updates/AutoUpdaterTest.xml", new NetworkCredential("FtpUserName", "FtpPassword"));

            AutoUpdater.Start("https://rbsoft.org/updates/AutoUpdaterTest.xml");
        }
Пример #4
0
 private static void CheckForUpdates()
 {
     AutoUpdater.Start(Resources.UpdatesURL);
 }
Пример #5
0
 private void IUpdateApp_OnClick(object sender, RoutedEventArgs e)
 {
     AutoUpdater.Start("https://raw.githubusercontent.com/Foxlider/Fox-s-Arma-Server-Tool-Extended-Rewrite/master/FASTER_Version.xml");
 }
Пример #6
0
 private void ButtonCheckForUpdate_Click(object sender, EventArgs e)
 {
     AutoUpdater.Mandatory = true;
     AutoUpdater.Start("http://rbsoft.org/updates/AutoUpdaterTest.xml");
 }
Пример #7
0
 private void CheckLauncher()
 {
     AutoUpdater.Start("https://enkdev.xyz/cdn/software/tourlauncher/update.xml");
 }
Пример #8
0
 private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
 {
     AutoUpdater.CheckAtOnce = true;
     AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys1/update.xml");
 }
Пример #9
0
        /// <summary>
        /// Initializes the plugin and loads its assembly but does not start it.
        /// To start the plugin use <see cref="Start"/>
        /// </summary>
        internal void Initialize()
        {
            Bridge.Logger.Info("Loading plugin on path \"{PATH}\"...", Path);
            Server      = new Server(this);
            EntryPoints = new List <EntryPoint>();
            using (Stream stream = File.OpenRead(Path))
            {
                _assembly = _context.LoadFromStream(stream);
            }

            foreach (Type type in _assembly.GetExportedTypes())
            {
                if (PluginType.IsAssignableFrom(type))
                {
                    PluginMeta meta = type.GetCustomAttribute <PluginMeta>();
                    if (meta == null)
                    {
                        ChangePluginState(PluginState.Failed);
                        Bridge.Logger.Fatal(
                            "Onsharp found a plugin class {CLASS} in the plugin on path \"{PATH}\" which does not have a meta descriptor!",
                            type.FullName, Path);
                        return;
                    }

                    if (string.Equals(meta.Id, "native", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Bridge.Logger.Fatal(
                            "Onsharp found a plugin class {CLASS} in the plugin on path \"{PATH}\" which has native as plugin id which is not allowed!",
                            type.FullName, Path);
                        return;
                    }

                    AutoUpdaterAttribute updateAttribute = type.GetCustomAttribute <AutoUpdaterAttribute>();
                    if (updateAttribute != null)
                    {
                        UpdatingData = AutoUpdater.RetrieveData(updateAttribute.Url);
                        if (meta.Version == UpdatingData.Version)
                        {
                            UpdatingData = null;
                        }
                    }

                    Plugin = TryCreatePlugin(type);
                    if (Plugin != null)
                    {
                        Plugin.Meta     = meta;
                        Plugin.FilePath = Path;
                        Plugin.Data     = new DataStorage(Plugin);
                        Plugin.Logger   = new Logger(Plugin.Display, meta.IsDebug);
                        Plugin.State    = PluginState.Unknown;
                        EntryPoints.Add(Plugin);

                        PackageProvider = TryCreatePackageProvider(meta.PackageProvider);
                        if (PackageProvider == null)
                        {
                            continue;
                        }
                        PackageProvider.Author ??= meta.Author;
                        PackageProvider.Version ??= meta.Version;
                        PackageProvider.Name ??= Plugin.Display;
                        PackageProvider.Name = Regex.Replace(PackageProvider.Name, "[^0-9A-Za-z]", "");
                    }
                    else
                    {
                        ChangePluginState(PluginState.Failed);
                        Bridge.Logger.Fatal(
                            "Onsharp tried to instantiate the plugin class {CLASS} in the plugin on path \"{PATH}\" but failed! Does the class have a default constructor?",
                            type.FullName, Path);
                        return;
                    }
                }
                else if (EntryPointType.IsAssignableFrom(type))
                {
                    EntryPoint entryPoint = (EntryPoint)Activator.CreateInstance(type);
                    if (entryPoint == null)
                    {
                        Bridge.Logger.Fatal(
                            "Could not instantiate the entry class {CLASS} in the plugin on path \"{PATH}\"! Does it has a default constructor?",
                            type.FullName, Path);
                        continue;
                    }

                    EntryPoints.Add(entryPoint);
                }
            }

            if (Plugin == null)
            {
                ChangePluginState(PluginState.Failed);
                Bridge.Logger.Fatal(
                    "Could not finish the load process of the plugin on path \"{PATH}\": There is no valid plugin main class!", Path);
                return;
            }

            if (Plugin.Meta.ApiVersion < Bridge.ApiVersion)
            {
                ChangePluginState(PluginState.Failed);
                Bridge.Logger.Fatal(
                    "The plugin failed on the api version check! The plugin {PLUGIN} uses the api v{V1} but your runtime runs with v{VR}, the runtime version is too new!",
                    Plugin.Display, Plugin.Meta.ApiVersion, Bridge.ApiVersion);
                return;
            }

            I18n = Plugin.Meta.I18n == I18n.Mode.Disabled ? null : new I18n(Plugin.Logger, _assembly, Plugin);
            Server.Inject();
            foreach (EntryPoint entryPoint in EntryPoints)
            {
                entryPoint.Server        = Server;
                entryPoint.PluginManager = Bridge.PluginManager;
                entryPoint.I18n          = I18n;
                entryPoint.Runtime       = Bridge.Runtime;
                entryPoint.Runtime.RegisterConsoleCommands(entryPoint, Plugin.Meta.Id);
                entryPoint.Server.RegisterExportable(entryPoint);
                entryPoint.Server.RegisterRemoteEvents(entryPoint);
                entryPoint.Server.RegisterServerEvents(entryPoint);
                entryPoint.Server.RegisterCommands(entryPoint);
            }

            ChangePluginState(PluginState.Loaded);
        }
Пример #10
0
 private void checkForUpdateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AutoUpdater.Mandatory = true;
     AutoUpdater.Start("https://rbsoft.org/updates/AutoUpdaterTest.json");
 }
 private void ButtonCheckForUpdate_Click(object sender, RoutedEventArgs e)
 {
     AutoUpdater.Start("https://raw.githubusercontent.com/asarmiento13315/AutoUpdater.NET/master/UnitTests/DownloadSamples/wpf_lastest.xml");
 }
Пример #12
0
 private void procurarAtualizaçõesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AutoUpdater.Start(AUTOUPDATE_URL);
 }
Пример #13
0
        static void Main(string[] args)
        {
//            Thread.Sleep(10000);
            if (AutoUpdater.SuggestAndUpdate(false))
            {
                return;
            }
            //Thread.Sleep(3000);
            if (args == null || args.Length == 0 || args[0].ToUpper() == "HELP" || args[0] == "?")
            {
                Console.Write(Resources.Help);
                return;
            }

            string     scriptFile = args[0];
            string     dbmlFile   = args.Length > 1 ? args[1] : "";
            ScriptList scripts;

            var ser = new XmlSerializer(typeof(ScriptList));

            if (dbmlFile.ToUpper() == "CSS")
            {
                using (var stream = new FileStream(scriptFile, FileMode.Create, FileAccess.Write))
                {
                    var obj = new ScriptList(new BaseSync[]
                    {
                        new SyncAssociation {
                            AssociationName = "AssociationName"
                        },
                        new SyncColumn {
                            TableName = "TableName"
                        },
                        new SyncTable {
                            TableName = "TableName"
                        },
                    });
                    obj.Version = Version;
                    ser.Serialize(stream, obj);
                }
                return;
            }
            var isSdbml = Path.GetExtension(scriptFile).Equals(".sdbml", StringComparison.OrdinalIgnoreCase);

            if (isSdbml && dbmlFile == "")
            {
                dbmlFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scriptFile), "DB.dbml"));
                if (!File.Exists(dbmlFile))
                {
                    dbmlFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scriptFile), "../DB.dbml"));
                    if (!File.Exists(dbmlFile))
                    {
                        dbmlFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scriptFile), "../../DB.dbml"));
                    }
                }
            }

            if (string.IsNullOrEmpty(dbmlFile))
            {
                dbmlFile = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"
                           + "<Database Class=\"DBDataContext\" xmlns=\"http://schemas.microsoft.com/linqtosql/dbml/2007\"></Database>";
            }

            var doc = XDocument.Load(dbmlFile);

            using (var stream = new FileStream(scriptFile, FileMode.Open, FileAccess.Read))
                scripts = (ScriptList)ser.Deserialize(stream);
            if (scripts.Version != Version)
            {
                Console.WriteLine("Version of file '{0}' not equals version of program '{1}'", scripts.Version, Version);
                return;
            }

            var syncManager = new ScriptManager();

            foreach (var publicSyncFile in Settings.Default.PublicSyncFiles)
            {
                var files = Directory.GetFiles(publicSyncFile, "*.sdbml", SearchOption.AllDirectories);
                syncManager.AddScripts <ScriptList, BaseSync>(files);
            }

            syncManager.MergeScripts <ScriptList, BaseSync>(scripts);

            var ignoreTables     = Settings.Default.IgnoreTables.Cast <string>().ToDictionary(s => s);
            var modifyOnlyTables = Settings.Default.ModifyOnlyTables.Cast <string>().ToDictionary(s => s);

            scripts.IgnoreTables     = ignoreTables;
            scripts.ModifyOnlyTables = modifyOnlyTables;
            foreach (var script in scripts.Scripts.Where(r => !r.SkipExecution))
            {
//                Console.WriteLine("Execute " + script.Command + " from " + script.GetType().FullName);
                if (script.IsChangeTables(ignoreTables))
                {
                    Console.WriteLine("Skip " + script.GetName());
                    continue;
                }
                if (modifyOnlyTables.Count > 0 && !script.IsChangeTables(modifyOnlyTables))
                {
                    Console.WriteLine("Skip " + script.GetName());
                    continue;
                }
                if ((!script.IsExecuted && !script.Execute(doc, scripts)) || (script.IsExecuted && !script.Success && script.MustHave))
                {
                    Console.WriteLine();
                    Console.WriteLine("Failed sync");
                    if (isSdbml)
                    {
                        Console.WriteLine("Do you want to ignore error? Y/N");
                        if (Console.ReadKey().Key == ConsoleKey.Y)
                        {
                            continue;
                        }
                        Console.WriteLine("Execution canceled. Press any key.");
                        Console.ReadKey();
                    }
                    return;
                }
            }
            doc.Save(dbmlFile + ".new");
            File.Replace(dbmlFile + ".new", dbmlFile, dbmlFile + ".bak");
            Console.WriteLine();
            Console.WriteLine("Successful sync");

            var codeFile  = Path.Combine(Path.GetDirectoryName(dbmlFile), "DB.designer.cs");
            var ns        = Path.GetFileName(Path.GetDirectoryName(dbmlFile));
            var arguments = "/namespace:" + ns + " \"/code:" + codeFile + "\" \"" + dbmlFile + "\"";
            var startInfo = new ProcessStartInfo(Settings.Default.SqlMetal, arguments);

            startInfo.RedirectStandardOutput = true;
            startInfo.UseShellExecute        = false;
            var process = Process.Start(startInfo);

            Console.WriteLine(process.StandardOutput.ReadToEnd());
            process.WaitForExit();

            if (isSdbml)
            {
                Console.WriteLine("Press any key");
                Console.Read();
            }
        }
Пример #14
0
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     AutoUpdater.AppCastUrl = "https://gist.githubusercontent.com/Snegovikufa/dbba6461db04bc7eb2c0/raw/605116ba229afd0600ad2e832c2bcecf4ef10d33/appcast.xml";
     AutoUpdater.Start();
 }
Пример #15
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AutoUpdater.Start("https://www.tryallthethings.xyz/downloads/DNS-Swapper.xml");
 }
Пример #16
0
 private void MainForm_GE_Load(object sender, EventArgs e)
 {
     AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys1/update.xml");
     DXSeting.floatToolsLoadSet();
 }
Пример #17
0
 public void Setup()
 {
     updateManager = MockRepository.GenerateStub<IUpdateManager>();
     autoUpdater = new AutoUpdater(updateManager);
 }
Пример #18
0
        private static void AutoUpdater_CheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                if (args.IsUpdateAvailable)
                {
                    DialogResult dialogResult;
                    if (args.Mandatory.Value)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version { args.InstalledVersion }. Do you want to update the application now?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }

                    // Uncomment the following line if you want to show standard update dialog instead.
                    // AutoUpdater.ShowUpdateForm(args);

                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    Debug.WriteLine(@"There is no update available please try again later.", @"No update available",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (args.Error is WebException)
                {
                    Debug.WriteLine(
                        @"There is a problem reaching update server. Please check your internet connection and try again later.",
                        @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    Debug.WriteLine(args.Error.Message,
                                    args.Error.GetType().ToString(), MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Пример #19
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     AutoUpdater.Start("http://80.211.213.82:9595/AutoUpdaterTest.xml");
 }
Пример #20
0
        public MainWindow()
        {
            // Prevent app from being open multiple times
            foreach (var process in Process.GetProcesses())
            {
                if (process.ProcessName == Process.GetCurrentProcess().ProcessName)
                {
                    if (process.Id != Process.GetCurrentProcess().Id)
                    {
                        ShowWindow(process.MainWindowHandle, 5);
                        SwitchToThisWindow(process.MainWindowHandle, true);

                        CloseApp();
                    }
                }
            }

            //if (Process.GetProcesses().Count(p => p.ProcessName == thisprocessname) > 1)
            //    CloseApp();

            while (!CheckForInternetConnection())
            {
                MessageBoxResult result = MessageBox.Show("No connection, do you want to retry?", "CopyShare", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.No)
                {
                    CloseApp();
                }
            }

            InitializeComponent();

            RegisterInStartup();

            progressBar   = progressBar1;
            progressBar_2 = progressBar2;
            progressBar_3 = progressBar3;
            progressBar_4 = progressBar4;

            image1  = imageWindow1;
            image2  = imageWindow2;
            image3  = imageWindow3;
            textBox = textBox1;

            new ClipboardEventsHandler();

            System.Windows.Forms.ContextMenu contextMenu1 = new System.Windows.Forms.ContextMenu();

            contextMenu1.MenuItems.Add("Open CopyShare", new EventHandler(open_App));
            contextMenu1.MenuItems.Add("Exit CopyShare", new EventHandler(close_App));

            ni.Icon         = new System.Drawing.Icon(@"C:\Users\vandi\Dropbox\Projects\CopyShare\CopyShare\Main.ico");
            ni.Visible      = true;
            ni.DoubleClick +=
                delegate(object sender, EventArgs args)
            {
                this.Show();
                this.WindowState = WindowState.Normal;
                this.Activate();
            };
            ni.ContextMenu = contextMenu1;

            //Start external auto updater
            AutoUpdater.Start("https://raw.githubusercontent.com/daniel-vd/CopyShare/master/CopyShareUpdater.xml");

            this.Hide();
        }
Пример #21
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AutoUpdater.Start("https://raw.githubusercontent.com/d1820/cosmos-query-manager/master/version.xml");
 }
Пример #22
0
        private void MetroWindowLoaded(object sender, RoutedEventArgs e)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);

            if (File.Exists(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) + "/log.log"))
            {
                File.Delete(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) + "/log.log");
            }

            if (Settings.AutoClearQueue)
            {
                ReqList.Clear();
                WebHelper.UpdateWebQueue("", "", "", "", "", "1", "c");
            }

            Settings.MsgLoggingEnabled = false;
            // Load Config file if one exists
            if (File.Exists(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) + "/config.xml"))
            {
                ConfigHandler.LoadConfig(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) + "/config.xml");
            }

            // Add sources to combobox
            AddSourcesToSourceBox();

            // Create systray menu and icon and show it
            _menuItem1.Text   = @"Exit";
            _menuItem1.Click += MenuItem1Click;
            _menuItem2.Text   = @"Show";
            _menuItem2.Click += MenuItem2Click;

            _contextMenu.MenuItems.AddRange(new[] { _menuItem2, _menuItem1 });

            NotifyIcon.Icon         = Properties.Resources.songify;
            NotifyIcon.ContextMenu  = _contextMenu;
            NotifyIcon.Visible      = true;
            NotifyIcon.DoubleClick += MenuItem2Click;
            NotifyIcon.Text         = @"Songify";

            // set the current theme
            ThemeHandler.ApplyTheme();

            // start minimized in systray (hide)
            if (Settings.Systray)
            {
                MinimizeToSysTray();
            }

            // get the software version from assembly
            Assembly        assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            Version = fvi.FileVersion;

            // generate UUID if not exists, expand the window and show the telemetrydisclaimer
            if (Settings.Uuid == "")
            {
                Width         = 588 + 200;
                Height        = 247.881 + 200;
                Settings.Uuid = Guid.NewGuid().ToString();

                TelemetryDisclaimer();
            }
            else
            {
                // start the timer that sends telemetry every 5 Minutes
                TelemetryTimer();
            }

            // check for update
            AutoUpdater.Mandatory        = true;
            AutoUpdater.UpdateMode       = Mode.ForcedDownload;
            AutoUpdater.AppTitle         = "Songify";
            AutoUpdater.RunUpdateAsAdmin = false;

            AutoUpdater.Start("https://songify.rocks/update.xml");

            // set the cbx index to the correct source
            cbx_Source.SelectedIndex     = Settings.Source;
            _selectedSource              = cbx_Source.SelectedValue.ToString();
            cbx_Source.SelectionChanged += Cbx_Source_SelectionChanged;

            // text in the bottom right
            LblCopyright.Content =
                "Songify v" + Version.Substring(0, 5) + " Copyright ©";

            if (_selectedSource == PlayerType.SpotifyWeb)
            {
                if (string.IsNullOrEmpty(Settings.AccessToken) && string.IsNullOrEmpty(Settings.RefreshToken))
                {
                    TxtblockLiveoutput.Text = "Please link your Spotify account\nSettings -> Spotify";
                }
                else
                {
                    APIHandler.DoAuthAsync();
                }

                img_cover.Visibility = Visibility.Visible;
            }
            else
            {
                img_cover.Visibility = Visibility.Hidden;
            }

            if (Settings.TwAutoConnect)
            {
                TwitchHandler.BotConnect();
            }

            // automatically start fetching songs
            SetFetchTimer();
        }
Пример #23
0
        private bool InitApplication(string systemLangName)
        {
            try
            {
                // init pipe stream for ipc receiver
                try
                {
                    //TODO (SD-184) rework single instance application IPC
                    // https://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application
                    this.ipcServer = new NamedPipeServerStream(IpcChannelName, PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
                    this.ipcServer.BeginWaitForConnection(new AsyncCallback(IpcProcessConnection), null);
                }
                catch (Exception ex)
                {
                    this.ipcServer = null;
                    log.Error("Could not listen on Ipc Channel: " + ex.Message + " (" + ex.GetType().Name + ")", ex);
                }

                // only the first instance should delete log files
                DeleteOldLogFiles(MaxLogFileRetentionDays);

                if (!NetworkDriveCollection.DrivesConfigured())
                {
                    LoadConfigurationSuffix();
                }

                // initialize licenser silent
                //this.serverAuthorization = new ServerAuthorization(systemLangName);

                // load drives
                try
                {
                    this.driveCollection = new NetworkDriveCollection();
                    this.driveCollection.LoadDrives();
                }
                catch (Exception ex)
                {
                    this.log.Error(ex.GetType().Name + " while loading network drive storage: " + ex.Message, ex);
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        MessageBox.Show(Strings.MessageNetworkDriveStorageCorrupted, Branding.ApplicationName, MessageBoxButton.OK, MessageBoxImage.Error);
                    }));
                }

                // init background manager and start activity for automatic mounting
                this.backgroundManager = new BackgroundDriveManager(this.driveCollection);
                this.backgroundManager.BeginBackgroundActivity();

                // check for updates
                this.updater = new AutoUpdater(this.appOptions);

                this.officeConfiguration = new MicrosoftOfficeConfiguration();

                return(true);
            }
            catch (Exception ex)
            {
                this.log.Error("Unhandled Exception in App.InitApplication: " + ex.Message + " (" + ex.GetType().Name + ")", ex);
                this.Dispatcher.Invoke(new Action(() =>
                {
                    MessageBox.Show(string.Format(Strings.MessageFatalError, ex.GetType().Name, ex.Message, ex.StackTrace), Branding.ApplicationName, MessageBoxButton.OK, MessageBoxImage.Error);
                }));
                return(false);
            }
        }
Пример #24
0
 private void ButtonCheckForUpdate_Click(object sender, RoutedEventArgs e)
 {
     AutoUpdater.Start("http://rbsoft.org/updates/AutoUpdaterTestWPF.xml");
 }
Пример #25
0
 public static void CheckForUpdates()
 {
     AutoUpdater.Start("https://raw.githubusercontent.com/kosace/EnhancePoEApp/master/SetupCRE2/autoupdate.xml");
 }
Пример #26
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    DialogResult dialogResult;
                    if (args.Mandatory)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. This is required update. Press Ok to begin updating the application.",
                                @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. Do you want to update the application now?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }


                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            //You can use Download Update dialog used by AutoUpdater.NET to download the update.

                            if (AutoUpdater.DownloadUpdate())
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"There is no update available. Please try again later.", @"Update Unavailable",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(
                    @"There is a problem reaching update server. Please check your internet connection and try again later.",
                    @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #27
0
 private void IUpdateApp_OnClick(object sender, RoutedEventArgs e)
 {
     AutoUpdater.Start("https://raw.githubusercontent.com/Salluci/Faster-APM-Edit/master/FASTER_Version.xml");
 }
Пример #28
0
        public MainMenu()
        {
            AutoUpdater.Start("https://www.tryallthethings.xyz/downloads/DNS-Swapper.xml");

            InitializeComponent();

            // Upgrade settings file (user.config in %LOCALAPPDATA%\DNS_Swapper from previous version
            Settings.Default.Upgrade();

            // Load network interfaces
            scanNICs();

            // Load previously saved user settings
            NIC_select.SelectedIndex = NIC_select.FindStringExact(Settings.Default.NIC);

            // Remove blank in IP-Address
            string DNS1_var = Settings.Default.DNS_1.Replace(" ", string.Empty);
            string DNS2_var = Settings.Default.DNS_2.Replace(" ", string.Empty);
            // Variables used for validated IP-Addresses
            IPAddress DNS1_IP = new IPAddress(new byte[] { 127, 0, 0, 1 });
            IPAddress DNS2_IP = new IPAddress(new byte[] { 127, 0, 0, 1 });

            if (string.IsNullOrEmpty(DNS1_var) || string.IsNullOrEmpty(DNS2_var))
            {
                // No DNS servers configured
                MessageBox.Show("Tool not configured yet", "DNS-Swapper configuration missing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Show();
                WindowState   = FormWindowState.Normal;
                ShowInTaskbar = true;
            }
            else
            {
                // Validate configuration
                if (IPAddress.TryParse(DNS1_var, out DNS1_IP) && IPAddress.TryParse(DNS2_var, out DNS2_IP))
                {
                    // DNS server IPs valid
                    // Set Loaded variables into settings text boxes
                    DNS_1.Text = DNS1_var;
                    DNS_2.Text = DNS2_var;

                    // Set taskbar icon color
                    if (NIC_select.SelectedItem != null && !string.IsNullOrEmpty(DNS_1.Text) && !string.IsNullOrEmpty(DNS_2.Text))
                    {
                        if (NetworkManagement.getDNS(NIC_select.SelectedItem.ToString()).Equals(DNS1_IP))
                        {
                            taskBarIcon.Icon = Resource1.icon_red;
                            changeToggleBtnPosition(false);
                        }
                        else if (NetworkManagement.getDNS(NIC_select.SelectedItem.ToString()).Equals(DNS2_IP))
                        {
                            taskBarIcon.Icon = Resource1.icon_blue;
                            changeToggleBtnPosition(true);
                        }
                    }
                }
                else
                {
                    // DNS server IP(s) invalid - display error message
                    MessageBox.Show("Invalid configuration detected. Resetting settings to default", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    resetToolStripMenuItem_Click(null, null);
                    saveSettings();
                    Show();
                    WindowState   = FormWindowState.Normal;
                    ShowInTaskbar = true;
                }
            }
        }
Пример #29
0
 private void Update_OnClick(object sender, RoutedEventArgs e) => AutoUpdater.ShowUpdateForm();