public void FileDialog() { // file open dialog BrowserProperties properties = new BrowserProperties(); properties.filter = "Text File (*.txt) | *.txt"; properties.filterIndex = 0; new FileBrowser().OpenFileBrowser(properties, path => { SetFilePath(path); }); }
/// <summary> /// FileDialog for saving any file, returns path with extention for further uses /// </summary> public void SaveFileBrowser() { #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = "txt files (*.txt)|*.txt"; bp.filterIndex = 0; new FileBrowser().SaveFileBrowser(bp, "test", ".txt", result => { resultText.text = result; Debug.Log(result); }); #endif }
/// <summary> /// FileDialog for picking a single file /// </summary> public void OpenFileBrowser(string typee) { #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = typee + " files (*." + typee + ")|*." + typee; bp.filterIndex = 0; new FileBrowser().OpenFileBrowser(bp, result => { videoPlayer.url = result; Debug.Log(result); }); #endif }
/// <summary> /// FileDialog for picking a single file /// </summary> public void OpenFileBrowser() { // #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = "txt files (*.txt)|*.txt"; bp.filterIndex = 0; new FileBrowser().OpenFileBrowser(bp, result => { resultText.text = result; Debug.Log(result); }); // #endif }
public string browse_package() { var bp = new BrowserProperties(); bp.filter = "zip files (*.zip)|*.zip"; bp.filterIndex = 0; string path = ""; new FileBrowser().OpenFileBrowser(bp, result => { path = result; }); return(path); }
// reference: https://github.com/SrejonKhan/AnotherFileBrowser Accessed on: 23rd Feb 2021 // FileDialog for picking a single file public string OpenFileBrowser() { var bp = new BrowserProperties(); bp.filter = "png files (*.png)|*.png|jpg files (*.jpg)|*.jpg"; bp.filterIndex = 0; string res = ""; new FileBrowser().OpenFileBrowser(bp, result => { res = result; }); return(res); }
// reference: https://github.com/SrejonKhan/AnotherFileBrowser Accessed on: 23rd Feb 2021 // <summary> /// FileDialog for picking a single file /// </summary> public string OpenFileBrowser(string typee) { #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = typee + " files (*." + typee + ")|*." + typee; bp.filterIndex = 0; string res = ""; new FileBrowser().OpenFileBrowser(bp, result => { res = result; }); return(res); #endif }
/// <summary> /// FileDialog for picking multiple file(s) /// </summary> public void OpenMultiSelectBrowser() { #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = "txt files (*.txt)|*.txt|All Files (*.*)|*.*"; bp.filterIndex = 0; new FileBrowser().OpenMultiSelectFileBrowser(bp, result => { string s = ""; for (int i = 0; i < result.Length; i++) { s += result[i] + "\n"; } resultText.text = s; }); #endif }
public void MusicFileLoad() { #if UNITY_STANDALONE_WIN var bp = new BrowserProperties(); bp.filter = "txt files (*.txt)|*.txt|All Files (*.*)|*.*"; bp.filterIndex = 0; new FileBrowser().OpenMultiSelectFileBrowser(bp, result => { string s = ""; for (int i = 0; i < result.Length; i++) { s += result[i] + "\n"; } musicFilePath = s; StartCoroutine(MusicFileLoader()); }); #endif }
public void SelectAudioFile() { if (fileDropDown.value == 1) { var bp = new BrowserProperties(); bp.title = "Select Audio File (Avoid .MP3 if possible and more than one minute and not too long)"; bp.initialDir = Path.GetDirectoryName(Main.selectedAudioPath); bp.filter = "Supported Audio Files (Avoid .MP3 if possible) (*.wav;*.ogg;*.mp3)|*.wav;*.ogg;*.mp3"; bp.filterIndex = 2; new FileBrowser().OpenFileBrowser(bp, result => { ProgressBar.EnableProgressBarGO(); ProgressBar.IncrementProgressBar(0.1f); Main.selectedAudioPath = result; Main.audioPathInUseForProcessing = result; Main.selectedAudioPathName = Path.GetFileName(result); Main.audioFileChanged = true; Debug.Log(result); }); StartCoroutine(ChangeFileDropDownValue(0)); } else if (fileDropDown.value == 2) { if (Main.selectedAudioPath != Main.defaultAudioPath) { Main.selectedAudioPath = Main.defaultAudioPath; Main.audioPathInUseForProcessing = Main.defaultAudioPath; Main.selectedAudioPathName = Main.defaultAudioPathName; Main.audioFileChanged = true; Main.resetAudioToDefault = true; } StartCoroutine(ChangeFileDropDownValue(0)); } }
public string browse_folder() { var bp = new BrowserProperties(); bp.filter = "txt files (*.txt)|*.txt|All Files (*.*)|*.*"; bp.filterIndex = 0; string selected_path = ""; new FileBrowser().OpenFolderBrowser(bp, path => { selected_path = path; }); if (selected_path == "" || selected_path == null) { warningController.displayErrorMessage("Path not available."); } return(selected_path); }
public override void SampleCall(string[] args) { #region Parse Arguments ArgParser cmdLineParser = new ArgParser(); if (!cmdLineParser.Parse(args)) { // parse failed PrintUsage(INVALID_ARGUMENTS_ERROR); return; } #endregion #region Initialize properties from command line // Initialize the properties. ContextProperties contextProps = new ContextProperties(); SessionProperties sessionProps = SampleUtils.NewSessionPropertiesFromConfig(cmdLineParser.Config); #endregion // Define IContext and ISession. IContext context = null; ISession session = null; IBrowser browser = null; IQueue queue = null; try { InitContext(cmdLineParser.LogLevel); #region Initialize the context, connect the Session, and assert capabilities. Console.WriteLine("About to create the context ..."); context = ContextFactory.Instance.CreateContext(contextProps, null); Console.WriteLine("Context successfully created "); Console.WriteLine("About to create the session ..."); session = context.CreateSession(sessionProps, SampleUtils.HandleMessageEvent, SampleUtils.HandleSessionEvent); Console.WriteLine("Session successfully created."); Console.WriteLine("About to connect the session ..."); if (session.Connect() == ReturnCode.SOLCLIENT_OK) { Console.WriteLine("Session successfully connected"); Console.WriteLine(GetRouterInfo(session)); } // Does the appliance support these capabilities:PUB_GUARANTEED,ENDPOINT_MANAGEMENT,BROWSER? Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.PUB_GUARANTEED)); if (!session.IsCapable(CapabilityType.PUB_GUARANTEED)) { Console.WriteLine("Not Supported\n Exiting"); return; } else { Console.WriteLine("Supported"); } Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.ENDPOINT_MANAGEMENT)); if (!session.IsCapable(CapabilityType.ENDPOINT_MANAGEMENT)) { Console.WriteLine("Not Supported\n Exiting"); return; } else { Console.WriteLine("Supported"); } Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.BROWSER)); if (!session.IsCapable(CapabilityType.BROWSER)) { Console.WriteLine("Not Supported \n Exiting"); return; } else { Console.WriteLine("Supported"); } #endregion #region Provision a new queue endpoint EndpointProperties endpointProps = new EndpointProperties(); // Set permissions to allow all permissions to others. endpointProps.Permission = EndpointProperties.EndpointPermission.Delete; // Set access type to exclusive. endpointProps.AccessType = EndpointProperties.EndpointAccessType.Exclusive; // Set quota to 100 MB. endpointProps.Quota = 100; string queueName = "solclient_dotnet_sample_QueueProvisionAndBrowse_" + (new Random()).Next(1000); queue = ContextFactory.Instance.CreateQueue(queueName); Console.WriteLine(String.Format("About to provision queue '{0}' on the appliance", queueName)); try { session.Provision(queue /* endpoint */, endpointProps /*endpoint properties */, ProvisionFlag.WaitForConfirm /* block waiting for confirmation */, null /*no correlation key*/); Console.WriteLine("Endpoint queue successfully provisioned on the appliance"); } catch (Exception ex) { PrintException(ex); Console.WriteLine("Exiting"); return; } #endregion #region Publishing some messages to this newly provisioned queue IMessage msg = ContextFactory.Instance.CreateMessage(); msg.BinaryAttachment = Encoding.ASCII.GetBytes(SampleUtils.MSG_ATTACHMENTTEXT); msg.DeliveryMode = MessageDeliveryMode.Persistent; msg.Destination = queue; int howManyToPublish = 10; Console.WriteLine(String.Format("About to publish {0} messages", howManyToPublish)); for (int i = 0; i < howManyToPublish; i++) { if (session.Send(msg) == ReturnCode.SOLCLIENT_OK) { Console.Write("."); } Thread.Sleep(100); // wait for 0.5 seconds } Console.WriteLine("\nDone"); #endregion #region Create a Browser to the newly provisioned Queue, and selectively remove the spooled messages. BrowserProperties browserProps = new BrowserProperties(); browser = session.CreateBrowser(queue, browserProps); Console.WriteLine(string.Format("Browsing queue {0} ", queueName)); int count = 0, removedCount = 0; while ((msg = browser.GetNext()) != null) { Console.WriteLine(msg.Dump()); count++; if (count % 3 == 0) { // A message may be removed by calling IBrowser.remove(). // This deletes it from the appliance's message spool. Console.WriteLine("Removing spooled message ({0}).", count); browser.Remove(msg); removedCount++; } } Console.WriteLine(string.Format("Browsed {0} messages, removed {1} ", count, removedCount)); #endregion } catch (Exception ex) { PrintException(ex); Console.WriteLine("Exiting"); } finally { if (browser != null) { browser.Dispose(); } if (session != null) { session.Deprovision(queue, ProvisionFlag.WaitForConfirm, null); session.Dispose(); } if (context != null) { context.Dispose(); } // Must cleanup after. CleanupContext(); } }
public void SaveVisualisation() { if (toggleVideo.isOn) { if (ScreenRecorder.finishedVideoCapture) { if (PathConfig.lastVideoFile != "") { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() { FileName = PathConfig.lastVideoFile, UseShellExecute = true, Verb = "open" }); } } else if (!ScreenRecorder.isVideoCaptureInProcess) // Should not be { var dialogBoxContainer = GameObject.Find("MainCanvas").transform.Find("DialogBoxContainer").gameObject; dialogBoxContainer.SetActive(true); var dialogBoxTrigger = GetComponent <DialogBoxTrigger>(); dialogBoxTrigger.enabled = true; dialogBoxTrigger.ShowWithCallback(selectionResult => { Debug.Log(selectionResult); dialogBoxContainer.SetActive(false); if (selectionResult == 0) // Element number == "OK" { var bp = new BrowserProperties(); bp.title = "Select Save Location"; bp.filter = "MPEG-4 Part 14 (*.mp4)|*.mp4"; bp.filterIndex = 2; new FileBrowser().SaveFileBrowser(bp, getSaveFilename(), "mp4", pathResult => { PathConfig.saveFolder = pathResult; ScreenRecorder.takeVideo = true; StartCoroutine(playAudio()); Debug.Log(pathResult); }); } }); } } else if (togglePicture.isOn) { if (AddImagesToGrid.replacedChildrenWithSingle) { var bp = new BrowserProperties(); bp.title = "Select Save Location"; bp.filter = "Portable Network Graphics (*.png)|*.png"; bp.filterIndex = 2; new FileBrowser().SaveFileBrowser(bp, getSaveFilename(), "png", result => { Texture2D currentPictureTex = (Texture2D)GameObject.Find("SpiralPuzzlePanel").GetComponentInChildren <RawImage>().texture; // pull in our file data bytes for the specified image format (has to be done from main thread) byte[] fileData = currentPictureTex.EncodeToPNG(); // create new thread to save the image to file (only operation that can be done in background) new System.Threading.Thread(() => { var f = System.IO.File.Create(result); f.Write(fileData, 0, fileData.Length); f.Close(); Debug.Log(string.Format("Wrote screenshot {0} of size {1}", result, fileData.Length)); }).Start(); Debug.Log(result); }); } else { // may not be clickable } } }