Beispiel #1
0
 public Node(string prop_name, object val, comparison c)
 {
     data = new NodeData()
     {
         value = val,
         prop = prop_name,
         comp = c
     };
 }
        Result iTool.Execute(Job job)
        {
            Result result = new Result(job.Id);

            config     permConfig = new config();
            comparison security   = new comparison();
            Helper     helper     = Helper.Instance;

            permConfig.ReadConfig(job.DownloadAttachment());

            List <site> sites = new List <site>();

            foreach (comparisonsite compSite in permConfig.comparisonSites)
            {
                Console.WriteLine(compSite.source);
                using (SPWeb web = new SPSite(compSite.source).OpenWeb())
                {
                    int              listCount = 0;
                    site             site      = new site(compSite.source, compSite.target);
                    List <folder>    folders   = new List <folder>();
                    SPListCollection siteLists = web.Lists;

                    foreach (SPList list in siteLists)
                    {
                        try
                        {
                            if (!permConfig.ignoreList.Contains(list.RootFolder.Name.ToLower()))
                            {
                                listCount++;
                                folder listFolder = AddFolder(list);

                                listFolder.serverRelativeUrl = helper.MapServerRelativeUrl(listFolder.serverRelativeUrl,
                                                                                           compSite.source,
                                                                                           compSite.target);

                                site.folders.Add(listFolder);

                                SPQuery query = new SPQuery();
                                query.Query          = @"
                                <Where>
                                    <BeginsWith>
                                        <FieldRef Name='ContentTypeId' />
                                        <Value Type='ContentTypeId'>0x0120</Value>
                                    </BeginsWith>
                                </Where>";
                                query.ViewAttributes = "Scope='RecursiveAll'";
                                SPListItemCollection items = list.GetItems(query);

                                foreach (SPListItem item in items)
                                {
                                    folder folder = AddFolder(item.Folder, false, item.Folder.Files.Count);

                                    string updatedUrl = helper.MapServerRelativeUrl(folder.serverRelativeUrl,
                                                                                    compSite.source,
                                                                                    compSite.target);
                                    folder.serverRelativeUrl = updatedUrl;

                                    site.folders.Add(folder);
                                }
                            }
                        }
                        catch (Exception ex) { Console.WriteLine(list.Title); Console.WriteLine(ex.Message); }
                    }

                    site.ListCount = listCount;
                    security.sites.Add(site);
                }
            }

            XmlSerializer serializer = new XmlSerializer(typeof(comparison));
            string        tmpFile    = Scheduler.Instance.CreateTmpFile();

            using (TextWriter stream = new StreamWriter(tmpFile))
            {
                using (XmlWriter writer = XmlWriter.Create(stream, new XmlWriterSettings {
                    Indent = true, CheckCharacters = true
                }))
                {
                    writer.WriteStartDocument();
                    serializer.Serialize(writer, security);
                    writer.WriteEndDocument();
                    writer.Flush();
                }
            }

            result.AddFile(tmpFile);

            return(result);
        }
Beispiel #3
0
 select new Condition(field, value, comparison, logical, index));
 public RequirementCondition(string statName = "anxiety", int value = 0, comparison comp = comparison.Greater)
 {
     this.statName       = statName;
     this.reqValue       = value;
     this.comparisonType = comp;
 }
Beispiel #5
0
 /// <inheritdoc/>
 public CompareResult Compare(in AttributeComparison comparison) => Compare(comparison, _attrComparers, CompareResult.Different);
Beispiel #6
0
 /// <inheritdoc/>
 public CompareResult Compare(in Comparison comparison) => Compare(comparison, _nodeComparers, CompareResult.Different);