private static IEnumerable<WorkerTask> GenerateNormalRandomList(EngineType? tasktype) { var tasks = new List<WorkerTask>(); var random = new Random(); var numberOfTasks = random.Next(16, 32); for (int i = 1; i <= numberOfTasks; i++) { var loopTask = Task.Factory.StartNew(t => FakeTaskActionMethod(), TaskCreationOptions.LongRunning); WorkerTask cloudTask; const string operationName = "Test Operation"; if (tasktype.HasValue) { cloudTask = new WorkerTask(operationName, loopTask, FakeTaskActionMethod, tasktype.Value); } else { cloudTask = new WorkerTask(operationName, loopTask, FakeTaskActionMethod, i % 2 == 0 ? EngineType.ScheduledTask : (i % 3 == 0 ? EngineType.Workflow : EngineType.Maintenance)); } tasks.Add(cloudTask); } return tasks; }
public EngineWrapper(Part part) { engine = (ModuleEngines)part.Modules["ModuleEngines"]; if (engine != null) { type = EngineType.ModuleEngine; } else { engineFX = (ModuleEnginesFX)part.Modules["ModuleEnginesFX"]; if (engineFX != null) { type = EngineType.ModuleEngineFX; } else { // fsengine = (Firespitter.engine.FSengine)part.Modules["FSengine"]; // if (fsengine != null) { // type = EngineType.FSengine; } } } Debug.Log("EngineWrapper: engine type is " + type.ToString()); }
public Theater(TheaterType theaterType, EngineType engine, IniFile rules, IniFile art) { _theaterType = theaterType; _engine = engine; _rules = rules; _art = art; }
public Car(string make, string model, double engineSize, EngineType engineType) { Make = make; Model = model; EngineSize = engineSize; Enginetype = engineType; }
/// <summary> /// Initializes a new instance of the <see cref="MetaCart"/> class. /// </summary> /// <param name="language">Language.</param> /// <param name="engineType">Engine type.</param> public MetaCart(Language language, EngineType engineType) { _language = language; _engineType = engineType; InitializeFeatureMeta(); }
public FSengineWrapper(Part part, string name) { engineFX = part.Modules.OfType<ModuleEnginesFX>().Where(p => p.engineID == name).FirstOrDefault(); if (engineFX != null) type = EngineType.ModuleEngineFX; //Debug.Log("FSengineWrapper: engine type is " + type.ToString()); }
public WorkerTask(string name, Task task, Action action, EngineType taskType) { Name = name; ThreadedTask = task; MethodToExecute = action; EngineType = taskType; }
public FSengineWrapper(Part part) { engine = part.Modules.OfType<ModuleEngines>().FirstOrDefault(); if (engine != null) { type = EngineType.ModuleEngine; } else { engineFX = part.Modules.OfType<ModuleEnginesFX>().FirstOrDefault(); if (engineFX != null) { type = EngineType.ModuleEngineFX; } else { fsengine = part.Modules.OfType<FSengine>().FirstOrDefault(); if (fsengine != null) { type = EngineType.FSengine; } } } //Debug.Log("FSengineWrapper: engine type is " + type.ToString()); }
internal byte[] GetResponse(byte[] msg, EngineType type) { Type = type; byte[] recvData; if (this.isFirstPacket && this.SendFirstPacketTwice) { this.isFirstPacket = false; SendData(msg); } SendData(msg); recvData = ReceiveData(); try { int header = BitConverter.ToInt32(recvData, 0); switch (header) { case SinglePacket: return ParseSinglePkt(recvData); case MultiPacket: return ParseMultiPkt(recvData); default: throw new InvalidHeaderException("Protocol header is not valid"); } } catch (Exception e) { e.Data.Add("ReceivedData", recvData); throw; } }
public bool Initialize(MapFile mf, EngineType et, List<string> customRulesININames, List<string> customArtININames) { if (et == EngineType.AutoDetect) { Logger.Fatal("Engine type needs to be known by now!"); return false; } Engine = et; TheaterType = Theater.TheaterTypeFromString(mf.ReadString("Map", "Theater")); FullSize = mf.FullSize; LocalSize = mf.LocalSize; _tiles = new TileLayer(FullSize.Size); LoadAllObjects(mf); if (!IgnoreLighting) _lighting = mf.Lighting; else _lighting = new Lighting(); _wayPoints.AddRange(mf.Waypoints); if (!LoadInis(customRulesININames, customArtININames)) { Logger.Fatal("Ini files couldn't be loaded"); return false; } Logger.Info("Overriding rules.ini with map INI entries"); _rules.MergeWith(mf); return true; }
protected GameCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art) { Engine = engine; Theater = theater; Type = type; Rules = rules; Art = art; }
public LdapServerInformation(string serverName, string context, int port, string userName, string password) { m_serverName = serverName; m_port = port; m_context = context; m_userName = userName; m_password = password; m_type = EngineType.NotSet; }
public LdapServerInformation() { m_serverName = ""; m_port = 0; m_context = ""; m_userName = ""; m_password = ""; m_type = EngineType.NotSet; }
public static void LoadDefaultConfig(EngineType engine) { if (engine == EngineType.TiberianSun) ActiveConfig = DefaultsTS; else if (engine == EngineType.Firestorm) ActiveConfig = DefaultsFS; else if (engine == EngineType.RedAlert2) ActiveConfig = DefaultsRA2; else if (engine == EngineType.YurisRevenge) ActiveConfig = DefaultsYR; }
public static void SetEngineTilt(EngineType engine, float angle) { // -1 to 1 if(engine == EngineType.Left) { instance.engineLeft.SetTilt(Mathf.Clamp(angle, -1, 1)); } else if (engine == EngineType.Right) { instance.engineRight.SetTilt(Mathf.Clamp(angle, -1, 1)); } }
public static void SetEnginePower(EngineType engine, float power) { // 0 to 1 if (engine == EngineType.Left) { instance.engineLeft.SetPower(Mathf.Clamp01(power)); } else if (engine == EngineType.Right) { instance.engineRight.SetPower(Mathf.Clamp01(power)); } }
/// <summary> /// Returns an object that represents the server /// </summary> /// <param name="type">Base engine which game uses</param> /// <param name="endPoint">Socket address of server</param> /// <param name="isObsolete">Obsolete Gold Source servers reply only to half life protocol.if set to true then it would use half life protocol.If set to null,then protocol is identified at runtime.</param> /// <param name="sendTimeOut">Sets Socket's SendTimeout Property.</param> /// <param name="receiveTimeOut">Sets Socket's ReceiveTimeout.</param> /// <returns>Instance of server class that represents the connected server</returns> public static Server GetServerInstance(EngineType type, IPEndPoint endPoint, bool? isObsolete = false, int sendTimeOut = 3000, int receiveTimeOut = 3000) { Server server = null; switch (type) { case EngineType.GoldSource: server = new GoldSource(endPoint, isObsolete, sendTimeOut, receiveTimeOut); break; case EngineType.Source: server = new Source(endPoint, sendTimeOut, receiveTimeOut); break; default: throw new ArgumentException("An invalid EngineType was specified."); } return server; }
/// <summary> /// Gets the appropriate masterserver query instance /// </summary> /// <param name="type">Engine used by server</param> /// <returns>Master server instance</returns> public static MasterServer GetMasterServerInstance(EngineType type) { MasterServer server = null; switch (type) { case EngineType.GoldSource: server = new MasterServer(GoldSrcServer); break; case EngineType.Source: server = new MasterServer(SourceServer); break; default: throw new FormatException("An invalid EngineType was specified."); } return server; }
public void LoadEngine(EngineType mEngine, Int32 EngineIndex = 0) { switch (mEngine) { case EngineType.Default: break; case EngineType.Custom: break; case EngineType.Debug: break; } }
private Excel_parameterViewModel createParameterVM(EngineType engineType) { if (engineType == EngineType.Monte) { //수정해야함. standard로 그냥 가면 댈거 같은데 mc니까 return new Excel_singleAssetCompositeOptionStandParaWithEngineViewModel(); } else { throw new Exception("unknown Engine"); } }
private Excel_parameterViewModel createParameterVM(EngineType engineType) { if (engineType == EngineType.FX_AnalyticQuantLib) { // 요놈이 주가면 gmb을 쓰고 머.. 이자면 hull을 쓰고 머 그런 정보.. 는 어디에..? //throw new Exception("engine not implemented"); return new Excel_standardParaViewModel(); } else { throw new Exception("unknown Engine"); } }
private Excel_parameterViewModel createParameterVM(EngineType engineType) { if (engineType == EngineType.AnalyticQuantLib) { // 요놈이 주가면 gmb을 쓰고 머.. 이자면 hull을 쓰고 머 그런 정보.. 는 어디에..? return new Excel_singleAssetCompositeOptionStandParaWithEngineViewModel(); } else { throw new Exception("unknown Engine"); } }
public static XmlDocument GetXml(EngineType engine_, string fileName_) { XmlDocument myXml = new XmlDocument(); if (XmlDocuments.ContainsKey(engine_)) { myXml = XmlDocuments[engine_]; } else { myXml.Load(fileName_); XmlDocuments.Add(engine_, myXml); } return myXml; }
internal static string GetTibName(OverlayObject o, EngineType engine) { if (engine <= EngineType.Firestorm) { if (IsTS_Riparius(o)) return "Riparius"; else if (IsTS_Cruentus(o)) return "Cruentus"; else if (IsTS_Vinifera(o)) return "Vinifera"; else if (IsTS_Aboreus(o)) return "Aboreus"; } else { if (IsRA2_Riparius(o)) return "Riparius"; else if (IsRA2_Cruentus(o)) return "Cruentus"; else if (IsRA2_Vinifera(o)) return "Vinifera"; else if (IsRA2_Aboreus(o)) return "Aboreus"; } return ""; }
public static OverlayTibType GetOverlayTibType(OverlayObject o, EngineType engine) { if (engine <= EngineType.Firestorm) { if (IsTS_Riparius(o)) return OverlayTibType.Riparius; else if (IsTS_Cruentus(o)) return OverlayTibType.Cruentus; else if (IsTS_Vinifera(o)) return OverlayTibType.Vinifera; else if (IsTS_Aboreus(o)) return OverlayTibType.Aboreus; } else { if (IsRA2_Riparius(o)) return OverlayTibType.Riparius; else if (IsRA2_Cruentus(o)) return OverlayTibType.Cruentus; else if (IsRA2_Vinifera(o)) return OverlayTibType.Vinifera; else if (IsRA2_Aboreus(o)) return OverlayTibType.Aboreus; } return OverlayTibType.NotSpecial; }
internal Logs(EngineType type, int port, IPEndPoint serverEndPoint) { ServerEndPoint = serverEndPoint; Port = port; recvData = new byte[BufferSize]; LineSplit = new Regex(": "); switch (type) { case EngineType.GoldSource: HeaderSize = 10; break; case EngineType.Source: HeaderSize = 7; break; } UdpSocket = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, ProtocolType.Udp); UdpSocket.Bind(new IPEndPoint(IPAddress.Any, Port)); UdpSocket.BeginReceive(recvData, 0, recvData.Length, SocketFlags.None, Recv, null); }
// Managed at: // https://docs.google.com/spreadsheet/ccc?key=0AiVQdoAJ4w7bdE9ILUpvNVVDa2J2MG04RnBURU96VUE#gid=0 public static PaletteType GetDefaultPalette(CollectionType t, EngineType engine) { switch (t) { case CollectionType.Building: case CollectionType.Aircraft: case CollectionType.Infantry: case CollectionType.Vehicle: return PaletteType.Unit; case CollectionType.Overlay: return PaletteType.Overlay; case CollectionType.Smudge: case CollectionType.Terrain: case CollectionType.Animation: default: return PaletteType.Iso; } }
public static bool GetDefaultRemappability(CollectionType type, EngineType engine) { switch (type) { case CollectionType.Aircraft: case CollectionType.Building: case CollectionType.Infantry: case CollectionType.Vehicle: return true; case CollectionType.Overlay: case CollectionType.Smudge: case CollectionType.Terrain: case CollectionType.Animation: return false; default: throw new ArgumentOutOfRangeException("type"); } }
public static void UpdateInputData(Grid grid, EngineType engine, InputData data) { foreach (var child in grid.Children) if (child is TextBox) foreach (var key in data.Data.Keys) if (key == (child as TextBox).Name) if (data.Data[key].Engine.FindIndex(type => type == engine) < 0) { (child as TextBox).IsEnabled = false; (child as TextBox).Background = Brushes.Gray; } else { (child as TextBox).IsEnabled = true; (child as TextBox).Background = Brushes.White; } }
public ObjectCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art, IniFile.IniSection objectsList, PaletteCollection palettes) : base(type, theater, engine, rules, art) { Palettes = palettes; if (engine >= EngineType.RedAlert2) { string fireNames = Rules.ReadString(Engine == EngineType.RedAlert2 ? "AudioVisual" : "General", "DamageFireTypes", "FIRE01,FIRE02,FIRE03"); FireNames = fireNames.Split(new[] { ',', '.' }, StringSplitOptions.RemoveEmptyEntries); } foreach (var entry in objectsList.OrderedEntries) { if (!string.IsNullOrEmpty(entry.Value)) { Logger.Trace("Loading object {0}.{1}", objectsList.Name, entry.Value); AddObject(entry.Value); } } }
/// <summary> /// AssertEqual /// </summary> /// <param name="emit_results"></param> /// <param name="results"></param> /// <param name="engineType"></param> /// <exception cref="DatabaseException">Ignore.</exception> /// <exception cref="DatabaseException">Ignore.</exception> private static void AssertEqual(IEnumerable <KeyValuePair <string, object> > emit_results, IEnumerable <KeyValuePair <string, object> > results, EngineType engineType) { var dict = results.ToDictionary(kv => kv.Key); Assert.True(emit_results.Count() == dict.Count); foreach (var kv in emit_results) { Assert.True(dict.ContainsKey(kv.Key)); Assert.True(TypeConvert.TypeValueToDbValueStatement(dict[kv.Key].Value, false, engineType) == TypeConvert.TypeValueToDbValueStatement(kv.Value, false, engineType)); } }
public IVehicle CreateTruck(string model, string make, string registrationNumber, string year, EngineType engine, int weightAllowedInKilograms) { IVehicle newTruck = new Truck(model, make, registrationNumber, year, engine, weightAllowedInKilograms); return(newTruck); }
public EngineItem(EngineType type, int tier) { this.type = type; this.tier = tier; }
//get top 5 results async from Google/Bing site static async Task SearchByEngine(EngineType engineType, string engineUrl, string kewWord, string xpath, IList <QueryResult> results) { string SearchResults = engineUrl + kewWord; StringBuilder sb = new StringBuilder(); byte[] ResultsBuffer = new byte[8192]; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SearchResults); request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream resStream = response.GetResponseStream(); string tempString = null; int count = 0; do { count = resStream.Read(ResultsBuffer, 0, ResultsBuffer.Length); if (count != 0) { tempString = Encoding.UTF8.GetString(ResultsBuffer, 0, count); sb.Append(tempString); } }while (count > 0); string sbb = sb.ToString(); HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(sbb); var selectNodes = html.DocumentNode.SelectNodes(xpath); HtmlNode doc = html.DocumentNode; int i = 0; foreach (var node in selectNodes) { if (i == 5) { break; } try { lock (padlock) { string text = engineType == EngineType.Google ? node.InnerText : node.ChildNodes[0].ChildNodes[0].InnerText; results.Add(new QueryResult() { Keyword = kewWord, Title = System.Web.HttpUtility.UrlDecode(text), EnteredDate = DateTime.Now, SearchEngineId = (int)engineType }); } } catch (Exception ex) { } i++; } }
public EngineItem(String type) { this.type = getEngineType(type); this.tier = 0; }
public Drone CreateDrone(int year, string brand, int weight, int maxVelocity, Guid id, Color color, EngineType engineType) { drone.ProductionYear = year; drone.Brand = brand; drone.KerbWeight = weight; drone.MaxVelocity = maxVelocity; drone.Id = id; drone.Color = color; drone.EngineType = engineType; return(drone); }
/// <summary>Gets the determine map name. </summary> /// <returns>The filename to save the map as</returns> public static string DetermineMapName(MapFile map, EngineType engine) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(map.FileName); IniFile.IniSection basic = map.GetSection("Basic"); if (basic.ReadBool("Official") == false) { return(StripPlayersFromName(MakeValidFileName(basic.ReadString("Name", fileNameWithoutExtension)))); } string mapExt = Path.GetExtension(Settings.InputFile); string missionName = ""; string mapName = ""; PktFile.PktMapEntry pktMapEntry = null; MissionsFile.MissionEntry missionEntry = null; // campaign mission if (!basic.ReadBool("MultiplayerOnly") && basic.ReadBool("Official")) { string missionsFile; switch (engine) { case EngineType.TiberianSun: case EngineType.RedAlert2: missionsFile = "mission.ini"; break; case EngineType.Firestorm: missionsFile = "mission1.ini"; break; case EngineType.YurisRevenge: missionsFile = "missionmd.ini"; break; default: throw new ArgumentOutOfRangeException("engine"); } var mf = VFS.Open <MissionsFile>(missionsFile); if (mf != null) { missionEntry = mf.GetMissionEntry(Path.GetFileName(map.FileName)); } if (missionEntry != null) { missionName = (engine >= EngineType.RedAlert2) ? missionEntry.UIName : missionEntry.Name; } } else { // multiplayer map string pktEntryName = fileNameWithoutExtension; PktFile pkt = null; if (FormatHelper.MixArchiveExtensions.Contains(mapExt)) { // this is an 'official' map 'archive' containing a PKT file with its name try { var mix = new MixFile(File.Open(Settings.InputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); pkt = mix.OpenFile(fileNameWithoutExtension + ".pkt", FileFormat.Pkt) as PktFile; // pkt file is cached by default, so we can close the handle to the file mix.Close(); if (pkt != null && pkt.MapEntries.Count > 0) { pktEntryName = pkt.MapEntries.First().Key; } } catch (ArgumentException) { } } else { // determine pkt file based on engine switch (engine) { case EngineType.TiberianSun: case EngineType.RedAlert2: pkt = VFS.Open <PktFile>("missions.pkt"); break; case EngineType.Firestorm: pkt = VFS.Open <PktFile>("multi01.pkt"); break; case EngineType.YurisRevenge: pkt = VFS.Open <PktFile>("missionsmd.pkt"); break; default: throw new ArgumentOutOfRangeException("engine"); } } // fallback for multiplayer maps with, .map extension, // no YR objects so assumed to be ra2, but actually meant to be used on yr if (mapExt == ".map" && pkt != null && !pkt.MapEntries.ContainsKey(pktEntryName) && engine >= EngineType.RedAlert2) { var vfs = new VFS(); vfs.AddItem(Settings.InputFile); pkt = vfs.OpenFile <PktFile>("missionsmd.pkt"); } if (pkt != null && !string.IsNullOrEmpty(pktEntryName)) { pktMapEntry = pkt.GetMapEntry(pktEntryName); } } // now, if we have a map entry from a PKT file, // for TS we are done, but for RA2 we need to look in the CSV file for the translated mapname if (engine <= EngineType.Firestorm) { if (pktMapEntry != null) { mapName = pktMapEntry.Description; } else if (missionEntry != null) { if (engine == EngineType.TiberianSun) { string campaignSide; string missionNumber; if (missionEntry.Briefing.Length >= 3) { campaignSide = missionEntry.Briefing.Substring(0, 3); missionNumber = missionEntry.Briefing.Length > 3 ? missionEntry.Briefing.Substring(3) : ""; missionName = ""; mapName = string.Format("{0} {1} - {2}", campaignSide, missionNumber.TrimEnd('A').PadLeft(2, '0'), missionName); } else if (missionEntry.Name.Length >= 10) { mapName = missionEntry.Name; } } else { // FS map names are constructed a bit easier mapName = missionName.Replace(":", " - "); } } else if (!string.IsNullOrEmpty(basic.ReadString("Name"))) { mapName = basic.ReadString("Name", fileNameWithoutExtension); } } // if this is a RA2/YR mission (csfEntry set) or official map with valid pktMapEntry else if (missionEntry != null || pktMapEntry != null) { string csfEntryName = missionEntry != null ? missionName : pktMapEntry.Description; string csfFile = engine == EngineType.YurisRevenge ? "ra2md.csf" : "ra2.csf"; _logger.Info("Loading csf file {0}", csfFile); var csf = VFS.Open <CsfFile>(csfFile); mapName = csf.GetValue(csfEntryName.ToLower()); if (missionEntry != null) { if (mapName.Contains("Operation: ")) { string missionMapName = Path.GetFileName(map.FileName); if (char.IsDigit(missionMapName[3]) && char.IsDigit(missionMapName[4])) { string missionNr = Path.GetFileName(map.FileName).Substring(3, 2); mapName = mapName.Substring(0, mapName.IndexOf(":")) + " " + missionNr + " -" + mapName.Substring(mapName.IndexOf(":") + 1); } } } else { // not standard map if ((pktMapEntry.GameModes & PktFile.GameMode.Standard) == 0) { if ((pktMapEntry.GameModes & PktFile.GameMode.Megawealth) == PktFile.GameMode.Megawealth) { mapName += " (Megawealth)"; } if ((pktMapEntry.GameModes & PktFile.GameMode.Duel) == PktFile.GameMode.Duel) { mapName += " (Land Rush)"; } if ((pktMapEntry.GameModes & PktFile.GameMode.NavalWar) == PktFile.GameMode.NavalWar) { mapName += " (Naval War)"; } } } } // not really used, likely empty, but if this is filled in it's probably better than guessing if (mapName == "" && basic.SortedEntries.ContainsKey("Name")) { mapName = basic.ReadString("Name"); } if (mapName == "") { _logger.Warn("No valid mapname given or found, reverting to default filename {0}", fileNameWithoutExtension); mapName = fileNameWithoutExtension; } else { _logger.Info("Mapname found: {0}", mapName); } mapName = StripPlayersFromName(MakeValidFileName(mapName)).Replace(" ", " "); return(mapName); }
public FuelCar(string brand, string model, int doors, int speed, Consumption consumption, EngineType engine, int fuelcap, int fuelusage) : base(brand, model, doors, speed, consumption, engine) { FuelCapacity = fuelcap; CurrentFuel = fuelusage; }
public ImplementationMetadataAttribute(EngineType type) { EngineType = type; }
public ElectricCar(string brand, string model, int doors, int topSpeed, int batteryCapacity, Consumption consumption) : base(brand, model, doors, topSpeed, consumption) { BatteryCapacity = batteryCapacity; EngineType = EngineType.Electric; }
public PDULegacyPlaneInfoResponse(string from, string to, EngineType engineType, string csl) : base(from, to) { EngineType = engineType; CSL = csl; }
public void SetEngineType(EngineType engineType) { FEngine.SetEngineType(engineType); }
// TODO (Dragon): support CEA 360 with LZX private static CompressionState DetermineState(IReader reader, EngineDatabase engineDb, out EngineType type, out EngineDescription engineInfo) { CacheFileVersionInfo version = null; // not all compressed maps have a decompressed header // so we handle that here try { // Attempt to set the reader's endianness based upon the file's header magic reader.SeekTo(0); byte[] headerMagic = reader.ReadBlock(4); reader.Endianness = CacheFileLoader.DetermineCacheFileEndianness(headerMagic); // Load engine version info version = new CacheFileVersionInfo(reader); } catch (ArgumentException e) // map had no header, assume its CEA { using (MemoryStream ms_header_out = new MemoryStream()) { // first chunk offset is at 0x4 reader.SeekTo(0x4); int first_chunk_offset = reader.ReadInt32(); int second_chunk_offset = reader.ReadInt32(); int first_chunk_size = second_chunk_offset - first_chunk_offset - 6; reader.SeekTo(first_chunk_offset); // CEA 360 stores an 0xFF, use it for ID byte cea_360_ff_byte = reader.ReadByte(); if (cea_360_ff_byte == 0xFF) // CEA 360 { // TODO (Dragon): decompress first chunk to get the header with lzx throw new InvalidOperationException("assembly does not support CEA 360 decompression (missing LZX)"); } else // assume CEA MCC { reader.SeekTo(first_chunk_offset + 6); byte[] first_chunk_bytes = reader.ReadBlock(first_chunk_size); using (MemoryStream ms_header_comp = new MemoryStream(first_chunk_bytes)) { //ms_header_comp.Write(first_chunk_bytes, 0, first_chunk_size); using (DeflateStream ds = new DeflateStream(ms_header_comp, CompressionMode.Decompress)) { ds.CopyTo(ms_header_out); } } } EndianReader header_reader = new EndianReader(ms_header_out, Endian.LittleEndian); version = new CacheFileVersionInfo(header_reader); } } // if version wasnt set its because we couldnt read a proper header, throw an exception if (version == null) { throw new NullReferenceException("Failed to create CacheFileVersionInfo from map header"); } type = version.Engine; engineInfo = engineDb.FindEngineByVersion(version.BuildString); if (version.Engine == EngineType.FirstGeneration) { if (engineInfo == null) { return(CompressionState.Null); } if (!engineInfo.UsesCompression) { return(CompressionState.Null); } return(AnalyzeFirstGen(reader, engineInfo)); } else if (version.Engine == EngineType.SecondGeneration) { if (engineInfo == null) { return(CompressionState.Null); } if (!engineInfo.UsesCompression) { return(CompressionState.Null); } return(AnalyzeSecondGen(reader, engineInfo)); } else { return(CompressionState.Null); } }
public FuelCar(string brand, string model, int doors, int topSpeed, int fuelCapacity, int currentFuel, Consumption consumption, EngineType engineType) : base(brand, model, doors, topSpeed, consumption) { FuelCapacity = fuelCapacity; CurrentFuel = currentFuel; EngineType = engineType; }
public Engine(EngineType engineType) { _engineType = engineType; }
public TileCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art, TheaterSettings theaterSettings, IniFile theaterIni = null) : base(type, theater, engine, rules, art) { _theaterSettings = theaterSettings; if (theaterIni == null) { _theaterIni = VFS.Open <IniFile>(theaterSettings.TheaterIni); if (_theaterIni == null) { Logger.Warn("Unavailable theater loaded, theater.ini not found"); return; } } else { _theaterIni = theaterIni; } #region Set numbers IniFile.IniSection General = _theaterIni.GetSection("General"); ACliffMMPieces = General.ReadShort("ACliffMMPieces", -1); ACliffPieces = General.ReadShort("ACliffPieces", -1); BlackTile = General.ReadShort("BlackTile", -1); BridgeBottomLeft1 = General.ReadShort("BridgeBottomLeft1", -1); BridgeBottomLeft2 = General.ReadShort("BridgeBottomLeft2", -1); BridgeBottomRight1 = General.ReadShort("BridgeBottomRight1", -1); BridgeBottomRight2 = General.ReadShort("BridgeBottomRight2", -1); BridgeMiddle1 = General.ReadShort("BridgeMiddle1", -1); BridgeMiddle2 = General.ReadShort("BridgeMiddle2", -1); BridgeSet = General.ReadShort("BridgeSet", -1); BridgeTopLeft1 = General.ReadShort("BridgeTopLeft1", -1); BridgeTopLeft2 = General.ReadShort("BridgeTopLeft2", -1); BridgeTopRight1 = General.ReadShort("BridgeTopRight1", -1); BridgeTopRight2 = General.ReadShort("BridgeTopRight2", -1); ClearTile = General.ReadShort("ClearTile", -1); ClearToGreenLat = General.ReadShort("ClearToGreenLat", -1); ClearToPaveLat = General.ReadShort("ClearToPaveLat", -1); ClearToRoughLat = General.ReadShort("ClearToRoughLat", -1); ClearToSandLat = General.ReadShort("ClearToSandLat", -1); CliffRamps = General.ReadShort("CliffRamps", -1); CliffSet = General.ReadShort("CliffSet", -1); DestroyableCliffs = General.ReadShort("DestroyableCliffs", -1); DirtRoadCurve = General.ReadShort("DirtRoadCurve", -1); DirtRoadJunction = General.ReadShort("DirtRoadJunction", -1); DirtRoadSlopes = General.ReadShort("DirtRoadSlopes", -1); DirtRoadStraight = General.ReadShort("DirtRoadStraight", -1); DirtTrackTunnels = General.ReadShort("DirtTrackTunnels", -1); DirtTunnels = General.ReadShort("DirtTunnels", -1); GreenTile = General.ReadShort("GreenTile", -1); HeightBase = General.ReadShort("HeightBase", -1); Ice1Set = General.ReadShort("Ice1Set", -1); Ice2Set = General.ReadShort("Ice2Set", -1); Ice3Set = General.ReadShort("Ice3Set", -1); IceShoreSet = General.ReadShort("IceShoreSet", -1); MMRampBase = General.ReadShort("MMRampBase", -1); MMWaterCliffAPieces = General.ReadShort("MMWaterCliffAPieces", -1); Medians = General.ReadShort("Medians", -1); MiscPaveTile = General.ReadShort("MiscPaveTile", -1); MonorailSlopes = General.ReadShort("MonorailSlopes", -1); PaveTile = General.ReadShort("PaveTile", -1); PavedRoadEnds = General.ReadShort("PavedRoadEnds", -1); PavedRoadSlopes = General.ReadShort("PavedRoadSlopes", -1); PavedRoads = General.ReadShort("PavedRoads", -1); RampBase = General.ReadShort("RampBase", -1); RampSmooth = General.ReadShort("RampSmooth", -1); Rocks = General.ReadShort("Rocks", -1); RoughGround = General.ReadShort("RoughGround", -1); RoughTile = General.ReadShort("RoughTile", -1); SandTile = General.ReadShort("SandTile", -1); ShorePieces = General.ReadShort("ShorePieces", -1); SlopeSetPieces = General.ReadShort("SlopeSetPieces", -1); SlopeSetPieces2 = General.ReadShort("SlopeSetPieces2", -1); TrackTunnels = General.ReadShort("TrackTunnels", -1); TrainBridgeSet = General.ReadShort("TrainBridgeSet", -1); Tunnels = General.ReadShort("Tunnels", -1); WaterBridge = General.ReadShort("WaterBridge", -1); WaterCaves = General.ReadShort("WaterCaves", -1); WaterCliffAPieces = General.ReadShort("WaterCliffAPieces", -1); WaterCliffs = General.ReadShort("WaterCliffs", -1); WaterSet = General.ReadShort("WaterSet", -1); WaterfallEast = General.ReadShort("WaterfallEast", -1); WaterfallNorth = General.ReadShort("WaterfallNorth", -1); WaterfallSouth = General.ReadShort("WaterfallSouth", -1); WaterfallWest = General.ReadShort("WaterfallWest", -1); WoodBridgeSet = General.ReadShort("WoodBridgeSet", -1); #endregion }
private List <CarPart> ConvertLinesToCarParts(List <string> lines) { var carParts = new List <CarPart>(); foreach (var line in lines) { var quantity = line.Split(' ')[0]; var type = line.Split(' ')[1]; var part = line.Split(' ')[2]; int nr; bool isChassis = false; bool isEngine = false; bool isPaint = false; bool isWheel = false; var isInt = int.TryParse(quantity, out nr); if (!isInt) { throw new Exception($"Invalid car part {line}"); } if (part.Contains(Wheel.ToString())) { WheelType wheelType = WheelType.SUMMER; isWheel = Enum.TryParse <WheelType>(type.ToUpper(), out wheelType); if (isWheel) { carParts.Add(new Wheel() { WheelType = wheelType }); } continue; } if (part.Contains(Engine.ToString())) { EngineType engineType = EngineType.DIESEL; isEngine = Enum.TryParse <EngineType>(type.ToUpper(), out engineType); if (isEngine) { carParts.Add(new Engine() { EngineType = engineType }); } continue; } if (part.Contains(Chassis.ToString())) { ChassisType chassisType = ChassisType.TITANIUM; isChassis = Enum.TryParse <ChassisType>(type.ToUpper(), out chassisType); if (isChassis) { carParts.Add(new Chassis() { ChassisType = chassisType }); } continue; } if (part.Contains(Paint.ToString())) { PaintType paintType = PaintType.BLACK; isPaint = Enum.TryParse <PaintType>(type.ToUpper(), out paintType); if (isPaint) { carParts.Add(new Paint() { PaintType = paintType }); } continue; } if (!isChassis && !isEngine && !isPaint && !isWheel) { throw new Exception($"Invalid car part {line}"); } } return(carParts); }
public bool ScanMixDir(string mixDir, EngineType engine) { if (engine == EngineType.AutoDetect) { Logger.Fatal("Scanning mixdir for auto detect theater is no longer supported!"); return(false); } if (string.IsNullOrEmpty(mixDir)) { mixDir = DetermineMixDir(mixDir, engine); } if (string.IsNullOrEmpty(mixDir)) { Logger.Fatal("No mix directory detected!"); return(false); } // see http://modenc.renegadeprojects.com/MIX for more info Logger.Info("Initializing filesystem on {0} for the {1} engine", mixDir, engine.ToString()); // add mixdir if we didnt receive it yet if (AllArchives.OfType <DirArchive>().All(d => d.Directory != mixDir)) { AddFile(mixDir); } // try all expand\d{2}md?\.mix files for (int i = 99; i >= 0; i--) { string file = "expand" + i.ToString("00") + ".mix"; if (FileExists(file)) { AddFile(file); } if (engine == EngineType.YurisRevenge) { file = "expandmd" + i.ToString("00") + ".mix"; if (FileExists(file)) { AddFile(file); } } } // the game actually loads these earlier, but modders like to override them // with ares or something if (engine >= EngineType.RedAlert2) { if (engine == EngineType.YurisRevenge) { AddFile("langmd.mix"); } AddFile("language.mix"); } if (engine >= EngineType.RedAlert2) { if (engine == EngineType.YurisRevenge) { AddFile("ra2md.mix"); } AddFile("ra2.mix"); } else { if (engine == EngineType.Firestorm) { AddFile("patch.mix"); } AddFile("tibsun.mix"); } if (engine == EngineType.YurisRevenge) { AddFile("cachemd.mix"); } AddFile("cache.mix"); if (engine == EngineType.YurisRevenge) { AddFile("localmd.mix"); } AddFile("local.mix"); if (engine == EngineType.YurisRevenge) { AddFile("audiomd.mix"); } for (int i = 99; i >= 0; i--) { string file = string.Format("ecache{0:d2}.mix", i); if (FileExists(file)) { AddFile(file); } } for (int i = 99; i >= 0; i--) { string file = string.Format("elocal{0:d2}.mix", i); if (FileExists(file)) { AddFile(file); } } if (engine >= EngineType.RedAlert2) { foreach (string file in Directory.GetFiles(mixDir, "*.mmx")) { AddFile(Path.Combine(mixDir, file)); } if (engine == EngineType.YurisRevenge) { foreach (string file in Directory.GetFiles(mixDir, "*.yro")) { AddFile(Path.Combine(mixDir, file)); } } } AddFile("conquer.mix"); if (engine >= EngineType.RedAlert2) { if (engine == EngineType.YurisRevenge) { AddFile("conqmd.mix"); AddFile("genermd.mix"); } AddFile("generic.mix"); if (engine == EngineType.YurisRevenge) { AddFile("isogenmd.mix"); } AddFile("isogen.mix"); if (engine == EngineType.YurisRevenge) { AddFile("cameomd.mix"); } AddFile("cameo.mix"); if (engine == EngineType.YurisRevenge) { AddFile("mapsmd03.mix"); AddFile("multimd.mix"); AddFile("thememd.mix"); } } return(true); }
public JsonResult GetWorks(EngineType type) { var list = workSelectListModelBuilder.Build(type); return(Json(list, JsonRequestBehavior.AllowGet)); }
public VehicleBuilder <Rocket> SetEngineType(EngineType engineType) { _vehicle.EngineType = engineType; return(this); }
public EngineItem() { type = EngineType.Error; this.tier = 0; }
public EngineItem(String type, int tier) { this.type = getEngineType(type); this.tier = tier; }
public Server QueryServerInstance(EngineType type, string ip, ushort port) { return(ServerQuery.GetServerInstance(type, ip, port)); }
public ShowEngine(EngineType type) { EngineType = type; }
// TODO Check hooks public static bool canHaul(this EngineType e, ProductType p) { return(e.era() >= p.era()); }
public EngineItem(EngineType type) { this.type = type; this.tier = 0; }
public EngineModel(EngineType engineType) { this.EngineTypeLevel = engineType; }
// SHP vehicles and infantry behave differently, so they require different frame decider logic. // This is due to SHP vehicles not obeying the unwritten rule that infantry have standing frames coming first. public static Func <GameObject, int> SHPVehicleFrameDecider(int StartStandFrame, int StandingFrames, int StartWalkFrame, int WalkFrames, int Facings, EngineType engine) { return(delegate(GameObject obj) { int direction = 0; int frameoffset = 0; int framenumber = 0; if (obj is OwnableObject) { direction = (obj as OwnableObject).Direction; } if (Facings == 8) { frameoffset = (direction / 32) + 1; if (frameoffset >= 8) { frameoffset -= 8; } } if (Facings == 32) { if (engine < EngineType.RedAlert2) { frameoffset = (direction / 8) + 1; if (frameoffset >= 32) { frameoffset -= 32; } } else { frameoffset = direction / 8 + 5; if (frameoffset >= 32) { frameoffset -= 32; } } } if (StandingFrames == 0 && StartStandFrame == 0 && WalkFrames > 0) { framenumber = StartWalkFrame + (frameoffset * WalkFrames); } else if (StandingFrames == 0 && StartStandFrame == 0 && WalkFrames == 0) { framenumber = StartWalkFrame + frameoffset; } else if (StandingFrames == 0 && StartStandFrame > 0) { framenumber = StartStandFrame + frameoffset; } else { framenumber = StartStandFrame + (frameoffset * StandingFrames); } return framenumber; }); }
public Vehicle(int numWheels, int numDoors, EngineType et) { numberOfWheels = numWheels; numberOfDoors = numDoors; engineType = et; }
/// <summary> /// Creates a new boat engine and adds it to the database. /// </summary> /// <param name="model"> Engine manufacturer model </param> /// <param name="horsepower"> Engine power (in HP) </param> /// <param name="displacement"> Engine displacement (water draught) </param> /// <param name="engineType"> Engine type (Jet or Sterndrive)</param> /// <returns> A view with information about the outcome of the operation </returns> public string CreateBoatEngine(string model, int horsepower, int displacement, EngineType engineType) { IBoatEngine engine; switch (engineType) { case EngineType.Jet: engine = new JetEngine(model, horsepower, displacement); break; case EngineType.Sterndrive: engine = new SterndriveEngine(model, horsepower, displacement); break; default: throw new NotImplementedException(); } this.Database.Engines.Add(engine); return(string.Format( "Engine model {0} with {1} HP and displacement {2} cm3 created successfully.", model, horsepower, displacement)); }