예제 #1
0
파일: Form1.cs 프로젝트: killbug2004/WSProf
        private void ReplacePolicySetFile(LocalPolicySetCache policySetCache)
        {
            if (null == policySetCache)
                return;

            PolicyFileWriter fileWriter = new PolicyFileWriter();
            fileWriter.WriteFile(policySetCache, policySetCache.FileName, false);
        }
예제 #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;
		}
예제 #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;
		}
예제 #4
0
 public IPolicyXml GetPolicySetXml(string name)
 {
     Logger.LogInfo(string.Format("GetPolicySetXml: {0}", name));
     LocalPolicySetCache lps = new LocalPolicySetCache();
     return lps.GetExistingPolicySetXml(name);
 }
예제 #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);
                }
			}
		}