Esempio n. 1
0
		public CompiledPolicySet(ICompiledPolicySetCache cps)
		{
			InitializeComponent();
			
			xmlTreeView1.Xml = cps.Content;
			xmlTreeView2.Xml = cps.ObjectReferences;
		}
Esempio n. 2
0
        private GeneralPolicyProcessor InitialiseGPP(ICompiledPolicySetCache compiledPolicy)
        {
            if (compiledPolicy == null)
                return null;

            string lang = GetCurrentCulturesLanguageFile(compiledPolicy);
            string content = compiledPolicy.Content;

            PolicySetLanguageMerger pslm = new PolicySetLanguageMerger();
            content = pslm.Merge(content, lang);

            GeneralPolicyProcessor gpp = new GeneralPolicyProcessor();
			gpp.ExceptionHandler += new ExceptionEventHandler(OnException);

            gpp.Initialise(m_runAt, content, compiledPolicy.ObjectReferences);

            return gpp;
        }
Esempio n. 3
0
        private void SaveLanguages(List<CompiledPolicyLanguage> languages, ICompiledPolicySetCache cps)
        {
            foreach (CompiledPolicyLanguage language in languages)
            {
                bool bFoundExisting = false;

                foreach (IPolicyLanguageTableCache existing_language in cps.Languages)
                {
                    if (existing_language.Language.Code == language.Code)
                    {
                        existing_language.Content = language.Content;
                        bFoundExisting = true;
                        break;
                    }
                }

                if (!bFoundExisting)
                    cps.NewLanguage(language.Code, language.Content, language.DefaultLanguage);
            }
        }
Esempio n. 4
0
		private void ShowCompiledPolicySetDetails(ICompiledPolicySetCache cps)
		{
			CompiledPolicySet cpsForm = new CompiledPolicySet(cps);
			ShowDetail(cpsForm);
		}
Esempio n. 5
0
        private static string GetCurrentCulturesLanguageFile(ICompiledPolicySetCache policySetCache)
        {
            string languagexml = "";
            string defaultLanguageXml = "";

            CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;

            bool foundLang = false;
            bool foundDefaultLang = false;
            foreach (IPolicyLanguageTableCache languageTableCache in policySetCache.Languages)
            {
                if (string.Compare(languageTableCache.Language.Code, ci.TwoLetterISOLanguageName, true, CultureInfo.InvariantCulture) == 0)
                {
                    languagexml = languageTableCache.Content;
                    foundLang = true;
                }
                if (languageTableCache.Language.Default)
                {
                    defaultLanguageXml = languageTableCache.Content;
                    foundDefaultLang = true;
                }

                if ( foundLang && foundDefaultLang)
                    break;
            }
            if (languagexml == "")
                languagexml = defaultLanguageXml;

            return languagexml;
        }
Esempio n. 6
0
 public bool Evaluate(ICompiledPolicySetCache cpsc)
 {
     return 0 == string.Compare(m_matchValue, cpsc.Target, 
         StringComparison.InvariantCultureIgnoreCase);
 }
Esempio n. 7
0
 /// <summary>
 /// </summary>
 public void SetCompiledPolicySetCache(ICompiledPolicySetCache store)
 {
     m_CompiledPolicySetCache = store;
 }
Esempio n. 8
0
		private XmlNode WriteCompiledPolicySetInfo(XmlDocument xmlDoc, ICompiledPolicySetCache cps)
		{
			XmlElement compiledset = xmlDoc.CreateElement("CompiledPolicySet");
            XmlAttribute id = xmlDoc.CreateAttribute("id");
            id.Value = Convert.ToString((cps as LocalCompiledPolicySetCache).ID, CultureInfo.InvariantCulture);
            XmlAttribute channelAtt = xmlDoc.CreateAttribute("channel");
			channelAtt.Value = cps.Channel;
			XmlAttribute targetAtt = xmlDoc.CreateAttribute("target");
			targetAtt.Value = cps.Target;

            compiledset.Attributes.Append(id);
			compiledset.Attributes.Append(channelAtt);
			compiledset.Attributes.Append(targetAtt);

			XmlElement cps_content = xmlDoc.CreateElement("Content");
			cps_content.InnerXml = cps.Content;
			compiledset.AppendChild(cps_content);

			XmlElement cps_objects = xmlDoc.CreateElement("Objects");
			cps_objects.InnerXml = cps.ObjectReferences;
			compiledset.AppendChild(cps_objects);


			XmlElement langs = xmlDoc.CreateElement("Languages");
			foreach (IPolicyLanguageTableCache lang in cps.Languages)
				langs.AppendChild(WriteLanguageInfo(xmlDoc, lang));

			compiledset.AppendChild(langs);

			return compiledset;
		}