Ejemplo n.º 1
0
        public virtual void Execute(object sender, SimPe.Events.ResourceEventArgs e)
        {
            SimPe.Interfaces.Files.IPackedFileDescriptor pfd = ExtractFileDescriptor(e);
            SimPe.Interfaces.Files.IPackageFile pkg = ExtractPackage(e);

            if (!IsEnabled(pfd, pkg)) return;

            SimPe.Interfaces.Plugin.IToolResult ires = ShowDialog(ref pfd, ref pkg);

            if (e.Count>0)
            {
                e[0].ChangedFile = ires.ChangedFile;
                e[0].ChangedPackage = ires.ChangedPackage;
            }
        }
Ejemplo n.º 2
0
        SimPe.Interfaces.Plugin.IToolResult ITool.ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package)
        {
            if (!System.IO.Directory.Exists(PathProvider.Global.NeighborhoodFolder))
            {
                System.Windows.Forms.MessageBox.Show("The Folder " + PathProvider.Global.NeighborhoodFolder + " was not found.\n" +
                                                     "Please specify the correct SaveGame Folder in the Options Dialog.");
                return(new ToolResult(false, false));
            }

            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            fbd.Description         = L.Get("ChooseFolder");
            fbd.SelectedPath        = SimPe.PathProvider.SimSavegameFolder;
            fbd.ShowNewFolderButton = true;
            System.Windows.Forms.DialogResult dr = fbd.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return(new ToolResult(false, false));
            }


            NeighborhoodForm nfm = new NeighborhoodForm();

            nfm.LoadNgbh          = false;
            nfm.ShowBackupManager = false;
            nfm.Text = L.Get("nfmTitle");
            SimPe.Interfaces.Plugin.IToolResult ret = nfm.Execute(ref package, null);

            string hood = "";

            if (nfm.DialogResult == System.Windows.Forms.DialogResult.OK && nfm.SelectedNgbh != null)
            {
                hood = Path.GetFileName(Path.GetDirectoryName(nfm.SelectedNgbh));
            }

            try
            {
                SimPe.WaitingScreen.Wait();
                splash = delegate(string message) { SimPe.WaitingScreen.UpdateMessage(message); };
                Rufio(fbd.SelectedPath, hood, 0);
                return(new SimPe.Plugin.ToolResult(false, false));
            }
            finally
            {
                SimPe.WaitingScreen.Stop();
            }
        }