public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Signature = binaryReader.ReadTagClass(); this.Width = binaryReader.ReadInt16(); this.Height = binaryReader.ReadInt16(); this.Depth = binaryReader.ReadByte(); this.BitmapDataMoreFlags = ((MoreFlags)(binaryReader.ReadByte())); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.Format = ((FormatEnum)(binaryReader.ReadInt16())); this.BitmapDataFlags = ((Flags)(binaryReader.ReadInt16())); this.RegistrationPoint = binaryReader.ReadPoint(); this.MipmapCount = binaryReader.ReadInt16(); this.LowDetailMipmapCount = binaryReader.ReadInt16(); this.PixelsOffset = binaryReader.ReadInt32(); this.LOD1TextureDataOffset = binaryReader.ReadInt32(); this.LOD2TextureDataOffset = binaryReader.ReadInt32(); this.LOD3TextureDataOffset = binaryReader.ReadInt32(); this.fieldskip = binaryReader.ReadBytes(12); this.LOD1TextureDataLength = binaryReader.ReadInt32(); this.LOD2TextureDataLength = binaryReader.ReadInt32(); this.LOD3TextureDataLength = binaryReader.ReadInt32(); this.fieldskip0 = binaryReader.ReadBytes(52); return(pointerQueue); }
private void CheckFormat(FormatEnum format) { if (IsSpecifiedFormatNone(format)) { throw new Exception("Valid file format is not specified in file name."); } }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.Format = ((FormatEnum)(binaryReader.ReadInt16())); this.Usage = ((UsageEnum)(binaryReader.ReadInt16())); this.BitmapFlags = ((Flags)(binaryReader.ReadInt16())); this.DetailFadeFactor = binaryReader.ReadSingle(); this.SharpenAmount = binaryReader.ReadSingle(); this.BumpHeight = binaryReader.ReadSingle(); this.SpriteSize = ((SpriteSizeEnum)(binaryReader.ReadInt16())); this.EMPTYSTRING = binaryReader.ReadInt16(); this.ColorPlateWidth = binaryReader.ReadInt16(); this.ColorPlateHeight = binaryReader.ReadInt16(); this.data = binaryReader.ReadBytes(8); this.data0 = binaryReader.ReadBytes(8); this.BlurFilterSize = binaryReader.ReadSingle(); this.AlphaBias = binaryReader.ReadSingle(); this.MipmapCount = binaryReader.ReadInt16(); this.SpriteUsage = ((SpriteUsageEnum)(binaryReader.ReadInt16())); this.SpriteSpacing = binaryReader.ReadInt16(); this.ForceFormat = ((ForceFormatEnum)(binaryReader.ReadInt16())); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(60)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(116)); return(pointerQueue); }
public void Post([FromBody] Record record) { FormatEnum format = _parserServiceWrapper.ParserService.GetFormat(record.Delimiter); Person person = _parserServiceWrapper.ParserService.GetPerson(format, record.Line); _parserServiceWrapper.PersonCache.Add(person); }
private void Read(StreamPart streamFile, string name) { GetType(streamFile); int index = 0; streamFile.Stream.Position = streamFile.Position; using (BinaryReader reader = IOTools.OpenReadFile(streamFile.Stream, IsLittleEndian)) do { int Size = reader.ReadInt32(); if (streamFile.Position + streamFile.Size < Size + streamFile.Stream.Position) { throw new Exception("TBL error"); } byte[] tempdata = reader.ReadBytes(Size); FormatEnum fileType = GameFormatHelper.GetFormat(tempdata); string ext = Path.GetExtension(name); string tempName = name.Substring(0, name.Length - ext.Length) + "(" + index++.ToString().PadLeft(2, '0') + ")"; if (fileType == FormatEnum.Unknown) { tempName += ".DAT"; } else { tempName += "." + fileType.ToString(); } SubFiles.Add(GameFormatHelper.OpenFile(tempName, tempdata, fileType == FormatEnum.Unknown ? FormatEnum.DAT : fileType)); reader.BaseStream.Position += IOTools.Alignment(reader.BaseStream.Position - streamFile.Position, 16); } while (streamFile.Stream.Position < streamFile.Position + streamFile.Size); }
/// <summary> /// Initializes a new instance of the <see cref="GetCallbackSettingsResponse" /> class. /// </summary> /// <param name="outUrl">This URL is used to push message delivery status updates to your application. (required).</param> /// <param name="inUrl">This URL is used to push incoming SMS to your application. (required).</param> /// <param name="format">Desired callback data format. m - multipart/form-data, u - application/x-www-form-urlencoded, j - application/json (required).</param> public GetCallbackSettingsResponse(string outUrl = default(string), string inUrl = default(string), FormatEnum format = default(FormatEnum)) { // to ensure "outUrl" is required (not null) if (outUrl == null) { throw new InvalidDataException("outUrl is a required property for GetCallbackSettingsResponse and cannot be null"); } else { this.OutUrl = outUrl; } // to ensure "inUrl" is required (not null) if (inUrl == null) { throw new InvalidDataException("inUrl is a required property for GetCallbackSettingsResponse and cannot be null"); } else { this.InUrl = inUrl; } // to ensure "format" is required (not null) if (format == null) { throw new InvalidDataException("format is a required property for GetCallbackSettingsResponse and cannot be null"); } else { this.Format = format; } }
private void ModifyRequest(ListRequest request, string sourceLanguage, FormatEnum format, TranslationModel?model) { request.ModifyRequest += _versionHeaderAction; request.Source = sourceLanguage; request.Format = format; request.Model = GetEffectiveModelName(model); }
/// <summary> /// Sets the data members of the class and returns true if successful. /// </summary> public bool Set(string inputFilenameWithPath, string outputFilenameWithPath) { InputFilenameWithPath = inputFilenameWithPath; OutputFilenameWithPath = outputFilenameWithPath; _inputFormat = ImplicitFormat(inputFilenameWithPath); return(true); }
public HeaderEntryBase(string name, int start, int end, int length, FormatEnum type) { Start = start; End = end; Length = length; Type = type; Name = name; }
public FIDMeta(char id, char subId, string description, FormatEnum fidFormat, int min, int max) { Id = id; SubId = subId; Description = description; FidFormat = fidFormat; Min = min; Max = max; }
private void ModifyRequest(ListRequest request, string sourceLanguage, FormatEnum format, TranslationModel?model) { request.ModifyRequest += _versionHeaderAction; request.Source = sourceLanguage; request.Format = format; var effectiveModel = model ?? DefaultModel; TranslationModels.ValidateModel(effectiveModel); request.Model = effectiveModel.ToApiName(); }
public override FormatEnum GetFileFormat(string fileName) { FormatEnum result = new FormatEnum(); if (fileName.Contains(Constants.Comma)) { result = FormatEnum.comma; } return(result); }
/// <summary> /// Constructs and initializes an instance object of the class TestGenerator. /// </summary> public TestGenerator() { InputFilenameWithPath = null; OutputFilenameWithPath = null; GeneratedTestsInSuite = null; CoverageMetricsInSuite = new CoverageMetrics(); _testCaseNumber = 0; _random = new Random(); _inputFormat = FormatEnum.None; }
/// <summary> /// Reads the test specification in its given format and returns the resulting object. /// </summary> private TestSpecification Read(string inputFilenameWithPath, FormatEnum inputFormat) { TestSpecification testSpecification = new TestSpecification(); if (((inputFormat == FormatEnum.Xml) && testSpecification.ReadAsXml(inputFilenameWithPath)) || ((inputFormat == FormatEnum.Json) && testSpecification.ReadAsJson(inputFilenameWithPath))) { return(testSpecification); } return(null); }
public void ParserServiceShouldGetSpaceFileFormatFromFileName() { //arrange string fileName = @"C:\gtr\gtr-space.txt"; //act FormatEnum actual = _parserService.GetFormat(fileName); //assert FormatEnum expected = FormatEnum.space; Assert.AreEqual(expected, actual); }
/// <summary> /// Initializes a new instance of the <see cref="ContactExportRequest" /> class. /// </summary> /// <param name="format">File extension to export contacts (required).</param> /// <param name="callbackUrl">Url to receive the webhook.</param> /// <param name="segments">Array of segment IDs to filter contacts to export. ***Note:*** segments of type ***auto*** and ***tag*** are not yet supported but they are expected to be supported soon!.</param> /// <param name="fields">Array of field IDs to be displayed in the exported file.</param> public ContactExportRequest(FormatEnum format = default(FormatEnum), string callbackUrl = default(string), List <string> segments = default(List <string>), List <string> fields = default(List <string>)) { // to ensure "format" is required (not null) if (format == null) { throw new InvalidDataException("format is a required property for ContactExportRequest and cannot be null"); } else { this.Format = format; } this.CallbackUrl = callbackUrl; this.Segments = segments; this.Fields = fields; }
public FormatEnum GetFormat(string input) { CheckFormatters(); var result = new FormatEnum(); foreach (var getter in _formatGetters) { result = getter.GetFileFormat(input); if (result != FormatEnum.none) { break; } } return(result); }
public void SetName(string name) { foreach (var a in SubFiles) { FormatEnum fileType = a.GameData.Type; string ext = Path.GetExtension(name); if (fileType == FormatEnum.DAT) { a.Name = name.Substring(0, name.Length - ext.Length) + "(" + ((int)a.Tag).ToString().PadLeft(2, '0') + ").DAT"; } else { a.Name = name.Substring(0, name.Length - ext.Length) + "." + fileType.ToString(); } } }
/// <summary> /// Converts a FormatEnum value to a corresponding string value /// </summary> /// <param name="enumValue">The FormatEnum value to convert</param> /// <returns>The representative string value</returns> public static string ToValue(FormatEnum enumValue) { switch (enumValue) { //only valid enum elements can be used //this is necessary to avoid errors case FormatEnum.SMS: case FormatEnum.TTS: case FormatEnum.MMS: return(stringValues[(int)enumValue]); //an invalid enum value was requested default: return(null); } }
static void ImportAll(GameFile objectFile, string openedFileDir) { foreach (var item in objectFile.GameData.SubFiles) { string newpath = Path.Combine(openedFileDir, item.Name.Replace('/', '+')); FormatEnum fileType = item.GameData.Type; if (File.Exists(newpath)) { var file = GameFormatHelper.OpenFile(objectFile.Name, File.ReadAllBytes(newpath), fileType); if (file != null) { item.GameData = file.GameData; } } } }
public IList <Person> GetPersons(string fileName) { List <Person> persons = new List <Person>(); try { FormatEnum format = GetFormat(fileName); CheckFormat(format); KeyValuePair <FormatEnum, char> delimiter = GetDilimiter(format); persons = GetPersons(fileName, delimiter.Value); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } return(persons); }
public Person GetPerson(FormatEnum format, string record) { Person person; try { KeyValuePair <FormatEnum, char> delimiter = GetDilimiter(format); string[] parsedRecord = record.Split(delimiter.Value); CheckArraySize(parsedRecord); person = GetPerson(parsedRecord); } catch (Exception e) { Console.WriteLine(e.Message); throw; } return(person); }
private (Transaction transaction, ImageJson image) Translate(TransactionInput input) { var guidImage = Guid.NewGuid(); var guidTransaction = Guid.NewGuid(); var date = DateTime.Now; FormatEnum format = GetFormat(input.Format); var imgJson = new ImageJson { Id = guidImage, Data = input.File, Format = format }; var transacion = new Transaction { Title = input.Title, Description = input.Description, Cash = input.Cost, Date = date, Id = guidTransaction, File = guidImage }; return(transacion, imgJson); }
/// <summary> /// Initializes a new instance of the <see cref="Field" /> class. /// </summary> /// <param name="name">Name of the field (required).</param> /// <param name="format">Field format (required).</param> /// <param name="unique">True if the field is unique, false otherwise.</param> public Field(string name = default(string), FormatEnum format = default(FormatEnum), bool?unique = default(bool?)) { // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for Field and cannot be null"); } else { this.Name = name; } // to ensure "format" is required (not null) if (format == null) { throw new InvalidDataException("format is a required property for Field and cannot be null"); } else { this.Format = format; } this.Unique = unique; }
public override void LoadFromXml(System.Xml.XmlElement xmlEl ) { base.LoadFromXml(xmlEl); string prompt=xmlEl.GetAttribute("PR"); this._prompt=(prompt=="1"?true:false); string formatString=xmlEl.GetAttribute("FS").Trim(); this._format=(formatString==null || formatString=="")?FormatEnum.Default:(FormatEnum)(int.Parse(formatString)); foreach(System.Xml.XmlElement childEl in xmlEl.ChildNodes) //calculated member references { if(childEl.Name=="D") // dimension { throw new NotImplementedException(); } else if(childEl.Name=="H") // hierarchy { string uniqueName=childEl.GetAttribute("UN"); string ignoreError=childEl.GetAttribute("IE"); Hierarchy hier=Schema.Hierarchies[uniqueName]; if(hier==null && ignoreError!="1") throw new InvalidMemberException("Invalid object: " + uniqueName); _mdxParameters.Add(hier, false); } else if(childEl.Name=="L") // level { string uniqueName=childEl.GetAttribute("UN"); string ignoreError=childEl.GetAttribute("IE"); Level lev=Schema.Levels[uniqueName]; if(lev==null && ignoreError!="1") throw new InvalidMemberException("Invalid object: " + uniqueName); _mdxParameters.Add(lev, false); } else if(childEl.Name=="M") // member { string hierUN=childEl.GetAttribute("H"); string ignoreError=childEl.GetAttribute("IE"); DataMember dmem=null; Hierarchy hier=null; try { if(hierUN!="") { hier=Schema.Hierarchies[hierUN]; if(hier==null && ignoreError!="1") throw new InvalidMemberException("Invalid object: " + hier); } dmem=DataMember.GetFromXml( (hier==null?this.Hierarchy:hier), childEl); } catch(InvalidMemberException imexc) { if(ignoreError!="1") throw imexc; } _mdxParameters.Add(dmem, false); } } }
/// <summary> /// /// </summary> /// <param name="format"></param> public RQKosFormat(FormatEnum format) { this.Format = format; }
/// <summary> /// Initializes a new instance of the <see cref="ComplexField" /> class. /// </summary> public ComplexField(string name = default(string), FormatEnum format = default(FormatEnum), bool?unique = default(bool?)) : base(fieldId, name, format, unique) { }
private KeyValuePair <FormatEnum, char> GetDilimiter(FormatEnum fileFormat) { CheckDelimiters(); return(_delimiters.Where(x => x.Key == fileFormat).FirstOrDefault()); }
private bool IsSpecifiedFormatNone(FormatEnum format) { return(FormatEnum.none == format); }
public TypeScriptGenerator WithEnumFormatter(FormatEnum typeFormatter, FormatEnumProperty propertyFormatter) { _enumFormatter = typeFormatter; _enumPropertyFormatter = propertyFormatter; return(this); }
public override void LoadFromXml(System.Xml.XmlElement xmlEl) { base.LoadFromXml(xmlEl); string prompt = xmlEl.GetAttribute("PR"); this._prompt = (prompt == "1"?true:false); string formatString = xmlEl.GetAttribute("FS").Trim(); this._format = (formatString == null || formatString == "")?FormatEnum.Default:(FormatEnum)(int.Parse(formatString)); foreach (System.Xml.XmlElement childEl in xmlEl.ChildNodes) //calculated member references { if (childEl.Name == "D") // dimension { throw new NotImplementedException(); } else if (childEl.Name == "H") // hierarchy { string uniqueName = childEl.GetAttribute("UN"); string ignoreError = childEl.GetAttribute("IE"); Hierarchy hier = Schema.Hierarchies[uniqueName]; if (hier == null && ignoreError != "1") { throw new InvalidMemberException("Invalid object: " + uniqueName); } _mdxParameters.Add(hier, false); } else if (childEl.Name == "L") // level { string uniqueName = childEl.GetAttribute("UN"); string ignoreError = childEl.GetAttribute("IE"); Level lev = Schema.Levels[uniqueName]; if (lev == null && ignoreError != "1") { throw new InvalidMemberException("Invalid object: " + uniqueName); } _mdxParameters.Add(lev, false); } else if (childEl.Name == "M") // member { string hierUN = childEl.GetAttribute("H"); string ignoreError = childEl.GetAttribute("IE"); DataMember dmem = null; Hierarchy hier = null; try { if (hierUN != "") { hier = Schema.Hierarchies[hierUN]; if (hier == null && ignoreError != "1") { throw new InvalidMemberException("Invalid object: " + hier); } } dmem = DataMember.GetFromXml((hier == null?this.Hierarchy:hier), childEl); } catch (InvalidMemberException imexc) { if (ignoreError != "1") { throw imexc; } } _mdxParameters.Add(dmem, false); } } }