diff options
Diffstat (limited to 'cs/demo/book/simple_filesystem/Client.cs')
-rwxr-xr-x | cs/demo/book/simple_filesystem/Client.cs | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/cs/demo/book/simple_filesystem/Client.cs b/cs/demo/book/simple_filesystem/Client.cs index d0cd00d3cfb..80b400a65f6 100755 --- a/cs/demo/book/simple_filesystem/Client.cs +++ b/cs/demo/book/simple_filesystem/Client.cs @@ -18,64 +18,64 @@ public class Client static void listRecursive(DirectoryPrx dir, int depth) { - string indent = new string('\t', ++depth); + string indent = new string('\t', ++depth); - NodePrx[] contents = dir.list(); + NodePrx[] contents = dir.list(); - foreach (NodePrx node in contents) { - DirectoryPrx subdir = DirectoryPrxHelper.checkedCast(node); - FilePrx file = FilePrxHelper.uncheckedCast(node); - Console.WriteLine(indent + node.name() + (subdir != null ? " (directory):" : " (file):")); - if (subdir != null) { - listRecursive(subdir, depth); - } else { - string[] text = file.read(); - for (int j = 0; j < text.Length; ++j) - Console.WriteLine(indent + "\t" + text[j]); - } - } + foreach (NodePrx node in contents) { + DirectoryPrx subdir = DirectoryPrxHelper.checkedCast(node); + FilePrx file = FilePrxHelper.uncheckedCast(node); + Console.WriteLine(indent + node.name() + (subdir != null ? " (directory):" : " (file):")); + if (subdir != null) { + listRecursive(subdir, depth); + } else { + string[] text = file.read(); + for (int j = 0; j < text.Length; ++j) + Console.WriteLine(indent + "\t" + text[j]); + } + } } public static void Main(string[] args) { - int status = 0; - Ice.Communicator ic = null; - try { - // Create a communicator - // - ic = Ice.Util.initialize(ref args); + int status = 0; + Ice.Communicator ic = null; + try { + // Create a communicator + // + ic = Ice.Util.initialize(ref args); - // Create a proxy for the root directory - // - Ice.ObjectPrx obj = ic.stringToProxy("RootDir:default -p 10000"); + // Create a proxy for the root directory + // + Ice.ObjectPrx obj = ic.stringToProxy("RootDir:default -p 10000"); - // Down-cast the proxy to a Directory proxy - // - DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(obj); - if (rootDir == null) - throw new ApplicationException("Invalid proxy"); + // Down-cast the proxy to a Directory proxy + // + DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(obj); + if (rootDir == null) + throw new ApplicationException("Invalid proxy"); - // Recursively list the contents of the root directory - // - Console.WriteLine("Contents of root directory:"); - listRecursive(rootDir, 0); - } catch (Exception e) { - Console.Error.WriteLine(e); - status = 1; - } - if (ic != null) { - // Clean up - // - try { - ic.destroy(); - } catch (Exception e) { - Console.Error.WriteLine(e); - status = 1; - } - } - if(status != 0) - { - System.Environment.Exit(status); - } + // Recursively list the contents of the root directory + // + Console.WriteLine("Contents of root directory:"); + listRecursive(rootDir, 0); + } catch (Exception e) { + Console.Error.WriteLine(e); + status = 1; + } + if (ic != null) { + // Clean up + // + try { + ic.destroy(); + } catch (Exception e) { + Console.Error.WriteLine(e); + status = 1; + } + } + if(status != 0) + { + System.Environment.Exit(status); + } } } |