static void Main(string[] args) { List<string> words = new List<string>(); // New string-typed list words.Add("melon"); words.Add("avocado"); words.AddRange(new[] { "banana", "plum" }); words.Insert(0, "lemon"); // Insert at start words.InsertRange(0, new[] { "peach", "nashi" }); // Insert at start words.Remove("melon"); words.RemoveAt(3); // Remove the 4th element words.RemoveRange(0, 2); // Remove first 2 elements words.RemoveAll(s => s.StartsWith("n"));// Remove all strings starting in 'n' Console.WriteLine(words[0]); // first word Console.WriteLine(words[words.Count - 1]); // last word foreach (string s in words) Console.WriteLine(s); // all words List<string> subset = words.GetRange(1, 2); // 2nd->3rd words string[] wordsArray = words.ToArray(); // Creates a new typed array string[] existing = new string[1000];// Copy first two elements to the end of an existing array words.CopyTo(0, existing, 998, 2); List<string> upperCastWords = words.ConvertAll(s => s.ToUpper()); List<int> lengths = words.ConvertAll(s => s.Length); ArrayList al = new ArrayList(); al.Add("hello"); string first = (string)al[0]; string[] strArr = (string[])al.ToArray(typeof(string)); List<string> list = al.Cast<string>().ToList(); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess dataAccess) { int index_successful = Params.IndexOfOutputParam("successful"); if (index_successful != -1) { dataAccess.SetData(index_successful, false); } int index; bool run = false; index = Params.IndexOfInputParam("_run"); if (index == -1 || !dataAccess.GetData(index, ref run)) { run = false; } if (!run) { return; } index = Params.IndexOfInputParam("_pathTasTSD"); if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } string path = null; if (!dataAccess.GetData(index, ref path) || string.IsNullOrWhiteSpace(path)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <Tuple <string, string, string> > values = Analytical.Tas.Query.DesignDayNames(path); index = Params.IndexOfOutputParam("zoneGUIDs"); if (index != -1) { dataAccess.SetDataList(index, values?.ConvertAll(x => x.Item1)); } index = Params.IndexOfOutputParam("coolingDesignDayNames"); if (index != -1) { dataAccess.SetDataList(index, values?.ConvertAll(x => x.Item2)); } index = Params.IndexOfOutputParam("heatingDesignDayNames"); if (index != -1) { dataAccess.SetDataList(index, values?.ConvertAll(x => x.Item3)); } }
/** * Constructor taking the outside-the-scope value and a list of integer values, to * make both the initial and current possible variable values. The outside-the-scope value * must not belong to this list, or an ArgumentException is raised. */ public Domain( List< int > domain, int outsideScope ) : this(outsideScope) { if( domain.Contains( outsideScope ) ) throw new ArgumentException("The outside-scope number must not be in domain", "outsideScope"); CurrentDomain = domain.ConvertAll( v => v ); InitialDomain = domain.ConvertAll( v => v ); }
public ExtendedStatistics(List<double> values) : base(values) { mad = computeMad(values.ConvertAll<double>(p => p)); iqr = computeIQR(values.ConvertAll<double>(p => p)); entropy = computeEntropy(values.ConvertAll<double>(p => p)); maxIndex = computeMaxIndex(values.ConvertAll<double>(p => p)); autocorr = computeAutocorr(values.ConvertAll<double>(p => p)); }
public void Move(Vector3D vector3D) { if (vector3D == null) { return; } geometries = geometries?.ConvertAll(x => x.GetMoved(vector3D)); }
public _3DStatistic(List<double> x, List<double> y, List<double> z) { xStat = new ExtendedStatistics(x); yStat = new ExtendedStatistics(y); zStat = new ExtendedStatistics(z); xy_corr = computeCorrelation(x.ConvertAll<double>(p => p), y.ConvertAll<double>(p => p)); xz_corr = computeCorrelation(x.ConvertAll<double>(p => p), z.ConvertAll<double>(p => p)); yz_corr = computeCorrelation(y.ConvertAll<double>(p => p), z.ConvertAll<double>(p => p)); sma = computeSMA(x.ConvertAll<double>(p => p), y.ConvertAll<double>(p => p), z.ConvertAll<double>(p => p)); energy = computeEnergy(x.ConvertAll<double>(p => p), y.ConvertAll<double>(p => p), z.ConvertAll<double>(p => p)); }
public ReviewListMapper(IAmazonRequest amazonRequest) { this.amazonRequest = amazonRequest; errors = new List<KeyValuePair<string, string>>(); try { var reviewMapper = new ReviewMapper(amazonRequest.AccessKeyId, amazonRequest.AssociateTag, amazonRequest.SecretAccessKey, amazonRequest.CustomerId); reviews = reviewMapper.GetReviews(); foreach (var error in reviewMapper.GetErrors()) { errors.Add(error); } var productMapper = new ProductMapper(amazonRequest.AccessKeyId, amazonRequest.AssociateTag, amazonRequest.SecretAccessKey); products = productMapper.GetProducts(reviews.ConvertAll(review => review.ASIN)); foreach (var error in productMapper.GetErrors()) { errors.Add(error); } } catch(Exception ex) { errors.Add(new KeyValuePair<string, string>("ServiceError", ex.Message)); } }
public override BuilderOut BuildQueueAfterTTIZero(List<ISimulationUser> userList, List<ISimulationUser> newUserList, int curTTI, int residualRb) { List<IUlScheduleUser> list = new List<IUlScheduleUser>(); List<IUlScheduleUser> nonScheduledList = new List<IUlScheduleUser>(); List<IUlScheduleUser> list3 = newUserList.ConvertAll<IUlScheduleUser>(new Converter<ISimulationUser, IUlScheduleUser>(UlScheduleTools.ConvertToUlSchUser)); List<IUlScheduleUser> lessThanGBRList = new List<IUlScheduleUser>(); List<IUlScheduleUser> lessThanNonGBRList = new List<IUlScheduleUser>(); List<IUlScheduleUser> gBRHappyList = new List<IUlScheduleUser>(); List<IUlScheduleUser> nonGBRHappyList = new List<IUlScheduleUser>(); foreach (IUlScheduleUser user in userList) { this.AssortUser(user, curTTI, lessThanGBRList, lessThanNonGBRList, gBRHappyList, nonGBRHappyList, nonScheduledList); } UlScheduleTools.SortUserList(nonScheduledList, base.noScheduledComparer, curTTI); UlScheduleTools.SortUserList(list3, base.newAccessUserComparer, curTTI); this.SortServicedUser(lessThanGBRList, curTTI, residualRb, new CalBr(this.CalLessThanBrUser)); this.SortServicedUser(lessThanNonGBRList, curTTI, residualRb, new CalBr(this.CalLessThanBrUser)); this.SortServicedUser(gBRHappyList, curTTI, residualRb, new CalBr(this.CalMoreThanBrUser)); this.SortServicedUser(nonGBRHappyList, curTTI, residualRb, new CalBr(this.CalMoreThanBrUser)); list.AddRange(nonScheduledList); list.AddRange(list3); list.AddRange(lessThanGBRList); list.AddRange(lessThanNonGBRList); list.AddRange(gBRHappyList); list.AddRange(nonGBRHappyList); base.m_BuilderOut.NormalUserList = list; base.m_BuilderOut.NoPacketUserList = new List<IUlScheduleUser>(); return base.m_BuilderOut; }
public Card(string CardAsString, User _Controller) { List<string> Card = new List<string>(); Card.AddRange(CardAsString.Replace("[", "").Replace("]", "").Split(new string[] { "," }, StringSplitOptions.None)); NumberInDeck = Convert.ToInt32(Card[0]); SerialNo = Convert.ToInt32(Card[1]); UnitTitle = Card[2]; UnitName = Card[3]; Power = Convert.ToInt32(Card[4]); Support = Convert.ToInt32(Card[5]); IsHorizontal = Convert.ToBoolean(Card[6]); FrontShown = Convert.ToBoolean(Card[7]); Visible = Convert.ToBoolean(Card[8]); List<string> temp = new List<string>(); if (Card[9] != "()") { temp.AddRange(Card[9].Replace("(", "").Replace(")", "").Split(new string[] { ";" }, StringSplitOptions.None)); while (temp.Contains("")) { temp.Remove(""); } OverlayCardNo = temp.ConvertAll<Int32>(Convert.ToInt32); } else { OverlayCardNo = new List<int>(); } Comments = Card[10]; Controller = _Controller; }
// Set all the items in the list box, and check them all. public void SetControlsToDelete(List<KeyValuePair<Id<ControlPoint>,string>> controlsToDelete) { codeListBox.Items.Clear(); codeListBox.Items.AddRange(controlsToDelete.ConvertAll(pair => new ListItem(pair.Key, pair.Value)).ToArray()); for (int i = 0; i < codeListBox.Items.Count; ++i) codeListBox.SetItemChecked(i, true); }
void Update() { elapsed += Time.deltaTime; if (elapsed > 1f) { elapsed = 0f; List<int> lst = new List<int>(); lst.Add(6); lst.Add(95); foreach (var v in lst) { Debug.Log(v); } int vFind = lst.Find((val) => (val == 6)); Debug.Log("vFind = " + vFind); var lstS = lst.ConvertAll<string>((v) => "s: " + v); foreach (var v in lstS) { Debug.Log(v); } Debug.Log(lstS[0]); Debug.Log(lstS[1]); } }
public Polygon2D(Vector2[] mainPoints, List<CLine> lines) { this.mainPoints[0] = mainPoints[0]; this.mainPoints[1] = mainPoints[1]; this.lines = lines.ConvertAll(l => new Line2D(l.NPoints[0], l.NPoints[1], l.IsSeam)); }
/// <summary> /// Create new instance of UadpNetworkMessage /// </summary> /// <param name="writerGroupConfiguration">The <see cref="WriterGroupDataType"/> confguration object that produced this message.</param> /// <param name="uadpDataSetMessages"><see cref="UadpDataSetMessage"/> list as input</param> public UadpNetworkMessage(WriterGroupDataType writerGroupConfiguration, List <UadpDataSetMessage> uadpDataSetMessages) : base(writerGroupConfiguration, uadpDataSetMessages?.ConvertAll <UaDataSetMessage>(x => (UaDataSetMessage)x) ?? new List <UaDataSetMessage>()) { UADPVersion = kUadpVersion; DataSetClassId = Guid.Empty; Timestamp = DateTime.UtcNow; }
//Get cleared Kuni and check current open and register the difference to open kuni public void registerOpenKuni(int clearedKuniId) { List<int> openKuniList = new List<int>(); //Identify Cleared Kuni for(int i=0; i<kuniMapMst.param.Count; i++){ int temClearedKuniId = kuniMapMst.param[i].Souce; if(temClearedKuniId == clearedKuniId){ openKuniList.Add(kuniMapMst.param[i].Open); } } //Remove Existed Open Kuni List<string> tempList = new List<string>(); string openKuniString = PlayerPrefs.GetString("openKuni"); char[] delimiterChars = {','}; tempList = new List<string>(openKuniString.Split (delimiterChars)); List<int> openedKuniList = tempList.ConvertAll(x => int.Parse(x)); foreach (int i in openKuniList) { if(!openedKuniList.Contains(i)){ openKuniString = openKuniString + "," + i.ToString(); string tempKuni = "naisei" + i.ToString(); PlayerPrefs.SetString(tempKuni,"1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0"); } } //Open kuni initial data setting PlayerPrefs.SetString("openKuni", openKuniString); PlayerPrefs.Flush(); }
private Row GenerateRowForProperty(UInt32Value rowIndex, int linesToAdd, ProjectFile projectFile, String property) { Row row = new Row() { RowIndex = (UInt32Value)(rowIndex + linesToAdd), Spans = new ListValue<StringValue>() { InnerText = "3:9" }, DyDescent = 0.25D }; ProjectProperty projectProperty = projectFile.ProjectProperties.FirstOrDefault(prop => prop.Type == property); if (projectProperty != null) { int sharedStringIndexForType = 0; for (int i = 0; i < SharedStrings.Count; i++) { if (SharedStrings[i].Text.Text == projectProperty.Type) { sharedStringIndexForType = i; break; } } List<Cell> cells = new List<Cell>() { new Cell(){CellReference = GetCell(String.Format("C{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 7U,DataType = CellValues.SharedString, CellValue = new CellValue(sharedStringIndexForType.ToString(CultureInfo.InvariantCulture))}, new Cell(){CellReference = GetCell(String.Format("D{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 8U,DataType = CellValues.Number, CellValue = new CellValue(projectProperty.Rate.ToString(CultureInfo.InvariantCulture))}, new Cell(){CellReference = GetCell(String.Format("F{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 9U,DataType = CellValues.Number, CellValue = new CellValue(projectProperty.Words.ToString(CultureInfo.InvariantCulture))}, new Cell(){CellReference = GetCell(String.Format("G{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 9U,DataType = CellValues.Number, CellValue = new CellValue(projectProperty.Characters.ToString(CultureInfo.InvariantCulture))}, new Cell(){CellReference = GetCell(String.Format("H{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 9U,DataType = CellValues.Number, CellValue = new CellValue(projectProperty.ValueByWords.ToString(CultureInfo.InvariantCulture))}, new Cell(){CellReference = GetCell(String.Format("I{0}", rowIndex.Value), linesToAdd),StyleIndex = (UInt32Value) 9U,DataType = CellValues.SharedString, CellValue = new CellValue("15")} }; row.Append(cells.ConvertAll(c => (OpenXmlElement) c)); } return row; }
protected void CreateCircle() { List<Component> components = new List<Component>(SplineRoot.GetComponentsInChildren(typeof(Transform))); List<Transform> transforms = components.ConvertAll(c => (Transform)c); transforms.Remove(SplineRoot.transform); transforms.Sort(delegate(Transform a, Transform b) { return a.name.CompareTo(b.name); }); Vector3 midpoint = Vector3.zero; int numberOfNodes = transforms.Count; if (numberOfNodes <= 1) return; foreach (Transform element in transforms) { midpoint += element.position; } midpoint = midpoint / numberOfNodes; int i = 0; foreach (Transform element in transforms) { element.position = new Vector3(midpoint.x + xRadius * Mathf.Cos((i * (2* Mathf.PI)) / numberOfNodes), midpoint.y, midpoint.z + yRadius * Mathf.Sin((i *2 * Mathf.PI) / numberOfNodes)); ++i; } transforms[numberOfNodes - 1].position = transforms[0].position; }
public ProductListMapper(IAmazonRequest amazonRequest) { this.amazonRequest = amazonRequest; errors = new List<KeyValuePair<string, string>>(); try { var listMapper = new ListMapper(amazonRequest.AccessKeyId, amazonRequest.AssociateTag, amazonRequest.SecretAccessKey, amazonRequest.ListId); listItems = listMapper.GetList(); foreach (var error in listMapper.GetErrors()) { errors.Add(error); } var productMapper = new ProductMapper(amazonRequest.AccessKeyId, amazonRequest.AssociateTag, amazonRequest.SecretAccessKey); products = productMapper.GetProducts(listItems.ConvertAll(listItem => listItem.ASIN)); foreach (var error in productMapper.GetErrors()) { errors.Add(error); } } catch(Exception ex) { errors.Add(new KeyValuePair<string, string>("ServiceError", ex.Message)); } }
public void CreateFriendrequest(List<FriendBM> frndbm) { ProWorldzContext context = new ProWorldzContext(); List<Friend> friends = frndbm.ConvertAll<Friend>(new Converter<FriendBM, Friend>(ConvertToDM)); context.Friend.AddRange(friends); context.SaveChanges(); }
static public Mesh CreateMesh(float[,,] voxels) { List<Vector3> verts = new List<Vector3>(); List<int> index = new List<int>(); float[] cube = new float[8]; for(int x = 0; x < voxels.GetLength(0)-1; x++) { for(int y = 0; y < voxels.GetLength(1)-1; y++) { for(int z = 0; z < voxels.GetLength(2)-1; z++) { //Get the values in the 8 neighbours which make up a cube FillCube(x,y,z,voxels,cube); //Perform algorithm Mode_Func(new Vector3(x,y,z), cube, verts, index); } } } //Center pivot point verts = verts.ConvertAll(vert => vert -= new Vector3(voxels.GetLength(0)/2f, voxels.GetLength(1)/2f, voxels.GetLength(2)/2f)); Mesh mesh = new Mesh(); mesh.vertices = verts.ToArray(); mesh.triangles = index.ToArray(); return mesh; }
internal void UpdateDependencies(List<ShadowFileNode> dependencies) { if (dependencies.Count == 0) buildItem.RemoveMetadata(Constants.DependsOn); else buildItem.SetMetadata(Constants.DependsOn, dependencies.ConvertAll(elem => elem.buildItem.ToString()).Aggregate("", (a, item) => a + ',' + item).Substring(1)); }
/// <summary> /// Gets all permissions by names. /// Throws <see cref="AbpValidationException"/> if can not find any of the permission names. /// </summary> public static IEnumerable<Permission> GetPermissionsFromNamesByValidating(this IPermissionManager permissionManager, IEnumerable<string> permissionNames) { var permissions = new List<Permission>(); var undefinedPermissionNames = new List<string>(); foreach (var permissionName in permissionNames) { var permission = permissionManager.GetPermissionOrNull(permissionName); if (permission == null) { undefinedPermissionNames.Add(permissionName); } permissions.Add(permission); } if (undefinedPermissionNames.Count > 0) { throw new AbpValidationException(string.Format("There are {0} undefined permission names.", undefinedPermissionNames.Count)) { ValidationErrors = undefinedPermissionNames.ConvertAll(permissionName => new ValidationResult("Undefined permission: " + permissionName)) }; } return permissions; }
public void CheckForUnregisteredProperties() { //todo: build stackrace or other go to code functionality registeredButUntested = testedSpecs.FindAll(s => s.TimesTested == 0); if (registeredButUntested.Count != 0) { StringBuilder message = new StringBuilder(); registeredButUntested.ConvertAll(s => s.Name) .ForEach(s => message.AppendLine(s)); try { throw new UnregisteredPropertiesException(message.ToString()); } catch (UnregisteredPropertiesException exception) { try { throw new SpecFailedException( "Registered Spec not evaluated", exception ); } catch (SpecFailedException specFailedException) { failedSpec = specFailedException; } } } }
/// <summary> /// Obtain list of errors, made by EnC not valid changes. /// </summary> /// <param name="changes">List of changes made in running code.</param> /// <returns>List of errors, empty if there are not any.</returns> public static List<BuildError> GetErrors(List<SourceChange> changes) { List<BuildError> errors = changes.ConvertAll(new Converter<SourceChange, BuildError>(IsValid)); errors.RemoveAll(delegate(BuildError err){return err == null;}); errors.TrimExcess(); return errors; }
private void ProcessJavascript(List<LineOfJavascript> lines) { List<LineOfJavascript> nonAspRelatedLines = new List<LineOfJavascript>(); foreach (var line in lines) { if (line.Namespace.IsAspControlNamespace) { line.Namespace.Lines.Add(line); } else if (line.Namespace.ParentAspControlNamespace != null) { line.Namespace.ParentAspControlNamespace.Lines.Add(line); } else { nonAspRelatedLines.Add(line); } } bool isDebug = inputFile.Name.EndsWith(".debug.js"); foreach (var file in outputDirectory.GetFiles(isDebug ? "*.debug.js" : "*.js")) { file.Delete(); } foreach (var ns in Namespace.Namespaces) { if (ns.Lines.Count > 0) { File.WriteAllLines(Path.Combine(outputDirectory.FullName, ns.Name + (isDebug ? ".debug" : "" ) + ".js"), ns.Lines.ConvertAll(l => l.Text).ToArray()); } } File.WriteAllLines(Path.Combine(outputDirectory.FullName, inputFile.Name), nonAspRelatedLines.ConvertAll(l => l.Text).ToArray()); }
public override Vector3[] GetPathPositions() { nodes = DijkstraPathFinder.FindShortestPath(CurrentNode, PathBuilder.Instance.GetNodeById(positionToGo)); List<Vector3> nodePositions = nodes.ConvertAll(item => item.transform.position); nodePositions.Insert(0, transform.position); return nodePositions.ToArray(); }
public FormConferention(string _roomJid, string _roomName, bool _savingHistory, bool _persistRoom, string _roomDesc = "", List<string> users = null ) { InitializeComponent(); roomJid = new Jid(_roomJid); roomName = _roomName; this.Text = _roomName; roomDesc = _roomDesc; mainJid = Settings.jid; nickname = Settings.nickname; xmpp = Settings.xmpp; muc = new MucManager(xmpp); savingHistory = _savingHistory ? "1" : "0"; persistRoom = _persistRoom ? "1" : "0"; //muc.AcceptDefaultConfiguration(roomJid, new IqCB(OnGetFieldsResult)); muc.CreateReservedRoom(roomJid); muc.GrantOwnershipPrivileges(roomJid, new Jid(mainJid)); muc.JoinRoom(roomJid, nickname); initMucConfig(); xmpp.MesagageGrabber.Add(roomJid, new BareJidComparer(), new MessageCB(MessageCallback), null); xmpp.PresenceGrabber.Add(roomJid, new BareJidComparer(), new PresenceCB(PresenceCallback), null); muc.Invite(users.ConvertAll<Jid>( delegate(string jid) { return new Jid(jid); } ).ToArray(), roomJid, "Вы приглашены в конференцию Конф."); }
public static ExpressionMatrix ReadMatrix(this TCGATechnologyType ttt, TCGADataType tdt, List<BarInfo> bis, List<string> genes) { double?[,] data = new double?[genes.Count, bis.Count]; for (int i = 0; i < bis.Count; i++) { var reader = ttt.GetTechnology().GetReader(); var fn = tdt == TCGADataType.Count ? ttt.GetTechnology().GetCountFilename(bis[i].FileName) : bis[i].FileName; var dd = reader.ReadFromFile(fn).Values.ToDictionary(m => m.Name, m => m.Value); for (int j = 0; j < genes.Count; j++) { if (dd.ContainsKey(genes[j])) { data[j, i] = dd[genes[j]]; } else { data[j, i] = null; } } } ExpressionMatrix result = new ExpressionMatrix(); result.Values = data; result.Rownames = genes.ToArray(); result.Colnames = bis.ConvertAll(m => m.BarCode).ToArray(); return result; }
public Message(string message) { message = removeInvalid.Replace(message,""); List<string> lines = new List<string>(message.Split(new char[1]{'\n'},StringSplitOptions.RemoveEmptyEntries)); for (int i=0;i<lines.Count;i++) { string line = lines[i]; line = removeMultiple.Replace(line,"$+"); line = removeEnd.Replace(line,""); line = removeUnused.Replace(line,"$1"); if (line[line.Length-1]=='&') { line = line.Substring(0,line.Length-1); } if (line.Length<=64) { continue; } int lastspace = line.LastIndexOf(' ',63,wordwrap); if (lastspace!=-1) { line = line.Remove(lastspace,1); } int pos = (lastspace!=-1)?lastspace:64; int lastcolor = line.LastIndexOf('&',pos-1,pos); string color = ""; if (lastcolor!=-1) { color = line.Substring(lastcolor,2); } if (lastcolor>=pos-2 && lastcolor<pos) { line = line.Remove(lastcolor,2); pos = lastcolor; }lines[i] = line.Substring(0,pos); lines.Insert(i+1,color+"-> "+line.Substring(pos)); } packets = lines.ConvertAll(new Converter<string,Packet>(ToPacket)); }
public ProxyType(Type type) { var envTypes = new List<Type>(); var methods = (from method in type.GetMethods(BindingFlags.Instance | BindingFlags.Public) .Where(method => Attribute.IsDefined(method, typeof(ServiceMethodAttribute))) select new { MethodName = method.Name, ServiceAttribute = (ServiceMethodAttribute)Attribute.GetCustomAttribute(method, typeof(ServiceMethodAttribute)) }).ToArray(); var mappings = (from m in methods select new { MethodName = m.MethodName, Action = m.ServiceAttribute.Action, ArgsTypeIndex = AddOrGetIndexOfExistingType(envTypes, m.ServiceAttribute.ArgType), ResultsTypeIndex = AddOrGetIndexOfExistingType(envTypes, m.ServiceAttribute.ReturnType) }).ToArray(); var xmlRoot = new XmlRootAttribute("Command"); var envSerializers = envTypes.ConvertAll<XmlSerializer>(t => new XmlSerializer(t, xmlRoot)); foreach (var m in mappings) { var svcMethod = new ServiceMethodInfo() { MethodName = m.MethodName, ServiceAction = m.Action, ArgsSerializer = envSerializers[m.ArgsTypeIndex], ResultsSerializer = envSerializers[m.ResultsTypeIndex] }; _methods.Add(svcMethod.MethodName, svcMethod); } }
protected override CompilerResults GetResultsFrom(List<SourceFile> files) { string pdbFileName = parameters.OutputAssembly.Substring(0, parameters.OutputAssembly.Length - 3) + "pdb"; fileSystem.Delete(parameters.OutputAssembly); fileSystem.Delete(pdbFileName); if (options.KeepTemporarySourceFiles) { string[] sourceFiles = files.ConvertAll<string>(SourceFileToFileName).ToArray(); return codeProvider.CompileAssemblyFromFile(parameters, sourceFiles); } string[] sources = files.ConvertAll<string>(SourceFileToSource).ToArray(); return codeProvider.CompileAssemblyFromSource(parameters, sources); }
IEnumerator OutroAnimation() { yield return new WaitForSeconds(1.5f); List<Component> components = new List<Component>(coinSpawners[currMargin].GetComponentsInChildren(typeof(Transform))); List<Transform> transforms = components.ConvertAll(c => (Transform)c); transforms.Remove(coinSpawners[currMargin].transform); transforms.Sort( delegate (Transform t1, Transform t2) { return (t1.transform.localPosition.y.CompareTo(t2.transform.localPosition.y)); } ); for (int j = transforms.Count - 1; j > -1; j--) { //TODO change when changing margin scripts if(StatePinball.Instance.ID > 2) { transforms[j].gameObject.GetComponent<CoinLoader>().strenghtXComponent = 0; transforms[j].gameObject.GetComponent<CoinLoader>().strenghtYComponent = 1.5f; } transforms[j].gameObject.GetComponent<CoinLoader>().ChargeIntoCannon(); yield return new WaitForSeconds(0.2f); } yield return new WaitForSeconds(waitTimeAfterLastCoin); ActivateMarginSlinding(); //StateInitializePinball.Instance.MarginDisappear(); }
public IEnumerable<string> GetTemplates(string root) { var result = new List<string>(); IntPtr ppHier; uint pitemid; IVsMultiItemSelect ppMIS; IntPtr ppSC; object directory = ""; if (ErrorHandler.Succeeded(GlobalServices.SelectionTracker.GetCurrentSelection(out ppHier, out pitemid, out ppMIS, out ppSC))) { try { IVsHierarchy hier = (IVsHierarchy)Marshal.GetObjectForIUnknown(ppHier); if (ErrorHandler.Succeeded(hier.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectDir, out directory))) if (project_directory == (string)directory) { result.AddRange(Directory.EnumerateFiles(directory + root, "*.django", SearchOption.AllDirectories)); result.AddRange(Directory.EnumerateFiles(directory + root, "*.htm", SearchOption.AllDirectories)); result.AddRange(Directory.EnumerateFiles(directory + root, "*.html", SearchOption.AllDirectories)); } } finally { Marshal.Release(ppHier); if (!ppSC.Equals(IntPtr.Zero)) Marshal.Release(ppSC); } } return result.ConvertAll(file => file.Substring((directory + root).Length + 1)); }
public static List <AbsenceModel> ToContracts(this List <Absence> absences) { return(absences?.ConvertAll(x => new AbsenceModel { Id = x.Id, Name = x.AbsenceType })); }
public static List <Absence> ToDataBaseEntities(this List <AbsenceModel> absences) { return(absences?.ConvertAll(x => new Absence { Id = x.Id, AbsenceType = x.Name })); }
/// <summary> /// Add List of tags to the database that are assocated with this distance /// </summary> /// <param name="Distance">Distance of tags in cm</param> /// <param name="TagList">List of the tags</param> public void Add_Tags(int Distance, List<Tag> TagList) { List<LookupData> ConvertedData = TagList.ConvertAll(r => new LookupData(r, Distance)); this.LookupData.InsertAllOnSubmit(ConvertedData); this.SubmitChanges(); }
public static List <Restaurant> ToDataBaseEntities(this List <RestaurantModel> restaurants) { return(restaurants?.ConvertAll(x => new Restaurant { Id = x.Id, Name = x.Name, ImagePath = x.ImagePath })); }
public static StatisticalReport <T> Create <T>( Converter <T, double> toDouble, Converter <double, T> fromDouble, List <T>?values) { var doubles = values?.ConvertAll(toDouble); return(Create(doubles).Convert(fromDouble)); }
/// <summary> /// Sets the currentl list of displayed courses. Converts from Course to WeekCouresView /// </summary> /// <param name="courses"></param> public void SetCourses(List <Course> courses) { this.courses = courses?.ConvertAll <WeekCourseView>((Course c) => { WeekCourseView cv = new WeekCourseView(this, courseColorRandomizer); cv.Course = c; return(cv); }); }
public static List <RestaurantModel> ToContracts(this List <Restaurant> restaurants) { return(restaurants?.ConvertAll(x => new RestaurantModel { Id = x.Id, Name = x.Name, ImagePath = x.ImagePath })); }
/// <summary> /// Create new instance of <see cref="JsonNetworkMessage"/> as a DataSet message /// </summary> /// <param name="writerGroupConfiguration">The <see cref="WriterGroupDataType"/> configuration object that produced this message.</param> /// <param name="jsonDataSetMessages"><see cref="JsonDataSetMessage"/> list as input</param> public JsonNetworkMessage(WriterGroupDataType writerGroupConfiguration, List <JsonDataSetMessage> jsonDataSetMessages) : base(writerGroupConfiguration, jsonDataSetMessages?.ConvertAll <UaDataSetMessage>(x => (UaDataSetMessage)x) ?? new List <UaDataSetMessage>()) { MessageId = Guid.NewGuid().ToString(); MessageType = kDataSetMessageType; DataSetClassId = string.Empty; m_jsonNetworkMessageType = JSONNetworkMessageType.DataSetMessage; }
public static List <Employee> ToDataBaseEntities(this List <EmployeeModel> employees) { return(employees?.ConvertAll(x => new Employee { Id = x.Id, Name = x.Name, Email = x.Email, UserName = x.UserName })); }
public static List <EmployeeModel> ToContracts(this List <Employee> employees) { return(employees?.ConvertAll(x => new EmployeeModel { Id = x.Id, Name = x.Name, Email = x.Email, UserName = x.UserName })); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(1, false); bool run = false; if (!dataAccess.GetData(4, ref run)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } if (!run) { return; } string path_TBD = null; if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <string> names = new List <string>(); if (!dataAccess.GetDataList(1, names)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } bool caseSensitive = false; if (!dataAccess.GetData(2, ref caseSensitive)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } bool trim = false; if (!dataAccess.GetData(3, ref trim)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <Guid> result = Analytical.Tas.Modify.AssignRooflightBuilidingElementType(path_TBD, names, caseSensitive, trim); dataAccess.SetData(0, result?.ConvertAll(x => x.ToString())); dataAccess.SetData(1, result != null); }
public static List <Employee_Absence> ToDataBaseEntities(this List <EmployeeAbsenceModel> employeeAbsences) { return(employeeAbsences?.ConvertAll(x => new Employee_Absence { Id = x.Id, StartDate = x.StartDate, EndDate = x.EndDate, Employee = x.Employee.ToDataBaseEntity(), Absence = x.Absence.ToDataBaseEntity(), Removed = x.Removed })); }
public static List <LunchModel> ToContracts(this List <Lunch> lunches) { return(lunches?.ConvertAll(x => new LunchModel { Id = x.Id, EmployeesList = x.Employees.ToList().ToContracts(), LunchTime = x.LunchTime, Restaurant = x.Restaurant.ToContract(), RestaurantId = x.RestaurantId, Removed = x.Removed })); }
public static List <EmployeeAbsenceModel> ToContracts(this List <Employee_Absence> employeeAbsences) { return(employeeAbsences?.ConvertAll(x => new EmployeeAbsenceModel { Id = x.Id, StartDate = x.StartDate.Date, EndDate = x.EndDate, Employee = x.Employee.ToContract(), Absence = x.Absence.ToContract(), Removed = x.Removed })); }
public static List <Lunch> ToDataBaseEntities(this List <LunchModel> lunches) { return(lunches?.ConvertAll(x => new Lunch { Id = x.Id, Employees = x.EmployeesList.ToDataBaseEntities(), LunchTime = x.LunchTime, Restaurant = x.Restaurant.ToDataBaseEntity(), RestaurantId = x.Restaurant.Id, Removed = x.Removed })); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(1, false); bool run = false; if (!dataAccess.GetData(4, ref run)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } if (!run) { return; } string path_TBD = null; if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <DesignDay> coolingDesignDays = new List <DesignDay>(); dataAccess.GetDataList(1, coolingDesignDays); List <DesignDay> heatingDesignDays = new List <DesignDay>(); dataAccess.GetDataList(2, heatingDesignDays); int repetitions = 30; dataAccess.GetData(3, ref repetitions); List <Guid> guids = null; if (coolingDesignDays != null || heatingDesignDays != null) { if (coolingDesignDays.Count != 0 || heatingDesignDays.Count != 0) { guids = Analytical.Tas.Modify.AddDesignDays(path_TBD, coolingDesignDays, heatingDesignDays, repetitions); } } dataAccess.SetData(0, guids?.ConvertAll(x => x.ToString())); dataAccess.SetData(1, guids != null); }
public override ModConfig Clone() { // Since ListOfInts is a reference type, we need to clone it manually so our config works properly. var clone = (ModConfigShowcaseMisc)base.Clone(); // We use ?. and ?: here because many of these fields can be null. // clone.ListOfInts = ListOfInts != null ? new List<int>(ListOfInts) : null; clone.gradient = gradient == null ? null : gradient.Clone(); clone.StringPairDictionary = StringPairDictionary.ToDictionary(i => i.Key, i => i.Value?.Clone()); clone.JsonItemFloatDictionary = JsonItemFloatDictionary.ToDictionary(i => new ItemDefinition(i.Key.mod, i.Key.name), i => i.Value); clone.itemSet = new HashSet <ItemDefinition>(itemSet); clone.ListOfPair2 = ListOfPair2?.ConvertAll(pair => pair.Clone()); clone.pairExample2 = pairExample2 == null ? null : pairExample2.Clone(); clone.simpleDataExample = simpleDataExample == null ? null : simpleDataExample.Clone(); clone.simpleDataExample2 = simpleDataExample2 == null ? null : simpleDataExample2.Clone(); clone.complexData = complexData == null ? null : complexData.Clone(); return(clone); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(1, false); bool run = false; if (!dataAccess.GetData(2, ref run)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } if (!run) { return; } string path_TBD = null; if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <ApertureConstruction> apertureConstructions = new List <ApertureConstruction>(); if (!dataAccess.GetDataList(1, apertureConstructions) || apertureConstructions == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <Guid> guids = Analytical.Tas.Modify.UpdateApertureControl(path_TBD, apertureConstructions); dataAccess.SetData(0, guids?.ConvertAll(x => x.ToString())); dataAccess.SetData(1, guids != null); }
public void SetImages(List <JObject> images) { this.Images = images?.ConvertAll <JObject>((Converter <JObject, JObject>)(jt => (JObject)jt?.DeepClone())); }
public static List <string> ToStringName(this List <EmploymentType> employmentTypes) => employmentTypes?.ConvertAll <string>(ToStringName);
/// <summary> /// Create new instance of <see cref="JsonNetworkMessage"/> /// </summary> /// <param name="writerGroupConfiguration">The <see cref="WriterGroupDataType"/> confguration object that produced this message.</param> /// <param name="jsonDataSetMessages"><see cref="JsonDataSetMessage"/> list as input</param> public JsonNetworkMessage(WriterGroupDataType writerGroupConfiguration, List <JsonDataSetMessage> jsonDataSetMessages) : base(writerGroupConfiguration, jsonDataSetMessages?.ConvertAll <UaDataSetMessage>(x => (UaDataSetMessage)x) ?? new List <UaDataSetMessage>()) { MessageType = kDefaultMessageType; DataSetClassId = string.Empty; }
public static List <EmploymentType> ToEmploymentType(this List <string> list) => list?.ConvertAll(ToEmploymentType);
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(4, false); bool run = false; if (!dataAccess.GetData(2, ref run)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } if (!run) { return; } string path_TBD = null; if (!dataAccess.GetData(0, ref path_TBD) || string.IsNullOrWhiteSpace(path_TBD)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } IAnalyticalObject analyticalObject = null; if (!dataAccess.GetData(1, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List <SpaceSimulationResult> spaceSimulationResults_Cooling = null; List <SpaceSimulationResult> spaceSimulationResults_Heating = null; List <Space> spaces = null; bool result = false; if (analyticalObject is AnalyticalModel) { analyticalObject = Analytical.Tas.Modify.UpdateDesignLoads(path_TBD, (AnalyticalModel)analyticalObject); AdjacencyCluster adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; if (adjacencyCluster != null) { spaces = adjacencyCluster.GetSpaces(); if (spaces != null) { spaceSimulationResults_Cooling = new List <SpaceSimulationResult>(); spaceSimulationResults_Heating = new List <SpaceSimulationResult>(); foreach (Space space in spaces) { List <SpaceSimulationResult> spaceSimulationResults = adjacencyCluster.GetResults <SpaceSimulationResult>(space, Analytical.Tas.Query.Source()); if (spaceSimulationResults == null) { continue; } spaceSimulationResults_Cooling.AddRange(spaceSimulationResults.FindAll(x => x.LoadType() == LoadType.Cooling)); spaceSimulationResults_Cooling.AddRange(spaceSimulationResults.FindAll(x => x.LoadType() == LoadType.Heating)); } result = true; } } } else if (analyticalObject is BuildingModel) { BuildingModel buildingModel = new BuildingModel((BuildingModel)analyticalObject); spaces = Analytical.Tas.Modify.UpdateDesignLoads(buildingModel, path_TBD); if (spaces != null) { spaceSimulationResults_Cooling = new List <SpaceSimulationResult>(); spaceSimulationResults_Heating = new List <SpaceSimulationResult>(); foreach (Space space in spaces) { List <SpaceSimulationResult> spaceSimulationResults = buildingModel.GetResults <SpaceSimulationResult>(space, Analytical.Tas.Query.Source()); if (spaceSimulationResults == null) { continue; } spaceSimulationResults_Cooling.AddRange(spaceSimulationResults.FindAll(x => x.LoadType() == LoadType.Cooling)); spaceSimulationResults_Cooling.AddRange(spaceSimulationResults.FindAll(x => x.LoadType() == LoadType.Heating)); } result = true; } analyticalObject = buildingModel; } dataAccess.SetData(0, new GooAnalyticalObject(analyticalObject)); dataAccess.SetDataList(1, spaces?.ConvertAll(x => new GooSpace(x))); dataAccess.SetDataList(2, spaceSimulationResults_Cooling?.ConvertAll(x => new GooResult(x))); dataAccess.SetDataList(3, spaceSimulationResults_Heating?.ConvertAll(x => new GooResult(x))); dataAccess.SetData(4, result); }
public TermInfo[] GetTermsHandled(SessionProfile sessionProfile) => _terms ?? (_terms = _functions?.ConvertAll(f => f.GetTermInfo(sessionProfile.CurrentLanguage.Abbr)).ToArray());
public override List <TechOperation> CreateTechOperations() => _borders?.ConvertAll(p => new SawingTechOperation(this, p) as TechOperation);
public IEnumerable <string> GetAllRecordNames() { return(content?.ConvertAll((record) => record.recordName)); }
public IEnumerable <FakeInput> GetAllFakeInputs() { return(fakeInputsWithFipsAndActions?.ConvertAll((e) => e.fakeInput)); }
public IEnumerable <object> GetAllFips() { return(fipsAndActions?.ConvertAll((e) => e.fakeInputParameter)); }