Esempio n. 1
0
 private static void Main()
 {
     try
     {
         var args = Environment.GetCommandLineArgs();
         if (args.Contains("-s"))
         {
             CreateShortcut();
         }
         else if (args.Contains("-l"))
         {
             var cb = Properties.Settings.Default.CurrentBackup;
             var d  = MsnBackup.GetBackups().First(b => Path.GetFileName(b.Directory) == cb).Directory;
             Process.Start(Path.Combine(d, "msnmsgr.exe"));
         }
         else
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             Application.Run(new MainForm());
         }
     }
     catch (Exception ex)
     {
         var result = MessageBox.Show($"{AppName} has crashed because of {ex.Message}. \nWould you like to copy the crash report?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Error);
         if (result == DialogResult.Yes)
         {
             Clipboard.SetText($"{AppName} Crash Report: \n{ex.ToString()}");
             MessageBox.Show("The crash report has been copied. You can sent this report to Craftplacer over the MessengerGeek forum.", AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Esempio n. 2
0
        public static void CreateShortcut()
        {
            string link     = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Windows Live Messenger.lnk");
            var    shortcut = new WshShell().CreateShortcut(link) as IWshShortcut;

            shortcut.TargetPath       = Application.ExecutablePath;
            shortcut.WorkingDirectory = Application.StartupPath;
            shortcut.Arguments        = "-l";
            shortcut.WindowStyle      = (int)WshWindowStyle.WshNormalFocus;

            var cb = Properties.Settings.Default.CurrentBackup;
            var d  = MsnBackup.GetBackups().First(b => Path.GetFileName(b.Directory) == cb).Directory;

            shortcut.IconLocation = Path.GetFullPath(Path.Combine(d, "msnmsgr.exe")) + ",1";
            shortcut.Save();
        }
        public void ListAllVersions()
        {
            VersionPanel.Controls.Clear();
            var backups = MsnBackup.GetBackups();

            if (backups.Count != 0)
            {
                foreach (MsnBackupVersion backup in backups)
                {
                    var button = new Button()
                    {
                        Text = $"   {backup.Title}\n   Build {backup.BuildVersion}",
                        TextImageRelation = TextImageRelation.ImageBeforeText,
                        Dock       = DockStyle.Top,
                        FlatStyle  = FlatStyle.Flat,
                        Tag        = backup,
                        Height     = 48,
                        TextAlign  = ContentAlignment.TopLeft,
                        ImageAlign = ContentAlignment.TopLeft,
                    };
                    button.Image = backup.BuildVersion.Major > 8 ? Properties.Resources.messenger14 : Properties.Resources.messenger8;
                    button.FlatAppearance.BorderSize         = 0;
                    button.FlatAppearance.MouseDownBackColor = Color.Gainsboro;
                    button.FlatAppearance.MouseOverBackColor = Color.WhiteSmoke;
                    button.FlatAppearance.BorderColor        = Color.White;

                    button.Click += (s, e) =>
                    {
                        CurrentBackup = backup;
                        SwitchTab("progress");
                    };
                    VersionPanel.Controls.Add(button);
                }
            }
            else
            {
                var label = new Label()
                {
                    Text      = "You don't have any saved versions.",
                    AutoSize  = false,
                    TextAlign = ContentAlignment.MiddleCenter,
                    ForeColor = SystemColors.GrayText,
                    Dock      = DockStyle.Fill,
                };
                VersionPanel.Controls.Add(label);
            }
        }