Esempio n. 1
0
        private Package(IPackageMetadata metadata, ZipArchive archive, IInstructionCollection instructions)
        {
            this.Metadata     = metadata;
            this.Instructions = instructions;

            this.archive = archive;
        }
        public static async Task <IEnumerable <T> > Find <T>(this IDocumentCollection <T> self, IWorkContext context, IInstructionCollection instruction)
        {
            Verify.IsNotNull(nameof(self), self);
            Verify.IsNotNull(nameof(instruction), instruction);

            IInstructionCollection and   = instruction as And;
            IInstructionCollection or    = instruction as Or;
            IInstructionCollection andOr = and ?? or;

            if (andOr != null)
            {
                return(await self.Find(context, andOr.ToDocument()));
            }

            OrderBy    orderBy    = instruction.OfType <OrderBy>().SingleOrDefault();
            Projection projection = instruction.OfType <Projection>().SingleOrDefault();

            FindOptions <T, T> options = new FindOptions <T, T>
            {
                Sort       = orderBy?.ToDocument(),
                Projection = projection?.ToDocument(),
            };

            Query query = instruction.OfType <Query>().FirstOrDefault();

            return(await self.Find(context, query?.ToDocument() ?? new BsonDocument(), options));
        }
Esempio n. 3
0
        public static Package OpenPackage(IPackageMetadata metadata, ZipArchive archive)
        {
            ZipArchiveEntry installationInstructionsEntry = archive.Entries.First((archiveEntry) => { return(archiveEntry.FullName == "Installation.xml"); });

            using (Stream installationInstructionsStream = installationInstructionsEntry.Open()) {
                using (XmlReader installationInstructionsReader = XmlReader.Create(installationInstructionsStream)) {
                    IInstructionCollection instructionCollection = InstructionCollection.LoadFromXml(installationInstructionsReader);

                    return(new Package(metadata, archive, instructionCollection));
                }
            }
        }
Esempio n. 4
0
        public static int GetMethodBodySize(IMethodDeclaration value)
        {
            int size = 0;

            IMethodBody methodBody = value.Body as IMethodBody;

            if (methodBody != null)
            {
                IInstructionCollection instructions = methodBody.Instructions;
                if (instructions.Count != 0)
                {
                    IInstruction lastInstruction = instructions[instructions.Count - 1];
                    size = size + lastInstruction.Offset + Helper.GetInstructionSize(lastInstruction);
                }
            }

            return(size);
        }
Esempio n. 5
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n, Func<IInstruction, IInstruction, Action<string, string>, bool> checkitem, Action<string, string> errAct)
 {
     return Compare<IInstruction>(source,n,checkitem,errAct);
 }
Esempio n. 6
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n, Func<IInstruction, IInstruction, bool> checkitem)
 {
     return Compare<IInstruction>(source,n,checkitem);
 }
Esempio n. 7
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n)
 {
     return Compare<IInstruction>(source,n);
 }
Esempio n. 8
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n, Func <IInstruction, IInstruction, Action <string, string>, bool> checkitem, Action <string, string> errAct)
 {
     return(Compare <IInstruction>(source, n, checkitem, errAct));
 }
Esempio n. 9
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n, Func <IInstruction, IInstruction, bool> checkitem)
 {
     return(Compare <IInstruction>(source, n, checkitem));
 }
Esempio n. 10
0
 public static bool Compare(this IInstructionCollection source, IInstructionCollection n)
 {
     return(Compare <IInstruction>(source, n));
 }
        public virtual IInstructionCollection TransformInstructionCollection(IInstructionCollection value)
        {
            IInstruction[] array = new IInstruction[value.Count];
            for (int i = 0; i < value.Count; i++)
            {
                array[i] = this.TransformInstruction(value[i]);
            }

            IInstructionCollection target = new InstructionCollection();
            target.AddRange(array);
            return target;
        }
 private void InsituTransformInstructionCollection(IInstructionCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         value[i] = this.TransformInstruction(value[i]);
     }
 }