Esempio n. 1
0
        static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName));

            MIDIPreRenderAudio.Init();

            var s = new KivaSettings();
            s.InitSoundfontListner();
            if (s.EnableUpdates)
            {
                if (File.Exists(KivaUpdates.DefaultUpdatePackagePath))
                {
                    try
                    {
                        using (var z = File.OpenRead(KivaUpdates.DefaultUpdatePackagePath))
                            using (ZipArchive archive = new ZipArchive(z))
                            { }
                        UpdateReady = true;
                        if (!KivaUpdates.IsAnotherKivaRunning())
                        {
                            if (args.Length == 0)
                            {
                                Process.Start(KivaUpdates.InstallerPath, "update -Reopen");
                            }
                            else
                            {
                                Process.Start(KivaUpdates.InstallerPath, "update -Reopen -ReopenArg \"" + args[0] + "\"");
                            }
                        }
                    }
                    catch (Exception e) { TryDownloadUpdatePackage(s.VersionName); }
                }
                else
                {
                    TryDownloadUpdatePackage(s.VersionName);
                }
            }

            var window = new MainWindow(s);
            if (args.Length != 0)
            {
                window.LoadMidi(args[0]);
            }
            window.ShowDialog();
#if !DEBUG
        }

        catch (Exception e)
        {
            string msg = e.Message + "\n" + e.Data + "\n";
            msg += e.StackTrace;
            MessageBox.Show(msg, "Kiva has crashed!");
        }
#endif
        }
Esempio n. 2
0
 public LoadingMidiForm(string filepath, KivaSettings settings)
 {
     InitializeComponent();
     this.filepath = filepath;
     this.settings = settings;
 }