Example #1
0
        void ParseTargetDirectory()
        {
            if (TargetDirectory == null)
            {
                hostname = username = directory = null;
                return;
            }
            int indexOfAt    = TargetDirectory.IndexOf('@');
            int indexOfColon = TargetDirectory.IndexOf(':');

            if (indexOfColon < 1)
            {
                LoggingService.LogWarning("Ignoring invalid SSHFS host path \"{0}\" in configuration.", TargetDirectory);
                return;
            }
            if (indexOfAt > 0 && indexOfColon > indexOfAt)
            {
                username = TargetDirectory.Substring(0, indexOfAt);
                hostname = TargetDirectory.Substring(indexOfAt + 1, indexOfColon - indexOfAt - 1);
            }
            else
            {
                hostname = TargetDirectory.Substring(0, indexOfColon);
            }
            directory = TargetDirectory.Substring(indexOfColon + 1);
        }