Exemple #1
0
        /// <summary>
        /// Sets up the to chain.
        /// </summary>
        /// <param name="i">Current count.</param>
        /// <param name="logger">Logger class.</param>
        /// <param name="serviceProvider">DI service provider.</param>
        /// <returns>Returns an instance of the <see cref="IChain{T}"/> interface.</returns>
        private IChain <Routable> SetupToChain(int i, ILogger logger, IServiceProvider serviceProvider)
        {
            To toChain = new To(logger, this.GetToComponent(i, serviceProvider), this.GetIdentity());

            logger.LogInformation(string.Format(Resources.INFO_SETUP_TO, toChain?.ToString()));
            if (i < this.toUris.Count - 1)
            {
                toChain.SetNext(this.SetupToChain(++i, logger, serviceProvider));
            }
            else
            {
                IChain <Routable> atomic = null;
                IChain <Routable> error  = null;
                if (this.atomicComponent != null)
                {
                    logger.LogInformation(string.Format(Resources.INFO_SETUP_ATOMIC, this.atomicComponent.ToString()));
                    atomic = new Atomic(logger, this.atomicComponent, this.GetIdentity());
                }

                if (this.errorComponent != null)
                {
                    logger.LogInformation(string.Format(Resources.INFO_SETUP_ERR, this.errorComponent.ToString()));
                    error = new Chain.Error(logger, this.errorComponent, this.GetIdentity());
                }

                toChain.SetNext(this.GetFinal(error, atomic));
            }

            return(toChain);
        }
 public override void Modify(IChain chain)
 {
     if (!chain.Middleware.OfType <TransactionalFrame>().Any())
     {
         chain.Middleware.Add(new TransactionalFrame());
     }
 }
Exemple #3
0
        public static IChain ChainFromFileOrCode(string file, PdbLoadOptions loadOptions = PdbLoadOptions.Default, char?chainId = null)
        {
            IEnumerable <AtomRecord> records = GetPdbRecords(file).Select(record => record as AtomRecord).Where(record => record as HetatmRecord == null);
            IChain chain = ChainFromRecords(records, loadOptions, chainId);

            return(chain);
        }
Exemple #4
0
        public static Matrix GetRmsdTransformForResidues(IChain move, int firstMoveResidue, int lastMoveResidue, IChain stationary, int firstStationaryResidue, int lastStationaryResidue)
        {
            Vector3[] stationaryCoordinates = new Vector3[(lastStationaryResidue - firstStationaryResidue + 1) * 3];
            Vector3[] moveCoordinates       = new Vector3[(lastMoveResidue - firstMoveResidue + 1) * 3];

            int arrayIndex = 0;

            for (int residueIndex = firstStationaryResidue; residueIndex <= lastStationaryResidue; residueIndex++)
            {
                stationaryCoordinates[arrayIndex++] = stationary[residueIndex][Aa.N_].Xyz;
                stationaryCoordinates[arrayIndex++] = stationary[residueIndex][Aa.CA_].Xyz;
                stationaryCoordinates[arrayIndex++] = stationary[residueIndex][Aa.C_].Xyz;
            }

            arrayIndex = 0;
            for (int residueIndex = firstMoveResidue; residueIndex <= lastMoveResidue; residueIndex++)
            {
                moveCoordinates[arrayIndex++] = move[residueIndex][Aa.N_].Xyz;
                moveCoordinates[arrayIndex++] = move[residueIndex][Aa.CA_].Xyz;
                moveCoordinates[arrayIndex++] = move[residueIndex][Aa.C_].Xyz;
            }

            Matrix matrix = VectorMath.GetRmsdAlignmentMatrix(moveCoordinates, false, stationaryCoordinates, false);

            return(matrix);
        }
Exemple #5
0
        /// <summary>
        /// Returns sequence alignments that could join all of the input structures
        /// </summary>
        /// <param name="structures"></param>
        /// <param name="chains">IChain indices for each structure that should be </param>
        /// <returns></returns>
        public static TransformSequenceAlignment[][] GetRepeatFilteredTransformAlignments(IStructure[] structures, int[][] chains)
        {
            TransformSequenceAlignment[][] result = new TransformSequenceAlignment[structures.Length - 1][];
            for (int i = 0; i < structures.Length - 1; i++)
            {
                List <TransformSequenceAlignment> alignments = new List <TransformSequenceAlignment>();
                foreach (int chainIndex1 in chains[i])
                {
                    foreach (int chainIndex2 in chains[i + 1])
                    {
                        IChain chain1 = structures[i][chainIndex1];
                        IChain chain2 = structures[i + 1][chainIndex2];

                        // Shorten the
                        List <TransformSequenceAlignment> chainAlignments = GetRepeatFilteredTransformAlignments(structures[i], chainIndex1, false, structures[i + 1], chainIndex2, i != structures.Length - 2 && structures[i + 1].Count == 1, SS.Helix | SS.Extended);
                        foreach (TransformSequenceAlignment alignment in chainAlignments)
                        {
                            alignment.ChainIndex1 = chainIndex1;
                            alignment.ChainIndex2 = chainIndex2;
                        }
                        alignments.AddRange(chainAlignments);
                    }
                }
                result[i] = alignments.ToArray();
            }
            return(result);
        }
Exemple #6
0
        public static List <TransformSequenceAlignment> GetRepeatFilteredTransformAlignments(
            IChain chain1, bool fuseEndsOnly1,
            IChain chain2, bool fuseEndsOnly2,
            SS allowedTypes, int minAlignmentLength = DefaultMinAlignmentLength, float maxRmsd = DefaultRmsdThreshold)
        {
            List <TransformSequenceAlignment> alignments = GetTransformAlignments(chain1, chain2, allowedTypes, minAlignmentLength, maxRmsd);

            if (fuseEndsOnly1)
            {
                int repeatLength1;
                if (Sequence.TryGetInternalRepeatLength(chain1, out repeatLength1) && repeatLength1 > 15)
                {
                    alignments.RemoveAll(a => (a.Range1.Start > 1.15 * repeatLength1) && (a.Range1.End < chain1.Count - 1.15 * repeatLength1));
                }
            }

            if (fuseEndsOnly2)
            {
                int repeatLength2;
                if (Sequence.TryGetInternalRepeatLength(chain2, out repeatLength2) && repeatLength2 > 15)
                {
                    alignments.RemoveAll(a => (a.Range2.Start > 1.15 * repeatLength2) && (a.Range2.End < chain1.Count - 1.15 * repeatLength2));
                }
            }

            return(alignments);
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nChain">The peptide that will be constitute the N-terminal region of the resultant spliced peptide</param>
        /// <param name="cChain">The peptide that will be constitute the C-terminal region of the resultant spliced peptide</param>
        /// <param name="nInclude">The included portion of the N-terminal peptide</param>
        /// <param name="cInclude">The included portion of hte C-terminal peptide</param>
        /// <param name="nAlignNullable">The region to align on prior to splicing</param>
        /// <param name="cAlignNullable">The region to align on prior to splicing</param>
        /// <returns></returns>
        public static IChain GetPeptide(IChain nChain, IChain cChain, Range nInclude, Range cInclude, Range?nAlignNullable = null, Range?cAlignNullable = null)
        {
            bool  performAlignment = nAlignNullable != null && cAlignNullable != null;
            Range nAlign           = performAlignment ? new Range((Range)nAlignNullable) : new Range();
            Range cAlign           = performAlignment ? new Range((Range)cAlignNullable) : new Range();

            if (performAlignment && ((Range)nAlignNullable).Length != ((Range)cAlignNullable).Length)
            {
                throw new ArgumentException("Splice ranges must be of equal length");
            }
            if (nInclude.Start < 0 || nChain.Count <= nInclude.End || cInclude.Start < 0 || cChain.Count <= cInclude.End)
            {
                throw new IndexOutOfRangeException("Splice ranges exceed the peptide ranges");
            }

            IChain chain = new Chain();
            //float rmsd = Rmsd.GetRmsd(cTerminus[cAlign.Start, cAlign.End], nTerminus[nAlign.Start, nAlign.End]);
            Matrix cTerminusTransform = performAlignment ? Rmsd.GetRmsdTransform(cChain[cAlign.Start, cAlign.End], nChain[nAlign.Start, nAlign.End]) : Matrix.Identity;

            cTerminusTransform.Rotation.Normalize();
            //Quaternion rotation = cTerminusTransform.Rotation;
            //rotation.Normalize();
            //cTerminusTransform.Rotation = rotation;
            for (int i = nInclude.Start; i <= nInclude.End; i++)
            {
                chain.Add(new Aa(nChain[i]));
            }
            for (int i = cInclude.Start; i <= cInclude.End; i++)
            {
                IAa residue = new Aa(cChain[i]);
                residue.Transform(cTerminusTransform);
                chain.Add(residue);
            }
            return(chain);
        }
Exemple #8
0
        private void VisitChain(IChain <MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor> c)
        {
            Contract.Requires(c != null);
            switch (c.Tag)
            {
            case ChainTag.Type:
                var t = c.Type.reference.ResolvedType;
                this.thingsToKeep.Add(t);
                var ntr = t as INamespaceTypeReference;
                if (ntr != null)
                {
                    this.AddUpwardNamespace(ntr.ContainingUnitNamespace);
                }
                foreach (var child in c.Children)
                {
                    this.VisitChain(child);
                }
                break;

            case ChainTag.Field:
                this.thingsToKeep.Add(c.Field.reference.ResolvedField);
                break;

            case ChainTag.Method:
                var m = c.Method.reference.ResolvedMethod;
                this.thingsToKeep.Add(m);
                this.methodHashAttributes.Add(m, c.MethodHashAttribute);
                break;

            default:
                Contract.Assume(false, "switch should be exhaustive");
                break;
            }
        }
Exemple #9
0
 public static void CheckIfChainIsFresh(IChain chain, bool acceptStaleRequests)
 {
     if (!acceptStaleRequests && chain.IsStale)
     {
         throw new HttpStatusCodeException(HttpStatusCode.InternalServerError, "Node is still synchronizing; API cannot be used yet");
     }
 }
        private void DoSettlement(IChain sourceChain, Address sourceAddress, Address targetAddress, string symbol, BigInteger value, byte[] data)
        {
            Runtime.Expect(value > 0, "value must be greater than zero");
            Runtime.Expect(targetAddress.IsUser, "target must not user address");

            Runtime.Expect(this.Runtime.TokenExists(symbol), "invalid token");
            var tokenInfo = this.Runtime.GetToken(symbol);

            /*if (tokenInfo.IsCapped())
             * {
             *  var supplies = new SupplySheet(symbol, this.Runtime.Chain, Runtime.Nexus);
             *
             *  if (IsAddressOfParentChain(sourceChain.Address))
             *  {
             *      Runtime.Expect(supplies.MoveFromParent(this.Storage, value), "target supply check failed");
             *  }
             *  else // child chain
             *  {
             *      Runtime.Expect(supplies.MoveFromChild(this.Storage, sourceChain.Name, value), "target supply check failed");
             *  }
             * }
             */

            if (tokenInfo.IsFungible())
            {
                Runtime.SwapTokens(sourceChain.Name, sourceAddress, Runtime.Chain.Name, targetAddress, symbol, value, null, null);
            }
            else
            {
                var nft = Serialization.Unserialize <PackedNFTData>(data);
                Runtime.SwapTokens(sourceChain.Name, sourceAddress, Runtime.Chain.Name, targetAddress, symbol, value, nft.ROM, nft.RAM);
            }
        }
 /// <summary>
 /// Build this controller.
 /// </summary>
 /// <param name="config"> Higher level API configuration. </param>
 /// <param name="chain"> Executor's chain instance from bitprim-cs library. </param>
 /// <param name="memoryCache"> Abstract. </param>
 /// <param name="poolsInfo"> For recognizing blocks which come from mining pools. </param>
 public BlockController(IOptions <NodeConfig> config, IChain chain, IMemoryCache memoryCache, IPoolsInfo poolsInfo)
 {
     config_      = config.Value;
     chain_       = chain;
     memoryCache_ = memoryCache;
     poolsInfo_   = poolsInfo;
 }
Exemple #12
0
 public DotnetWrapperService(
     [NotNull] IChain <IProcessWrapper> processChain,
     [NotNull] IFileSystem fileSystem)
 {
     _processChain = processChain ?? throw new ArgumentNullException(nameof(processChain));
     _fileSystem   = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
 }
Exemple #13
0
 /// <summary>
 /// Build this controller.
 /// </summary>
 /// <param name="config"> Higher level API configuration. </param>
 /// <param name="executor"> Node executor from bitprim-cs library. </param>
 /// <param name="logger">  Abstract logger. </param>
 public AddressController(IOptions <NodeConfig> config, Executor executor, ILogger <AddressController> logger)
 {
     nodeExecutor_ = executor;
     chain_        = nodeExecutor_.Chain;
     config_       = config.Value;
     logger_       = logger;
 }
        private string GetNodesDescription(IChain <MessageInfo, LinkInfo <T> > map)
        {
            var sb = new StringBuilder();

            foreach (var node in map.Nodes)
            {
                var processedNode = new Node <MessageInfo>(node)
                {
                    Attributes = new Dictionary <string, string>(4)
                };
                foreach (var nodeRule in _theme.DefaultNodeRules())
                {
                    nodeRule.Process(processedNode, _theme.DefaultNodeRules(), map);
                }

                if (!string.IsNullOrEmpty(processedNode.Comments))
                {
                    sb.AppendLine($"/* {processedNode.Comments} */");
                }

                var additional = string.Empty;
                if (processedNode.Attributes.Count > 0)
                {
                    additional = $"[{string.Join(", ", processedNode.Attributes.Select(x => $"{x.Key.ToLower()}={CheckAndWrapQuotes(x.Value)}").ToArray())}]";
                }

                sb.AppendLine($"{processedNode.Name}{additional};");
            }
            return(sb.ToString());
        }
        private string ProcessChain(IChain <MessageInfo, LinkInfo <T> > chain)
        {
            var sb = new StringBuilder();

            foreach (var edge in chain.Edges)
            {
                sb.AppendLine();

                var attributes = new Dictionary <string, string>();

                if (!string.IsNullOrEmpty(edge.Info.Label))
                {
                    attributes.Add(GraphvizAttribute.Label.ToString(), edge.Info.Label);
                }

                foreach (var linkRule in _theme.DefaultLinkRules())
                {
                    linkRule.Process(edge, attributes, chain);
                }

                sb.Append($"{edge.FromId.NormalizeGraphvizNames()} -> {edge.ToId.NormalizeGraphvizNames()}");
                if (attributes.Count > 0)
                {
                    sb.Append($"[{string.Join(", ", attributes.Select(x => $"{x.Key.ToLower()}={CheckAndWrapQuotes(x.Value)}").ToArray())}]");
                }

                sb.Append(";");
            }
            sb.AppendLine();

            return(sb.ToString());
        }
 /// <summary>
 /// Notifies all subscribers of the new chain
 /// </summary>
 /// <param name="chain">The new message handler Chain</param>
 public void Notify(IChain chain)
 {
     foreach (var s in this.eventSubscribers)
     {
         s(chain);
     }
 }
Exemple #17
0
        public static Selection GetContactSelectionInFocusSet(IList <IChain> focus, IList <IChain> other, ContactType contactType = ContactType.Atomic)
        {
            Selection selection = new Selection();

            for (int focusIndex = 0; focusIndex < focus.Count; focusIndex++)
            {
                for (int otherIndex = 0; otherIndex < other.Count; otherIndex++)
                {
                    IChain focusChain = focus[focusIndex];
                    IChain otherChain = other[otherIndex];

                    for (int focusAaIndex = 0; focusAaIndex < focusChain.Count; focusAaIndex++)
                    {
                        IAa aaFocus = focusChain[focusAaIndex];
                        for (int otherAaIndex = 0; otherAaIndex < otherChain.Count; otherAaIndex++)
                        {
                            IAa aaOther = otherChain[otherAaIndex];
                            Trace.Assert(aaFocus != aaOther);
                            if (AnyContact(aaFocus, aaOther, contactType))
                            {
                                selection.Aas.Add(aaFocus);
                                break;
                            }
                        }
                    }
                }
            }
            return(selection);
        }
Exemple #18
0
        public static Selection GetContactSelection(IChain[] chains, ContactType contactType = ContactType.Atomic)
        {
            Selection selection = new Selection();

            for (int chainIndex1 = 0; chainIndex1 < chains.Length - 1; chainIndex1++)
            {
                for (int chainIndex2 = chainIndex1 + 1; chainIndex2 < chains.Length; chainIndex2++)
                {
                    IChain chain1 = chains[chainIndex1];
                    IChain chain2 = chains[chainIndex2];
                    Trace.Assert(chain1 != chain2);

                    for (int aaIndex1 = 0; aaIndex1 < chain1.Count; aaIndex1++)
                    {
                        IAa aa1 = chain1[aaIndex1];
                        for (int aaIndex2 = 0; aaIndex2 < chain2.Count; aaIndex2++)
                        {
                            IAa aa2 = chain2[aaIndex2];
                            Trace.Assert(aa1 != aa2);

                            if (AnyContact(aa1, aa2, contactType))
                            {
                                selection.Aas.Add(aa1);
                                selection.Aas.Add(aa2);
                            }
                        }
                    }
                }
            }
            return(selection);
        }
 public DictionaryLP(int input)
 {
     mod           = input;
     hastValue     = new HashTechnique_2();
     DictionaryArr = new Node[input];
     this.chain    = new ChainLenierProbing(input);
 }
 public void ApplyTransactionSupport(IChain chain)
 {
     if (!chain.Middleware.OfType <TransactionalFrame>().Any())
     {
         chain.Middleware.Add(new TransactionalFrame());
     }
 }
Exemple #21
0
        public static List <SSBlock> GetPhiPsiSSBlocksOfType(IChain peptide, SS allowedTypes, int minStructureLength = 1)
        {
            List <SSBlock> list             = GetPhiPsiSSBlocks(peptide, minStructureLength);
            List <SSBlock> matchingTypeList = list.Where(block => (block.SS & allowedTypes) != 0).ToList();

            return(matchingTypeList);
        }
Exemple #22
0
        public static Matrix GetRmsdAndTransform(IChain move, int moveStart, int moveEnd, IChain stationary, int stationaryStart, int stationaryEnd, out float rmsd)
        {
            Matrix transform = Rmsd.GetRmsdTransformForResidues(move, moveStart, moveEnd, stationary, stationaryStart, stationaryEnd);

            rmsd = GetRmsdNCAC(transform, move, moveStart, moveEnd, stationary, stationaryStart, stationaryEnd);
            return(transform);
        }
Exemple #23
0
        public static float GetRmsdNCAC(IChain peptide1, int rangeStart1, int rangeEnd1, IChain peptide2, int rangeStart2, int rangeEnd2)
        {
            Matrix transform = Rmsd.GetRmsdTransformForResidues(peptide1, rangeStart1, rangeEnd1, peptide2, rangeStart2, rangeEnd2);
            float  rmsd      = GetRmsdNCAC(transform, peptide1, rangeStart1, rangeEnd1, peptide2, rangeStart2, rangeEnd2);

            return(rmsd);
        }
Exemple #24
0
        private static void VisitChain(IChain <MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor> c, MetadataTraverser mt)
        {
            Contract.Requires(c != null);
            Contract.Requires(mt != null);
            switch (c.Tag)
            {
            case ChainTag.Type:
            {
                Contract.Assume(c.Children != null, "The code makes such an assumption");
                foreach (var child in c.Children)
                {
                    VisitChain(child, mt);
                }
            }
            break;

            case ChainTag.Field:
            {
                Contract.Assume(c.Field.reference != null);
                mt.Traverse(c.Field.reference);
            }
            break;

            case ChainTag.Method:
            {
                Contract.Assume(c.Method.reference != null);
                mt.Traverse(c.Method.reference);
            }
            break;

            default:
                Contract.Assert(false, "switch should be exhaustive");
                break;
            }
        }
Exemple #25
0
        public static List <Vector3> GetHelixVectors(IChain peptide, IEnumerable <SSBlock> blocks)
        {
            List <Vector3> vectors = new List <Vector3>();

            foreach (SSBlock block in blocks.Where(b => b.SS == SS.Helix))
            {
                Vector3 start = peptide[block.Start][Aa.CA_].Xyz;
                Vector3 end   = peptide[block.End][Aa.CA_].Xyz;
                if (18 < block.Length)
                {
                    end = peptide[block.Start + 18][Aa.CA_].Xyz;
                }
                else if (11 < block.Length)
                {
                    end = peptide[block.Start + 11][Aa.CA_].Xyz;
                }
                else if (7 < block.Length)
                {
                    end = peptide[block.Start + 7][Aa.CA_].Xyz;
                }
                Vector3 vec = end - start;
                vectors.Add(vec);
            }
            return(vectors);
        }
Exemple #26
0
        public Engine(IoCContainer container)
        {
            _container = container;
#if DEBUG_REFERENCES
            SharpDX.Configuration.EnableObjectTracking     = true;
            SharpDX.Configuration.EnableReleaseOnFinalizer = true;
#endif
            IDeviceContextService deviceContextService = _container.Resolve <IDeviceContextService>();

            _form    = deviceContextService.Form;
            _context = deviceContextService.Context;

            _form.Icon         = Resources.openuo;
            _form.Text         = string.Format("OpenUO v{0}", new AssemblyInfo(Assembly.GetEntryAssembly()).Version);
            _form.ResizeBegin += OnResizeBegin;
            _form.ResizeEnd   += OnResizeEnd;
            _form.FormClosed  += OnFormClosed;

            _updateState = new UpdateState();
            _gameTime    = new GameTime();
            _world       = new World(container);

            container.Resolve <IConsole>().WriteLine("Testing 123");

            _config           = _container.Resolve <IConfiguration>();
            _updateChain      = _container.Resolve <IChain <UpdateState> >();
            _worldRenderChain = _container.Resolve <IWorldRenderChain>();
            _uiRenderChain    = _container.Resolve <IUIRenderChain>();

            _screenTarget = new DrawScreenTarget(_context);

            _updateChain.Freeze();
            _worldRenderChain.Freeze();
            _uiRenderChain.Freeze();
        }
Exemple #27
0
 public void UnionWith(IChain chain)
 {
     _chains.Add(chain);
     foreach (IAa aa in chain)
     {
         this.UnionWith(aa);
     }
 }
Exemple #28
0
 public void AppendTo(IChain parent)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     Parent = parent;
 }
Exemple #29
0
        public StopwatchFrame(IChain chain)
        {
            _chain = chain;

            // This frame creates a Stopwatch, so we
            // expose that fact to the rest of the generated method
            // just in case someone else wants that
            _stopwatch = new Variable(typeof(Stopwatch), "stopwatch", this);
        }
        public void ChainBuilt(IChain chain)
        {
            var subscriptionNotification = new ChainBuilderNotifier();
            var services  = new ChainBuilderSetupServices(subscriptionNotification);
            var chainFunc = this.newchainBuilder.BuildFunc(services);

            this.newChain = new Chain <TNewMessageType>(chainFunc, chain.Dispose);
            subscriptionNotification.Notify(this.newChain);
        }
Exemple #31
0
        public void GivenAListOfRules(Table table)
        {
            var rules = table.CreateSet<Rule>();
            chain = new Chain();
            rules.ToList().ForEach(r => { chain.Add(r); });

            chain["Rule 1"].Apply = (c) => c.Amount < 200;
            chain["Rule 2"].Apply = (c) => c.Amount > 400 && c.Amount < 600;
            chain["Rule 3"].Apply = (c) => c.Amount > 600 && c.Amount < 800;
            chain["Rule 4"].Apply = (c) => c.Amount > 800 && c.Amount < 1000;
            chain["Rule 5"].Apply = (c) => c.Amount > 1000;
        }
 public void SetCurrentChain(IChain chain)
 {
     if (_currentChain != chain)
     {
         listView1.Items.Clear();
         if ((_currentChain = chain) != null)
         {
             foreach (var frame in chain.GetFrames())
                 listView1.Items.Add(new CallStackListViewItem(frame));
         }
     }
     else
     {
         UpdateCurrentFrames();
     }
 }
 public void SetUp()
 {
     chain = new Chain();
 }
Exemple #34
0
 public void Add(IChain handler)
 {
     this.list.Add(handler);
 }
Exemple #35
0
 private void VisitChain(IChain<MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor> c) {
   Contract.Requires(c != null);
   switch (c.Tag) {
     case ChainTag.Type:
       var t = c.Type.reference.ResolvedType;
       this.thingsToKeep.Add(t);
       var ntr = t as INamespaceTypeReference;
       if (ntr != null) {
         this.AddUpwardNamespace(ntr.ContainingUnitNamespace);
       }
       foreach (var child in c.Children)
         this.VisitChain(child);
       break;
     case ChainTag.Field:
       this.thingsToKeep.Add(c.Field.reference.ResolvedField);
       break;
     case ChainTag.Method:
       var m = c.Method.reference.ResolvedMethod;
       this.thingsToKeep.Add(m);
       this.methodHashAttributes.Add(m, c.MethodHashAttribute);
       break;
     default:
       Contract.Assume(false, "switch should be exhaustive");
       break;
   }
 }
Exemple #36
0
        public Engine(IoCContainer container)
        {
            _container = container;
            #if DEBUG_REFERENCES
            SharpDX.Configuration.EnableObjectTracking = true;
            SharpDX.Configuration.EnableReleaseOnFinalizer = true;
            #endif
            IDeviceContextService deviceContextService = _container.Resolve<IDeviceContextService>();

            _form = deviceContextService.Form;
            _context = deviceContextService.Context;

            _form.Icon = Resources.openuo;
            _form.Text = string.Format("OpenUO v{0}", new AssemblyInfo(Assembly.GetEntryAssembly()).Version);
            _form.ResizeBegin += OnResizeBegin;
            _form.ResizeEnd += OnResizeEnd;
            _form.FormClosed += OnFormClosed;

            _updateState = new UpdateState();
            _gameTime = new GameTime();
            _world = new World(container);

            container.Resolve<IConsole>().WriteLine("Testing 123");

            _config = _container.Resolve<IConfiguration>();
            _updateChain = _container.Resolve<IChain<UpdateState>>();
            _worldRenderChain = _container.Resolve<IWorldRenderChain>();
            _uiRenderChain = _container.Resolve<IUIRenderChain>();

            _screenTarget = new DrawScreenTarget(_context);

            _updateChain.Freeze();
            _worldRenderChain.Freeze();
            _uiRenderChain.Freeze();
        }
Exemple #37
0
 // Defines the next Object to receive the
 // data if this one can't use it
 public void setNextChain(IChain nextChain)
 {
     nextInChain = nextChain;
 }
Exemple #38
0
 public Service(IInvoiceRepository invoiceRepository, IClientRepository clientRepository, IChain chain)
 {
     _invoiceRepository = invoiceRepository;
     _clientRepository = clientRepository;
     _chain = chain;
 }
Exemple #39
0
 public HDoc(IChain<HAttribute> attributes, IEnumerable<object> children)
     : base("html", attributes, children)
 {
 }
Exemple #40
0
 public void Initialize()
 {
     chain = new Chain();
 }
Exemple #41
0
        public MyChain4(IChain chain)
        {

        }
Exemple #42
0
        public MyChain2(IChain chain)
        {

        }
Exemple #43
0
        public MyChain(IChain chain)
        {

        }
Exemple #44
0
        public HElement(string name, IChain<HAttribute> attributes, IEnumerable<object> children)
            : base(children)
        {
            this.Name = name;

            if (attributes != null)
                Attributes = attributes.ToEnumerable ().Where (a => a.Value != null).ToList ();

            Validate ();
        }
 private static void VisitChain(IChain<MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor> c, MetadataTraverser mt) {
   Contract.Requires(c != null);
   Contract.Requires(mt != null);
   switch (c.Tag) {
     case ChainTag.Type:
       {
         Contract.Assume(c.Children != null, "The code makes such an assumption");
         foreach (var child in c.Children)
           VisitChain(child, mt);
       }
       break;
     case ChainTag.Field:
       {
         Contract.Assume(c.Field.reference != null);
         mt.Traverse(c.Field.reference);
       }
       break;
     case ChainTag.Method:
       {
         Contract.Assume(c.Method.reference!= null);
         mt.Traverse(c.Method.reference);
       }
       break;
     default:
       Contract.Assert(false, "switch should be exhaustive");
       break;
   }
 }