Beispiel #1
0
 void RebuildClicked(object sender, InstActionEventArgs e)
 {
     RebuildMCJar(SelectedInst);
 }
Beispiel #2
0
        void RemoveOpenALClicked(object sender, InstActionEventArgs e)
        {
            DialogResponse reply = MessageDialog.Show(MainWindow,
            "This will delete the OpenAL libraries distributed with minecraft." +
            "It can fix sound issues, but you should have the OpenAL installed in your system first." +
            "Are you sure you want to do this?",
            "Really delete OpenAL libraries?", MessageButtons.YesNo);

            if (reply == DialogResponse.Yes)
            {
                String openal32 = Path.Combine( ".", SelectedInst.MinecraftDir , "bin", "natives", "libopenal.so" );
                String openal64 = Path.Combine( ".", SelectedInst.MinecraftDir , "bin", "natives", "libopenal64.so" );
                openal32 = Path.GetFullPath(openal32);
                openal64 = Path.GetFullPath(openal64);
                System.Console.WriteLine(openal32);
                System.Console.WriteLine(openal64);
                if(File.Exists(openal32))
              	{
                    File.Delete(openal32);
                }
                if(File.Exists(openal64))
                {
                    File.Delete(openal64);
                }
            }
        }
Beispiel #3
0
 void LaunchInstance(object sender, InstActionEventArgs e)
 {
     StartInstance(e.Inst);
 }
Beispiel #4
0
        void ManageSavesClicked(object sender, InstActionEventArgs e)
        {
            ISaveManagerDialog manageSaveDialog = GUIManager.Main.SaveManagerDialog();
            manageSaveDialog.LoadSaveList(e.Inst);
            manageSaveDialog.Parent = MainWindow;
            manageSaveDialog.DefaultPosition = DefWindowPosition.CenterParent;

            manageSaveDialog.BackupSaveClicked += BackupSaveClicked;
            manageSaveDialog.RestoreSaveClicked += RestoreSaveClicked;

            manageSaveDialog.Run();
        }
Beispiel #5
0
        void EditNotesClicked(object sender, InstActionEventArgs e)
        {
            INotesDialog noteDlg = GUIManager.Main.NotesDialog();

            noteDlg.Notes = SelectedInst.Notes;
            noteDlg.ShowInTaskbar = false;

            noteDlg.Response += (o, args) =>
                {
                    if (args.Response == DialogResponse.OK)
                    {
                        SelectedInst.Notes = noteDlg.Notes;
                    }
                    noteDlg.Close();
                };
            noteDlg.Run();
        }
Beispiel #6
0
        void InstCopied(object sender, InstActionEventArgs e)
        {
            StopInstCopy();

            string instName = AskInstName("Copy instance");

            if (string.IsNullOrEmpty(instName))
                return;

            string newInstDir = Instance.GetValidDirName(instName,
                AppSettings.Main.InstanceDir);
            newInstDir = Path.Combine(AppSettings.Main.InstanceDir, newInstDir);

            DirCopyTask copyTask = new DirCopyTask(e.Inst.RootDir, newInstDir);
            StartModalTask(copyTask);

            Instance copiedInst = Instance.LoadInstance(newInstDir);
            copiedInst.Name = instName;
            copiedInst.Dispose();

            MainWindow.LoadInstances();
        }
Beispiel #7
0
        void EditModsClicked(object sender, InstActionEventArgs e)
        {
            IEditModsDialog editModsDlg = GUIManager.Main.EditModsDialog(SelectedInst);

            editModsDlg.LoadModList();
            editModsDlg.ShowInTaskbar = false;

            editModsDlg.Response += (o, args) =>
                {
                    if (args.Response == DialogResponse.OK)
                        editModsDlg.SaveModList();
                    editModsDlg.Close();
                };
            editModsDlg.Parent = MainWindow;
            editModsDlg.DefaultPosition = DefWindowPosition.CenterParent;
            editModsDlg.Run();
        }
Beispiel #8
0
        void DeleteInstClicked(object sender, InstActionEventArgs e)
        {
            IDialog deleteDialog = GUIManager.Main.DeleteDialog();
            deleteDialog.ShowInTaskbar = false;

            deleteDialog.Response += (o, args) =>
                {
                    if (args.Response == DialogResponse.OK)
                    {
                        try
                        {
                            Directory.Delete(SelectedInst.RootDir, true);
                        }
                        catch (IOException)
                        {
                            try
                            {
                                Directory.Delete(SelectedInst.RootDir, true);
                            }
                            catch (UnauthorizedAccessException)
                            {

                            }
                        }
                        catch (UnauthorizedAccessException)
                        {

                        }
                        MainWindow.LoadInstances();
                    }
                    deleteDialog.Close();
                };
            deleteDialog.Parent = MainWindow;
            deleteDialog.DefaultPosition = DefWindowPosition.CenterParent;
            deleteDialog.Run();
        }
Beispiel #9
0
        void ChangeIconClicked(object sender, InstActionEventArgs e)
        {
            IChangeIconDialog changeIconDlg = GUIManager.Main.ChangeIconDialog();

            changeIconDlg.ImageList = this.InstIconList;
            changeIconDlg.ShowInTaskbar = false;

            changeIconDlg.Response += (o, args) =>
                {
                    if (args.Response == DialogResponse.OK)
                    {
                        SelectedInst.IconKey = changeIconDlg.ChosenIconKey;
                    }
                    changeIconDlg.Close();
                };
            changeIconDlg.Parent = MainWindow;
            changeIconDlg.DefaultPosition = DefWindowPosition.CenterParent;
            changeIconDlg.Run();
            MainWindow.LoadInstances();
        }
Beispiel #10
0
 void ViewInstFolderClicked(object sender, InstActionEventArgs e)
 {
     Process.Start(SelectedInst.RootDir);
 }
Beispiel #11
0
        protected virtual void OnInstanceAction(InstAction action, Instance inst = null)
        {
            if (inst == null)
                inst = SelectedInst;

            InstActionEventArgs args = new InstActionEventArgs(inst);
            switch (action)
            {
            case InstAction.ChangeIcon:
                if (ChangeIconClicked != null)
                    ChangeIconClicked(this, args);
                break;

            case InstAction.EditNotes:
                if (EditNotesClicked != null)
                    EditNotesClicked(this, args);
                break;

            case InstAction.EditMods:
                if (EditModsClicked != null)
                    EditModsClicked(this, args);
                break;

            case InstAction.RebuildJar:
                if (RebuildJarClicked != null)
                    RebuildJarClicked(this, args);
                break;

            case InstAction.ViewFolder:
                if (ViewInstFolderClicked != null)
                    ViewInstFolderClicked(this, args);
                break;
            case InstAction.Delete:
                if (DeleteInstClicked != null)
                    DeleteInstClicked(this, args);
                break;
            }
        }