コード例 #1
0
ファイル: TestXfer.cs プロジェクト: gongfuPanada/gnome-sharp
        static void Main(string[] args)
        {
            TestXferOptions opt = new TestXferOptions();

            opt.ProcessArgs(args);

            if (opt.RemainingArguments.Length < 2)
            {
                opt.DoUsage();
                return;
            }

            XferOptions       options       = XferOptions.Default;
            XferOverwriteMode overwriteMode = XferOverwriteMode.Query;

            if (opt.recursive)
            {
                Console.WriteLine("Warning: Recursive xfer of directories.");
                options |= XferOptions.Recursive;
            }
            if (opt.followSymlinks)
            {
                Console.WriteLine("Warning: Following symlinks.");
                options |= XferOptions.FollowLinks;
            }
            if (opt.recursiveSymlinks)
            {
                Console.WriteLine("Warning: Following symlinks recursively.");
                options |= XferOptions.FollowLinksRecursive;
            }
            if (opt.replace)
            {
                Console.WriteLine("Warning: Using replace overwrite mode.");
                overwriteMode = XferOverwriteMode.Replace;
            }
            if (opt.deleteSource)
            {
                Console.WriteLine("Warning: Removing source files.");
                options |= XferOptions.Removesource;
            }

            Gnome.Vfs.Vfs.Initialize();

            Gnome.Vfs.Uri source = new Gnome.Vfs.Uri(opt.RemainingArguments[0]);
            Console.WriteLine("Source: `{0}'", source);
            Gnome.Vfs.Uri target = new Gnome.Vfs.Uri(opt.RemainingArguments[1]);
            Console.WriteLine("Target: `{0}'", target);

            Result result = Xfer.XferUri(source, target, options,
                                         XferErrorMode.Query,
                                         overwriteMode,
                                         new XferProgressCallback(OnProgress));

            Console.WriteLine("Result: {0}", Gnome.Vfs.Vfs.ResultToString(result));

            Gnome.Vfs.Vfs.Shutdown();
        }
コード例 #2
0
		static void Main (string[] args)
		{
			TestXferOptions opt = new TestXferOptions ();
			opt.ProcessArgs (args);
			
			if (opt.RemainingArguments.Length < 2) {
				opt.DoUsage ();
				return;
			}
			
			XferOptions options = XferOptions.Default;
			XferOverwriteMode overwriteMode = XferOverwriteMode.Query;
			if (opt.recursive) {
				Console.WriteLine ("Warning: Recursive xfer of directories.");
				options |= XferOptions.Recursive;
			}
			if (opt.followSymlinks) {
				Console.WriteLine ("Warning: Following symlinks.");
				options |= XferOptions.FollowLinks;
			}
			if (opt.recursiveSymlinks) {
				Console.WriteLine ("Warning: Following symlinks recursively.");
				options |= XferOptions.FollowLinksRecursive;
			}
			if (opt.replace) {
				Console.WriteLine ("Warning: Using replace overwrite mode.");
				overwriteMode = XferOverwriteMode.Replace;
			}
			if (opt.deleteSource) {
				Console.WriteLine ("Warning: Removing source files.");
				options |= XferOptions.Removesource;
			}
			
			Gnome.Vfs.Vfs.Initialize ();
			
			Gnome.Vfs.Uri source = new Gnome.Vfs.Uri (opt.RemainingArguments[0]);
			Console.WriteLine ("Source: `{0}'", source);
			Gnome.Vfs.Uri target = new Gnome.Vfs.Uri (opt.RemainingArguments[1]);
			Console.WriteLine ("Target: `{0}'", target);

			Result result = Xfer.XferUri (source, target, options,
						      XferErrorMode.Query,
						      overwriteMode,
						      new XferProgressCallback (OnProgress));
			Console.WriteLine ("Result: {0}", Gnome.Vfs.Vfs.ResultToString (result));
			
			Gnome.Vfs.Vfs.Shutdown ();
		}