public void BuildingArguments(string architecture)
        {
            RuleConditions conditions = new RuleConditions {
                FeatureConditions = new FeatureConditions {
                    IsForDemoUser = true
                },
                OsConditions = new OsConditions {
                    Architecture = architecture, Name = Platform
                }
            };

            if (VersionManifest.Type == VersionManifestType.V2)
            {
                string jvmArguments = VersionManifest.BuildArgumentsByGroup(ArgumentsGroupType.JVM, null,
                                                                            conditions);
                string gameArguments = VersionManifest.BuildArgumentsByGroup(ArgumentsGroupType.GAME, null,
                                                                             conditions);

                Console.WriteLine("JVM:");
                Console.WriteLine(jvmArguments);

                Console.WriteLine();

                Console.WriteLine("GAME:");
                Console.WriteLine(gameArguments);
            }
            else
            {
                Console.WriteLine(VersionManifest.ArgumentsCollection.ToString(null));
            }
        }
Beispiel #2
0
 public override string ToString()
 {
     return("[" +
            GetType() +
            "\n\tRuleConditions: " +
            RuleConditions.ToString() +
            "\n\tOutputTerm: " +
            OutputTerm.ToString() +
            "]");
 }
Beispiel #3
0
        public override object Clone()
        {
            RuleConditions list = new RuleConditions();

            foreach (RuleCondition rc in this)
            {
                list.Add((RuleCondition)rc.Clone());
            }

            return(list);
        }
Beispiel #4
0
        public void CreateJunkRule(string senderEmailAddress)
        {
            RuleConditions    ruleConditions           = null;
            TextRuleCondition subjectTextRuleCondition = null;

            RuleActions          ruleActions    = null;
            MoveOrCopyRuleAction moveRuleAction = null;

            string ruleName = "PhishingReporter-Autogenerated";

            NameSpace session = Application.Session;
            Store     store   = session.DefaultStore;
            Rules     rules   = store.GetRules();
            Rule      rule    = GetRuleIfExist(ruleName, rules);

            // No rule found
            if (rule == null)
            {
                rule           = rules.Create(ruleName, OlRuleType.olRuleReceive);
                ruleConditions = rule.Conditions;
                ruleConditions.SenderAddress.Address = new[] { senderEmailAddress };
                ruleConditions.SenderAddress.Enabled = true;

                rule.Actions.MoveToFolder.Folder  = spamFolder;
                rule.Actions.MoveToFolder.Enabled = true;

                rules.Save();
            }
            else // SpamRule already exists
            {
                ruleConditions = rule.Conditions;
                string[] oldAddresses = ruleConditions.SenderAddress.Address;
                string[] newAddresses = new string[oldAddresses.Length + 1];
                oldAddresses.CopyTo(newAddresses, 0);
                newAddresses[oldAddresses.Length] = senderEmailAddress;

                ruleConditions.SenderAddress.Address = newAddresses;
                ruleConditions.SenderAddress.Enabled = true;

                rule.Actions.MoveToFolder.Folder  = spamFolder;
                rule.Actions.MoveToFolder.Enabled = true;

                rules.Save();
            }
        }
        private void ListConditions(RuleConditions masterlist, RuleConditions list)
        {
            listConditions.Items.Clear();
            foreach (RuleCondition rc in masterlist)
            {
                LinkLabel ll = new LinkLabel();
                ll.Text     = rc.Text;
                ll.LinkArea = new LinkArea(rc.ValueStart, rc.ValueText.Length);
                RuleViewItem rvi = new RuleViewItem(ll);
                rvi.Tag = rc;

                if (list.FindByFormat(rc.TextFormat) != null)
                {
                    rvi.Checked = true;
                }

                listConditions.Items.Add(rvi);
            }
        }
Beispiel #6
0
        public override bool Equals(object obj)
        {
            AssociationRule rightRule = obj as AssociationRule;
            IEqualityComparer <RuleCondition> conditionEqualityComparer = new RuleConditionComparer();
            IEqualityComparer <RuleResult>    resultEqualityComparer    = new RuleResultComparer();

            List <RuleCondition> conditionDifference = RuleConditions.Except(rightRule.RuleConditions, conditionEqualityComparer).ToList();
            List <RuleResult>    resultDifference    = RuleResults.Except(rightRule.RuleResults, resultEqualityComparer).ToList();

            if (conditionDifference.Count == 0 && resultDifference.Count == 0)
            {
                conditionDifference = rightRule.RuleConditions.Except(RuleConditions, conditionEqualityComparer).ToList();
                resultDifference    = rightRule.RuleResults.Except(RuleResults, resultEqualityComparer).ToList();

                if (conditionDifference.Count == 0 && resultDifference.Count == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #7
0
        public void GettingLibraries(string architecture)
        {
            RuleConditions conditions = new RuleConditions {
                OsConditions = new OsConditions {
                    Architecture = architecture, Name = Platform
                }
            };

            List <Library> list = VersionManifest.Libraries.Where(lib =>
                                                                  lib.IsAllowed(conditions) || lib.IsAllowed(conditions) && lib.IsNativesFor(Platform)).ToList();

            foreach (Library library in list)
            {
                Console.WriteLine($"{library.Name} IsNatives: {library.IsNatives}");
                foreach (DownloadEntry downloadsEntry in library.GetDownloadsEntries(string.Empty, Platform, architecture == "x64"))
                {
                    Console.WriteLine($" Url: {downloadsEntry.Url}");
                    Console.WriteLine($" Path: {downloadsEntry.Path}");
                }
            }
        }
Beispiel #8
0
        void SetLayout()
        {
            string Layout = this.FlowDefine;

            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(Layout);
            string qq;
            string WFBOSystemName = string.Empty;
            string WFBOObjectName = string.Empty;

            qq = "";
            XmlReader    XmlReader;
            StringReader bb = new StringReader(Layout);

            XmlReader = XmlReader.Create(bb);

            #region 遍历XML
            //while (XmlReader.Read())
            //{
            //    qq+="<li>节点类型:" + XmlReader.NodeType + "==<br>";
            //    switch (XmlReader.NodeType)
            //    {
            //        case XmlNodeType.XmlDeclaration:
            //            for (int i = 0; i < XmlReader.AttributeCount; i++)
            //            {
            //                XmlReader.MoveToAttribute(i);
            //                qq+="属性:" + XmlReader.Name + "=" + XmlReader.Value + "&nbsp;";
            //            }
            //            break;
            //        case XmlNodeType.Attribute:
            //            for (int i = 0; i < XmlReader.AttributeCount; i++)
            //            {
            //                XmlReader.MoveToAttribute(i);
            //                qq+="属性:" + XmlReader.Name + "=" + XmlReader.Value + "&nbsp;";
            //            }
            //            break;
            //        case XmlNodeType.CDATA:
            //            qq+="CDATA:" + XmlReader.Value + "&nbsp;";
            //            break;
            //        case XmlNodeType.Element:
            //            qq+="节点名称:" + XmlReader.LocalName + "<br>";
            //            for (int i = 0; i < XmlReader.AttributeCount; i++)
            //            {
            //                XmlReader.MoveToAttribute(i);
            //               qq+="属性:" + XmlReader.Name + "=" + XmlReader.Value + "&nbsp;";
            //            }
            //            break;
            //        case XmlNodeType.Comment:
            //            qq+="Comment:" + XmlReader.Value;
            //            break;
            //        case XmlNodeType.Whitespace:
            //            qq+="Whitespace:" + "&nbsp;";
            //            break;
            //        case XmlNodeType.ProcessingInstruction:
            //            qq+="ProcessingInstruction:" + XmlReader.Value;
            //            break;
            //        case XmlNodeType.Text:
            //            qq+="Text:" + XmlReader.Value;
            //            break;
            //    }
            // }

            #endregion

            XElement XElementS = XElement.Load(XmlReader);

            var flowSystem = from c in XElementS.Descendants("System")
                             select c;
            if (flowSystem != null)
            {
                foreach (var tmp in flowSystem)
                {
                    WFBOSystemName = tmp.Value;
                }
            }

            //BOSystem

            var a = from c in XElementS.Descendants("Activity")
                    select c;

            foreach (var tmp in a)
            {
                string stepname = tmp.Attribute("Name").Value;
                if (stepname != "StartFlow" && stepname != "EndFlow")
                {
                    StateActive Flow = new StateActive();
                    Flow.MinWidth = 60;
                    Flow.Name     = stepname;
                    // 1s 冉龙军
                    //string tmpStateName = (StateList.Where(s => s.StateCode.ToString() == stepname).ToList().First().StateName);
                    string tmpStateName = tmp.Attribute("Remark").Value;
                    // 1e
                    string StateName = "";

                    for (int i = 0; i < tmpStateName.Length; i = i + 6)
                    {
                        if (tmpStateName.Length < i + 6)
                        {
                            StateName += (i == 0 ? tmpStateName : "\r\n" + tmpStateName.Substring(i));
                        }
                        else
                        {
                            StateName += (i == 0 ? tmpStateName.Substring(i, 6) : "\r\n" + tmpStateName.Substring(i, 6));
                        }
                    }

                    Flow.StateName.Text = StateName;// (StateList.Where(s => s.StateCode.ToString() == stepname).ToList().First().StateName);

                    #region 加载KPI点的信息
                    if (KPIPointList != null && KPIPointList.Count != 0)
                    {
                        foreach (T_HR_KPIPOINT point in KPIPointList)
                        {
                            if (stepname.Equals(point.STEPID))
                            {
                                Flow.StateName.Text += "(KPI点)";
                            }
                        }
                    }
                    #endregion 加载KPI点的信息
                    Flow.SetValue(Canvas.TopProperty, Convert.ToDouble(tmp.Attribute("X").Value));
                    Flow.SetValue(Canvas.LeftProperty, Convert.ToDouble(tmp.Attribute("Y").Value));
                    if (!cnsDesignerContainer.Children.Contains(Flow))
                    {
                        // 1s 冉龙军 暂不处理错误
                        //cnsDesignerContainer.Children.Add(Flow);
                        try
                        {
                            cnsDesignerContainer.Children.Add(Flow);
                        }
                        catch (Exception ex)
                        {
                        }
                        // 1e
                        Flow.Container = this;
                        Actives.Add(Flow);
                    }
                }
            }

            var b = from c in XElementS.Descendants("Rule")
                    select c;

            foreach (var tmp in b)
            {
                RuleLine RuleLineS = new RuleLine();
                RuleLineS.Name = tmp.Attribute("Name").Value;

                RuleLineS.StrStartActive = tmp.Attribute("StrStartActive").Value;
                RuleLineS.StrEndActive   = tmp.Attribute("StrEndActive").Value;
                RuleLineS.Container      = this;

                if (tmp.Element("Conditions") != null)
                {
                    RuleConditions newRuleCondition = new RuleConditions();
                    newRuleCondition.Name            = tmp.Element("Conditions").Attribute("Name").Value;
                    newRuleCondition.ConditionObject = tmp.Element("Conditions").Attribute("Object").Value;
                    newRuleCondition.CodiCombMode    = tmp.Element("Conditions").Attribute("CodiCombMode").Value;

                    if (!string.IsNullOrEmpty(newRuleCondition.ConditionObject))
                    {
                        WFBOObjectName = newRuleCondition.ConditionObject;
                    }

                    if (tmp.Element("Conditions").Elements("Condition").Count() > 0)
                    {
                        var e = from f in tmp.Element("Conditions").Descendants("Condition")
                                select f;

                        foreach (var tmp2 in e)
                        {
                            CompareCondition newCD = new CompareCondition();
                            newCD.Name         = tmp2.Attribute("Name").Value;
                            newCD.Description  = tmp2.Attribute("Description").Value;
                            newCD.CompAttr     = tmp2.Attribute("CompAttr").Value;
                            newCD.Operate      = backEscapeXMLChar(tmp2.Attribute("Operate").Value);
                            newCD.DataType     = tmp2.Attribute("DataType").Value;
                            newCD.CompareValue = tmp2.Attribute("CompareValue").Value;
                            newRuleCondition.subCondition.Add(newCD);
                        }
                    }

                    RuleLineS.ruleCoditions = newRuleCondition;
                }

                if (!cnsDesignerContainer.Children.Contains(RuleLineS))
                {
                    // 1s 冉龙军 暂不处理错误
                    //cnsDesignerContainer.Children.Add(RuleLineS);
                    try
                    {
                        cnsDesignerContainer.Children.Add(RuleLineS);
                    }
                    catch (Exception ex)
                    {
                    }
                    // 1e
                    SetRuleLinePos(RuleLineS.Name);
                    Rules.Add(RuleLineS);
                    // a.ActivityChanged += new ActivityChangeDelegate(OnActivityChanged);
                }
                // MessageBox.Show(tmp.Attribute("Name").Value);
            }
        }