Beispiel #1
0
        private static IUpdateSource[] GetUpdateSources(string[] sourceArgs)
        {
            if (sourceArgs.Length == 0)
            {
                var updateSources = UpdateSourceManager.GetUpdateSources(_exeDirectory);
                if (updateSources == null || updateSources.Length == 0)
                {
                    MessageBox.Show("No links to update sources have been provided in arguments and the UpdateSources file is missing or has no valid sources.\n\nAdd one or more links to update sources as arguments or edit the UpdateSources file.", "Invalid arguments", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(updateSources);
            }

            var results = new List <IUpdateSource>();

            foreach (var source in sourceArgs)
            {
                try
                {
                    var link = new Uri(source);
                    results.Add(UpdateSourceManager.GetUpdater(link));
                }
                catch (Exception e)
                {
                    MessageBox.Show($"Error opening update source link: {source}\n\n{e}", "Invalid arguments", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Console.WriteLine(e);
                    return(null);
                }
            }
            return(results.ToArray());
        }
Beispiel #2
0
        public MainWindow()
        {
            Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);

            Program.MainSynchronizationContext = SynchronizationContext.Current;

            Instance = this;

            InitializeComponent();

            InstallDirectoryHelper.KoikatuDirectory = GetKoikatuDirectory();

            SetupTabs();

            Task.Run((Action)PopulateStartMenu);

            _updateSources = UpdateSourceManager.GetUpdateSources(Program.ProgramLocation);
            if (_updateSources.Length == 0)
            {
                updateSideloaderModpackToolStripMenuItem.Enabled = false;
            }

#if DEBUG
            var version = Assembly.GetExecutingAssembly().GetName().Version;
#else
            var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
#endif
            Text = $"KK Manager {version} (Fancy updates edition) - {InstallDirectoryHelper.KoikatuDirectory.FullName}";
        }
Beispiel #3
0
        private static UpdateSourceBase[] GetUpdateSources(string[] sourceArgs)
        {
            if (sourceArgs.Length > 0)
            {
                return(UpdateSourceManager.GetUpdateSources(sourceArgs));
            }

            var updateSources = UpdateSourceManager.FindUpdateSources(_exeDirectory);

            if (updateSources == null || updateSources.Length == 0)
            {
                MessageBox.Show("No links to update sources have been provided in arguments and the UpdateSources file is missing or has no valid sources.\n\nAdd one or more links to update sources as arguments or edit the UpdateSources file.", "Invalid arguments", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(updateSources);
        }
Beispiel #4
0
        private static UpdateSourceBase[] GetUpdateSources(string[] sourceArgs)
        {
            if (sourceArgs.Length > 0)
            {
                return(UpdateSourceManager.GetUpdateSources(sourceArgs));
            }

            var updateSources = UpdateSourceManager.FindUpdateSources(_exeDirectory);

            if (updateSources == null || updateSources.Length == 0)
            {
                ShowArgError("No links to update sources have been provided in arguments and the UpdateSources file is missing or has no valid sources.\n\n" +
                             "Add one or more links to update sources as arguments or edit the UpdateSources file.");
            }
            return(updateSources);
        }