/// <summary> /// Initializes a new instance of the <see cref="Bootstrapper" /> class. /// </summary> /// <param name="name">The name of the project. Typically it is the name of the product to be installed.</param> /// <param name="items">The project installable items (e.g. directories, files, registry keys, Custom Actions).</param> public Bundle(string name, params ChainItem[] items) { WixExtensions.Add("WiXNetFxExtension"); WixExtensions.Add("WiXBalExtension"); Name = name; Chain.AddRange(items); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var keywords = new Dictionary <string, Func <string, string> > { ["capitalize"] = (input) => { return(input.Replace("e", "EE")); }, ["replace"] = (input) => { return(input.Replace("o", "O")); } }; string code = "capitalize replace"; var tokens = code.Split(' '); var chain = new Chain <string>(); chain.AddRange(tokens.Select(ix => keywords[ix])); var result = chain.Evaluate("join the revolution, capitalize and replace"); Console.WriteLine(result); }
/// <summary> /// Initializes a new instance of the <see cref="Bootstrapper" /> class. /// </summary> /// <param name="name">The name of the project. Typically it is the name of the product to be installed.</param> /// <param name="items">The project installable items (e.g. directories, files, registry keys, Custom Actions).</param> public Bundle(string name, params ChainItem[] items) { if (!Compiler.AutoGeneration.LegacyDefaultIdAlgorithm) { // in case of Bundle project just do nothing } this.Include(WixExtension.NetFx); this.Include(WixExtension.Bal); Name = name; Chain.AddRange(items); }
/// <summary> /// Initializes a new instance of the <see cref="Bootstrapper" /> class. /// </summary> /// <param name="name">The name of the project. Typically it is the name of the product to be installed.</param> /// <param name="items">The project installable items (e.g. directories, files, registry keys, Custom Actions).</param> public Bundle(string name, params ChainItem[] items) { if (!Compiler.AutoGeneration.LegacyDefaultIdAlgorithm) { // in case of Bundle project just do nothing } WixExtensions.Add("WiXNetFxExtension"); WixExtensions.Add("WiXBalExtension"); Name = name; Chain.AddRange(items); }
void LockedChainApply(List <Block> newChain) { var localTxs = Chain.SelectMany(x => x.Transactions); var remoteTxs = newChain.SelectMany(x => x.Transactions); var txNotIncludeRemote = localTxs.Where(tx => !remoteTxs.Any(x => x.Id.Equals(tx.Id))).ToArray(); lock (TransactionPool) { var txIds = TransactionPool.GetPool().Select(x => x.Id) .Where(x => remoteTxs.Any(tx => x.Equals(tx.Id))).ToArray(); TransactionPool.RemoveTxs(txIds); TransactionPool.AddTxs(txNotIncludeRemote); } lock (Chain) { Chain.Clear(); Chain.AddRange(newChain); } UpdateUtxos(); Applied?.Invoke(); }
/// <summary> /// Tests whether either N fused to C or C fused to N has a valid combination. If both are being tested, the function /// returns whether either has a valid combination /// </summary> /// <param name="multiplicity"></param> /// <param name="cn"></param> /// <param name="other"></param> /// <param name="alignment"></param> /// <param name="ntermCnTest"></param> /// <param name="ctermCnTest"></param> /// <param name="minSubstructureLength"></param> /// <returns></returns> public static bool TestClashCn(int multiplicity, IStructure cn, IStructure other, TransformSequenceAlignment alignment, bool ntermCnTest = true, bool ctermCnTest = true, int minSubstructureLength = 0) { Trace.Assert(minSubstructureLength >= 0); IChain cnChain = cn[alignment.ChainIndex1]; IChain otherChain = other[alignment.ChainIndex2]; if (ntermCnTest) { int finalOtherIndex = Math.Min(otherChain.Count - 1, alignment.Range2.End + minSubstructureLength - 1); Trace.Assert(alignment.Range1.Start < cnChain.Count); Trace.Assert(0 <= alignment.Range2.End && alignment.Range2.End < otherChain.Count && finalOtherIndex < otherChain.Count); IChain copyCn = new Chain(cnChain[0, alignment.Range1.Start]); IChain copyOther = new Chain(otherChain[alignment.Range2.End, finalOtherIndex], true); copyOther.Transform(alignment.Align2); if (!Clash.AnyContact(copyCn, copyOther, Clash.ContactType.MainchainMainchainClash)) { copyCn.AddRange(copyOther); AxisPattern <IChain> pattern = new AxisPattern <IChain>(Vector3.UnitZ, multiplicity, copyCn); IChain[] neighbors = pattern[1, multiplicity - 1].ToArray(); //IChain[] pattern = CxUtilities.Pattern(copyCn, Vector3.UnitZ, multiplicity, new int[] { 0 }, true); if (!Clash.AnyContact(new IChain[] { copyCn }, neighbors, Clash.ContactType.MainchainMainchainClash)) { return(false); } } } if (ctermCnTest) { int firstOtherIndex = Math.Max(0, alignment.Range2.Start - minSubstructureLength + 1); Trace.Assert(0 <= alignment.Range1.End && alignment.Range1.End < cnChain.Count); Trace.Assert(0 <= firstOtherIndex && firstOtherIndex < otherChain.Count && alignment.Range2.Start < otherChain.Count); IChain copyCn = new Chain(cnChain[alignment.Range1.End, cnChain.Count - 1]); IChain copyOther = new Chain(otherChain[firstOtherIndex, alignment.Range2.Start], true); copyOther.Transform(alignment.Align2); if (!Clash.AnyContact(copyCn, copyOther, Clash.ContactType.MainchainMainchainClash)) { copyCn.AddRange(copyOther); AxisPattern <IChain> pattern = new AxisPattern <IChain>(Vector3.UnitZ, multiplicity, copyCn); IChain[] neighbors = pattern[1, multiplicity - 1].ToArray(); //IChain[] pattern = CxUtilities.Pattern(copyCn, Vector3.UnitZ, multiplicity, new int[] { 0 }, true); if (!Clash.AnyContact(new IChain[] { copyCn }, neighbors, Clash.ContactType.MainchainMainchainClash)) { return(false); } } } return(true); }