Ejemplo n.º 1
0
        public override void RegisterRealTasks(PhysicalServer site)
        {
            var path = PathConverter.Convert(site, _path);

            var task = new ClearAclsTask(path, _groupsToPreserve, _groupsToRemove);

            site.AddTask(task);
        }
        public override void RegisterRealTasks(PhysicalServer site)
        {
            var path = PathConverter.Convert(site, _path);

            var task = new RemoveAclsInheritanceTask(path);

            site.AddTask(task);
        }
Ejemplo n.º 3
0
        public override void RegisterRealTasks(PhysicalServer site)
        {
            var path = PathConverter.Convert(site, _path);
            //path = RemotePathHelper.Convert(site, path);

            var task = new GrantReadWriteTask(path, _group, new DotNetPath());

            site.AddTask(task);
        }
Ejemplo n.º 4
0
        public override void RegisterRealTasks(PhysicalServer site)
        {
            string target  = PathConverter.Convert(site, _target);
            string newName = PathConverter.Convert(site, _newName);

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

            site.AddTask(o);
        }
Ejemplo n.º 5
0
        public void CopyFileToUncPath()
        {
            var sourceUncPath      = PathConverter.Convert(Environment.MachineName, _path.GetFullPath(_sourceFilePath));
            var destinationUncPath = PathConverter.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);
        }
Ejemplo n.º 6
0
 public IEnumerable <Expression> ConvertTokensToExpressions(IEnumerable <object> tokens)
 {
     tokens = CommentAndLayoutConverter.Convert(tokens);
     tokens = LiteralConverter.Convert(tokens);
     tokens = HelperConverter.Convert(tokens, _configuration);
     tokens = HashParametersConverter.Convert(tokens);
     tokens = PathConverter.Convert(tokens);
     tokens = SubExpressionConverter.Convert(tokens);
     tokens = PartialConverter.Convert(tokens);
     tokens = HelperArgumentAccumulator.Accumulate(tokens);
     tokens = ExpressionScopeConverter.Convert(tokens);
     tokens = WhitespaceRemover.Remove(tokens);
     tokens = StaticConverter.Convert(tokens);
     tokens = BlockAccumulator.Accumulate(tokens, _configuration);
     return(tokens.Cast <Expression>());
 }
Ejemplo n.º 7
0
        //Reference http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2062983
        //Reference http://stackoverflow.com/questions/425688/how-to-set-read-permission-on-the-private-key-file-of-x-509-certificate-from-net
        protected static void AddAccessToPrivateKey(X509Certificate2 cert, string group, FileSystemRights rights, StoreLocation storeLocation, Path dotNetPath, PhysicalServer server, DeploymentResult result)
        {
            var rsa = cert.PrivateKey as RSACryptoServiceProvider;

            if (rsa == null)
            {
                result.AddError("Certificate does not contain a private key that is accessible");
                return;
            }

            var keyfilepath = FindKeyLocation(storeLocation, dotNetPath);

            var file = dotNetPath.Combine(keyfilepath, rsa.CspKeyContainerInfo.UniqueKeyContainerName);

            file = PathConverter.Convert(server, file);

            dotNetPath.SetFileSystemRights(file, group, rights, result);
            //var account = new NTAccount(group);
            //var fs = file.GetAccessControl();
            //fs.AddAccessRule(new FileSystemAccessRule(account, rights, AccessControlType.Allow));

            //file.SetAccessControl(fs);
        }
        private void ReadSingleLib(Statements statements, string currentDirectoryPath, Control lib)
        {
            // get full path of .lib
            string libPath        = PathConverter.Convert(lib.Parameters.Get(0).Image);
            bool   isAbsolutePath = Path.IsPathRooted(libPath);
            string libFullPath    = isAbsolutePath ? libPath : Path.Combine(currentDirectoryPath, libPath);

            // check if file exists
            if (!File.Exists(libFullPath))
            {
                Validation.Reading.Add(
                    new ValidationEntry(
                        ValidationEntrySource.Reader,
                        ValidationEntryLevel.Warning,
                        $"Netlist include at {libFullPath} could not be found",
                        lib.LineInfo));
                return;
            }

            // get lib content
            string libContent = FileReader.ReadAll(libFullPath);

            if (libContent != null)
            {
                var lexerSettings = new SpiceLexerSettings()
                {
                    HasTitle = false,
                    IsDotStatementNameCaseSensitive = LexerSettings.IsDotStatementNameCaseSensitive,
                };

                var tokens = TokenProviderPool.GetSpiceTokenProvider(lexerSettings).GetTokens(libContent);

                foreach (var token in tokens)
                {
                    token.FileName = libFullPath;
                }

                SpiceNetlistParser.Settings = new SingleSpiceNetlistParserSettings(lexerSettings)
                {
                    IsNewlineRequired = false,
                    IsEndRequired     = false,
                };

                SpiceNetlist includeModel = SpiceNetlistParser.Parse(tokens);

                var allStatements = includeModel.Statements.ToList();

                if (lib.Parameters.Count == 2)
                {
                    ReadSingleLibWithTwoArguments(statements, lib, allStatements);
                }
                else if (lib.Parameters.Count == 1)
                {
                    ReadSingleLibWithOneArgument(statements, lib, allStatements);
                }
            }
            else
            {
                Validation.Reading.Add(
                    new ValidationEntry(
                        ValidationEntrySource.Reader,
                        ValidationEntryLevel.Warning,
                        $"Netlist include at {libFullPath} could not be read",
                        lib.LineInfo));
            }
        }
Ejemplo n.º 9
0
 public void should_convert_c_colon_successfully()
 {
     Assert.AreEqual(@"\\{0}\C$\bob\bill".FormatWith(remoteServerName), PathConverter.Convert(server, "C:\\bob\\bill"));
 }
Ejemplo n.º 10
0
 public void should_convert_c_colon_successfully()
 {
     Assert.AreEqual(@"C:\bob\bill", PathConverter.Convert(server, "C:\\bob\\bill"));
 }
        private void ReadSingleInclude(Statements statements, string currentDirectoryPath, Control include)
        {
            // get full path of .include
            string includePath = include.Parameters.Get(0).Image;

            includePath = PathConverter.Convert(includePath);

            bool   isAbsolutePath  = Path.IsPathRooted(includePath);
            string includeFullPath = isAbsolutePath ? includePath : Path.Combine(currentDirectoryPath, includePath);

            // check if file exists
            if (!File.Exists(includeFullPath))
            {
                Validation.Reading.Add(
                    new ValidationEntry(
                        ValidationEntrySource.Reader,
                        ValidationEntryLevel.Warning,
                        $"Netlist include at {includeFullPath}  is not found",
                        include.LineInfo));
                return;
            }

            // get include content
            string includeContent = FileReader.ReadAll(includeFullPath);

            if (includeContent != null)
            {
                var lexerSettings = new SpiceLexerSettings()
                {
                    HasTitle = false,
                    IsDotStatementNameCaseSensitive = LexerSettings.IsDotStatementNameCaseSensitive,
                };

                var tokens = TokenProviderPool.GetSpiceTokenProvider(lexerSettings).GetTokens(includeContent);

                foreach (var token in tokens)
                {
                    token.FileName = includeFullPath;
                }

                SpiceNetlistParser.Settings = new SingleSpiceNetlistParserSettings(lexerSettings)
                {
                    IsNewlineRequired = false,
                    IsEndRequired     = false,
                };

                SpiceNetlist includeModel = SpiceNetlistParser.Parse(tokens);

                // process includes of include netlist
                includeModel.Statements = Process(includeModel.Statements, Path.GetDirectoryName(includeFullPath));

                // replace statement by the content of the include
                statements.Replace(include, includeModel.Statements);
            }
            else
            {
                Validation.Reading.Add(
                    new ValidationEntry(
                        ValidationEntrySource.Reader,
                        ValidationEntryLevel.Warning,
                        $"Netlist include at {includeFullPath} could not be read",
                        include.LineInfo));
            }
        }
Ejemplo n.º 12
0
 public RemoteDropkickExecutionTask(PhysicalServer server)
 {
     _server             = server;
     _remotePhysicalPath = PathConverter.Convert(_server, _remotePath);
     CopyRemoteRunnerToServerIfNotExists();
 }
Ejemplo n.º 13
0
 /// <summary>
 /// This will convert a path string to the physical path (local server deploy will get a local address).
 /// If you need to force the path to be local always, you should call dropkick.FileSystem.Path.GetPhysicalPath(server,path,TRUE)
 /// </summary>
 /// <param name="path">The path on the server</param>
 /// <returns>A physical path, will be a local path if the deploy is run on the same server it is deploying to</returns>
 public string MapPath(string path)
 {
     return(PathConverter.Convert(this, path));
 }