public bool RemoveEmptyTrailingComponents() { try { for (var eachComponent = ComponentList.Count - 1; eachComponent >= 0; eachComponent--) { if (ComponentList[eachComponent].Value == "") { ComponentList.Remove(ComponentList[eachComponent]); } else { break; } } return(true); } catch (Exception ex) { throw new HL7Exception("Error removing trailing comonents - " + ex.Message); } }
public void RemoveObject(GameObject go) { if (go == null) { throw new BeyondException("GameObject is null"); } if (GroupObject == null) { throw new BeyondException("GroupObject is null"); } BeyondComponent bc = go.GetComponent <BeyondComponent>(); if (bc == null) { throw new BeyondException("No Beyond Component attached to GameObject"); } bc.UnSetGroupPosition(); go.transform.SetParent(null); ComponentList.Remove(bc); }
protected void BindComponentList() { List <KitComponent> components = new List <KitComponent>(); foreach (ProductKitComponent pkc in _Product.ProductKitComponents) { KitComponent kc = pkc.KitComponent; if (kc != null) { kc.RemoveInvalidKitProducts(); components.Add(kc); } } if (components.Count > 0) { if (_Kit == null) { // WE MUST HAVE KIT TO BIND COMPONENTS _Kit = new Kit(_Product, false); _Kit.Save(); } ComponentList.DataSource = components; ComponentList.DataBind(); SortComponents.Visible = (components.Count > 1); PriceRange.Text = string.Format("{0} - {1}", _Kit.MinPrice.LSCurrencyFormat("lc"), _Kit.MaxPrice.LSCurrencyFormat("lc")); DefaultPrice.Text = _Kit.DefaultPrice.LSCurrencyFormat("lc"); WeightRange.Text = string.Format("{0:F2} - {1:F2}", _Kit.MinWeight, _Kit.MaxWeight); DefaultWeight.Text = string.Format("{0:F2}", _Kit.DefaultWeight); ExistingKitPanel.Visible = true; NewKitPanel.Visible = false; } else { ExistingKitPanel.Visible = false; NewKitPanel.Visible = true; } }
protected override Stream UnParse() { long posn; MemoryStream s = new MemoryStream(); BinaryWriter w = new BinaryWriter(s); w.Write(format); posn = s.Position; w.Write((uint)0); w.Write((uint)0); if (components == null) { components = new ComponentList(OnResourceChanged); } components.UnParse(s); if (tgiBlocks == null) { tgiBlocks = new TGIBlockList(OnResourceChanged); } if (componentData == null) { componentData = new ComponentDataList(OnResourceChanged, tgiBlocks); } componentData.UnParse(s); w.Write(unknown1); tgiBlocks.UnParse(s, posn); s.Flush(); return(s); }
static Weapons() { WeaponHashes = WeaponList.Select(weapon => (uint)API.GetHashKey(weapon)).ToArray(); ComponentHashes = ComponentList.Select(component => (uint)API.GetHashKey(component)).ToArray(); }
public void AddComponentToList(byte index, string name) { ComponentList.Add(new Component(index, name)); }
public void visitComponentList(ComponentList cl) { throw new NotImplementedException(); }
/// <summary> /// 获取方法包中的所有性质 /// </summary> /// <returns></returns> public ComponentList GetComponents() { ComponentList clst = new ComponentList(); if (this.IdModels != null && this.IdModels.Count > 0) { foreach (var m in this.IdModels) { if (m.SpecLib != null && m.SpecLib.FirstOrDefault() != null) { foreach (var c in m.SpecLib.FirstOrDefault().Components) { if (!clst.Contains(c.Name)) { clst.Add(c); } } } } } if (this.FitModels != null && this.FitModels.Count > 0) { foreach (var m in this.FitModels) { if (m.SpecLib != null && m.SpecLib.FirstOrDefault() != null) { foreach (var c in m.SpecLib.FirstOrDefault().Components) { if (!clst.Contains(c.Name)) { clst.Add(c); } } } } } if (this.PLS != null && this.PLS.SubModels != null) { foreach (var m in this.PLS.SubModels) { if (!clst.Contains(m.Comp.Name)) { clst.Add(m.Comp); } } } if (this.Itg != null) { foreach (var c in this.Itg.Comps) { if (!clst.Contains(c.Name)) { clst.Add(c); } } } return(clst); //return clst.Count == 0 ? null : clst; }
private ComponentList iceComponents() { ComponentList components = new ComponentList(); if(chkFreeze.Checked) { components.Add("Freeze"); } if(chkGlacier2.Checked) { components.Add("Glacier2"); } if(chkIceBox.Checked) { components.Add("IceBox"); } if(chkIceGrid.Checked) { components.Add("IceGrid"); } if(chkIcePatch2.Checked) { components.Add("IcePatch2"); } if(chkIceSSL.Checked) { components.Add("IceSSL"); } if(chkIceStorm.Checked) { components.Add("IceStorm"); } return components; }
public Configuration(string name, Vector2 size) { Name = name; Transform = new Transform(default(Vector2), size); Components = new ComponentList( ); }
protected LayoutComponent(LayoutComponent prototype) : base(prototype) { m_children = prototype.m_children.Clone(); }
public void visitComponentList(ComponentList cl) { _program = cl; }
public override string SerializeValue() { if (IsDelimiters) { return(Value); } if (HasRepetitions) { var serialized = new StringBuilder(); serialized.Append(string.Join(Encoding.RepeatDelimiter.ToString(), RepetitionList.Select(rep => rep.SerializeValue()))); return(serialized.ToString()); } else { var serialized = new StringBuilder(); serialized.Append(string.Join(Encoding.ComponentDelimiter.ToString(), ComponentList.Select(com => com.SerializeValue()))); return(serialized.ToString()); } }
private LayoutComponent(string category, string name, FabricStyleList fabricStyles, ComponentParameterCollection parameters) : base(TypeName, category, name, fabricStyles, parameters) { m_children = new ComponentList(); }
public AstJsonVisitor(ComponentList graph) { _nodeStack = new Stack <GraphNode>(); _graph = new Graph(); graph.accept(this); }
private void Start() { m_ChopsLeft = m_ChopsToFell; ComponentList.OnStart(this); }
private void OnDestroy() { ComponentList.OnEnd(this); }
private static void setDotNetDevPath(string csBinPath) { string devPath = Environment.GetEnvironmentVariable("DEVPATH"); if(String.IsNullOrEmpty(devPath)) { Environment.SetEnvironmentVariable("DEVPATH", csBinPath); return; } if(devPath.Contains(csBinPath)) { ComponentList list = new ComponentList(csBinPath.Split(Path.PathSeparator)); list.Remove(csBinPath); devPath = list.ToString(Path.PathSeparator); } devPath = csBinPath + Path.PathSeparator + devPath; devPath = devPath.Trim(Path.PathSeparator); Environment.SetEnvironmentVariable("DEVPATH", devPath); }
public Entity AddComponent(Component component) { ComponentList.Add(component.GetType(), component); component.Owner = this; return(this); }
public List <IntegrateResultItem> Predict(Spectrum spec, bool needFilter = true, int numOfId = 5, int topK = 1) { foreach (var c in this._comps) { c.PredictedValue = 0; } ComponentList idresult = this._comps.Clone(); ComponentList fitresult = this._comps.Clone(); ComponentList pls1result = this._comps.Clone(); ComponentList plsannresult = this._comps.Clone(); IdentifyItem[][] idobj = new IdentifyItem[this._comps.Count][]; FittingResult[] fitobj = new FittingResult[this._comps.Count]; PLS1Result[] pls1obj = new PLS1Result[this._comps.Count]; PLS1Result[] annobj = new PLS1Result[this._comps.Count]; int[] groupidid = new int[this._comps.Count]; int[] groupfitid = new int[this._comps.Count]; double[] idTQ = new double[this._comps.Count]; double[] fitTQ = new double[this._comps.Count]; double[] idSQ = new double[this._comps.Count]; double[] fitSQ = new double[this._comps.Count]; bool[] okid = new bool[this._comps.Count]; bool[] okfit = new bool[this._comps.Count]; bool[] okpls1 = new bool[this._comps.Count]; bool[] okann = new bool[this._comps.Count]; bool[] innerPLs1 = new bool[this._comps.Count]; bool[] innerAnn = new bool[this._comps.Count]; double[] minIdTQ = new double[this._comps.Count]; double[] minFitTQ = new double[this._comps.Count]; double[] minIdSQ = new double[this._comps.Count]; double[] minFitSQ = new double[this._comps.Count]; DateTime dt = DateTime.Now; if (this.IdModels != null && this.IdModels.Count > 0) { var ilst = new List <IdentifyResult>(); foreach (var i in this.IdModels) { ilst.Add(i.Predict(spec, needFilter, numOfId, topK)); } var group = this._idSelectMatrix.Select((d, i) => new { idx = i, d = d }).GroupBy(d => d.d); foreach (var g in group) { var a = new List <IdentifyItem>(); for (int i = 0; i < this.IdModels.Count; i++) { var d = (int)Math.Pow(2, i); if ((d & g.Key) == d) { a.AddRange(ilst[i].Items); } } //找识别出来的 var clst = a.OrderByDescending(d => d.Result).ThenByDescending(d => d.TQ); //取识别结果的明细 var idgobj = clst.Take(10).ToArray();//需要修改 if (clst.Count() > 0) { var idtrue = clst.Where(d => d.Result); foreach (var i in g) { minIdTQ[i.idx] = clst.First().TQ; minIdSQ[i.idx] = clst.First().SQ; var allc = idtrue.Select(d => d.Spec.Components).Where(d => d.Contains(idresult[i.idx].Name)).Select(d => d[idresult[i.idx].Name].ActualValue).Take(numOfId); if (allc.Count() > 0) { okid[i.idx] = true; idresult[i.idx].PredictedValue = allc.Sum() / allc.Count(); } else { var cs = clst.First().Spec.Components; idresult[i.idx].PredictedValue = cs.Contains(idresult[i.idx].Name) ? cs[idresult[i.idx].Name].ActualValue : double.NaN; } idobj[i.idx] = idgobj; groupidid[i.idx] = g.Key; idTQ[i.idx] = this.IdModels.First().TQ; idSQ[i.idx] = this.IdModels.First().MinSQ; } } } } log.InfoFormat("识别库花费{0}s,共{1}个", (DateTime.Now - dt).TotalSeconds, this.IdModels.Count); dt = DateTime.Now; if (this.FitModels != null && this.FitModels.Count > 0) { var group = this._fitSelectMatrix.Select((d, i) => new { idx = i, d = d }).GroupBy(d => d.d); var ilst = new List <FittingResult>(); int gidx = -1; foreach (var g in group) { gidx++; if (this._cacheFitModel == null) { this._cacheFitModel = new List <FittingModel>(); } if (this._cacheFitModel.Count < gidx + 1) { var models = new List <FittingModel>(); for (int i = 0; i < this.FitModels.Count; i++) { var d = (int)Math.Pow(2, i); if ((d & g.Key) == d) { models.Add(this.FitModels[i]); } } if (models.Count == 0) { continue; } var idxmax = models.Select(d => d.SpecLib.Count).Select((d, i) => new { idx = i, d = d }).OrderByDescending(d => d.d).First().idx; var m = Serialize.DeepClone <FittingModel>(models[idxmax]); //合并 DateTime dtn = DateTime.Now; for (int i = 0; i < models.Count; i++) { if (i != idxmax) { m.SpecLib.Merger(models[i].SpecLib); } } log.InfoFormat("merger spend {0}s", (DateTime.Now - dtn).TotalSeconds); dtn = DateTime.Now; this._cacheFitModel.Add(m); } var dddt = DateTime.Now; var fresult = this._cacheFitModel[gidx].Predict(spec, needFilter, numOfId, topK); log.InfoFormat("fit predict spend {0}s", (DateTime.Now - dddt).TotalSeconds); foreach (var i in g) { minFitTQ[i.idx] = fresult.TQ; minFitSQ[i.idx] = fresult.SQ; okfit[i.idx] = fresult.Result; var cs = fresult.FitSpec.Components; fitresult[i.idx].PredictedValue = cs.Contains(fitresult[i.idx].Name) ? cs[fitresult[i.idx].Name].PredictedValue : double.NaN; fitobj[i.idx] = fresult; groupfitid[i.idx] = g.Key; fitTQ[i.idx] = this._cacheFitModel[gidx].TQ; fitSQ[i.idx] = this._cacheFitModel[gidx].MinSQ; } } } log.InfoFormat("拟合库花费{0}s,共{1}个", (DateTime.Now - dt).TotalSeconds, this.FitModels.Count); dt = DateTime.Now; if (this.Pls1Models != null && this.Pls1Models.Count > 0) { foreach (var m in this.Pls1Models) { var idx = pls1result.GetIndex(m.Comp.Name); if (idx >= 0) { var pre = m.Predict(spec, needFilter); pls1result[idx].PredictedValue = pre.Comp.PredictedValue; okpls1[idx] = pre.Comp.State != ComponentStatu.Red; innerPLs1[idx] = pre.Comp.State == ComponentStatu.Pass; pls1obj[idx] = pre; } } } log.InfoFormat("PLS1花费{0}s,共{1}个", (DateTime.Now - dt).TotalSeconds, this.Pls1Models.Count); dt = DateTime.Now; if (this.PlsANNModels != null && this.PlsANNModels.Count > 0) { foreach (var m in this.PlsANNModels) { var idx = plsannresult.GetIndex(m.Comp.Name); if (idx >= 0) { var pre = m.Predict(spec, needFilter); plsannresult[idx].PredictedValue = pre.Comp.PredictedValue; okann[idx] = pre.Comp.State != ComponentStatu.Red; innerAnn[idx] = pre.Comp.State == ComponentStatu.Pass; annobj[idx] = pre; } } } log.InfoFormat("PLSANN花费{0}s,共{1}个", (DateTime.Now - dt).TotalSeconds, this.PlsANNModels.Count); //开始算系数 var result = new List <IntegrateResultItem>(); for (int i = 0; i < this._comps.Count; i++) { var c = this._comps[i]; var r = new IntegrateResultItem() { Comp = c.Clone(), MinFitTQ = minFitTQ[i] == 0 ? double.NaN : minFitTQ[i], MinIdTQ = minIdTQ[i] == 0 ? double.NaN : minIdTQ[i], MinFitSQ = minFitSQ[i] == 0 ? double.NaN : minFitSQ[i], MinIdSQ = minIdSQ[i] == 0 ? double.NaN : minIdSQ[i] }; r.PrimalWID = this._weights[i, 0]; r.PrimalWFit = this._weights[i, 1]; r.PrimalWPLS1 = this._weights[i, 2]; r.PrimalWANN = this._weights[i, 3]; //取系数 r.IdWeight = this._weights[i, 0] > 0 ? this._weights[i, 0] : double.NaN; r.FitWeight = this._weights[i, 1] > 0 ? this._weights[i, 1] : double.NaN; r.Pls1Weight = this._weights[i, 2] > 0 ? this._weights[i, 2] : double.NaN; r.ANNWeight = this._weights[i, 3] > 0 ? this._weights[i, 3] : double.NaN; //取值 r.IdOk = okid[i]; r.FitOk = okfit[i]; r.PLS1Ok = okpls1[i]; r.ANNOk = okann[i]; r.InnerANN = innerAnn[i]; r.InnerPLS = innerPLs1[i]; r.IdValue = idresult[c.Name].PredictedValue; r.FitValue = fitresult[c.Name].PredictedValue; r.Pls1Value = okpls1[i] ? pls1result[c.Name].PredictedValue : double.NaN; r.ANNValue = okann[i] ? plsannresult[c.Name].PredictedValue : double.NaN; r.IdResult = idobj[i]; r.FitResult = fitobj[i]; r.Pls1Result = pls1obj[i]; r.AnnResult = annobj[i]; r.GroupIDID = groupidid[i]; r.GroupFitID = groupfitid[i]; r.IDSQ = idSQ[i]; r.IDTQ = idTQ[i]; r.FitSQ = fitSQ[i]; r.FitTQ = fitTQ[i]; //计算最终结果 bool failid = r.IdResult != null && okid[i] == false; bool failfit = r.FitResult != null && okfit[i] == false; bool failpls1 = r.Pls1Result != null && okpls1[i] == false; bool failann = r.AnnResult != null && okann[i] == false; //修改修改权重 if (failid && (r.FitResult != null || r.Pls1Result != null || r.AnnResult != null)) { r.IdWeight = double.NaN; } if (failfit && (okid[i] || okpls1[i] || okann[i] || r.Pls1Result != null || r.AnnResult != null)) { r.FitWeight = double.NaN; } if (failpls1 && (okid[i] || okfit[i] || okann[i])) { r.Pls1Weight = double.NaN; } if (failann && (okid[i] || okfit[i] || okpls1[i])) { r.ANNWeight = double.NaN; } //求总合 double sumweight = double.Epsilon; if (!double.IsNaN(r.IdWeight)) { sumweight += r.IdWeight; } if (!double.IsNaN(r.FitWeight)) { sumweight += r.FitWeight; } if (!double.IsNaN(r.Pls1Weight)) { sumweight += r.Pls1Weight; } if (!double.IsNaN(r.ANNWeight)) { sumweight += r.ANNWeight; } //乘系统 if (!double.IsNaN(r.IdWeight)) { r.IdWeight = r.IdWeight * (100 / sumweight); } if (!double.IsNaN(r.FitWeight)) { r.FitWeight = r.FitWeight * (100 / sumweight); } if (!double.IsNaN(r.Pls1Weight)) { r.Pls1Weight = r.Pls1Weight * (100 / sumweight); } if (!double.IsNaN(r.ANNWeight)) { r.ANNWeight = r.ANNWeight * (100 / sumweight); } if (r.IdWeight < 0.00001) { r.IdWeight = double.NaN; } if (r.FitWeight < 0.00001) { r.FitWeight = double.NaN; } if (r.Pls1Weight < 0.00001) { r.Pls1Weight = double.NaN; } if (r.ANNWeight < 0.00001) { r.ANNWeight = double.NaN; } double sum = 0; if (!double.IsNaN(r.IdWeight)) { sum += r.IdValue * r.IdWeight; } if (!double.IsNaN(r.FitWeight)) { sum += r.FitValue * r.FitWeight; } if (!double.IsNaN(r.Pls1Weight)) { sum += r.Pls1Value * r.Pls1Weight; } if (!double.IsNaN(r.ANNWeight)) { sum += r.ANNValue * r.ANNWeight; } r.Comp.PredictedValue = sum / 100;//转换百分比 result.Add(r); } return(result); }
private ComponentList iceComponents() { ComponentList components = new ComponentList(); if(chkGlacier2.Checked) { components.Add("Glacier2"); } if(chkIceBox.Checked) { components.Add("IceBox"); } if(chkIceGrid.Checked) { components.Add("IceGrid"); } if(chkIcePatch2.Checked) { components.Add("IcePatch2"); } if(!_compactFramework) { if(chkIceSSL.Checked) { components.Add("IceSSL"); } } if(chkIceStorm.Checked) { components.Add("IceStorm"); } return components; }
private void chkEnableBuilder_CheckedChanged(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if(editingIncludeDir()) { endEditIncludeDir(true); } if(_initialized) { _initialized = false; setEnabled(chkEnableBuilder.Checked); ComponentList components; if(chkEnableBuilder.Checked) { // // Enable the components that were previously enabled if any. // components = new ComponentList(Util.getProjectProperty(_project, Util.PropertyIceComponents)); // // If there isn't a previous set of componets, we enable the default components. // if(components.Count == 0) { components.Add("Ice"); components.Add("IceUtil"); } for(int i = 0; i < components.Count; ++i) { checkComponent(components[i], true); } } else { components = iceComponents(); } // // Enable / Disable the given set of components // for(int i = 0; i < components.Count; ++i) { checkComponent(components[i], chkEnableBuilder.Checked); } chkEnableBuilder.Enabled = true; _initialized = true; needSave(); } Cursor = Cursors.Default; } catch(Exception ex) { Cursor = Cursors.Default; Util.unexpectedExceptionWarning(ex); throw; } }
public PDFChooseWhenList(ComponentList inner) : base(inner) { }
public IntegratePropertyResult Predict(Spectrum spec, bool needFilter = true) { IntegratePropertyResult result = new IntegratePropertyResult() { FitRate = this.FitRate, IDRate = this.IDRate, PLS1Rate = this.PLS1Rate, PLSANNRate = this.PLSANNRate, Comp = this._comp.Clone() }; if (this._comp == null)//性质为空,则返回NULL { return(null); } if (this._pls1 != null && this._pls1.Comp.Name == this._comp.Name) { result.PLS1Result = this._pls1.Predict(spec, needFilter); } if (this._plsann != null && this._plsann.Comp.Name == this._comp.Name) { result.PLSANNResult = this._plsann.Predict(spec, needFilter); } //识别 if (this._identify != null && this._identify.Count > 0) { foreach (var i in this._identify) { if (i.SpecLib.Components.Contains(this._comp.Name)) { result.IDResult = BindModel.CombineIdResult(result.IDResult, i.Predict(spec, needFilter)); } } //过滤其它性质 ComponentList clst = new ComponentList(); foreach (var c in result.IDResult.Components) { if (c.Name == this._comp.Name) { clst.Add(c.Clone()); break; } } foreach (var s in result.IDResult.Items) { var c = s.Spec.Components[this._comp.Name].Clone(); s.Spec.Components = new ComponentList(); s.Spec.Components.Add(c); } result.IDResult.Components = clst; } //拟合 if (this._fittings != null && this._fittings.Count > 0) { var fitmodel = Serialize.DeepClone <FittingModel>(this._fittings.First()); for (int i = 1; i < this._fittings.Count; i++) { if (this._fittings[i].SpecLib.Components.Contains(this._comp.Name)) { fitmodel.SpecLib.Merger(this._fittings[i].SpecLib); } } result.FitResult = fitmodel.Predict(spec, needFilter); //过滤其它性质 ComponentList clst = new ComponentList(); foreach (var c in result.FitResult.FitSpec.Components) { if (c.Name == this._comp.Name) { clst.Add(c.Clone()); break; } } result.FitResult.FitSpec.Components = clst; foreach (var s in result.FitResult.Specs) { var c = s.Spec.Components[this._comp.Name].Clone(); s.Spec.Components = new ComponentList(); s.Spec.Components.Add(c); } } return(result); }
public Entity() { Components = new ComponentList(this); }
private async void Search_Click(object sender, System.EventArgs e) { try { var dictionary = new List <KeyValuePair <string, object> >(); foreach (var child in OptionPanel.Controls) { if (child is IBaseOption option) { dictionary.AddRange(option.Dictionary .Select(x => new KeyValuePair <string, object>(x.Item1, x.Item2))); } } IEnumerable <BaseComponent> components = null; switch (ComponentTypeEnumeration) { case ComponentTypeEnumeration.CPU: var resultCPUs = await APIContext.CPUs.Get(dictionary); components = resultCPUs.Data; break; case ComponentTypeEnumeration.RAM: var resultRAMs = await APIContext.RAMs.Get(dictionary); components = resultRAMs.Data; break; case ComponentTypeEnumeration.GPU: var resultGPUs = await APIContext.GPUs.Get(dictionary); components = resultGPUs.Data; break; case ComponentTypeEnumeration.PowerUnit: var resultPowerUnits = await APIContext.PowerUnits.Get(dictionary); components = resultPowerUnits.Data; break; case ComponentTypeEnumeration.Motherboard: var resultMotherboards = await APIContext.Motherboards.Get(dictionary); components = resultMotherboards.Data; break; case ComponentTypeEnumeration.HDD: var resultHDDs = await APIContext.HDDs.Get(dictionary); components = resultHDDs.Data; break; case ComponentTypeEnumeration.SSD: var resultSSDs = await APIContext.SSDs.Get(dictionary); components = resultSSDs.Data; break; } var componentListPage = new ComponentList(Assembly, components); componentListPage.GoBackClicked += (o, a) => { this.ParentForm.Controls.Remove(componentListPage); this.Visible = true; }; this.Visible = false; this.ParentForm.Controls.Add(componentListPage); } catch (Exception ex) { } }
public bool HasComponent(int componentID) { return((ComponentList != default) && ComponentList.Contains(componentID)); }
public DFGVisitor(ComponentList program, bool isVerification) { _isParent = true; _initialise(program, null, null, null, null, null, null, isVerification); }
public void setParent(ComponentList parent) { m_parent = parent; }
// // Apply unsaved changes, returns true if new settings are all applied correctly, // otherwise returns false. // private bool apply() { if(!hasUnsavedChanges()) { return true; // Nothing to do. } try { if(editingIncludeDir()) { endEditIncludeDir(true); } // // This must be the first setting to be updated, as other settings cannot be // updated if the add-in is disabled. // if(chkEnableBuilder.Checked && !Util.isSliceBuilderEnabled(_project)) { Util.addBuilderToProject(_project, iceComponents()); _initialized = false; load(); _initialized = true; // There aren't other changes at this point, we have just enabled the add-in. return true; } bool development = Util.developmentMode(_project); ComponentList components = new ComponentList(); if(chkGlacier2.Checked != Util.hasDotNetReference(_project, "Glacier2")) { componentChanged("Glacier2", chkGlacier2.Checked, development); if(!chkGlacier2.Checked) { components.Add("Glacier2"); } } if(chkIceBox.Checked != Util.hasDotNetReference(_project, "IceBox")) { componentChanged("IceBox", chkIceBox.Checked, development); if(!chkIceBox.Checked) { components.Add("IceBox"); } } if(chkIceGrid.Checked != Util.hasDotNetReference(_project, "IceGrid")) { componentChanged("IceGrid", chkIceGrid.Checked, development); if(!chkIceGrid.Checked) { components.Add("IceGrid"); } } if(chkIcePatch2.Checked != Util.hasDotNetReference(_project, "IcePatch2")) { componentChanged("IcePatch2", chkIcePatch2.Checked, development); if(!chkIcePatch2.Checked) { components.Add("IcePatch2"); } } if(!_compactFramework) { if(chkIceSSL.Checked != Util.hasDotNetReference(_project, "IceSSL")) { componentChanged("IceSSL", chkIceSSL.Checked, development); if(!chkGlacier2.Checked) { components.Add("IceSSL"); } } } if(chkIceStorm.Checked != Util.hasDotNetReference(_project, "IceStorm")) { componentChanged("IceStorm", chkIceStorm.Checked, development); if(!chkGlacier2.Checked) { components.Add("IceStorm"); } } // // This must be the last setting to be updated, as we want to update // all other settings and that isn't possible if the builder is disabled. // if(!chkEnableBuilder.Checked && Util.isSliceBuilderEnabled(_project)) { Util.removeBuilderFromProject(_project, components); _initialized = false; load(); _initialized = true; } return true; } finally { needSave(); // Call needSave to update apply button status } }
public QueryServices.Body.NodeList.NodeSeq.ComponentList setComponentList(ComponentList value) { m_ComponentRec.Clear(); for (int i = 0; i < value.m_ComponentRec.Count; i++) { m_ComponentRec.Add(value.m_ComponentRec[i]); m_ComponentRec[i].setParent(this); } return(this); }
public SystemMethodExecutor(Type type, MethodInfo m) { _type = type; var componentList = new ComponentList(); var parms = m.GetParameters(); var method = new DynamicMethod("Execute", null, new Type[] { typeof(object), typeof(int), typeof(void **) }); var gen = method.GetILGenerator(); var i = gen.DeclareLocal(typeof(int)); var b = gen.DeclareLocal(typeof(bool)); var arrays = new LocalBuilder[parms.Length]; for (var k = 0; k < parms.Length; k++) { arrays[k] = gen.DeclareLocal(parms[k].ParameterType); } var end = gen.DefineLabel(); var top = gen.DefineLabel(); //init component type pointers for (var k = 0; k < parms.Length; k++) { gen.Emit(OpCodes.Ldarg_2); if (k > 0) { gen.Emit(OpCodes.Sizeof, typeof(void *)); gen.Emit(OpCodes.Add); } gen.Emit(OpCodes.Ldind_I); gen.Emit(OpCodes.Stloc, arrays[k].LocalIndex); } //i = 0 gen.Emit(OpCodes.Ldc_I4_0); gen.Emit(OpCodes.Stloc, i.LocalIndex); gen.Emit(OpCodes.Br_S, end); // //for loop gen.MarkLabel(top); gen.Emit(OpCodes.Ldarg_0); //systemtest for (var k = 0; k < parms.Length; k++) { var pType = parms[k].ParameterType; var dataType = pType.GetElementType(); //load component ptr gen.Emit(OpCodes.Ldloc, arrays[k].LocalIndex); // gen.Emit(OpCodes.Ldarg_2); // if (k > 0) // { // gen.Emit(OpCodes.Ldc_I4, k); // gen.Emit(OpCodes.Sizeof, typeof(void*)); // gen.Emit(OpCodes.Mul); // gen.Emit(OpCodes.Add); // } // gen.Emit(OpCodes.Ldind_I); //load i gen.Emit(OpCodes.Ldloc, i.LocalIndex); gen.Emit(OpCodes.Conv_I); //increment pointer by index of i gen.Emit(OpCodes.Sizeof, dataType); gen.Emit(OpCodes.Mul); gen.Emit(OpCodes.Add); if (!componentList.TryAddComponent(dataType, out var componentType)) { return; //invalid type } if (!_componentTypes.Add(componentType)) { return; //duplicate type } //check if we are read only (finally a decent way to enforce read only pointers!) if (pType.GetCustomAttribute <System.Runtime.InteropServices.InAttribute>() != null) { _readComponents.Add(componentType); } else { _writeComponents.Add(componentType); } } //call method gen.Emit(OpCodes.Call, m); //i++ gen.Emit(OpCodes.Ldloc, i.LocalIndex); gen.Emit(OpCodes.Ldc_I4_1); gen.Emit(OpCodes.Add); gen.Emit(OpCodes.Stloc, i.LocalIndex); //i < length gen.MarkLabel(end); gen.Emit(OpCodes.Ldloc, i.LocalIndex); gen.Emit(OpCodes.Ldarg_1); gen.Emit(OpCodes.Clt); gen.Emit(OpCodes.Stloc, b.LocalIndex); gen.Emit(OpCodes.Ldloc, b.LocalIndex); gen.Emit(OpCodes.Brtrue_S, top); gen.Emit(OpCodes.Ret); Execute = (Executor)method.CreateDelegate(typeof(Executor)); Spec = new EntitySpec(_componentTypes.ToArray()); }
private void AddFunc() { ComponentList pl = new ComponentList(); pl.title = txt_title.Text; pl.img = txt_img.Text; pl.mainstyle = txt_mainstyle.Text; pl.memo = txt_memo.Text; pl.pagetype = ddl_pagetype.SelectedValue; pl.titlestyle = txt_titlestyle.Text; string jpath = @"\json\ComponentList.json"; List<ComponentList> pll = GetJsonToObject<List<ComponentList>>(jpath); pl.id = pll.Count + 1; pll.Add(pl); //保存修改 string s1 = JsonSerializer<List<ComponentList>>(pll); Write(CurrentPath + "\\" + jpath, s1); Product product = new Product(); product.id = pll.Count; string jpath2 = @"\json\Components\Component" + product.id + ".json"; product.date = DateTime.Now.ToLongDateString(); product.content = txt_content.Text; string s2 = JsonSerializer<List<Product>>(new List<Product>() { product }); Write(CurrentPath + "\\" + jpath2, s2); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>successCallback('添加成功!');</script>"); // Alert("添加成功!"); }
public void removeBuilderFromProject(Project project, ComponentList components) { cleanProject(project, true); if(Util.isCppProject(project)) { Util.removeIceCppConfigurations(project); Util.setProjectProperty(project, Util.PropertyIceComponents, components.ToString()); } else if(Util.isCSharpProject(project)) { if(Util.isSilverlightProject(project)) { Util.removeDotNetReference(project, "IceSL"); } else { Util.removeDotNetReference(project, "Ice"); } } Util.setProjectProperty(project, Util.PropertyIceComponents, components.ToString()); Util.setProjectProperty(project, Util.PropertyIce, false.ToString()); }
public void setComponentList(ComponentList value) { m_ComponentList = value; setParentPresenceVector(); }
// // Enable Slice builder for the project, and enable the components that are // in components. If components list is empty, the default set of components // are added to the project. // // Note: Components in this context is the list of Ice libraries or assemblies // that will be added to the project. // public void addBuilderToProject(Project project, ComponentList components) { if(Util.isCppProject(project)) { Util.addIceCppConfigurations(project); if(components.Count == 0) { components = new ComponentList(Util.getProjectProperty(project, Util.PropertyIceComponents)); } if(!components.Contains("Ice")) { components.Add("Ice"); } if(!components.Contains("IceUtil")) { components.Add("IceUtil"); } Util.addIceCppLibs(project, components); } else { if(Util.isCSharpProject(project)) { bool development = Util.developmentMode(project); if(Util.isSilverlightProject(project)) { string iceSlHome = Environment.GetEnvironmentVariable("ICE_SL_HOME"); if(String.IsNullOrEmpty(iceSlHome)) { MessageBox.Show("ICE_SL_HOME environment variable not set.\n" + "ICE_SL_HOME environment variable must be set to point to " + "Ice Silverlight installation path.", "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } Util.addDotNetReference(project, "IceSL", Util.getIceSlHome(), development); } else { if(components.Count == 0) { components = new ComponentList(Util.getProjectProperty(project, Util.PropertyIceComponents)); } if(!components.Contains("Ice")) { components.Add("Ice"); } string iceHome = Util.getIceHome(); foreach(string component in components) { Util.addDotNetReference(project, component, iceHome, development); } } } else if(Util.isVBProject(project)) { string iceHome = Util.getIceHome(); bool development = Util.developmentMode(project); if(components.Count == 0) { components = new ComponentList(Util.getProjectProperty(project, Util.PropertyIceComponents)); } if(!components.Contains("Ice")) { components.Add("Ice"); } foreach(string component in components) { Util.addDotNetReference(project, component, iceHome, development); } } } Util.setProjectProperty(project, Util.PropertyIceComponents, ""); Util.setProjectProperty(project, Util.PropertyIce, true.ToString()); if(hasErrors(project)) { bringErrorsToFront(); } }
// // Apply unsaved changes, returns true if new settings are all applied correctly, // otherwise returns false. // private bool apply() { if(!hasUnsavedChanges()) { return true; // Nothing to do. } try { if(editingIncludeDir()) { endEditIncludeDir(true); } // // This must be the first setting to be updated, as other settings cannot be // updated if the add-in is disabled. // bool enabling = false; if(chkEnableBuilder.Checked && !Util.isSliceBuilderEnabled(_project)) { Util.addBuilderToProject(_project, iceComponents()); _changed = true; _initialized = false; loadComponents(); _initialized = true; enabling = true; } bool changed = false; if(!outputDirView.apply(ref changed)) { return false; } if(changed) { _changed = true; } if(chkIcePrefix.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIcePrefix)) { Util.setProjectProperty(_project, Util.PropertyIcePrefix, chkIcePrefix.Checked.ToString()); _changed = true; } if(chkStreaming.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIceStreaming)) { Util.setProjectProperty(_project, Util.PropertyIceStreaming, chkStreaming.Checked.ToString()); _changed = true; } if(chkChecksum.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIceChecksum)) { Util.setProjectProperty(_project, Util.PropertyIceChecksum, chkChecksum.Checked.ToString()); _changed = true; } if(comboBoxVerboseLevel.SelectedIndex != Util.getVerboseLevel(_project)) { Util.setProjectProperty(_project, Util.PropertyVerboseLevel, comboBoxVerboseLevel.SelectedIndex.ToString(CultureInfo.InvariantCulture)); _changed = true; } changed = false; if(!extraCompilerOptions.apply(ref changed)) { return false; } if(changed) { _changed = true; } if(includePathView.apply()) { _changed = true; } if(!txtDllExportSymbol.Text.Equals(Util.getProjectProperty(_project, Util.PropertyIceDllExport), StringComparison.CurrentCulture)) { Util.setProjectProperty(_project, Util.PropertyIceDllExport, txtDllExportSymbol.Text); _changed = true; } ComponentList components = new ComponentList(); if(!enabling) { if(chkFreeze.Checked != Util.hasIceCppLib(_project, "Freeze")) { componentChanged("Freeze", chkFreeze.Checked); if(!chkFreeze.Checked) { components.Add("Freeze"); } } if(chkGlacier2.Checked != Util.hasIceCppLib(_project, "Glacier2")) { componentChanged("Glacier2", chkGlacier2.Checked); if(!chkGlacier2.Checked) { components.Add("Glacier2"); } } if(chkIceBox.Checked != Util.hasIceCppLib(_project, "IceBox")) { componentChanged("IceBox", chkIceBox.Checked); if(!chkIceBox.Checked) { components.Add("IceBox"); } } if(chkIceGrid.Checked != Util.hasIceCppLib(_project, "IceGrid")) { componentChanged("IceGrid", chkIceGrid.Checked); if(!chkIceGrid.Checked) { components.Add("IceGrid"); } } if(chkIcePatch2.Checked != Util.hasIceCppLib(_project, "IcePatch2")) { componentChanged("IcePatch2", chkIcePatch2.Checked); if(!chkIcePatch2.Checked) { components.Add("IcePatch2"); } } if(chkIceSSL.Checked != Util.hasIceCppLib(_project, "IceSSL")) { componentChanged("IceSSL", chkIceSSL.Checked); if(!chkIceSSL.Checked) { components.Add("IceSSL"); } } if(chkIceStorm.Checked != Util.hasIceCppLib(_project, "IceStorm")) { componentChanged("IceStorm", chkIceStorm.Checked); if(!chkIceStorm.Checked) { components.Add("IceStorm"); } } } // // This must be the last setting to be updated, as we want to update // all other settings and that isn't possible if the builder is disabled. // if(!chkEnableBuilder.Checked && Util.isSliceBuilderEnabled(_project)) { Util.removeBuilderFromProject(_project, components); _initialized = false; load(); _initialized = true; _changed = true; } return true; } finally { needSave(); // Call needSave to update apply button status } }
public bool notEquals(ComponentList value) { return(!this.isEqual(value)); }
//public VerificationVisitor(StatementList functionCode, VarList formalParams, DFGNode high, DFGNode low, Dictionary<Identifier, Dictionary<Identifier, DFG>> componentFunctionGraphs, List<DeferredInvocation> deferredInvocations, Identifier currentComponent) : base(functionCode, formalParams, high, low, componentFunctionGraphs, deferredInvocations, currentComponent) //{ // //try // //{ // // _code.accept(this); // //} // //catch (ParseException pe) // //{ // // _errors.Add(pe); // //} //} public new void visitComponentList(ComponentList cl) { base.visitComponentList(cl); foreach (Component c in cl) { if (c.type == GingerToken.Implementation && c.extends != null) { Identifier implementationIdent = c.variable.identifier; foreach (Component cc in cl) { if (cc.variable.identifier == c.extends) { Identifier contractIdent = cc.variable.identifier; c.accept(this); if (!_componentFunctionGraphs.ContainsKey(contractIdent)) { cc.accept(this); } foreach (DeferredInvocation defInv in _deferredInvocations) { defInv.visitor.visitDeferredInvocation(defInv); } _deferredInvocations.Clear(); //_cleanup(); Dictionary <Identifier, DFG> implementationFunctions = _componentFunctionGraphs[implementationIdent]; Dictionary <Identifier, DFG> contractFunctions = _componentFunctionGraphs[contractIdent]; foreach (KeyValuePair <Identifier, DFG> entry in implementationFunctions) { if (contractFunctions.ContainsKey(entry.Key)) { Dictionary <DFGNode, DFGNode> inOutEdges = new Dictionary <DFGNode, DFGNode>(); DFG implementationGraph = entry.Value; DFG contractGraph = contractFunctions[entry.Key]; // perform closure on graphs implementationGraph.performClosure(); contractGraph.performClosure(); foreach (DFGNode inNode in implementationGraph.ins) { // is there an edge from an in to an out? foreach (DFGNode outNode in implementationGraph.outs) { if (inNode.adjacencyList.Contains(outNode)) { DFGNode contractInNode = null; try { contractInNode = contractGraph.ins.Single(fp => fp.label.Equals(inNode.label)); } catch (InvalidOperationException ioe) { _errors.Add(new ParseException(0, 0, $"Edge {inNode.label} to {outNode.label} in {implementationIdent.name}.{entry.Key.name} does not exist in the contract", ExceptionLevel.ERROR)); } if (contractInNode != null && !contractInNode.adjacencyList.Any(n => n.label.Equals(outNode.label) && (n.type != DFGNodeType.Return || n == contractGraph.returnNode))) { _errors.Add(new ParseException(0, 0, $"Edge {inNode.label} to {outNode.label} in {implementationIdent.name}.{entry.Key.name} does not exist in the contract", ExceptionLevel.ERROR)); } } } } } else { _errors.Add(new ParseException(0, 0, $"{implementationIdent.name}.{entry.Key.name} does not exist in {contractIdent.name}", ExceptionLevel.ERROR)); } } } } } } }