Ejemplo n.º 1
0
        private void ReplacePolicySetFile(LocalPolicySetCache policySetCache)
        {
            if (null == policySetCache)
                return;

            PolicyFileWriter fileWriter = new PolicyFileWriter();
            fileWriter.WriteFile(policySetCache, policySetCache.FileName, false);
        }
Ejemplo n.º 2
0
		public IPolicySetCache NewPolicySet(string name)
		{
			LocalPolicySetCache lps = null;

			if (System.IO.Path.IsPathRooted(name))
				lps = new LocalPolicySetCache(name);
			else
				lps = new LocalPolicySetCache(m_LocalBasePath_User + name + (m_runtime ? Definitions.CompiledPolicyFileExtension : Definitions.PolicyFileExtension));

			lps.NewVersion("");
			m_policySets.Add(lps);
			return lps;
		}
Ejemplo n.º 3
0
		public virtual IPolicySetCache GetPolicySet(string name)
		{
			InitPolicies();

			foreach (IPolicySetCache ps in PolicySets)
			{
				if (ps.Id == name)
					return ps;
			}

			if (System.IO.File.Exists(name))
			{
				LocalPolicySetCache lps = new LocalPolicySetCache(name);
				if ((m_runtime && !lps.RuntimeType))
				{
					//Dont allow .policy files in the 'runtimepolicy' cache, but 
					//runtimepolicies are allowed in the cache where 'policy' files live.

					return null;
				}

				// This causes a lot of memory leak, so commenting it for now
				// m_policySets.Add(lps);

				return lps;
			}

			return null;
		}
Ejemplo n.º 4
0
 public IPolicyXml GetPolicySetXml(string name)
 {
     Logger.LogInfo(string.Format("GetPolicySetXml: {0}", name));
     LocalPolicySetCache lps = new LocalPolicySetCache();
     return lps.GetExistingPolicySetXml(name);
 }
Ejemplo n.º 5
0
		protected virtual void AddPolicySet(string policysetFile)
		{
			LocalPolicySetCache lps = new LocalPolicySetCache(policysetFile);
            if (lps.InitialisedOK)
			{
                if ((m_runtime && lps.RuntimeType) || (!m_runtime && !lps.RuntimeType))
                {
                    Logger.LogInfo(string.Format("Adding PolicySet to cache for policy: {0}", policysetFile));
                    m_policySets.Add(lps);
                }
			}
		}