Пример #1
0
        public override void RegisterRealTasks(PhysicalServer site)
        {
            var path = _path;

            path = RemotePathHelper.Convert(site, path);
            var task = new GrantReadTask(path, _group, new DotNetPath());

            site.AddTask(task);
        }
Пример #2
0
        public override void RegisterRealTasks(PhysicalServer site)
        {
            string target  = _target;
            string newName = _newName;

            target = RemotePathHelper.Convert(site, target);

            var o = new RenameTask(target, newName, new DotNetPath());

            site.AddTask(o);
        }
Пример #3
0
        public void CopyFileToUncPath()
        {
            var sourceUncPath      = RemotePathHelper.Convert(Environment.MachineName, _path.GetFullPath(_sourceFilePath));
            var destinationUncPath = RemotePathHelper.Convert(Environment.MachineName, _path.GetFullPath(_destinationFolderPath));

            var t = new CopyFileTask(sourceUncPath, destinationUncPath, null, new DotNetPath());

            t.Execute();

            string s = File.ReadAllText(_path.Combine(destinationUncPath, "test.txt"));

            Assert.AreEqual("the test\r\n", s);
        }
Пример #4
0
        public CopyRemoteOut(PhysicalServer server)
        {
            _server = server;

            //copy remote out
            //TODO: make this path configurable
            var remotePath = RemotePathHelper.Convert(server, @"C:\Temp\dropkick.remote");

            if (!Directory.Exists(remotePath))
            {
                Directory.CreateDirectory(remotePath);
            }
            _path = remotePath;

            var ewd   = Assembly.GetExecutingAssembly().Location;
            var local = Path.GetDirectoryName(ewd);

            if (local == null)
            {
                throw new Exception("shouldn't be null");
            }

            var filesToCopy = new[] { "dropkick.remote.exe", "dropkick.dll", "log4net.dll", "Magnum.dll" };

            foreach (var file in filesToCopy)
            {
                var dest = Path.Combine(remotePath, file);
                var src  = Path.Combine(local, file);
                _fineLog.DebugFormat("[msmq][remote] '{0}'->'{1}'", src, dest);

                try
                {
                    if (!File.Exists(dest))
                    {
                        File.Copy(src, dest, true);
                    }
                }
                catch (IOException ex)
                {
                    _fineLog.DebugFormat("[msmq][remote][file] Error copying '{0}' to '{1}'", file, remotePath);
                    throw;
                }
            }
        }
Пример #5
0
        public void TildaUncPath()
        {
            var path = RemotePathHelper.Convert("SrvTopeka02", @"~\bob\bill");

            Assert.AreEqual(@"\\SrvTopeka02\bob\bill", path);
        }
Пример #6
0
        public void Bob()
        {
            var path = RemotePathHelper.Convert("SrvTopeka02", @"E:\bob\bill");

            Assert.AreEqual(@"\\SrvTopeka02\E$\bob\bill", path);
        }
Пример #7
0
 public string MapPath(string path)
 {
     return(RemotePathHelper.Convert(this, path));
 }