Exemplo n.º 1
0
        public override void FinishedLaunching(NSObject notification)
        {
            ///////
            /// Glorified Event "Handler"
            ///  for Menu Items (like File, edit and so forth)
            ///////
            ///

            // *************************** //
            // TODO
            // - Reimplement SaveAs (command-S)

            mainWindowController = new MainWindowController ();
            mainWindowController.Window.MakeKeyAndOrderFront (this);

            MainWindow winMain = mainWindowController.Window;

            /////
            /// SaveAs File Menu Item
            /////
            miSaveAs.Activated += (object sender, EventArgs e) => {
                SharedWindowMethods.SaveCurrentSetFilePanel ();
            };

            /////
            /// Open File Menu Item
            /////
            miOpen.Activated += (object sender, EventArgs e) => {
                // Call for openPanel
                // Credit user: rjm
                // http://forums.xamarin.com/discussion/3876/regression-in-nsopenpanel
                NSOpenPanel openPanel = new NSOpenPanel ();
                openPanel.Begin (((int result) => {
                    try {
                        if (openPanel.Url != null) {
                            // get path
                            var file = openPanel.Url.Path;

                            // open file
                            m_at.OpenFile (System.IO.Path.GetFileName (file), System.IO.Path.GetDirectoryName (file));

                            // parse open file
                            m_at.InitSet ();

                            // init SetRunner
                            m_sr.Init (m_at.GetSetList ());

                            // update table
                            winMain.tbvSetList.DataSource = new TableViewHandler (m_at.GetSetListTable ());

                        }
                    } finally {
                        openPanel.Dispose ();
                    }
                }));

                // refresh window gui
                winMain.updateGUI ();
            };
        }
		partial void SetSyncPath(NSObject sender) {
			bool webSync = false;

			if (!String.IsNullOrEmpty (AppDelegate.settings.webSyncURL) || !String.IsNullOrWhiteSpace (AppDelegate.settings.webSyncURL)) {
				webSync = true;
				NSAlert syncWarning = new NSAlert() {
					MessageText = "Web Sync Found",
					InformativeText = "Setting the File System Sync Path will override the Web Sync Authorization",
					AlertStyle = NSAlertStyle.Informational
				};
				syncWarning.AddButton ("OK");
				syncWarning.BeginSheet (this.Window,this,null,IntPtr.Zero);
			}

            		var openPanel = new NSOpenPanel();
            		openPanel.ReleasedWhenClosed = true;
            		openPanel.CanChooseDirectories = true;
            		openPanel.CanChooseFiles = false;
            		openPanel.CanCreateDirectories = true;
            		openPanel.Prompt = "Select Directory";

            		var result = openPanel.RunModal();
            		if (result == 1) {
                		SyncPathTextField.Cell.Title = openPanel.DirectoryUrl.Path;
				//AppDelegate.FilesystemSyncPath = openPanel.DirectoryUrl.Path;

				AppDelegate.settings.syncURL = openPanel.DirectoryUrl.Path;


                		NSAlert alert = new NSAlert () {
                    			MessageText = "File System Sync",
                    			InformativeText = "File System Sync path has been set at:\n"+AppDelegate.settings.syncURL,
                    			AlertStyle = NSAlertStyle.Warning
                		};
                		alert.AddButton ("OK");
                		alert.BeginSheet (this.Window,
                    			this,
                    			null,
					IntPtr.Zero);

				if (webSync) {
					AppDelegate.settings.webSyncURL = String.Empty;
					AppDelegate.settings.token = String.Empty;
					AppDelegate.settings.secret = String.Empty;
				}

				try {
					if (AppDelegate.settings != null){
						SettingsSync.Write(AppDelegate.settings);
						Console.WriteLine ("WRITTEN PROPERLY");
					}
				} catch (NullReferenceException ex) {
					Console.WriteLine ("ERROR - "+ex.Message);
				}
			}
        	}
		public bool Run (AddFileDialogData data)
		{
			using (var panel = new NSOpenPanel () {
				CanChooseDirectories = false,
				CanChooseFiles = true,
			}) {
				MacSelectFileDialogHandler.SetCommonPanelProperties (data, panel);
				
				var popup = new NSPopUpButton (new RectangleF (0, 0, 200, 28), false);
				var dropdownBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
					{ new MDLabel (GettextCatalog.GetString ("Override build action:")), true },
					{ new MDAlignment (popup, true) { MinWidth = 200 }  }
				};
				
				var filterPopup = MacSelectFileDialogHandler.CreateFileFilterPopup (data, panel);
				if (filterPopup != null) {
					dropdownBox.Layout ();
					var box = new MDBox (LayoutDirection.Vertical, 2, 2) {
						dropdownBox.View,
						filterPopup,
					};
					box.Layout ();
					panel.AccessoryView = box.View;
					box.Layout (box.View.Superview.Frame.Size);
				} else {
					dropdownBox.Layout ();
					panel.AccessoryView = dropdownBox.View;
				}
				
				popup.AddItem (GettextCatalog.GetString ("(Default)"));
				popup.Menu.AddItem (NSMenuItem.SeparatorItem);
				
				foreach (var b in data.BuildActions) {
					if (b == "--")
						popup.Menu.AddItem (NSMenuItem.SeparatorItem);
					else
						popup.AddItem (b);
				}
				
				var action = MacSelectFileDialogHandler.RunPanel (data, panel);
				if (!action) {
					GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
					return false;
				}
				
				data.SelectedFiles = MacSelectFileDialogHandler.GetSelectedFiles (panel);
				
				var idx = popup.IndexOfSelectedItem - 2;
				if (idx >= 0)
					data.OverrideAction = data.BuildActions[idx];
				
				GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
				return true;
			}
		}
Exemplo n.º 4
0
 public OsxFileChooserDialog(string title, bool files)
 {
     var panel = new NSOpenPanel () {
         Title = title,
         CanChooseDirectories = !files,
         CanChooseFiles = files,
         AllowsMultipleSelection = true,
         // Translators: verb
         Prompt = Mono.Unix.Catalog.GetString ("Import")
     };
     open_panel = panel;
 }
Exemplo n.º 5
0
        public override WindowResponse Show()
        {
            WindowResponse resp;
            List<string> filetypes = new List<string>();
            NSUrl initDir = null;
            if (Directory.Exists(InitialDirectory)) initDir = new NSUrl(InitialDirectory);

            switch(DialogType)
            {
                case FileDialogType.OpenFile:
                    ofdlg = new NSOpenPanel();
                    if (initDir != null) ofdlg.DirectoryUrl = initDir;
                    ofdlg.Title = Title;
                    ofdlg.CanChooseFiles = true;
                    ofdlg.CanChooseDirectories = false;
                    ofdlg.AllowsMultipleSelection = false;
                    if(filetypes.Count > 0)
                    {
                        foreach(FileTypeFilter arr in FileTypeFilters) filetypes.AddRange(arr.Filter);
                        ofdlg.AllowedFileTypes = filetypes.ToArray();
                    }

                    resp = CocoaHelper.GetResponse(ofdlg.RunModal());
                    SelectedPath = ofdlg.Url.Path;
                    return resp;

                case FileDialogType.SelectFolder:
                    ofdlg = new NSOpenPanel();
                    if (initDir != null) ofdlg.DirectoryUrl = initDir;
                    ofdlg.Title = Title;
                    ofdlg.CanChooseFiles = false;
                    ofdlg.CanChooseDirectories = true;
                    ofdlg.AllowsMultipleSelection = false;

                    resp = CocoaHelper.GetResponse(ofdlg.RunModal());
                    SelectedPath = ofdlg.Url.Path;
                    return resp;

                case FileDialogType.SaveFile:
                    sfdlg = new NSSavePanel();
                    if (initDir != null) sfdlg.DirectoryUrl = initDir;
                    sfdlg.Title = Title;
                    sfdlg.CanCreateDirectories = true;

                    resp = CocoaHelper.GetResponse(sfdlg.RunModal());
                    SelectedPath = sfdlg.Url.Path;
                    return resp;
            }

            return WindowResponse.None;
        }
		void MediaChooser (object sender, EventArgs e)
		{
			var openPanel = new NSOpenPanel();
			openPanel.ReleasedWhenClosed = true;
			openPanel.Prompt = "Select file";

			var result = openPanel.RunModal();

			if (result == 1)
			{

				NSImage image = new NSImage (openPanel.Url);
				imageView.Image = image;

			}
		}
		public string ChooseFolder(string message)
		{
			var openPanel = new NSOpenPanel
			{
				ReleasedWhenClosed = true,
				Prompt = message,
				CanChooseDirectories = true,
				CanChooseFiles = false
			};

			var result = (NsButtonId)openPanel.RunModal();
			if (result == NsButtonId.OK)
			{
				return openPanel.Url.Path;
			}
			return null;
		}
Exemplo n.º 8
0
        public static string OpenFilePanel()
        {
            // Open file prompt
            // Credit user: rjm
            // http://forums.xamarin.com/discussion/3876/regression-in-nsopenpanel
            NSOpenPanel openPanel = new NSOpenPanel ();
            string s = "";
            openPanel.Begin (((int result) => {
                try {
                    if (openPanel.Url != null)
                        s = openPanel.Url.Path;

                } finally {
                    openPanel.Dispose ();
                }
            }));
            return s;
        }
Exemplo n.º 9
0
		public static void SelectFile(NSWindow window, NSTextField field)
		{
			NSOpenPanel openPanel = new NSOpenPanel ();
			openPanel.BeginSheet (window, (i) => {

				try {
					if (openPanel.Url != null) {
						string path = openPanel.Url.Path;

						if (!string.IsNullOrEmpty (path))
							field.StringValue = path;
					}
				} finally {
					openPanel.Dispose ();
				}


			});

		}
		public bool Run (SelectFileDialogData data)
		{
			NSSavePanel panel = null;
			
			try {
				bool directoryMode = data.Action != Gtk.FileChooserAction.Open;
				
				if (data.Action == Gtk.FileChooserAction.Save) {
					panel = new NSSavePanel ();
				} else {
					panel = new NSOpenPanel () {
						CanChooseDirectories = directoryMode,
						CanChooseFiles = !directoryMode,
					};
				}
				
				SetCommonPanelProperties (data, panel);
				
				if (!directoryMode) {
					var popup = CreateFileFilterPopup (data, panel);
					if (popup != null) {
						panel.AccessoryView = popup;
					}
				}
				
				var action = RunPanel (data, panel);
				
				if (action) {
					data.SelectedFiles = GetSelectedFiles (panel);
					GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
				} else {
					GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
				}
				return action;
			} finally {
				if (panel != null)
					panel.Dispose ();
			}
		}
        public void event_btnFindNfo_Activated(object sender, EventArgs e)
        {
            var openPanel = new NSOpenPanel();
            openPanel.ReleasedWhenClosed = true;
            openPanel.Prompt = "Select file";
            openPanel.AllowedFileTypes = new string[] {"nfo"};
            openPanel.AllowsMultipleSelection = false;
            openPanel.CanChooseDirectories = false;
            openPanel.CanCreateDirectories = false;

            var result = openPanel.RunModal();
            if (result == 1) {
                txtNfoFilename.StringValue = openPanel.Url.Path;
            } else {
                return;
            }
        }
Exemplo n.º 12
0
        public string ChangeSQFolder ()
        {
            string sqFolderPath = RuntimeSettings.DefaultHomePath;

            var openPanel = new NSOpenPanel();
            openPanel.ReleasedWhenClosed = true;
            openPanel.Prompt = "Select folder";
            openPanel.AllowsMultipleSelection = false;
            openPanel.CanCreateDirectories = true;
            openPanel.CanChooseFiles = false;
            openPanel.CanChooseDirectories = true;
            var result = openPanel.RunModal();
            if (result == 1)
            {
                sqFolderPath = Path.Combine(openPanel.Url.Path, GlobalSettings.HomeFolderName) + Path.DirectorySeparatorChar;
            }

            return sqFolderPath;
        }
		public bool Run (OpenFileDialogData data)
		{
			NSSavePanel panel = null;
			
			try {
				bool directoryMode = data.Action != Gtk.FileChooserAction.Open
					&& data.Action != Gtk.FileChooserAction.Save;
				
				if (data.Action == Gtk.FileChooserAction.Save) {
					panel = new NSSavePanel ();
				} else {
					panel = new NSOpenPanel () {
						CanChooseDirectories = directoryMode,
						CanChooseFiles = !directoryMode,
					};
				}
				
				MacSelectFileDialogHandler.SetCommonPanelProperties (data, panel);
				
				SelectEncodingPopUpButton encodingSelector = null;
				NSPopUpButton viewerSelector = null;
				NSButton closeSolutionButton = null;
				
				var box = new MDBox (LayoutDirection.Vertical, 2, 2);
				
				List<FileViewer> currentViewers = null;
				List<MDAlignment> labels = new List<MDAlignment> ();
				
				if (!directoryMode) {
					var filterPopup = MacSelectFileDialogHandler.CreateFileFilterPopup (data, panel);
					
					var filterLabel = new MDAlignment (new MDLabel (GettextCatalog.GetString ("Show files:")), true);
					var filterBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
						{ filterLabel },
						{ new MDAlignment (filterPopup, true) { MinWidth = 200 } }
					};
					labels.Add (filterLabel);
					box.Add (filterBox);
					
					if (data.ShowEncodingSelector) {
						encodingSelector = new SelectEncodingPopUpButton (data.Action != Gtk.FileChooserAction.Save);
						encodingSelector.SelectedEncodingId = data.Encoding;
						
						var encodingLabel = new MDAlignment (new MDLabel (GettextCatalog.GetString ("Encoding:")), true);
						var encodingBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
							{ encodingLabel },
							{ new MDAlignment (encodingSelector, true) { MinWidth = 200 }  }
						};
						labels.Add (encodingLabel);
						box.Add (encodingBox);
					}
					
					if (data.ShowViewerSelector && panel is NSOpenPanel) {
						currentViewers = new List<FileViewer> ();
						viewerSelector = new NSPopUpButton () {
							Enabled = false,
						};
						
						if (encodingSelector != null) {
							viewerSelector.Activated += delegate {
								var idx = viewerSelector.IndexOfSelectedItem;
								encodingSelector.Enabled = ! (idx == 0 && currentViewers[0] == null);
							};
						}
						
						var viewSelLabel = new MDLabel (GettextCatalog.GetString ("Open with:"));
						var viewSelBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
							{ viewSelLabel, true },
							{ new MDAlignment (viewerSelector, true) { MinWidth = 200 }  }
						};
						
						if (IdeApp.Workspace.IsOpen) {
							closeSolutionButton = new NSButton () {
								Title = GettextCatalog.GetString ("Close current workspace"),
								Hidden = true,
								State = NSCellStateValue.On,
							};
							
							closeSolutionButton.SetButtonType (NSButtonType.Switch);
							closeSolutionButton.SizeToFit ();
							
							viewSelBox.Add (closeSolutionButton, true);
						}
						
						box.Add (viewSelBox);
					}
				}
				
				if (labels.Count > 0) {
					float w = labels.Max (l => l.MinWidth);
					foreach (var l in labels) {
						l.MinWidth = w;
						l.XAlign = LayoutAlign.Begin;
					}
				}
				
				if (box.Count > 0) {
					box.Layout ();
					panel.AccessoryView = box.View;
					box.Layout (box.View.Superview.Frame.Size);
				}
				
				panel.SelectionDidChange += delegate(object sender, EventArgs e) {
					var selection = MacSelectFileDialogHandler.GetSelectedFiles (panel);
					bool slnViewerSelected = false;
					if (viewerSelector != null) {
						FillViewers (currentViewers, viewerSelector, selection);
						if (currentViewers.Count == 0 || currentViewers[0] != null) {
							if (closeSolutionButton != null)
								closeSolutionButton.Hidden = true;
							slnViewerSelected = false;
						} else {
							if (closeSolutionButton != null)
								closeSolutionButton.Hidden = false;
							slnViewerSelected = true;
						}
						box.Layout (box.View.Superview.Frame.Size);
					} 
					if (encodingSelector != null)
						encodingSelector.Enabled = !slnViewerSelected;
				};
				
				try {
					var action = MacSelectFileDialogHandler.RunPanel (data, panel);
					if (!action) {
						GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
						return false;
					}
				} catch (Exception ex) {
					System.Console.WriteLine (ex);
					throw;
				}
				
				data.SelectedFiles = MacSelectFileDialogHandler.GetSelectedFiles (panel);
				
				if (encodingSelector != null)
					data.Encoding = encodingSelector.SelectedEncodingId;
				
				if (viewerSelector != null ) {
					if (closeSolutionButton != null)
						data.CloseCurrentWorkspace = closeSolutionButton.State != NSCellStateValue.Off;
					data.SelectedViewer = currentViewers[viewerSelector.IndexOfSelectedItem];
				}
				
				GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
				return true;
			} finally {
				if (panel != null)
					panel.Dispose ();
			}
		}
Exemplo n.º 14
0
		private void uploadButton_Click(object sender, EventArgs args)
		{
			var openPanel = new NSOpenPanel();
			openPanel.ReleasedWhenClosed = true;
			openPanel.Prompt = "Open bar file";
			
			var result = openPanel.RunModal();
			if (result == 1)
			{
				string error = InjectorCore.Upload(openPanel.Url.Path);
				if (error != null) MessageBox(error, "Error");
				else MessageBox("Upload complete, but remember to check log.txt for any upload errors.", "Success");
			}
		}
Exemplo n.º 15
0
		void OpenFile (object sender, EventArgs e)
		{
			var openPanel = new NSOpenPanel ();

			openPanel.ReleasedWhenClosed = true;
			openPanel.Prompt = "Select File ... ";
			openPanel.DirectoryUrl = new NSUrl (TestsDir);
			var result = openPanel.RunModal ();
			if (result == 1) {


				var filename = openPanel.Filename; // will switch to .Url later


				if (Path.GetExtension (filename) == ".cs") {
					var newText = Extensions.ReadFile (filename);
					CSharpFilename.StringValue = Path.GetFileName (filename);
					CSharpTextEditor.Replace (new NSRange (0, CSharpTextEditor.Value.Length), newText);
					ViewModel.SourceCode = newText;
					ThreadPool.QueueUserWorkItem ((h) => {

						ViewModel.RecompileSource ();
					});
				}
				else if ((Path.GetExtension (filename) == ".sln")||(Path.GetExtension (filename) == ".csproj")) 
				{
					var newText = Extensions.ReadFile (filename);
					CSharpFilename.StringValue = Path.GetFileName (filename);
					CSharpTextEditor.Replace (new NSRange (0, CSharpTextEditor.Value.Length), newText);
					ViewModel.SourceCode = newText;
					ThreadPool.QueueUserWorkItem ((h) => {
						ViewModel.RecompileSolution (filename);
					});

//					CompileSolution
				}
				else
					Console.WriteLine("Cannot Load Type " +  Path.GetExtension(filename));
			
			}
		}
Exemplo n.º 16
0
		private void OpenFolder ()
		{
			NSOpenPanel opanel = new NSOpenPanel ();
			opanel.CanChooseDirectories = true;
			opanel.CanChooseFiles = false;

			if (_openFolderPath != null)
				opanel.DirectoryUrl = new NSUrl (_openFolderPath, true);

			if (opanel.RunModal () == (int)NSPanelButtonType.Ok) {
				_openFolderPath = opanel.DirectoryUrl.AbsoluteString;
				OpenPaths(new string[] { opanel.DirectoryUrl.Path });
			}

			UpdateUI();
		}
Exemplo n.º 17
0
        private void HandleOnBrowseCustomDirectoryButtonSelected(SessionsButton button)
        {
            string folderPath = string.Empty;
            using(NSOpenPanel openPanel = new NSOpenPanel())
            {
                openPanel.CanChooseDirectories = true;
                openPanel.CanChooseFiles = false;
                openPanel.ReleasedWhenClosed = true;
                openPanel.AllowsMultipleSelection = false;
                openPanel.Title = "Please select a folder for peak files";
                openPanel.Prompt = "Select folder for peak files"; 

                // Check for cancel
                if(openPanel.RunModal() == 0)
                    return;

                folderPath = openPanel.Url.Path;
            }

            if (!String.IsNullOrEmpty(folderPath))
                txtCustomDirectory.StringValue = folderPath;
        }
Exemplo n.º 18
0
		partial void openSlideshowFolder(MonoMac.Foundation.NSObject sender)
		{
			logger.Info("open slideshow folder");
			var openPanel = new NSOpenPanel
			{
				ReleasedWhenClosed = true,
				Prompt = "Select folder",
				CanChooseDirectories = true,
				CanChooseFiles = false
			};

			var result = (NsButtonId)openPanel.RunModal();
			if (result == NsButtonId.OK)
			{
				Preferences.Instance.SlideshowwPath = openPanel.Url.Path;

				RefreshSlideshows();
				Preferences.Instance.Save();
			}
		}
Exemplo n.º 19
0
		private void selectBarFile_Click(object sender, EventArgs args)
		{
			var openPanel = new NSOpenPanel();
			openPanel.ReleasedWhenClosed = true;
			openPanel.Prompt = "Select bar file";
			
			var result = openPanel.RunModal();
			if (result == 1)
			{
				barFileName.StringValue = openPanel.Url.Path;
				InjectorCore.BarFileName = openPanel.Url.Path;
			}
		}
		partial void SetExportNotesPath (NSButton sender) {
            		var openPanel = new NSOpenPanel();
            		openPanel.ReleasedWhenClosed = true;
            		openPanel.CanChooseDirectories = true;
            		openPanel.CanChooseFiles = false;
            		openPanel.CanCreateDirectories = false;
            		openPanel.Prompt = "Select Existing Notes Directory";

            		var result = openPanel.RunModal();
			if (result == 1) {
                		ExportPathTextField.Cell.Title = openPanel.DirectoryUrl.Path;
            		}

        	}
        public void event_btnParseFullSceneName_Activated(object sender, EventArgs e)
        {
            var openPanel = new NSOpenPanel();
            openPanel.ReleasedWhenClosed = true;
            openPanel.Prompt = "Select file";
            openPanel.AllowedFileTypes = new string[] {"torrent"};
            openPanel.AllowsMultipleSelection = false;
            openPanel.CanChooseDirectories = false;
            openPanel.CanCreateDirectories = false;

            var result = openPanel.RunModal();
            if (result == 1) {
                txtFullSceneName.StringValue = openPanel.Url.Path;
            } else {
                return;
            }

            _releaseInfo = new ReleaseInfo ();

            string fullSceneName = Path.GetFileNameWithoutExtension(txtFullSceneName.StringValue);

            fullSceneName = fullSceneName.Replace ('.', ' ');
            fullSceneName = fullSceneName.Replace ('_', ' ');
            fullSceneName = fullSceneName.Replace ('-', ' ');

            //Multilingual?
            _releaseInfo.releaseIsMultilingual = fullSceneName.IndexOf ("Multilingual") == -1 &&
                fullSceneName.IndexOf ("Bilingual") == -1 ? false : true;
            fullSceneName = fullSceneName.Replace ("Multilingual", "");
            fullSceneName = fullSceneName.Replace ("Bilingual", "");

            //Cracked, regged, retail, etc.
            _releaseInfo.releaseIsCracked = fullSceneName.IndexOf ("Cracked") == -1 ? false : true;
            _releaseInfo.releaseIsRetail = fullSceneName.IndexOf ("Retail") == -1 ? false : true;
            _releaseInfo.releaseIsKeygen = false;
            if (fullSceneName.IndexOf ("Keyfilemaker") != -1 ||
                fullSceneName.IndexOf ("Keygen") != -1 || fullSceneName.IndexOf ("Keymaker") != -1)
                _releaseInfo.releaseIsKeygen = true;

            int whereIsMacosx = fullSceneName.ToUpper().IndexOf ("MACOSX");
            _releaseInfo.releaseName = string.Empty;
            _releaseInfo.releaseVersion = string.Empty;
            bool parsingVersion = false;

            for (int i = 0; i < whereIsMacosx - 1; i++) {
                if (fullSceneName.ToUpper() [i] == 'V' && char.IsNumber(fullSceneName [i + 1]))
                    parsingVersion = true;

                if (parsingVersion) {
                    _releaseInfo.releaseVersion += fullSceneName [i];
                } else {
                    _releaseInfo.releaseName += fullSceneName [i];
                }
            }

            if (string.IsNullOrEmpty (_releaseInfo.releaseVersion))
                _releaseInfo.releaseVersion = "v1.0";

            _releaseInfo.releaseName = _releaseInfo.releaseName.Trim ();
            _releaseInfo.releaseVersion = _releaseInfo.releaseVersion.Substring(1).Trim().Replace(' ','.');

            string[] fullSceneNameArray = fullSceneName.Split (' ');
            _releaseInfo.releaseGroup = fullSceneNameArray [fullSceneNameArray.Length - 1];

            txtSearchTerms.StringValue = _releaseInfo.releaseName;
            lblReleaseName.StringValue = _releaseInfo.releaseName;
            lblReleaseVersion.StringValue = _releaseInfo.releaseVersion;
            lblReleaseGroup.StringValue = _releaseInfo.releaseGroup;
            lblReleaseMulti.StringValue = "Multi: " + _releaseInfo.releaseIsMultilingual.ToString ();
            lblReleaseRegType.StringValue = "Reg. Type: ";
            if (_releaseInfo.releaseIsCracked) lblReleaseRegType.StringValue += "Cracked ";
            if (_releaseInfo.releaseIsRetail) lblReleaseRegType.StringValue += "Retail ";
            if (_releaseInfo.releaseIsKeygen) lblReleaseRegType.StringValue += "Keygen ";

            string crackType = string.Empty;
            if (_releaseInfo.releaseIsCracked)
                crackType = "Crack";
            else if (_releaseInfo.releaseIsKeygen)
                crackType = "Keygen";
            else
                crackType = "Retail";

            txtTitleCode.StringValue = _releaseInfo.releaseName +
                " [Intel:"+ crackType +"] ["+ _releaseInfo.releaseVersion +"]";
        }
		public override void WindowDidLoad ()
		{
			base.WindowDidLoad ();
 			
			textKeytool.StringValue = helper.FindKeytool ();

			buttonKeytool.Activated += (sender, e) => {
				NSOpenPanel panelOpen = new NSOpenPanel();

				var result = panelOpen.RunModal ();

				if (result != 0)
					textKeytool.StringValue = panelOpen.Url.Path.Replace ("keytool", "").TrimEnd ('/');
			};

			buttonOpenKeystore.Activated += (sender, e) => {
				NSOpenPanel panelOpen = new NSOpenPanel();
				panelOpen.Title = "Choose a .keystore file";
				panelOpen.AllowedFileTypes = new string[] { "keystore" };

				var result = panelOpen.RunModal ();

				if (result != 0) {
					textCustomKeystore.StringValue = panelOpen.Url.Path;
				}
			};

			buttonGenerate.Activated += (sender, e) => {

				SignatureInfo sig = null;

				var keytool = helper.FindKeytool ();

				if (string.IsNullOrEmpty (keytool)) {
					ShowAlert ("Unable to locate keytool", "Java Keytool is needed to generate signatures.  We were unable to automatically locate keytool.  Please enter the location manually.");
					return;
				}


				if (radioSource.SelectedRow == 0) {

					try { 
						sig = helper.GetSignaturesFromKeystore ();
					} catch (Exception ex) {
						ShowAlert ("Error Generating Signatures", ex.ToString ());
					}
				
				} else {

					if (!File.Exists (textCustomKeystore.StringValue ?? "")) {
						ShowAlert ("Invalid .Keystore File", "The .keystore file you selected was invalid or not found");
						return;
					}

					var keystore = textCustomKeystore.StringValue;
					var alias = textCustomAlias.StringValue ?? "";
					var storepass = textCustomStorePass.StringValue ?? "";
					var keypass = textCustomKeyPass.StringValue ?? "";

					try {
						sig = helper.GetSignaturesFromKeystore (keytool, keystore, alias, storepass, keypass);
					} catch (Exception ex) {
						ShowAlert ("Error Generating Signatures", ex.ToString ());
					}
				}

				if (sig != null) {
					textMd5.StringValue = sig.MD5;
					textSha1.StringValue = sig.SHA1;
				}
			};

			radioSource.Activated += (sender, e) => {

				var enabled = radioSource.SelectedRow == 1;

				buttonOpenKeystore.Enabled = enabled;
				textCustomAlias.Enabled = enabled;
				textCustomKeyPass.Enabled = enabled;
				textCustomKeystore.Enabled = enabled;
				textCustomStorePass.Enabled = enabled;
			};

			textMd5.Editable = false;
			textSha1.Editable = false;

			buttonCopyMd5.Activated += (sender, e) => {
				NSPasteboard.GeneralPasteboard.SetStringForType (textMd5.StringValue, NSPasteboard.NSStringType);
			};

			buttonCopySha1.Activated += (sender, e) => {
				NSPasteboard.GeneralPasteboard.SetStringForType (textSha1.StringValue, NSPasteboard.NSStringType);
			};
		}
Exemplo n.º 23
0
        private void HandleOnAddFolderButtonSelected(SessionsButton button)
        {
            string folderPath = string.Empty;
            using(NSOpenPanel openPanel = new NSOpenPanel())
            {
                openPanel.CanChooseDirectories = true;
                openPanel.CanChooseFiles = false;
                openPanel.ReleasedWhenClosed = true;
                openPanel.AllowsMultipleSelection = false;
                openPanel.Title = "Please select a folder to add to the library";
                openPanel.Prompt = "Add folder to library"; 

                // Check for cancel
                if(openPanel.RunModal() == 0)
                    return;

                folderPath = openPanel.Url.Path;
            }

            if (!String.IsNullOrEmpty(folderPath))
                OnAddFolder(folderPath, true);
        }
Exemplo n.º 24
0
partial         void readAddresses(NSObject sender)
        {
            MonoMac.AppKit.NSOpenPanel p = new MonoMac.AppKit.NSOpenPanel();
            p.AllowsMultipleSelection = false;
            p.CanChooseDirectories = false;
            p.CanChooseFiles = true;
            int ret = p.RunModal();
            if (ret != 0) //NSFileHandlingPanelOKButton)
            {
                monoOutput.StringValue = (p.Urls[0].Path);
            }
            ReadMonoOutput();
            logButton.Enabled = true;
        }
Exemplo n.º 25
0
		private void OpenFile ()
		{
			NSOpenPanel opanel = new NSOpenPanel ();
			opanel.CanChooseDirectories = false;
			opanel.CanChooseFiles = true;
			//opanel.AllowsMultipleSelection = true;

			if (opanel.RunModal() == (int)NSPanelButtonType.Ok) {
				List<string> paths = new List<string>();
				foreach (var url in opanel.Urls)
					paths.Add(url.Path);
				OpenPaths(paths);
			}

			UpdateUI();
		}
Exemplo n.º 26
0
partial         void readLog(NSObject sender)
        {
            MonoMac.AppKit.NSOpenPanel p = new MonoMac.AppKit.NSOpenPanel();
            p.AllowsMultipleSelection = false;
            p.CanChooseDirectories = false;
            p.CanChooseFiles = true;
            int ret = p.RunModal();
            if (ret != 0) //NSFileHandlingPanelOKButton)
            {
                logNumber.StringValue = (p.Urls[0].Path);
            }

            ProcessLeaksOutput();
        }
Exemplo n.º 27
0
		void RunAllTests_Click (object sender, EventArgs e)
		{
			var openPanel = new NSOpenPanel ();

			openPanel.CanChooseDirectories = true;
			openPanel.CanChooseFiles = false;
			openPanel.ReleasedWhenClosed = true;
			openPanel.Prompt = "Select Folder ... ";
			openPanel.DirectoryUrl = new NSUrl (TestsDir);
			var result = openPanel.RunModal ();
			if (result == 1) {
				var filename = openPanel.Filename; // will switch to .Url later
//				var newText = File.ReadAllText (filename);
//				CSharpFilename.StringValue = Path.GetFileName (filename);
//				CSharpTextEditor.Replace (new NSRange (0, CSharpTextEditor.Value.Length), newText);
//				ViewModel.SourceCode = newText;
//				ViewModel.RecompileSource ();

				Func<string, string> strip = i => Regex.Replace(i??"", "[\r\n \t]+", " ").Trim();

				ViewModel.CompilerErrors = "\r\r" + ("Running all tests in : " + filename) + "\r\r";
				int passCount = 0;
				//			if (ResetStatus != null)
				//				ResetStatus.Stop();
					List<string> failedTestNames = new List<string> ();
				ThreadPool.QueueUserWorkItem((h) =>
					{

					var allTests = Directory.EnumerateFiles(filename).Where(u=> Path.GetExtension(u)==".cs").ToList().CustomSort();
					int noRunTests = 0;
						foreach(var file in allTests)
						{

							var shortName = Path.GetFileName(file);
						Console.WriteLine("-------------------------Running Test: " + shortName+ "-------------------------");
						ViewModel.CompilerErrors += "-------------------------Running Test: " + shortName+ "-------------------------";
						var text = Extensions.ReadFile (file);

						if(text=="-1")
							break;

							InvokeOnMainThread(()=>{
								CSharpFilename.StringValue = Path.GetFileName (file);


								CSharpTextEditor.Value = text;
						
							});

						CSharpOutput ="Z..)";
						CppOutput ="A..)";
						noRunTests++;
//							ViewModel.CompileAndRunCode(shortName,File.ReadAllText(file));
						CompileCSharp(false);
						CompileD();


						if (strip(CSharpOutput) == strip(CppOutput))
						{
								passCount++;
							InvokeOnMainThread(() =>
								{
									//	TestStatus.Content = "PASSED";
									//TestStatus.Background =
									//	new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.GreenYellow.R,
									//		Color.GreenYellow.G, Color.GreenYellow.B));

								ViewModel.CompilerErrors += String.Format("-------------------------Test {0} Passed:-------------------------\n", shortName);
								});
							Console.WriteLine( String.Format("-------------------------Test {0} Passed:-------------------------\n", shortName));

						}
						else
						{
							InvokeOnMainThread(() =>
								{
									//								TestStatus.Content = "FAILED";
									//								TestStatus.Background =
									//									new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.Red.R, Color.Red.G, Color.Red.B));
//										ViewModel.CompilerErrors += String.Format("Test {2} Failed:\n\nCSharp Output:\n{0}\nD Output:\n{1}",
//											CSharpOutput, CppOutput, shortName);
										ViewModel.CompilerErrors += String.Format("Test {0} Failed:\n", shortName);
								Console.WriteLine( String.Format("-------------------------Test {0} Failed:-------------------------\n", shortName));

										failedTestNames.Add(Path.GetFileNameWithoutExtension(shortName));

								});
						}
						//					if (ResetStatus == null)
						//					{
						//						ResetStatus = new Timer(2000);
						//						ResetStatus.AutoReset = false;
						//						ResetStatus.Elapsed += (o, args) => Dispatcher.Invoke(() =>
						//							{
						//								TestStatus.Content = "TEST STATUS";
						//								TestStatus.Background =
						//									new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.White.R, Color.White.G,
						//										Color.White.B));
						//							});
						//					}
						//					ResetStatus.Start();
						}

					ViewModel.CompilerErrors += String.Format("Summary \nTotal:{0} \nPass Rate:{1} \nPassed: {2} \nFailed: {3} {4}\n", noRunTests, (passCount*100)/((float)noRunTests), passCount, noRunTests-passCount, (noRunTests-passCount ==0)?"":failedTestNames.Aggregate((k,j)=>k+" , "+j));

					});
					


			}
		}
Exemplo n.º 28
0
        public void OpenFolder(NSObject sender)
        {
            var openPanel = new NSOpenPanel
            {
                ReleasedWhenClosed = true,
                Prompt = "Select",
                CanChooseDirectories = true,
                CanChooseFiles = false
            };

            var result = (NsButtonId)openPanel.RunModal();
            if (result != NsButtonId.OK)
            {
                return;
            }

            OpenFolderDirectly(openPanel.Url.Path);
        }
Exemplo n.º 29
0
		public bool Run (OpenFileDialogData data)
		{
			NSSavePanel panel = null;
			
			try {
				bool directoryMode = data.Action != Gtk.FileChooserAction.Open
						&& data.Action != Gtk.FileChooserAction.Save;
				
				if (data.Action == Gtk.FileChooserAction.Save) {
					panel = new NSSavePanel ();
				} else {
					panel = new NSOpenPanel () {
						CanChooseDirectories = directoryMode,
						CanChooseFiles = !directoryMode,
					};
				}
				
				MacSelectFileDialogHandler.SetCommonPanelProperties (data, panel);
				
				SelectEncodingPopUpButton encodingSelector = null;
				NSPopUpButton viewerSelector = null;
				NSButton closeSolutionButton = null;
				
				var box = new MDBox (LayoutDirection.Vertical, 2, 2);
				
				List<FileViewer> currentViewers = null;
				List<MDAlignment> labels = new List<MDAlignment> ();
				
				if (!directoryMode) {
					var filterPopup = MacSelectFileDialogHandler.CreateFileFilterPopup (data, panel);

					if (filterPopup != null) {
						var filterLabel = new MDAlignment (new MDLabel (GettextCatalog.GetString ("Show files:")), true);
						var filterBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
							{ filterLabel },
							{ new MDAlignment (filterPopup, true) { MinWidth = 200 } }
						};
						labels.Add (filterLabel);
						box.Add (filterBox);
					}

					if (data.ShowEncodingSelector) {
						encodingSelector = new SelectEncodingPopUpButton (data.Action != Gtk.FileChooserAction.Save);
						encodingSelector.SelectedEncodingId = data.Encoding != null ? data.Encoding.CodePage : 0;
						
						var encodingLabel = new MDAlignment (new MDLabel (GettextCatalog.GetString ("Encoding:")), true);
						var encodingBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
							{ encodingLabel },
							{ new MDAlignment (encodingSelector, true) { MinWidth = 200 }  }
						};
						labels.Add (encodingLabel);
						box.Add (encodingBox);
					}
					
					if (data.ShowViewerSelector && panel is NSOpenPanel) {
						currentViewers = new List<FileViewer> ();
						viewerSelector = new NSPopUpButton () {
							Enabled = false,
						};
						
						if (encodingSelector != null) {
							viewerSelector.Activated += delegate {
								var idx = viewerSelector.IndexOfSelectedItem;
								encodingSelector.Enabled = ! (idx == 0 && currentViewers [0] == null);
							};
						}
						
						var viewSelLabel = new MDLabel (GettextCatalog.GetString ("Open with:"));
						var viewSelBox = new MDBox (LayoutDirection.Horizontal, 2, 0) {
							{ viewSelLabel, true },
							{ new MDAlignment (viewerSelector, true) { MinWidth = 200 }  }
						};
						
						if (IdeApp.Workspace.IsOpen) {
							closeSolutionButton = new NSButton () {
								Title = GettextCatalog.GetString ("Close current workspace"),
								Hidden = true,
								State = NSCellStateValue.On,
							};
							
							closeSolutionButton.SetButtonType (NSButtonType.Switch);
							closeSolutionButton.SizeToFit ();
							
							viewSelBox.Add (closeSolutionButton, true);
						}
						
						box.Add (viewSelBox);
					}
				}
				
				if (labels.Count > 0) {
					float w = labels.Max (l => l.MinWidth);
					foreach (var l in labels) {
						l.MinWidth = w;
						l.XAlign = LayoutAlign.Begin;
					}
				}
				
				if (box.Count > 0) {
					box.Layout ();
					panel.AccessoryView = box.View;
				}
				
				panel.SelectionDidChange += delegate(object sender, EventArgs e) {
					var selection = MacSelectFileDialogHandler.GetSelectedFiles (panel);
					bool slnViewerSelected = false;
					if (viewerSelector != null) {
						FillViewers (currentViewers, viewerSelector, closeSolutionButton, selection);
						if (currentViewers.Count == 0 || currentViewers [0] != null) {
							if (closeSolutionButton != null)
								closeSolutionButton.Hidden = true;
							slnViewerSelected = false;
						} else {
							if (closeSolutionButton != null)
								closeSolutionButton.Hidden = false;
							slnViewerSelected = true;
						}
						box.Layout ();
						
						//re-center the accessory view in its parent, Cocoa does this for us initially and after
						//resizing the window, but we need to do it again after altering its layout
						var superFrame = box.View.Superview.Frame;
						var frame = box.View.Frame;
						//not sure why it's ceiling, but this matches the Cocoa layout
						frame.X = (float)Math.Ceiling ((superFrame.Width - frame.Width) / 2);
						frame.Y = (float)Math.Ceiling ((superFrame.Height - frame.Height) / 2);
						box.View.Frame = frame;
					} 
					if (encodingSelector != null)
						encodingSelector.Enabled = !slnViewerSelected;
				};

				var action = MacSelectFileDialogHandler.RunPanel (data, panel);
				if (!action) {
					GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
					return false;
				}

				data.SelectedFiles = MacSelectFileDialogHandler.GetSelectedFiles (panel);
				
				if (encodingSelector != null)
					data.Encoding = encodingSelector.SelectedEncodingId > 0 ? Encoding.GetEncoding (encodingSelector.SelectedEncodingId) : null;
				
				if (viewerSelector != null ) {
					if (closeSolutionButton != null)
						data.CloseCurrentWorkspace = closeSolutionButton.State != NSCellStateValue.Off;
					data.SelectedViewer = currentViewers[viewerSelector.IndexOfSelectedItem];
				}
				
				GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
			} catch (Exception ex) {
				LoggingService.LogError ("Error in Open File dialog", ex);
				MessageService.ShowException (ex);
			} finally {
				if (panel != null)
					panel.Dispose ();
			}
			return true;
		}
		partial void SetSyncPath(NSObject sender) {
            		var openPanel = new NSOpenPanel();
            		openPanel.ReleasedWhenClosed = true;
            		openPanel.CanChooseDirectories = true;
            		openPanel.CanChooseFiles = false;
            		openPanel.CanCreateDirectories = true;
            		openPanel.Prompt = "Select Directory";

            		var result = openPanel.RunModal();
            		if (result == 1) {
                		SyncPathTextField.Cell.Title = openPanel.DirectoryUrl.Path;
				//AppDelegate.FilesystemSyncPath = openPanel.DirectoryUrl.Path;

				AppDelegate.settings.syncURL = openPanel.DirectoryUrl.Path;
				SettingsSync.Write(AppDelegate.settings);

                		NSAlert alert = new NSAlert () {
                    			MessageText = "File System Sync",
                    			InformativeText = "File System Sync path has been set at:\n"+AppDelegate.settings.syncURL,
                    			AlertStyle = NSAlertStyle.Warning
                		};
                		alert.AddButton ("OK");
                			alert.BeginSheet (this.Window,
                    			this,
                    			null,
                    			IntPtr.Zero);
			}

        	}