Ejemplo n.º 1
0
        public void SetText(string s)
        {
            if (invalidCharsPath == null)
            {
                invalidCharsPath = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => a != '/' && a != '\\').ToArray();
            }
            if (invalidCharsFileName == null)
            {
                // Remove control characters. This way the user is only notified about characters they can remove.
                invalidCharsFileName = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => !char.IsControl(a)).ToArray();
            }
            if (inputField == null)
            {
                inputField = GetComponent <InputField>();
                inputField.onEndEdit.AddListener(OnSubmit);
            }
            if (fileBrowser == null)
            {
                fileBrowser = GetComponentInParent <SfbWindow>().fileBrowser;
            }

            text            = s;
            inputField.text = s;
            inputField.MoveTextEnd(true);
        }
Ejemplo n.º 2
0
        public bool IsValidInput(string input)
        {
            if (type == SfbInputFieldType.Path)
            {
                return(Regex.Replace(input, "[a-zA-Z]:[/\\\\]", "").IndexOfAny(invalidCharsPath) == -1);
            }

            return(input.IndexOfAny(SfbFileSystem.GetInvalidFileNameChars()) == -1);
        }