예제 #1
0
        /// <summary>
        /// Displays a dialog allowing the user to sign a set of <see cref="Feed"/>s.
        /// </summary>
        /// <param name="files">The <see cref="Feed"/> files to be signed.</param>
        public static void Show([NotNull, ItemNotNull] IEnumerable<FileInfo> files)
        {
            #region Sanity checks
            if (files == null) throw new ArgumentNullException("files");
            #endregion

            using (var dialog = new MassSignForm(files))
                dialog.ShowDialog();
        }
예제 #2
0
        /// <summary>
        /// Displays a dialog allowing the user to sign a set of <see cref="Feed"/>s.
        /// </summary>
        /// <param name="files">The <see cref="Feed"/> files to be signed.</param>
        public static void Show(IEnumerable <FileInfo> files)
        {
            #region Sanity checks
            if (files == null)
            {
                throw new ArgumentNullException(nameof(files));
            }
            #endregion

            using var dialog = new MassSignForm(files);
            dialog.ShowDialog();
        }
예제 #3
0
        /// <summary>
        /// Displays a dialog allowing the user to sign a set of <see cref="Feed"/>s.
        /// </summary>
        /// <param name="files">The <see cref="Feed"/> files to be signed.</param>
        public static void Show([NotNull, ItemNotNull] IEnumerable <FileInfo> files)
        {
            #region Sanity checks
            if (files == null)
            {
                throw new ArgumentNullException("files");
            }
            #endregion

            using (var dialog = new MassSignForm(files))
                dialog.ShowDialog();
        }
예제 #4
0
        [STAThread] // Required for WinForms
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ErrorReportForm.SetupMonitoring(new Uri("https://0install.de/error-report/"));
            NetUtils.ApplyProxy();

            var openPgp = OpenPgpFactory.CreateDefault();

            if (args == null || args.Length == 0)
            {
                Application.Run(new WelcomeForm(openPgp));
            }
            else
            {
                try
                {
                    var files = ArgumentUtils.GetFiles(args, "*.xml");
                    if (files.Count == 1)
                    {
                        string path = files.First().FullName;
                        Application.Run(new MainForm(FeedEditing.Load(path), openPgp));
                    }
                    else
                    {
                        MassSignForm.Show(files);
                    }
                }
                #region Error handling
                catch (ArgumentException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (IOException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (UnauthorizedAccessException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (InvalidDataException ex)
                {
                    Msg.Inform(null, ex.Message + (ex.InnerException == null ? "" : Environment.NewLine + ex.InnerException.Message), MsgSeverity.Warn);
                }
                #endregion
            }
        }
예제 #5
0
        [STAThread] // Required for WinForms
        private static void Main(string[] args)
        {
            ProcessUtils.SanitizeEnvironmentVariables();
            NetUtils.ApplyProxy();

            WindowsUtils.SetCurrentProcessAppID("ZeroInstall.Publishing");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ErrorReportForm.SetupMonitoring(new Uri("https://0install.de/error-report/"));

            var openPgp = OpenPgp.Signing();

            if (args.Length == 0)
            {
                Application.Run(new WelcomeForm(openPgp));
            }
            else
            {
                try
                {
                    var files = Paths.ResolveFiles(args, "*.xml");
                    if (files.Count == 1)
                    {
                        string path = files.First().FullName;
                        Application.Run(new MainForm(FeedEditing.Load(path), openPgp));
                    }
                    else
                    {
                        MassSignForm.Show(files);
                    }
                }
                #region Error handling
                catch (Exception ex) when(ex is ArgumentException or IOException or InvalidDataException)
                {
                    Msg.Inform(null, ex.GetMessageWithInner(), MsgSeverity.Warn);
                }
                catch (Exception ex) when(ex is UnauthorizedAccessException)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Error);
                }
                #endregion
            }
        }