void Start() { drag = gameObject.GetComponent<DragForces> (); transmission = gameObject.GetComponent<Transmission> (); engine = gameObject.GetComponent<CarEngine> (); carRigidbody = gameObject.GetComponent<Rigidbody> (); carRigidbody.centerOfMass = centerOfMass.localPosition; }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new MOTDNotificationComposer(), string.Format("Welcome to Project Boolean.\r\nYour socket-id: {0}\rYour socket-info: {1}\rYour buffer-size: {2}\rYour addressfamily: {3}", Session.Id, Session.Socket.RemoteEndPoint, Session.Socket.ReceiveBufferSize, Session.Socket.AddressFamily)); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { var Ping = ((Message.GetInt32() + Message.GetInt32()) / 2); if (Ping > int.Parse(Settings.GetValue("TCP.Sessions.MaxPing"))) { Solution.AppendPaint(); Solution.AppendLine("Session: Closed({0}) Ping to high({1})",Session.Id, Ping); // SessionHandler.CloseClientSocket(Session.Args); } }
public void SpawnVehicle(int vehicle) { newVehicle = Instantiate(vehicles[vehicle], spawnPoint, Quaternion.LookRotation(spawnRot, GlobalControl.worldUpDir)) as GameObject; cam.target = newVehicle.transform; cam.Initialize(); vp = newVehicle.GetComponent<VehicleParent>(); cam.GetComponent<CameraControlls>().cameraTarget = newVehicle.transform; trans = newVehicle.GetComponentInChildren<Transmission>(); if (trans) { trans.automatic = autoShift; newVehicle.GetComponent<VehicleParent>().brakeIsReverse = autoShift; if (trans is GearboxTransmission) { gearbox = trans as GearboxTransmission; } else if (trans is ContinuousTransmission) { varTrans = trans as ContinuousTransmission; if (!autoShift) { vp.brakeIsReverse = true; } } } if (newVehicle.GetComponent<VehicleAssist>()) { newVehicle.GetComponent<VehicleAssist>().enabled = assist; } if (newVehicle.GetComponent<FlipControl>() && newVehicle.GetComponent<StuntDetect>()) { newVehicle.GetComponent<FlipControl>().flipPower = stuntMode && assist ? new Vector3(10, 10, -10) : Vector3.zero; newVehicle.GetComponent<FlipControl>().rotationCorrection = stuntMode ? Vector3.zero : (assist ? new Vector3(5, 1, 10) : Vector3.zero); newVehicle.GetComponent<FlipControl>().stopFlip = assist; stunter = newVehicle.GetComponent<StuntDetect>(); } engine = newVehicle.GetComponentInChildren<Motor>(); propertySetter = newVehicle.GetComponent<PropertyToggleSetter>(); stuntText.gameObject.SetActive(stuntMode); scoreText.gameObject.SetActive(stuntMode); }
public static void Main(string[] args) { var settings = ConfigurationManager.AppSettings; var fromAddr = settings["fromaddr"]; var toAddr = settings["toaddr"]; var trans = new Transmission(); var to = new Recipient { Address = new Address { Email = toAddr }, SubstitutionData = new Dictionary<string, object> { {"firstName", "Jane"} } }; trans.Recipients.Add(to); trans.SubstitutionData["firstName"] = "Oh Ye Of Little Name"; trans.Content.From.Email = fromAddr; trans.Content.Subject = "SparkPost online content example"; trans.Content.Text = "Greetings {{firstName or 'recipient'}}\nHello from C# land."; trans.Content.Html = "<html><body><h2>Greetings {{firstName or 'recipient'}}</h2><p>Hello from C# land.</p></body></html>"; Console.Write("Sending mail..."); var client = new Client(settings["apikey"]); client.CustomSettings.SendingMode = SendingModes.Sync; var response = client.Transmissions.Send(trans); Console.WriteLine("done"); }
protected byte[] DownloadCacheFile(IFileInfo target, IDocument remoteDocument, Transmission transmission, IFileSystemInfoFactory fsFactory) { if (!this.LoadCacheFile(target, remoteDocument, fsFactory)) { if (target.Exists) { target.Delete(); } } using (var hashAlg = new SHA1Reuse()) { using (var filestream = target.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) using (var downloader = ContentTaskUtils.CreateDownloader()) { try { downloader.DownloadFile(remoteDocument, filestream, transmission, hashAlg, (byte[] checksumUpdate, long length) => this.SaveCacheFile(target, remoteDocument, checksumUpdate, length, transmission)); if (this.TransmissionStorage != null) { this.TransmissionStorage.RemoveObjectByRemoteObjectId(remoteDocument.Id); } } catch (Exception ex) { transmission.FailedException = ex; throw; } } target.Refresh(); return(hashAlg.Hash); } }
public void SetTransmission(Transmission transmission) { vehicle.Transmission = transmission; }
public Truck(Chassis chassis, Engine engine, Transmission transmission, double weight) : base(chassis, engine, transmission) { this.Weight = weight; }
public void Setup() { transmission = new Transmission(); mapper = new DataMapper("v1"); }
public TransmissionContainer(Transmission transmission) { _transmission = transmission; }
public TransmissionProcessedEventArgs(Transmission transmission, Exception exception = null, HttpWebResponseWrapper response = null) { this.Transmission = transmission; this.Exception = exception; this.Response = response; }
void Awake() { transmission = GetComponent <Transmission>(); vehicle = GetComponent <Vehicle>(); }
public Sedan(int size, double maxSpeed, int passangers, int power, int wheels, Transmission trans) : base(size, maxSpeed, passangers, power, wheels, trans) { }
public Car(int size, double maxSpeed, int passangers, int power, int wheels, Transmission trans) : base(size, maxSpeed, passangers, power) { this._countOfWheels = wheels; this._transmission = trans; }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new OfficialRoomsComposer()); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new BadgePointLimitsComposer()); }
// Use this for initialization void Start() { carController = gameObject.GetComponent<CarController> (); transmission = gameObject.GetComponent<Transmission> (); }
/// <summary> /// Send this data to the other end /// </summary> /// <param name="data"></param> /// <param name="option"></param> public override void Send(ArraySegment<byte> data, Transmission option) { lock (client) { try { Interlocked.Exchange(ref biggestPacket, data.Count); writer.Write(data.Count); writer.Write(data.Array, data.Offset, data.Count); writer.Flush(); } catch (IOException) { Console.Error.WriteLine("IO Exception in TCP connection"); } } }
public Cycler(int pX, int pY, Color[] pColours) : base(pColours[0], new Circle(new Point(pX - DGS.TRANSMITTER_RADIUS / 2, pY - DGS.TRANSMITTER_RADIUS / 2), DGS.TRANSMITTER_RADIUS), Transmission.Instance().CM().Load <Texture2D>("hackable")) { mColours = pColours; Reset(); }
public Vehicle(ManufacturersForTransmissionsAndVehicles manufacturer, Engine engine, Chassis chassis, Transmission transmission) { Id = IDController.GetId(); Manufacturer = manufacturer; VehicleEngine = engine; VehicleChassis = chassis; VehicleTransmission = transmission; }
public Track(int size, double maxSpeed, int passangers, int power, int wheels, Transmission trans, int weightCapacity) : base(size, maxSpeed, passangers, power, wheels, trans) { this._weightCapacity = weightCapacity; }
public Scooter(int maxSpeed, Engine engine, Transmission transmission, Chassis chassis) : base(engine, chassis, transmission, _vehicleType) { MaxSpeed = maxSpeed; }
static void Main(string[] args) { CRM crm = new CRM(); Fleet fleet = new Fleet(); Console.WriteLine("\n### Mates-Rates Rent-a-Car Operation Menu ###\n"); Console.WriteLine("You may press the ESC key at any menu to exit. Press the BACKSPACE key to return to the previous menu."); while (true) { ConsoleKeyInfo mainInput; Console.WriteLine("\nPlease enter a character from the options below:\n"); Console.WriteLine("a) Customer Management"); Console.WriteLine("b) Fleet Management"); Console.WriteLine("c) Rental Management"); Console.WriteLine(); Console.Write(">"); mainInput = Console.ReadKey(); Console.WriteLine(); if (mainInput.Key == ConsoleKey.A) { while (true) { ConsoleKeyInfo customerInput; Console.WriteLine("\nPlease enter a character from the options below:\n"); Console.WriteLine("a) Display Customers"); Console.WriteLine("b) New Customer"); Console.WriteLine("c) Modify Customer"); Console.WriteLine("d) Delete Customer"); Console.WriteLine(); Console.Write(">"); customerInput = Console.ReadKey(); Console.WriteLine(); if (customerInput.Key == ConsoleKey.A) { Console.WriteLine(); List <Customer> customers = crm.GetCustomers(); DataTable customersTable = new DataTable(); DataRow customersRow = null; customersTable.TableName = "Customers"; customersTable.Columns.Add("ID", typeof(int)).AllowDBNull = false; customersTable.Columns.Add("Title", typeof(string)); customersTable.Columns.Add("First Name", typeof(string)); customersTable.Columns.Add("Last Name", typeof(string)); customersTable.Columns.Add("Gender", typeof(string)); customersTable.Columns.Add("DOB", typeof(string)); for (int i = 0; i < customers.Count; i++) { customersRow = customersTable.NewRow(); // have new row on each iteration customersRow["ID"] = customers[i].CustomerID; customersRow["Title"] = customers[i].Title; customersRow["First Name"] = customers[i].FirstNames; customersRow["Last Name"] = customers[i].LastNames; if (customers[i].Gen == Gender.Male) { customersRow["Gender"] = "Male"; } else { customersRow["Gender"] = "Female"; } customersRow["DOB"] = customers[i].DateOfBirth; customersTable.Rows.Add(customersRow); } customersTable.Print(); } else if (customerInput.Key == ConsoleKey.B) { while (true) { Customer customer; int ID; string title, firstName, lastName, gender, DOB; string[] format = new string[] { "dd/MM/yyyy" }; DateTime dateTime; Console.WriteLine("\nPlease fill the following fields (fields marked with * are required):\n"); Console.Write("Title*: "); title = Console.ReadLine(); while (!Regex.IsMatch(title, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Title*: "); title = Console.ReadLine(); } Console.Write("First Name*: "); firstName = Console.ReadLine(); while (!Regex.IsMatch(firstName, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("First Name*: "); firstName = Console.ReadLine(); } Console.Write("Last Name*: "); lastName = Console.ReadLine(); while (!Regex.IsMatch(lastName, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Last Name*: "); lastName = Console.ReadLine(); } Console.Write("Gender*: "); gender = Console.ReadLine(); gender = gender.ToLower(); while (gender != "male" && gender != "female") { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Gender*: "); gender = Console.ReadLine(); gender = gender.ToLower(); } Console.Write("DOB*: "); DOB = Console.ReadLine(); while (!(DateTime.TryParseExact(DOB, format, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.NoCurrentDateDefault, out dateTime))) { Console.WriteLine("\nIncorrect Format!\n"); Console.Write("DOB*: "); DOB = Console.ReadLine(); } Console.WriteLine(); ID = crm.GenerateID(); if (gender == "male") { customer = new Customer(ID, title, firstName, lastName, Gender.Male, DOB); } else { customer = new Customer(ID, title, firstName, lastName, Gender.Female, DOB); } crm.AddCustomer(customer); crm.SaveToFile(); Console.WriteLine("Successfully created new customer '" + ID + " - " + title + " " + firstName + " " + lastName + "' and added to customer list."); break; } } else if (customerInput.Key == ConsoleKey.C) { string ID; Console.WriteLine("\nPlease enter an ID to modify record:\n"); Console.Write("ID: "); ID = Console.ReadLine(); while (!Regex.IsMatch(ID, @"^\d+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("ID: "); ID = Console.ReadLine(); } if (crm.FindCustomer(Convert.ToInt32(ID))) { while (true) { ConsoleKeyInfo modifyCustomerInput; Console.WriteLine("\nPlease enter a character from the options below to modify trait:\n"); Console.WriteLine("a) Title"); Console.WriteLine("b) First Name"); Console.WriteLine("c) Last Name"); Console.WriteLine("d) Gender"); Console.WriteLine("e) DOB"); Console.WriteLine(); Console.Write(">"); modifyCustomerInput = Console.ReadKey(); Console.WriteLine(); if (modifyCustomerInput.Key == ConsoleKey.A) { string title; Console.Write("\nTitle: "); title = Console.ReadLine(); while (!Regex.IsMatch(title, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Title: "); title = Console.ReadLine(); } crm.ModifyCustomer(Convert.ToInt32(ID), 1, title); crm.SaveToFile(); Console.WriteLine("\nID " + ID + " is successfully modified."); break; } else if (modifyCustomerInput.Key == ConsoleKey.B) { string firstName; Console.Write("\nFirst Name: "); firstName = Console.ReadLine(); while (!Regex.IsMatch(firstName, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("First Name: "); firstName = Console.ReadLine(); } crm.ModifyCustomer(Convert.ToInt32(ID), 2, firstName); crm.SaveToFile(); Console.WriteLine("\nID " + ID + " is successfully modified."); break; } else if (modifyCustomerInput.Key == ConsoleKey.C) { string lastName; Console.Write("\nLast Name: "); lastName = Console.ReadLine(); while (!Regex.IsMatch(lastName, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Last Name: "); lastName = Console.ReadLine(); } crm.ModifyCustomer(Convert.ToInt32(ID), 3, lastName); crm.SaveToFile(); Console.WriteLine("\nID " + ID + " is successfully modified."); break; } else if (modifyCustomerInput.Key == ConsoleKey.D) { string gender; Console.Write("\nGender: "); gender = Console.ReadLine(); gender = gender.ToLower(); while (gender != "male" && gender != "female") { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Gender: "); gender = Console.ReadLine(); gender = gender.ToLower(); } crm.ModifyCustomer(Convert.ToInt32(ID), 4, gender); Console.WriteLine("\nID " + ID + " is successfully modified."); break; } else if (modifyCustomerInput.Key == ConsoleKey.E) { string DOB; string[] format = new string[] { "dd/MM/yyyy" }; DateTime dateTime; Console.Write("\nDOB: "); DOB = Console.ReadLine(); while (!(DateTime.TryParseExact(DOB, format, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.NoCurrentDateDefault, out dateTime))) { Console.WriteLine("\nIncorrect Format!\n"); Console.Write("DOB: "); DOB = Console.ReadLine(); } crm.ModifyCustomer(Convert.ToInt32(ID), 5, DOB); crm.SaveToFile(); Console.WriteLine("\nID " + ID + " is successfully modified."); break; } else if (modifyCustomerInput.Key == ConsoleKey.Escape) { crm.SaveToFile(); fleet.SaveToFile(); Environment.Exit(0); } else if (modifyCustomerInput.Key == ConsoleKey.Backspace) { break; } else { Console.WriteLine("\nInvalid Input!"); } } } else { Console.WriteLine("\nID " + ID + " is not found."); } } else if (customerInput.Key == ConsoleKey.D) { string ID; Console.WriteLine("\nPlease enter an ID to delete record:\n"); Console.Write("ID: "); ID = Console.ReadLine(); while (!Regex.IsMatch(ID, @"^\d+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("ID: "); ID = Console.ReadLine(); } if (crm.RemoveCustomer(Convert.ToInt32(ID), fleet)) { Console.WriteLine("\nSuccessfully deleted customer " + ID + "."); } else { Console.WriteLine("\nCustomer " + ID + " is renting and thus cannot be deleted."); } } else if (customerInput.Key == ConsoleKey.Backspace) { break; } else if (customerInput.Key == ConsoleKey.Escape) { crm.SaveToFile(); fleet.SaveToFile(); Environment.Exit(0); } else { Console.WriteLine("\nInvalid Input!"); } } } else if (mainInput.Key == ConsoleKey.B) { while (true) { Console.WriteLine("\nPlease enter a number from the option below:\n"); Console.WriteLine("a) Display Fleet"); Console.WriteLine("b) New Vehicle"); Console.WriteLine("c) Modify Vehicle"); Console.WriteLine("d) Delete Vehicle\n"); Console.Write(">"); ConsoleKeyInfo fleetInput; fleetInput = Console.ReadKey(); if (fleetInput.Key == ConsoleKey.A) { Console.WriteLine(); List <Vehicle> vehicles = fleet.GetFleets(); var fleetTable = new DataTable(); DataRow fleetRow = null; fleetTable.TableName = "Fleet"; fleetTable.Columns.Add("Registration", typeof(string)); fleetTable.Columns.Add("Grade", typeof(string)); fleetTable.Columns.Add("Make", typeof(string)); fleetTable.Columns.Add("Model", typeof(string)); fleetTable.Columns.Add("Year", typeof(int)).AllowDBNull = false; fleetTable.Columns.Add("NumSeats", typeof(int)).AllowDBNull = false; fleetTable.Columns.Add("Transmission", typeof(string)); fleetTable.Columns.Add("Fuel", typeof(string)); fleetTable.Columns.Add("GPS", typeof(string)); fleetTable.Columns.Add("SunRoof", typeof(string)); fleetTable.Columns.Add("DailyRate", typeof(string)); fleetTable.Columns.Add("Colour", typeof(string)); for (int i = 0; i < vehicles.Count; i++) { fleetRow = fleetTable.NewRow(); // have new row on each iteration fleetRow["Registration"] = vehicles[i].Registration; fleetRow["Grade"] = vehicles[i].Grade; fleetRow["Make"] = vehicles[i].Make; fleetRow["Model"] = vehicles[i].Model; fleetRow["Year"] = vehicles[i].Year; fleetRow["NumSeats"] = vehicles[i].NumSeats; fleetRow["Transmission"] = vehicles[i].Transmission; fleetRow["Fuel"] = vehicles[i].Fuel; fleetRow["GPS"] = vehicles[i].GPS; fleetRow["SunRoof"] = vehicles[i].SunRoof; fleetRow["DailyRate"] = vehicles[i].DailyRate; fleetRow["Colour"] = vehicles[i].Colour; fleetTable.Rows.Add(fleetRow); } fleetTable.Print(); } else if (fleetInput.Key == ConsoleKey.B) { while (true) { //declare Identifier Vehicle vehicle; string Registration, Grade, Make, Model, Transmission, Fuel, Colour; int Year, NumSeats; bool GPS, SunRoof; float DailyRate; Console.Write("\nEnter Registration No : "); Registration = Console.ReadLine(); //check is registration already exist or not while (true) { if (fleet.CheckRegistration(Registration)) { Console.WriteLine("\nRegistration No Already Exist! Please Enter A Unique Registration No : "); Console.Write("\nEnter Registration No : "); Registration = Console.ReadLine(); } else if (Registration.Length != 6) { Console.WriteLine("\nRegistration Number Must Contains 6 Character"); Console.Write("Enter Registration No : "); Registration = Console.ReadLine(); } else { break; } } Console.Write("Enter Grade : "); Grade = Console.ReadLine(); //validate Grade while (!Regex.IsMatch(Grade, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Enter Grade : "); Grade = Console.ReadLine(); } Console.Write("Enter Make : "); Make = Console.ReadLine(); //validate Make while (!Regex.IsMatch(Grade, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Enter Make : "); Make = Console.ReadLine(); } Console.Write("Enter Model : "); Model = Console.ReadLine(); Console.Write("Enter Year : "); //validate Year while (!int.TryParse(Console.ReadLine(), out Year)) { Console.WriteLine("\nEnter Valid Year"); Console.Write("Enter Year : "); } Console.Write("Enter Number Of Seats : "); //validate NumSeats while (!int.TryParse(Console.ReadLine(), out NumSeats)) { Console.WriteLine("\nEnter Valid Number Of Seats"); Console.Write("Enter Number Of Seats : "); } Console.Write("Enter Transmission Type(Automatic/Manual) :"); Transmission = Console.ReadLine(); Transmission.Trim(); //validate trasmission while (Transmission.ToUpper() != "AUTOMATIC" && Transmission.ToUpper() != "MANUAL") { Console.WriteLine("\nPlease Enter Valid Transmission Type(Automatic/Manual)"); Console.Write("Enter Transmission Type(Automatic/Manual) :"); Transmission = Console.ReadLine(); Transmission.Trim(); } Console.Write("Enter Fuel Type (Petrol/Disel) : "); Fuel = Console.ReadLine(); Fuel.Trim(); //validate trasmission while (Fuel.ToUpper() != "PETROL" && Fuel.ToUpper() != "DISEL") { Console.WriteLine("\nPlease Enter Valid Fuel Type (Petrol/Disel)"); Console.Write("Enter Fuel Type (Petrol/Disel) : "); Fuel = Console.ReadLine(); Fuel.Trim(); } Console.Write("GPS (T/F) :"); string temp = Console.ReadLine(); while (temp.ToUpper() != "T" && temp.ToUpper() != "F") { Console.WriteLine("\nPlease Enter T or F for GPS"); Console.Write("GPS (T/F) :"); temp = Console.ReadLine(); } //assign value to GPS bool variable if (temp.ToUpper() == "T") { GPS = true; } else { GPS = false; } //Sunroof Console.Write("Sun Roof (T/F): "); temp = Console.ReadLine(); while (temp.ToUpper() != "T" && temp.ToUpper() != "F") { Console.WriteLine("\nPlease Enter T or F for Sun Roof"); Console.Write("Sun Roof (T/F): "); temp = Console.ReadLine(); } //assign value to GPS bool variable if (temp.ToUpper() == "T") { SunRoof = true; } else { SunRoof = false; } //Daily Rate Validation Console.Write("Please Enter Daily Rate : "); while (!float.TryParse(Console.ReadLine(), out DailyRate)) { Console.WriteLine("\nEnter Valid Daily Rate"); Console.Write("Please Enter Daily Rate : "); } Console.Write("Enter Color : "); Colour = Console.ReadLine(); vehicle = new Vehicle(Registration, Grade, Make, Model, Year, NumSeats, Transmission, Fuel, GPS, SunRoof, DailyRate, Colour); fleet.AddVehicle(vehicle); Console.WriteLine("Record Saved Successfully"); break; } } else if (fleetInput.Key == ConsoleKey.C) { while (true) { string Registration, Grade, Make, Model, Transmission, Fuel, Colour; int Year, NumSeats; bool GPS, SunRoof; float DailyRate; Console.Write("\nEnter Registration No : "); Registration = Console.ReadLine(); //check is registration already exist or not while (true) { if (fleet.CheckRegistration(Registration)) { Console.WriteLine("Registration No Already Exist! Please Enter A Unique Registration No : "); Console.Write("\nEnter Registration No : "); Registration = Console.ReadLine(); } else if (Registration.Length != 6) { Console.WriteLine("Registration Number Must Contains 6 Character"); Console.Write("\nEnter Registration No : "); Registration = Console.ReadLine(); } else { break; } } Console.Write("Enter Grade : "); Grade = Console.ReadLine(); //validate Grade while (!Regex.IsMatch(Grade, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Enter Grade : "); Grade = Console.ReadLine(); } Console.Write("Enter Make : "); Make = Console.ReadLine(); //validate Make while (!Regex.IsMatch(Grade, @"^[a-zA-Z]+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("Enter Make : "); Make = Console.ReadLine(); } Console.Write("Enter Model : "); Model = Console.ReadLine(); Console.Write("Enter Year : "); //validate Year while (!int.TryParse(Console.ReadLine(), out Year)) { Console.WriteLine("\nEnter Valid Year"); Console.Write("Enter Year : "); } Console.Write("Enter Number Of Seats : "); //validate NumSeats while (!int.TryParse(Console.ReadLine(), out NumSeats)) { Console.WriteLine("\nEnter Valid Number Of Seats"); Console.Write("Enter Number Of Seats : "); } Console.Write("Enter Transmission Type(Automatic/Manual) :"); Transmission = Console.ReadLine(); Transmission.Trim(); //validate trasmission while (Transmission.ToUpper() != "AUTOMATIC" && Transmission.ToUpper() != "MANUAL") { Console.WriteLine("\nPlease Enter Valid Transmission Type(Automatic/Manual)"); Console.Write("Enter Transmission Type(Automatic/Manual) :"); Transmission = Console.ReadLine(); Transmission.Trim(); } Console.Write("Enter Fuel Type (Petrol/Disel) : "); Fuel = Console.ReadLine(); //validate trasmission Fuel.Trim(); while (Fuel.ToUpper() != "PETROL" && Fuel.ToUpper() != "DISEL") { Console.WriteLine("\nPlease Enter Valid Fuel Type (Petrol/Disel)"); Console.Write("Enter Fuel Type (Petrol/Disel) : "); Fuel = Console.ReadLine(); Fuel.Trim(); } Console.Write("GPS (T/F) :"); string temp = Console.ReadLine(); while (temp.ToUpper() != "T" && temp.ToUpper() != "F") { Console.WriteLine("\nPlease Enter T or F for GPS"); Console.Write("GPS (T/F) :"); temp = Console.ReadLine(); } //assign value to GPS bool variable if (temp.ToUpper() == "T") { GPS = true; } else { GPS = false; } //Sunroof Console.Write("Sun Roof (T/F): "); temp = Console.ReadLine(); while (temp.ToUpper() != "T" && temp.ToUpper() != "F") { Console.WriteLine("\nPlease Enter T or F for Sun Roof"); Console.Write("Sun Roof (T/F): "); temp = Console.ReadLine(); } //assign value to GPS bool variable if (temp.ToUpper() == "T") { SunRoof = true; } else { SunRoof = false; } //Daily Rate Validation Console.Write("Please Enter Daily Rate : "); while (!float.TryParse(Console.ReadLine(), out DailyRate)) { Console.WriteLine("\nEnter Valid Daily Rate"); Console.Write("Please Enter Daily Rate : "); } Console.Write("Enter Color : "); Colour = Console.ReadLine(); fleet.ModifyRecord(Registration, Grade, Make, Model, Year, NumSeats, Transmission, Fuel, GPS, SunRoof, DailyRate, Colour); Console.WriteLine("Record Modify Successfully"); break; } } else if (fleetInput.Key == ConsoleKey.D) { string RegistrationNo; Console.WriteLine("\nPlease Enter Registration No To Delete.\n"); Console.Write("Registration No: "); RegistrationNo = Console.ReadLine(); while (true) { if (!fleet.CheckRegistration(RegistrationNo)) { Console.WriteLine("\nRegistration No. not found! Please enter a valid Registration No."); Console.Write("\nRegistration No: "); RegistrationNo = Console.ReadLine(); } else if (RegistrationNo.Length != 6) { Console.WriteLine("\nRegistration No. must contains 6 characters."); Console.Write("\nRegistration No: "); RegistrationNo = Console.ReadLine(); } else { break; } } if (fleet.RemoveVehicle((RegistrationNo))) { Console.WriteLine("\nRecord Removed Successfully"); } else { Console.WriteLine("\nThis vehicle is currently rented."); } } else if (fleetInput.Key == ConsoleKey.Backspace) { break; } else if (fleetInput.Key == ConsoleKey.Escape) { crm.SaveToFile(); fleet.SaveToFile(); Environment.Exit(0); } else { Console.WriteLine("\nInvalid Input!"); } } } else if (mainInput.Key == ConsoleKey.C) { while (true) { ConsoleKeyInfo rentalInput; Console.WriteLine("\nPlease enter a character from the options below:\n"); Console.WriteLine("a) Display Rentals"); Console.WriteLine("b) Search Vehicles"); Console.WriteLine("c) Rent Vehicle"); Console.WriteLine("d) Return Vehicle"); Console.WriteLine(); Console.Write(">"); rentalInput = Console.ReadKey(); Console.WriteLine(); if (rentalInput.Key == ConsoleKey.A) { Console.WriteLine(); Dictionary <string, int> rentals = fleet.GetRentals(); DataTable rentalsTable = new DataTable(); DataRow rentalsRow = null; rentalsTable.TableName = "Rentals"; rentalsTable.Columns.Add("Registration", typeof(string)); rentalsTable.Columns.Add("CustomerID", typeof(int)).AllowDBNull = false; foreach (string regNo in rentals.Keys) { rentalsRow = rentalsTable.NewRow(); // have new row on each iteration rentalsRow["Registration"] = regNo; rentalsRow["CustomerID"] = rentals[regNo]; rentalsTable.Rows.Add(rentalsRow); } rentalsTable.Print(); } else if (rentalInput.Key == ConsoleKey.B) { } else if (rentalInput.Key == ConsoleKey.C) { string regNo; string ID; Console.WriteLine("\nPlease enter the registration number of vehicle you want to rent:\n"); Console.Write("Registration No.: "); regNo = Console.ReadLine(); if (regNo.Length != 6) { Console.WriteLine("\nRegistration No. must contains 6 characters."); } else if (!fleet.CheckRegistration(regNo)) { Console.WriteLine("\nRegistration number not found."); } else if (fleet.IsRented(regNo)) { Console.WriteLine("\nVehicle " + regNo + " is already rented by customer " + fleet.RentedBy(regNo) + "."); } else { Console.WriteLine("\nPlease enter the customer ID:\n"); Console.Write("ID: "); ID = Console.ReadLine(); while (!Regex.IsMatch(ID, @"^\d+$")) { Console.WriteLine("\nInvalid Input!\n"); Console.Write("ID: "); ID = Console.ReadLine(); } if (crm.FindCustomer(Convert.ToInt32(ID))) { fleet.RentCar(regNo, Convert.ToInt32(ID)); Console.WriteLine("\nVehicle " + regNo + " is successfully rented by customer " + ID + "."); } else { Console.WriteLine("\nCustomer ID not found."); } } } else if (rentalInput.Key == ConsoleKey.D) { string regNo; Console.WriteLine("\nPlease enter the registration number of rented vehicle:\n"); Console.Write("Registration No.: "); regNo = Console.ReadLine(); if (regNo.Length != 6) { Console.WriteLine("\nRegistration No. must contains 6 characters."); } else if (fleet.ReturnCar(regNo) != -1) { Console.WriteLine("\nVehicle " + regNo + " is successfully returned."); } else { Console.WriteLine("\nRegistration No. is not found in rentals."); } } else if (rentalInput.Key == ConsoleKey.Backspace) { break; } else if (rentalInput.Key == ConsoleKey.Escape) { crm.SaveToFile(); fleet.SaveToFile(); Environment.Exit(0); } else { Console.WriteLine("\nInvalid Input!"); } } } else if (mainInput.Key == ConsoleKey.Escape) { crm.SaveToFile(); fleet.SaveToFile(); Environment.Exit(0); } else if (mainInput.Key == ConsoleKey.Backspace) { //Do nothing } else { Console.WriteLine("\nInvalid Input!"); } } }
public Scooter(Engine engine, Transmission transmission, Chassis chassis) : base(engine, transmission, chassis) { }
public Unhackable(int pX, int pY, Color pColour) : base(pColour, new Circle(new Point(pX - DGS.TRANSMITTER_RADIUS / 2, pY - DGS.TRANSMITTER_RADIUS / 2), DGS.TRANSMITTER_RADIUS), Transmission.Instance().CM().Load <Texture2D>("unhackable")) { Reset(); }
// car search /// <summary> /// <para>Performs the Search Method: /// Search Used Motors. /// Creates a query string based on the parameters provided, can be null if the parameter is not required for the request. /// </para> /// DOES NOT REQUIRE AUTHENTICATION. /// </summary> /// <param name="searchString">One or more keywords to use in a search query.</param> /// <param name="userRegion">Restricts search results to items from sellers located in the specified region.</param> /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param> /// <param name="priceMin">Minimum price.</param> /// <param name="priceMax">Maximum price.</param> /// <param name="make">Car make.</param> /// <param name="model">Car model.</param> /// <param name="bodyStyle">Car body style.</param> /// <param name="doorsMin">Minimum number of doors (range from 2 to 5).</param> /// <param name="doorsMax">Maximum number of doors. </param> /// <param name="transmission">Transmission type.</param> /// <param name="yearMax">Maximum year of manufacture.</param> /// <param name="yearMin">Minimum year of manufacture.</param> /// <param name="energySizeMin">Minimum engine size in cubic centimetres (e.g. 2000 for 2 litre engine). </param> /// <param name="energySizeMax">Maximum engine size.</param> /// <param name="odometerMin"> Minimum odometer value in kilometres.</param> /// <param name="odometerMax">Maximum odometer value.</param> /// <param name="listingType">Type of listing.</param> /// <param name="dateFrom">Return only listings started from this date.</param> /// <param name="page">Page number.</param> /// <param name="rows">Number of rows per page.</param> /// <returns>Cars.</returns> public Cars SearchUsedMotors( string searchString, int? userRegion, SortOrder sortOrder, decimal priceMin, decimal priceMax, string make, string model, BodyStyle bodyStyle, int? doorsMin, int? doorsMax, Transmission transmission, int? yearMax, int? yearMin, int? energySizeMin, int? energySizeMax, int? odometerMin, int? odometerMax, ListingType listingType, DateTime dateFrom, int? page, int? rows) { if (_search == null) { _search = new SearchMethods(_connection); } return _search.SearchUsedMotors(searchString, userRegion, sortOrder, priceMin, priceMax, make, model, bodyStyle, doorsMin, doorsMax, transmission, yearMax, yearMin, energySizeMin, energySizeMax, odometerMin, odometerMax, listingType, dateFrom, page, rows); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new UserObjectComposer(), Session.Character); }
internal override async Task EnqueueAsync(Transmission transmission) { try { if (transmission == null || this.StorageFolder == null) { return; } // Initial storage size calculation. await this.EnsureSizeIsCalculatedAsync().ConfigureAwait(false); if ((ulong)this.storageSize >= this.CapacityInBytes || this.storageCountFiles >= this.MaxFiles) { // if max storage capacity has reached, drop the transmission (but log every 100 lost transmissions). if (this.transmissionsDropped++ % 100 == 0) { CoreEventSource.Log.LogVerbose("Total transmissions dropped: " + this.transmissionsDropped); } return; } // Writes content to a temporaty file and only then rename to avoid the Peek from reading the file before it is being written. // Creates the temp file name string tempFileName = Guid.NewGuid().ToString("N"); // Creates the temp file (doesn't save any content. Just creates the file) IStorageFile temporaryFile = await this.StorageFolder.CreateFileAsync(tempFileName + ".tmp").AsTask().ConfigureAwait(false); // Now that the file got created we can increase the files count Interlocked.Increment(ref this.storageCountFiles); // Saves transmission to the temp file await SaveTransmissionToFileAsync(transmission, temporaryFile).ConfigureAwait(false); // Now that the file is written increase storage size. long temporaryFileSize = await this.GetSizeAsync(temporaryFile).ConfigureAwait(false); Interlocked.Add(ref this.storageSize, temporaryFileSize); // Creates a new file name string now = DateTime.UtcNow.ToString("yyyyMMddHHmmss"); string newFileName = string.Format(CultureInfo.InvariantCulture, "{0}_{1}.trn", now, tempFileName); // Renames the file await temporaryFile.RenameAsync(newFileName, NameCollisionOption.FailIfExists).AsTask().ConfigureAwait(false); } catch (Exception e) { CoreEventSource.Log.LogVerbose(string.Format(CultureInfo.InvariantCulture, "EnqueueAsync: Exception: {0}", e)); } }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new AchievementsComposer(), Session.Character); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new CreditBalanceComposer(), Session.Character.Credits); MessageHandler.HandleComposer(Session, new AchievementsScoreComposer(), Session.Character.GetAchievementScore()); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new IgnoredUsersMessageComposer(), StorageHandler.GetCharacterIgnores(Session.Character.Username)); }
private void SaveCacheFile(IFileInfo target, IDocument remoteDocument, byte[] hash, long length, Transmission transmissionEvent) { if (this.TransmissionStorage == null) { return; } target.Refresh(); IFileTransmissionObject obj = new FileTransmissionObject(transmissionEvent.Type, target, remoteDocument); obj.ChecksumAlgorithmName = "SHA-1"; obj.LastChecksum = hash; obj.LastContentSize = length; this.TransmissionStorage.SaveObject(obj); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new SoundSettingsComposer(), Session.Character.Soundvolume); }
//Where the damage is actually applied void DamageApplication(Vector3 damagePoint, Vector3 damageForce, float damageForceLimit, Vector3 surfaceNormal, ContactPoint colPoint, bool useContactPoint) { float colMag = Mathf.Min(damageForce.magnitude, maxCollisionMagnitude) * (1 - strength) * damageFactor; //Magnitude of collision float clampedColMag = Mathf.Pow(Mathf.Sqrt(colMag) * 0.5f, 1.5f); //Clamped magnitude of collision Vector3 clampedVel = Vector3.ClampMagnitude(damageForce, damageForceLimit); //Clamped velocity of collision Vector3 normalizedVel = damageForce.normalized; float surfaceDot; //Dot production of collision velocity and surface normal float massFactor = 1; //Multiplier for damage based on mass of other rigidbody Transform curDamagePart; float damagePartFactor; MeshFilter curDamageMesh; Transform curDisplacePart; Transform seamKeeper = null; //Transform for maintaining seams on shattered parts Vector3 seamLocalPoint; Vector3 vertProjection; Vector3 translation; Vector3 clampedTranslation; Vector3 localPos; float vertDist; float distClamp; DetachablePart detachedPart; Suspension damagedSus; //Get mass factor for multiplying damage if (useContactPoint) { damagePoint = colPoint.point; surfaceNormal = colPoint.normal; if (colPoint.otherCollider.attachedRigidbody) { massFactor = Mathf.Clamp01(colPoint.otherCollider.attachedRigidbody.mass / rb.mass); } } surfaceDot = Mathf.Clamp01(Vector3.Dot(surfaceNormal, normalizedVel)) * (Vector3.Dot((tr.position - damagePoint).normalized, normalizedVel) + 1) * 0.5f; //Damage damageable parts for (int i = 0; i < damageParts.Length; i++) { curDamagePart = damageParts[i]; damagePartFactor = colMag * surfaceDot * massFactor * Mathf.Min(clampedColMag * 0.01f, (clampedColMag * 0.001f) / Mathf.Pow(Vector3.Distance(curDamagePart.position, damagePoint), clampedColMag)); //Damage motors Motor damagedMotor = curDamagePart.GetComponent <Motor>(); if (damagedMotor) { damagedMotor.health -= damagePartFactor * (1 - damagedMotor.strength); } //Damage transmissions Transmission damagedTransmission = curDamagePart.GetComponent <Transmission>(); if (damagedTransmission) { damagedTransmission.health -= damagePartFactor * (1 - damagedTransmission.strength); } } //Deform meshes for (int i = 0; i < deformMeshes.Length; i++) { curDamageMesh = deformMeshes[i]; localPos = curDamageMesh.transform.InverseTransformPoint(damagePoint); translation = curDamageMesh.transform.InverseTransformDirection(clampedVel); clampedTranslation = Vector3.ClampMagnitude(translation, clampedColMag); //Shatter parts that can shatter ShatterPart shattered = curDamageMesh.GetComponent <ShatterPart>(); if (shattered) { seamKeeper = shattered.seamKeeper; if (Vector3.Distance(curDamageMesh.transform.position, damagePoint) < colMag * surfaceDot * 0.1f * massFactor && colMag * surfaceDot * massFactor > shattered.breakForce) { shattered.Shatter(); } } //Actual deformation if (translation.sqrMagnitude > 0 && strength < 1) { for (int j = 0; j < meshVertices[i].verts.Length; j++) { vertDist = Vector3.Distance(meshVertices[i].verts[j], localPos); distClamp = (clampedColMag * 0.001f) / Mathf.Pow(vertDist, clampedColMag); if (distClamp > 0.001f) { damagedMeshes[i] = true; if (seamKeeper == null || seamlessDeform) { vertProjection = seamlessDeform ? Vector3.zero : Vector3.Project(normalizedVel, meshVertices[i].verts[j]); meshVertices[i].verts[j] += (clampedTranslation - vertProjection * (usePerlinNoise ? 1 + Mathf.PerlinNoise(meshVertices[i].verts[j].x * 100, meshVertices[i].verts[j].y * 100) : 1)) * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor; } else { seamLocalPoint = seamKeeper.InverseTransformPoint(curDamageMesh.transform.TransformPoint(meshVertices[i].verts[j])); meshVertices[i].verts[j] += (clampedTranslation - Vector3.Project(normalizedVel, seamLocalPoint) * (usePerlinNoise ? 1 + Mathf.PerlinNoise(seamLocalPoint.x * 100, seamLocalPoint.y * 100) : 1)) * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor; } } } } } seamKeeper = null; //Deform mesh colliders for (int i = 0; i < deformColliders.Length; i++) { localPos = deformColliders[i].transform.InverseTransformPoint(damagePoint); translation = deformColliders[i].transform.InverseTransformDirection(clampedVel); clampedTranslation = Vector3.ClampMagnitude(translation, clampedColMag); if (translation.sqrMagnitude > 0 && strength < 1) { for (int j = 0; j < colVertices[i].verts.Length; j++) { vertDist = Vector3.Distance(colVertices[i].verts[j], localPos); distClamp = (clampedColMag * 0.001f) / Mathf.Pow(vertDist, clampedColMag); if (distClamp > 0.001f) { damagedCols[i] = true; colVertices[i].verts[j] += clampedTranslation * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor; } } } } //Displace parts for (int i = 0; i < displaceParts.Length; i++) { curDisplacePart = displaceParts[i]; translation = clampedVel; clampedTranslation = Vector3.ClampMagnitude(translation, clampedColMag); if (translation.sqrMagnitude > 0 && strength < 1) { vertDist = Vector3.Distance(curDisplacePart.position, damagePoint); distClamp = (clampedColMag * 0.001f) / Mathf.Pow(vertDist, clampedColMag); if (distClamp > 0.001f) { curDisplacePart.position += clampedTranslation * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor; //Detach detachable parts if (curDisplacePart.GetComponent <DetachablePart>()) { detachedPart = curDisplacePart.GetComponent <DetachablePart>(); if (colMag * surfaceDot * massFactor > detachedPart.looseForce && detachedPart.looseForce >= 0) { detachedPart.initialPos = curDisplacePart.localPosition; detachedPart.Detach(true); } else if (colMag * surfaceDot * massFactor > detachedPart.breakForce) { detachedPart.Detach(false); } } //Maybe the parent of this part is what actually detaches, useful for displacing compound colliders that represent single detachable objects else if (curDisplacePart.parent.GetComponent <DetachablePart>()) { detachedPart = curDisplacePart.parent.GetComponent <DetachablePart>(); if (!detachedPart.detached) { if (colMag * surfaceDot * massFactor > detachedPart.looseForce && detachedPart.looseForce >= 0) { detachedPart.initialPos = curDisplacePart.parent.localPosition; detachedPart.Detach(true); } else if (colMag * surfaceDot * massFactor > detachedPart.breakForce) { detachedPart.Detach(false); } } else if (detachedPart.hinge) { detachedPart.displacedAnchor += curDisplacePart.parent.InverseTransformDirection(clampedTranslation * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor); } } //Damage suspensions and wheels /*damagedSus = curDisplacePart.GetComponent<Suspension>(); * if (damagedSus) * { * if ((!damagedSus.wheel.grounded && ignoreGroundedWheels) || !ignoreGroundedWheels) * { * curDisplacePart.RotateAround(damagedSus.tr.TransformPoint(damagedSus.damagePivot), Vector3.ProjectOnPlane(damagePoint - curDisplacePart.position, -translation.normalized), clampedColMag * surfaceDot * distClamp * 20 * massFactor); * * damagedSus.wheel.damage += clampedColMag * surfaceDot * distClamp * 10 * massFactor; * * if (clampedColMag * surfaceDot * distClamp * 10 * massFactor > damagedSus.jamForce) * { * damagedSus.jammed = true; * } * * if (clampedColMag * surfaceDot * distClamp * 10 * massFactor > damagedSus.wheel.detachForce) * { * damagedSus.wheel.Detach(); * } * * foreach (SuspensionPart curPart in damagedSus.movingParts) * { * if (curPart.connectObj && !curPart.isHub && !curPart.solidAxle) * { * if (!curPart.connectObj.GetComponent<SuspensionPart>()) * { * curPart.connectPoint += curPart.connectObj.InverseTransformDirection(clampedTranslation * surfaceDot * Mathf.Min(clampedColMag * 0.01f, distClamp) * massFactor); * } * } * } * } * }*/ //Damage hover wheels HoverWheel damagedHoverWheel = curDisplacePart.GetComponent <HoverWheel>(); if (damagedHoverWheel) { if ((!damagedHoverWheel.grounded && ignoreGroundedWheels) || !ignoreGroundedWheels) { if (clampedColMag * surfaceDot * distClamp * 10 * massFactor > damagedHoverWheel.detachForce) { damagedHoverWheel.Detach(); } } } } } } }
private void Awake() { transmission = GetComponent <Transmission>(); vehicleInput = GetComponent <VehicleInput>(); carAudio = GetComponent <CarAudio>(); }
public Bus(int maxSeatsNumber, Engine engine, Transmission transmission, Chassis chassis) : base(engine, chassis, transmission, _vehicleType) { MaxSeatsNumber = maxSeatsNumber; }
public TransmissionMappingTests() { transmission = new Transmission(); mapper = new DataMapper("v1"); }
public byte[] CallUploadFileWithPWC(IFileInfo localFile, ref IDocument doc, Transmission transmission, IMappedObject mappedObject = null) { return(this.UploadFileWithPWC(localFile, ref doc, transmission, mappedObject)); }
public MappingCcFields() { transmission = new Transmission(); mapper = new DataMapper("v1"); }
//public ObservableCollection<string> FanSays { get { return fan.FanSays; } } //public ObservableCollection<string> PitcherSays { get { return pitcher.PitcherSays; } } // public int Trajectory { get; set; } //public int Distance { get; set; } public Simulator() { transmission = new Transmission(engine); carKey = engine.GetNewKey(); }
public Car(string model, string color, Engine engine, Transmission transmission, Chassis chassis) : base(engine, chassis, transmission, _vehicleType) { Model = model; Color = color; }
/// <summary> /// Returns true if CarInfo instances are equal /// </summary> /// <param name="other">Instance of CarInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(CarInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Year == other.Year || Year != null && Year.Equals(other.Year) ) && ( Price == other.Price || Price != null && Price.Equals(other.Price) ) && ( SerialNumber == other.SerialNumber || SerialNumber != null && SerialNumber.Equals(other.SerialNumber) ) && ( SoldDateUtc == other.SoldDateUtc || SoldDateUtc != null && SoldDateUtc.Equals(other.SoldDateUtc) ) && ( Comment == other.Comment || Comment != null && Comment.Equals(other.Comment) ) && ( Transmission == other.Transmission || Transmission != null && Transmission.Equals(other.Transmission) ) && ( Motor == other.Motor || Motor != null && Motor.Equals(other.Motor) ) && ( GarageId == other.GarageId || GarageId != null && GarageId.Equals(other.GarageId) ) && ( SellerId == other.SellerId || SellerId != null && SellerId.Equals(other.SellerId) )); }
private async Task StartSending(Transmission transmission) { SdkInternalOperationsMonitor.Enter(); try { Exception exception = null; HttpWebResponseWrapper responseContent = null; // Locally self-throttle this payload before we send it Transmission acceptedTransmission = this.Throttle(transmission); // Now that we've self-imposed a throttle, we can try to send the remaining data try { TelemetryChannelEventSource.Log.TransmissionSendStarted(acceptedTransmission.Id); responseContent = await acceptedTransmission.SendAsync().ConfigureAwait(false); } catch (Exception e) { exception = e; } finally { int currentCapacity = Interlocked.Decrement(ref this.transmissionCount); if (exception == null) { TelemetryChannelEventSource.Log.TransmissionSentSuccessfully(acceptedTransmission.Id, currentCapacity); } else { TelemetryChannelEventSource.Log.TransmissionSendingFailedWarning(acceptedTransmission.Id, exception.ToString()); } if (responseContent == null && exception is WebException) { HttpWebResponse response = (HttpWebResponse)((WebException)exception).Response; if (response != null) { responseContent = new HttpWebResponseWrapper() { StatusCode = (int)response.StatusCode, StatusDescription = response.StatusDescription, RetryAfterHeader = response.Headers?["Retry-After"] }; } else { responseContent = new HttpWebResponseWrapper() { StatusCode = 0, StatusDescription = null, RetryAfterHeader = null }; } } this.OnTransmissionSent(new TransmissionProcessedEventArgs(acceptedTransmission, exception, responseContent)); } } finally { SdkInternalOperationsMonitor.Exit(); } }
public async Task <TransmissionResponse> SendTransmission(Transmission trm) { string data = JsonConvert.SerializeObject(trm, _jsonSettings); return(await this.MakeRequest <TransmissionResponse>("transmissions", HttpMethod.Post, data)); }
// car search /// <summary> /// <para>Performs the Search Method: /// Search Used Motors. /// Creates a query string based on the parameters provided, can be null if the parameter is not required for the request. /// </para> /// DOES NOT REQUIRE AUTHENTICATION. /// </summary> /// <param name="searchString">One or more keywords to use in a search query.</param> /// <param name="userRegion">Restricts search results to items from sellers located in the specified region.</param> /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param> /// <param name="priceMin">Minimum price.</param> /// <param name="priceMax">Maximum price.</param> /// <param name="make">Car make.</param> /// <param name="model">Car model.</param> /// <param name="bodyStyle">Car body style.</param> /// <param name="doorsMin">Minimum number of doors (range from 2 to 5).</param> /// <param name="doorsMax">Maximum number of doors. </param> /// <param name="transmission">Transmission type.</param> /// <param name="yearMax">Maximum year of manufacture.</param> /// <param name="yearMin">Minimum year of manufacture.</param> /// <param name="energySizeMin">Minimum engine size in cubic centimetres (e.g. 2000 for 2 litre engine). </param> /// <param name="energySizeMax">Maximum engine size.</param> /// <param name="odometerMin"> Minimum odometer value in kilometres.</param> /// <param name="odometerMax">Maximum odometer value.</param> /// <param name="listingType">Type of listing.</param> /// <param name="dateFrom">Return only listings started from this date.</param> /// <param name="page">Page number.</param> /// <param name="rows">Number of rows per page.</param> /// <returns>Cars.</returns> public Cars SearchUsedMotors( string searchString, int? userRegion, SortOrder sortOrder, decimal priceMin, decimal priceMax, string make, string model, BodyStyle bodyStyle, int? doorsMin, int? doorsMax, Transmission transmission, int? yearMax, int? yearMin, int? energySizeMin, int? energySizeMax, int? odometerMin, int? odometerMax, ListingType listingType, DateTime dateFrom, int? page, int? rows) { var url = String.Format(Constants.Culture, "{0}/{1}/Used{2}", Constants.SEARCH, Constants.MOTORS, Constants.XML); _addAnd = false; var conditions = "?"; // create the parameters for the query string conditions += SearchMethods.ConstructQueryHelper(Constants.SEARCH_STRING, searchString, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.USER_REGION, string.Empty + userRegion, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MIN, string.Empty + priceMin, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.SORT_ORDER, string.Empty + sortOrder, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MAX, string.Empty + priceMax, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.MAKE, make, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.MODEL, model, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.BODY_STYLE, bodyStyle.ToString(), _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.DOORS_MIN, string.Empty + doorsMin, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.DOORS_MAX, string.Empty + doorsMax, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.TRANSMISSION, transmission.ToString(), _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MIN, string.Empty + yearMin, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MAX, string.Empty + yearMax, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MAX, string.Empty + energySizeMax, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MIN, string.Empty + energySizeMin, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.ODOMETER_MIN, string.Empty + odometerMin, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.ODOMETER_MAX, string.Empty + odometerMax, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.LISTING_TYPE, listingType.ToString(), _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom), _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd); conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd); // add the parameters to the query string if there are any if (conditions.Equals("?")) { url += conditions; } // perform the request return this.SearchUsedMotors(url); }
public Bus(Chassis chassis, Engine engine, Transmission transmission, int numberOfPassengers) : base(chassis, engine, transmission) { this.NumberOfPassengers = numberOfPassengers; }
private static async Task SaveTransmissionToFileAsync(Transmission transmission, IStorageFile file) { try { using (Stream stream = await file.OpenStreamForWriteAsync().ConfigureAwait(false)) { await StorageTransmission.SaveAsync(transmission, stream).ConfigureAwait(false); } } catch (UnauthorizedAccessException) { string message = string.Format("Failed to save transmission to file. UnauthorizedAccessException. File path: {0}, FileName: {1}", file.Path, file.Name); CoreEventSource.Log.LogVerbose(message); throw; } }
public Car Construct(string model, ushort year, Engine engine, Color color, Transmission transmission) { return new Car(model, year, engine, color, transmission); }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { var Ticket = Message.GetString(); var Character = CharacterHandler.Authenticate(Ticket); if (Character != null) { Solution.AppendPaint(ConsoleColor.DarkCyan); Solution.AppendLine("Character: Authenticated({0})", Character.Username); MessageHandler.HandleComposer(Session, new AuthenticationOKMessageComposer()); Session.Character = Character; } else { Solution.AppendPaint(); Solution.AppendLine("Authenticate: Unknown: {0}", Ticket); SessionHandler.CloseClientSocket(Session.Args); } }
private async Task StartSending(Transmission transmission) { SdkInternalOperationsMonitor.Enter(); Task <HttpWebResponseWrapper> transmissionTask = null; try { Exception exception = null; HttpWebResponseWrapper responseContent = null; // Locally self-throttle this payload before we send it Transmission acceptedTransmission = this.Throttle(transmission); // Now that we've self-imposed a throttle, we can try to send the remaining data try { TelemetryChannelEventSource.Log.TransmissionSendStarted(acceptedTransmission.Id); transmissionTask = acceptedTransmission.SendAsync(); this.inFlightTransmissions.TryAdd(transmission.FlushAsyncId, transmissionTask); responseContent = await transmissionTask.ConfigureAwait(false); } catch (Exception e) { exception = e; } finally { int currentCapacity = Interlocked.Decrement(ref this.transmissionCount); if (exception != null) { TelemetryChannelEventSource.Log.TransmissionSendingFailedWarning(acceptedTransmission.Id, exception.ToLogString()); } else { if (responseContent != null) { if (responseContent.StatusCode < 400) { TelemetryChannelEventSource.Log.TransmissionSentSuccessfully(acceptedTransmission.Id, currentCapacity); } else { TelemetryChannelEventSource.Log.TransmissionSendingFailedWarning( acceptedTransmission.Id, responseContent.StatusCode.ToString(CultureInfo.InvariantCulture)); } if (TelemetryChannelEventSource.IsVerboseEnabled) { TelemetryChannelEventSource.Log.RawResponseFromAIBackend(acceptedTransmission.Id, responseContent.Content); } } } if (responseContent == null && exception is HttpRequestException) { // HttpClient.SendAsync throws HttpRequestException on the following scenarios: // "The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout." // https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.sendasync?view=netstandard-1.6 responseContent = new HttpWebResponseWrapper() { // Expectation is that RetryPolicy will attempt retry for this status. StatusCode = ResponseStatusCodes.UnknownNetworkError, }; } this.inFlightTransmissions.TryRemove(transmission.FlushAsyncId, out _); this.OnTransmissionSent(new TransmissionProcessedEventArgs(acceptedTransmission, exception, responseContent)); } } finally { SdkInternalOperationsMonitor.Exit(); } }
internal abstract Task EnqueueAsync(Transmission transmission);
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new SessionParamsMessageComposer()); }
public void setTransmission(Transmission transmission) { this.transmission = transmission; }
public void Invoke(Transmission.Session Session, Types.InMessage Message) { MessageHandler.HandleComposer(Session, new PingMessageComposer(), Message.GetInt32()); }
public Truck(double height, Engine engine, Transmission transmission, Chassis chassis) : base(engine, transmission, chassis, _vehicleType) { Height = height; }
private static Transmission CreateTransmission(ITelemetry telemetry) { byte[] data = JsonSerializer.Serialize(telemetry); Transmission transmission = new Transmission( new Uri(@"http://some.url"), data, "application/x-json-stream", JsonSerializer.CompressionType); return transmission; }
public async Task <bool> SendAsync(EmailMessage email, bool deleteAttachmentes, params string[] attachments) { var config = this.Config as Config; if (config == null) { email.Status = Status.Cancelled; return(false); } try { email.Status = Status.Executing; var transmission = new Transmission(); transmission.Content.From.Email = config.FromEmail; transmission.Content.Subject = email.Subject; transmission.Content.Html = email.Message; if (attachments != null) { transmission.Content.Attachments = AttachmentHelper.AddAttachments(attachments); } var recipients = email.SendTo.Or("").Split(',').Select(x => x.Trim()); foreach (string recipient in recipients) { transmission.Recipients.Add(new Recipient { Address = new Address(recipient), Type = RecipientType.To }); } var client = new Client(config.ApiKey); client.CustomSettings.SendingMode = SendingModes.Async; var response = await client.Transmissions.Send(transmission).ConfigureAwait(false); var status = response.StatusCode; switch (status) { case HttpStatusCode.OK: case HttpStatusCode.Created: case HttpStatusCode.Accepted: case HttpStatusCode.NoContent: email.Status = Status.Completed; break; default: email.Status = Status.Failed; break; } return(true); } // ReSharper disable once CatchAllClause catch (Exception ex) { email.Status = Status.Failed; Log.Warning(@"Could not send email to {To} using SpartPost API. {Ex}. ", email.SendTo, ex); } finally { if (deleteAttachmentes && email.Status == Status.Completed) { FileHelper.DeleteFiles(attachments); } } return(false); }