public void TrimByAllowedVersions_HappyPath_Succeeds() { // Prepare var regInfo = new RegistrationInfo { Id = "package1", IncludePrerelease = true }; var pkgInfo1 = new PackageInfo { Version = NuGetVersion.Parse("0.0.1") }; regInfo.Add(pkgInfo1); var pkgInfo2 = new PackageInfo { Version = NuGetVersion.Parse("1.0.0") }; regInfo.Add(pkgInfo2); var allowedVersions = new Dictionary <string, VersionRange> { ["package1"] = VersionRange.Parse("1.0.0"), ["package2"] = VersionRange.Parse("0.0.1") // not used info }; // Act Trim.TrimByAllowedVersions(regInfo, allowedVersions); // Verify Assert.Equal(1, regInfo.Packages.Count); }
public ActionResult Create([Bind(Include = "Id,Name,Description,ImageUrl")] Trim trim, HttpPostedFileBase img) {//Agregar Imagen\\ if (img != null) { var folder = Server.MapPath("~/Content/Trims/"); var imageUrl = Path.GetFileName(img.FileName); var filename = Path.Combine(folder, imageUrl); img.SaveAs(filename); trim.ImageUrl = imageUrl; } else { trim.ImageUrl = "default.jpg"; } if (ModelState.IsValid) { db.Trims.Add(trim); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trim)); }
public void HappyPath(string inputString, string stringToTrim, string expectedOutput) { var test = new Trim(); var result = test.GetTrimmedString(inputString, stringToTrim); Assert.AreEqual(expectedOutput, result); }
private void LoadAndRunModel(string modelFileName) { FDMExecutive fdm = new FDMExecutive(); fdm.AircraftPath = rootDirectory + "/aircraft"; fdm.EnginePath = rootDirectory + "/engine"; fdm.LoadModel(modelFileName, true); InitialCondition IC = fdm.GetIC; IC.Load("reset00", true); Trim fgt = new Trim(fdm, TrimMode.Full); if (!fgt.DoTrim()) { log.Debug("Trim Failed"); } fgt.Report(); bool result = fdm.Run(); int count = 0; while (result && !(fdm.Holding() || fdm.State.IsIntegrationSuspended)) { result = fdm.Run(); count++; if (count > 10 && log.IsDebugEnabled) { count = 0; log.Debug("=> Time: " + fdm.State.SimTime); } } }
public void LongerDeliminatorsAreHandled(string inputString, string stringToTrim, string expectedOutput) { var test = new Trim(); var result = test.GetTrimmedString(inputString, stringToTrim); Assert.AreEqual(expectedOutput, result); }
public IEnumerator <ITask> TrimHandler(Trim trim) { trim.ResponsePort.Post( TrimResponse.FromRequest(trim.Body) ); yield break; }
public void TrimShouldTrimFromBothEnds() { var func = new Trim(); var result = func.Execute(FunctionsHelper.CreateArgs(" epplus "), _parsingContext); Assert.AreEqual("epplus", result.Result); }
/// <summary> /// Returns true if InputCollectionSearch instances are equal /// </summary> /// <param name="other">Instance of InputCollectionSearch to be compared</param> /// <returns>Boolean</returns> public bool Equals(InputCollectionSearch other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Input == other.Input || Input != null && other.Input != null && Input.SequenceEqual(other.Input) ) && ( Match == other.Match || Match != null && Match.Equals(other.Match) ) && ( Trim == other.Trim || Trim.Equals(other.Trim) ) && ( Ignorecase == other.Ignorecase || Ignorecase.Equals(other.Ignorecase) )); }
public void TrimShouldReturnDataTypeString() { var func = new Trim(); var result = func.Execute(FunctionsHelper.CreateArgs(" epplus "), _parsingContext); Assert.AreEqual(DataType.String, result.DataType); }
private void Test() { textBox5.Text = ""; textBox6.Text = "?"; if (comboBox1.SelectedIndex == -1) { return; } Align align = Utils.StringToAlign(comboBox1.SelectedItem.ToString()); if (comboBox2.SelectedIndex == -1) { return; } Trim trim = Utils.StringToTrim(comboBox2.SelectedItem.ToString()); if (comboBox3.SelectedIndex == -1) { return; } Append append = Utils.StringToAppend(comboBox3.SelectedItem.ToString()); string appendString = textBox3.Text; if (append == HomeSimCockpitX.LCD.Append.None || appendString.Length > 0) { int characters = listView2.Items.Count; int start = 0; textBox5.Text = LCDArea.FormatText(align, trim, append, appendString, characters, textBox4.Text, out start); textBox6.Text = start.ToString(); } }
public int ManageTrim(Trim trimObj) { if (trimObj != null) { var existingTrim = _context.Trims .Where(x => x.TrimName.ToLower().Equals(trimObj.TrimName.ToLower())) .FirstOrDefault(); if (existingTrim != null) { existingTrim.TrimName = trimObj.TrimName; _context.SaveChanges(); return(existingTrim.Id); } else { _context.Trims.Add(trimObj); _context.SaveChanges(); return(trimObj.Id); } } else { return(0); } }
public void TrimShouldTrimMultipleSpaces() { var func = new Trim(); var result = func.Execute(FunctionsHelper.CreateArgs(" epplus 5 "), _parsingContext); Assert.AreEqual("epplus 5", result.Result); }
internal StringElement(uint tag, String[] values, int maxLen, bool IsText, Trim trim, Check chk, Encoding encoding ) : base(tag, null) { this.trim = trim; this.maxLen = maxLen; this.IsText = IsText; m_data = toByteBuffer( values, trim, chk == null ? new Check( DoCheck ) : chk, encoding ); }
public ActionResult DeleteConfirmed(int id) { Trim trim = db.Trims.Find(id); db.Trims.Remove(trim); db.SaveChanges(); return(RedirectToAction("Index")); }
protected virtual void WriteToXml(XmlTextWriter xmlWriter) { xmlWriter.WriteAttributeString("id", ID); xmlWriter.WriteAttributeString("description", Description); xmlWriter.WriteAttributeString("align", Align.ToString()); xmlWriter.WriteAttributeString("trim", Trim.ToString()); xmlWriter.WriteAttributeString("append", Append.ToString()); xmlWriter.WriteAttributeString("appendString", AppendString); }
public Video(string ID, string Location, string Format, Trim trim) //audio download { downloadThread = new DownloadThread(ID, Location, Format, trim, null); //start download this.ID = ID; this.Location = Location; this.Format = Format; this.trim = trim; Type = "Audio"; }
public Video(string ID, string Name, string Location, string Format, string VideoFromPlaylist) //video from playlist download { downloadThread = new DownloadThread(ID, Name, Location, Format); //start download this.ID = ID; this.Location = Location; this.Format = Format; this.trim = null; Type = "Video"; }
public Video(string ID, string Name, string Location, string Format, Trim trim, string AudioFromPlaylist) //audio from playlist download { downloadThread = new DownloadThread(ID, Name, Location, Format, trim, null); //start download this.ID = ID; this.Location = Location; this.Format = Format; this.trim = trim; Type = "Audio"; }
public void Set(string id, string description, Align align, Trim trim, Append append, string appendString) { ID = id; Description = description; Align = align; Trim = trim; Append = append; AppendString = appendString; }
public Video(string ID, string Location, string Format) //video download { downloadThread = new DownloadThread(ID, Location, Format); //start download this.ID = ID; this.Location = Location; this.Format = Format; this.trim = null; Type = "Video"; }
public static string FormatText(Align align, Trim trim, Append append, string appendString, int characters, string text, out int start) { if (text == null || text.Length == 0) { text = ""; } if (append != Append.None) { while (appendString.Length < characters) { appendString += appendString; } } start = 0; if (text.Length > characters) { if (trim == Trim.Right) { text = text.Substring(0, characters); } else { text = text.Substring(text.Length - characters, characters); } } else { if (text.Length < characters) { int dif = characters - text.Length; if (append == Append.Left) { text = appendString.Substring(0, dif) + text; } else if (append == Append.Right) { text = text + appendString.Substring(appendString.Length - dif, dif); } else if (align != Align.Left) { if (align == Align.Center) { start = characters / 2 - text.Length / 2; } else if (align == Align.Right) { start = characters - text.Length; } } } } return(text); }
public async Task <ActionResult <Trim> > Post([FromBody] Trim entity) { if (!ModelState.IsValid) { return(BadRequest()); } await _trimRepository.Create(entity); await _unitOfWork.Save(); return(Ok(entity)); }
public static int ItemToInt(string Item) { int Time = Trim.StringToInt(Item); if (Item.Contains("sec")) { return(Convert.ToInt32(TimeSpan.FromSeconds(Time).TotalMilliseconds)); } else { return(Convert.ToInt32(TimeSpan.FromMinutes(Time).TotalMilliseconds)); } }
void ReleaseDesignerOutlets() { if (appraisalDate != null) { appraisalDate.Dispose(); appraisalDate = null; } if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } if (Mileage != null) { Mileage.Dispose(); Mileage = null; } if (sacComment != null) { sacComment.Dispose(); sacComment = null; } if (SacCommentsWidth != null) { SacCommentsWidth.Dispose(); SacCommentsWidth = null; } if (Trim != null) { Trim.Dispose(); Trim = null; } if (Vin != null) { Vin.Dispose(); Vin = null; } if (YearMakeModel != null) { YearMakeModel.Dispose(); YearMakeModel = null; } }
// GET: Trims/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Trim trim = db.Trims.Find(id); if (trim == null) { return(HttpNotFound()); } return(View(trim)); }
private Texture2D[] getTextures(ref ZipFile[] zf, Size size) { ZipFile trim = Array.Find(zf, x => x.Header.Location.FileName == "trim.txt"); bool HasTrim = !(trim is null); string[] split_; List <Texture2D> list = new List <Texture2D>(); Trim[] trims = new Trim[] { }; if (HasTrim) { byte[] Data = trim.Data; string data = Encoding.UTF8.GetString(Data); split_ = System.Text.RegularExpressions.Regex.Split(data, "\n"); if (split_.Count() <= 1) { split_ = System.Text.RegularExpressions.Regex.Split(data, "\r\n"); } trims = ConvertToTrim(split_); trim.Dispose(); } for (int i = 0; i < zf.Count(); i++) { ZipFile zff = zf[i]; if (zff.Header.Location.FileName == "trim.txt") { continue; } byte[] Data = zff.Data; using (MemoryStream ms = new MemoryStream(Data)) { Texture2D texture = new Texture2D(ms); if (HasTrim) { texture.Point = trims[i].point; texture.Size = trims[i].size; } else { texture.Size = new Size(info.Width, info.Height); texture.Point = new Point ((size.Width - texture.Width) / 2, (size.Height - texture.Height) / 2); } list.Add(texture); zff.Dispose(); } } return(list.ToArray()); }
public static string TrimToString(Trim trim) { switch (trim) { case Trim.Left: return("z lewej"); case Trim.Right: return("z prawej"); default: return("unk."); } }
public void Application_Should_Generate_Fake_Car_Trims() { List <Trim> trims = new List <Trim>(); for (int i = 0; i < 5; i++) { Trim trim = new Trim() { Id = i + 1, TitleAr = string.Format($"نوع {i + 1}"), TitleEn = string.Format($"Trim {i + 1}"), CreatedOn = DateTime.Now, MakeId = i + 1 }; trims.Add(trim); } }
// GET: Trims/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Trim trim = db.Trims.Find(id); if (trim == null) { return(HttpNotFound()); } var Results = from b in db.Restrictions select new { b.Id, b.Name, Checked = ((from ab in db.Trim_Restrictions where (ab.TrimId == id) && (ab.RestrictionsId == b.Id) select ab).Count() > 0) }; var MyViewModel = new TrimViewModel(); MyViewModel.TrimId = id.Value; MyViewModel.Name = trim.Name; MyViewModel.ImageUrl = trim.ImageUrl; MyViewModel.Description = trim.Description; var MyCheckBoxList = new List <CheckBoxViewModel>(); foreach (var item in Results) { MyCheckBoxList.Add(new CheckBoxViewModel { Id = item.Id, Name = item.Name, Checked = item.Checked }); } MyViewModel.Restrictions = MyCheckBoxList; return(View(MyViewModel)); }
public void SaveToXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("ledDisplays"); xmlWriter.WriteAttributeString("id", ID); xmlWriter.WriteAttributeString("description", Description); xmlWriter.WriteAttributeString("align", Align.ToString()); xmlWriter.WriteAttributeString("trim", Trim.ToString()); xmlWriter.WriteAttributeString("append", Append.ToString()); xmlWriter.WriteAttributeString("appendString", AppendString); foreach (LEDDisplayInGroup led in LEDDisplaysInGroup) { xmlWriter.WriteStartElement("ledDisplay"); xmlWriter.WriteAttributeString("ledDisplay", led.LEDDisplay.ID); xmlWriter.WriteAttributeString("order", led.Order.ToString()); xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); }
public List <Trim> GenerateCarTrims() { List <Trim> trims = new List <Trim>(); for (int i = 0; i < 5; i++) { Trim trim = new Trim() { Id = i + 1, TitleAr = string.Format($"نوع {i + 1}"), TitleEn = string.Format($"Trim {i + 1}"), CreatedOn = DateTime.Now, MakeId = i + 1 }; trims.Add(trim); } return(trims); }
private static ByteBuffer ToByteBuffer(String[] values, Trim trim, Check Check, Encoding encoding) { if (values.Length == 0) { return EMPTY_VALUE; } if (values.Length == 1) { return ToByteBuffer(values[0], trim, Check, encoding); } var bbs = new ByteBuffer[values.Length]; int totLen = - 1; for (int i = 0; i < values.Length; ++i) { bbs[i] = ToByteBuffer(values[i], trim, Check, encoding); totLen += (int)(bbs[i].Length + 1); } return ToByteBuffer(bbs, totLen); }
internal StringElement(uint tag, ByteBuffer data, Trim trim ) : base(tag, data) { this.trim = trim; }
internal MultiStringElement( uint tag, String value, int maxLen, bool IsText, Trim trim, Check chk, Encoding encoding ) : base(tag, value, maxLen, IsText, TRAIL_TRIM, chk, encoding) { }
private static ByteBuffer toByteBuffer(String value, Trim trim, Check check, Encoding encoding) { if (value == null || value.Length == 0) return EMPTY_VALUE; try { return ByteBuffer.Wrap( (encoding != null ? encoding : Encoding.ASCII).GetBytes(check(trim(value)))); } catch(Exception ex) { throw new ArgumentException(value); } }
private static ByteBuffer toByteBuffer(String[] values, Trim trim, Check Check, Encoding encoding) { if (values.Length == 0) return EMPTY_VALUE; if (values.Length == 1) return toByteBuffer(values[0], trim, Check, encoding); ByteBuffer[] bbs = new ByteBuffer[values.Length]; int totLen = - 1; for (int i = 0; i < values.Length; ++i) { bbs[i] = toByteBuffer(values[i], trim, Check, encoding); totLen += bbs[i].length() + 1; } return toByteBuffer(bbs, totLen); }
internal AsciiMultiStringElement(uint tag, ByteBuffer data, Trim trim) : base(tag, data, trim) { }
internal AsciiMultiStringElement( uint tag, String[] values, int maxLen, bool IsText, Trim trim, Check chk, Encoding encoding ) : base(tag, values, 10240, true, TRAIL_TRIM, chk, encoding) { }
private static ByteBuffer ToByteBuffer(String value, Trim trim, Check check, Encoding encoding) { if (string.IsNullOrEmpty(value)) { return EMPTY_VALUE; } try { return ByteBuffer.Wrap((encoding ?? Encoding.ASCII).GetBytes(check(trim(value)))); } catch (Exception) { throw new ArgumentException(value); } }
internal DateString(uint tag, ByteBuffer data, Trim trim) : base(tag, data, trim) { }
internal DS( uint tag, String[] values, Trim trim, Check chk ) : base(tag, values, 0, false, trim, chk, null) { }
public TrimVideo(double? startUnit, double? endUnit, double? duration, VideoUnitType timebaseUnit) { TrimFilter = new Trim(startUnit, endUnit, duration, timebaseUnit); }
internal DateString( uint tag, String value, Trim trim, Check chk ) : base(tag, value, 0, false, trim, chk, null) { }