Beispiel #1
0
 public TcpCubeClient(long handle, RCSymbolScalar right)
 {
     object[] parts = right.ToArray();
     for (int i = 1; i < parts.Length; ++i)
     {
         Path.Combine(_path, (string)parts[i]);
     }
     _dir    = new DirectoryInfo(_path);
     _files  = new Dictionary <string, FileStream> ();
     _handle = handle;
 }
Beispiel #2
0
        public static string PathSymbolToString(char separator, RCSymbolScalar symbol)
        {
            object[] parts      = symbol.ToArray();
            string   path       = "";
            string   zero       = parts[0].ToString();
            int      startIndex = 0;

            if (zero == "home")
            {
                string home = Environment.GetEnvironmentVariable("RCL_HOME");
                if (home == null)
                {
                    home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + separator +
                           "dev";
                }
                path += home;
                if (parts.Length > 1)
                {
                    path += separator;
                }
                startIndex = 1;
            }
            else if (zero == "root")
            {
                path      += separator;
                startIndex = 1;
            }
            else if (zero == "work")
            {
                path      += parts.Length == 1 ? "." : "";
                startIndex = 1;
            }
            // Need to handle windows drive letter.
            // There is a function called "GetPathRoot."
            // I think it can be used to obtain the drive letter prefix,
            // but only if you have a path.
            for (int i = startIndex; i < parts.Length; ++i)
            {
                path += parts[i].ToString();
                if (i < parts.Length - 1)
                {
                    path += separator;
                }
            }
            return(path);
        }