public void SaveDownloadedFile(bool isDefaultlocation, FileFormats fileformat, string fileName, string savelocation = "") { string saveDir; string message = ""; if (isDefaultlocation) { saveDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); message = " to My Documents"; } else { saveDir = savelocation; } string fileExt = ""; if (fileformat == FileFormats.MP3) { fileExt = ""; } else if (fileformat == FileFormats.MP4) { fileExt = ".mp4"; } else if (fileformat == FileFormats.WEBM) { fileExt = ".webm"; } StartTrySave :; if (Directory.Exists(saveDir)) { if (File.Exists(saveDir + "\\" + fileName + fileExt)) { MessageBoxResult result = MessageBox.Show("This file has been downloaded previously. Would you like to overwrite it?" + Environment.NewLine + "Otherwise its saved with a different filename", "Overwrite", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { File.Delete(saveDir + "\\" + fileName + fileExt); File.Copy(AppPath + "\\" + fileName + fileExt, saveDir + "\\" + fileName + fileExt); File.Delete(AppPath + "\\" + fileName + fileExt); } else { File.Copy(AppPath + "\\" + fileName + fileExt, saveDir + "\\-NEW-" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + " " + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + " " + fileName + fileExt); File.Delete(AppPath + "\\" + fileName + fileExt); } } else { File.Copy(AppPath + "\\" + fileName + fileExt, saveDir + "\\" + fileName + fileExt); File.Delete(AppPath + "\\" + fileName + fileExt); } MessageBox.Show("File saved successfully" + message, "Success", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Cannot save the file in the desired location as the location cannot be found. Saving to my documents", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); saveDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); goto StartTrySave; } }
private void mnuFileOpenText_Click(object sender, EventArgs e) { openFileDialog1 = new OpenFileDialog(); DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { try { using (StreamReader sr = File.OpenText(openFileDialog1.FileName)) { string s = ""; while ((s = sr.ReadLine()) != null) { infoBox.Items.Add(s); } } m_fileFmt = FileFormats.txt; latestSaved = openFileDialog1.FileName; hasSaved = true; } catch { MessageBox.Show("Could not open text file!"); } } }
private static string GetMessage(FileFormats format) { switch (format) { case FileFormats.KeePass1x: return("7Pass Remake does not support KeePass 1.x database files. " + "Please consider converting it to KeePass 2.x format." + "\r\n\r\nFile not added to 7Pass"); case FileFormats.NewVersion: return("The selected database file is created by a newer " + "version of KeePass that is not supported by 7Pass. " + "7Pass should be updated soon to support this version." + "\r\n\r\nFile not added to 7Pass"); case FileFormats.NotSupported: return("The selected file is not supported " + "by 7Pass, or not a KeePass database file." + "\r\n\r\nFile not added to 7Pass"); case FileFormats.OldVersion: return("The selected database file is too old, and is not supported by 7Pass. " + "Please use KeePass 2 on desktop to migrate it to the current format." + "\r\n\r\nFile not added to 7Pass"); case FileFormats.PartialSupported: return("The database is created/modified by a newer version of KeePass. " + "Do not make changes to the database with 7Pass to avoid loss of data."); default: return(null); } }
public static string[] OpenFolderDialog(DirectoryInfo directory, FileFormats formats) { var formatsBuilder = new StringBuilder(); if (formats.HasFlag(FileFormats.MeshFormats)) { formatsBuilder.Append("3D files (*.obj,*.stl )|*.obj;*.stl|"); } if (formats.HasFlag(FileFormats.All)) { formatsBuilder.Append("All files (*.*)|*.*"); } var filter = formatsBuilder.ToString().TrimEnd('|'); var dialog = new Microsoft.Win32.OpenFileDialog(); dialog.InitialDirectory = directory.FullName; dialog.Multiselect = true; dialog.Filter = filter; dialog.DefaultExt = filter; dialog.Title = "Open file"; if (dialog.ShowDialog() == false) { return(null); } return(dialog.FileNames); }
public IDocument OpenFromFile(string path, FileFormats file_formats) { string ext = Path.GetExtension(path).ToLower(); foreach (FileFormat format in file_formats) { string[] items = format.Filter.Split('|')[1].Split(';'); foreach (string item in items) { if (item.Remove(0, 1) == ext) { foreach (DockContent dc in this.dockPanel1.Documents) { if (dc is IDocument) { IDocument d = dc as IDocument; if (d.FileName == path) { if (MessageBox.Show($"{path} already exists!\r\n\r\nWould you like reload it?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { d.LoadFromFile(path); return(d); } } } } IDocument doc = (IDocument)Activator.CreateInstance(format.EditorType, new object[] { this }); doc.LoadFromFile(path); return(doc); } } } return(null); }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); Rotors = art.ReadBool("Rotors"); CustomRotor = art.ReadBool("CustomRotor"); Trailer = TypesRepository.GetAnimType(art.ReadString("Trailer")); SpawnDelay = art.ReadInt("SpawnDelay", 3); }
public async Task LoadCustomIcons() { var brands = new Brands(); foreach (var prop in typeof(Brands).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty)) { CustomBrands.Add(new MudIcons(prop.Name, prop.GetValue(brands).ToString(), IconType.Brands)); } CustomAll.AddRange(CustomBrands); var fileFormats = new FileFormats(); foreach (var prop in typeof(FileFormats).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty)) { CustomFileFormats.Add(new MudIcons(prop.Name, prop.GetValue(fileFormats).ToString(), IconType.FileFormats)); } CustomAll.AddRange(CustomFileFormats); var uncategorized = new Uncategorized(); foreach (var prop in typeof(Uncategorized).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty)) { CustomUncategorized.Add(new MudIcons(prop.Name, prop.GetValue(uncategorized).ToString(), IconType.Uncategorized)); } CustomAll.AddRange(CustomUncategorized); await Task.WhenAll(); }
/// <summary> /// Writes the given object instance to a file. /// <para>Object type (and all child types) must be decorated with the [Serializable] attribute.</para> /// <para>To prevent a variable from being serialized, decorate it with the [NonSerialized] attribute; cannot be applied to properties.</para> /// </summary> /// <typeparam name="T">The type of object being written to the file.</typeparam> /// <param name="format">Which format to use with this file.</param> /// <param name="filePath">The file path to write the object instance to.</param> /// <param name="objectToWrite">The object instance to write to the file.</param> /// <param name="append">If false the file will be overwritten if it already exists. If true the contents will be appended to the file.</param> public void WriteToFile <T>(FileFormats format, T objectToWrite, bool append = false) { #if WINDOWS switch (format) { // write as binary case FileFormats.Binary: WriteToBinaryFile <T>(objectToWrite, append); break; // write as xml case FileFormats.Xml: if (append) { throw new NotSupportedException("Cannot use 'append' option when writing an XML file."); } WriteToXmlFile <T>(objectToWrite); break; // should never happen. default: throw new NotSupportedException("Unknown file format!"); } #endif }
public void ProcessVideo(string uri) { try { // Get the audio format and bit rate from the settings AudioFormat format = FileFormats.GetValidAudioFormat(SettingsClient.Get <string>("Output", "Format")); int bitRate = FileFormats.GetValidBitRate(SettingsClient.Get <int>("Output", "BitRate")); // Create a temporary directory string tempFolder = Path.Combine(this.workingFolder, Guid.NewGuid().ToString()); if (!Directory.Exists(tempFolder)) { Directory.CreateDirectory(tempFolder); } if (this.IsVideoUrl(uri)) { // Process the video URL this.ConvertOnlineVideo(tempFolder, uri, format, bitRate); } else if (this.IsVideoFile(uri)) { // Process the video file this.ConvertLocalVideo(tempFolder, uri, format, bitRate); } } catch (Exception ex) { LogClient.Error("An error occurred while processing the video. Exception: {0}", ex.Message); this.SetConvertState(ConvertState.Failed); } }
private void mnuFileSaveAsTextFile_Click(object sender, EventArgs e) { try { using (var sfd = new SaveFileDialog()) { sfd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; sfd.Title = "Save a text file"; sfd.FilterIndex = 2; string saveAsString = ""; if (sfd.ShowDialog() == DialogResult.OK) { foreach (var item in infoBox.Items) { saveAsString += item.ToString() + "\n"; } File.WriteAllText(sfd.FileName, saveAsString); hasSaved = true; latestSaved = sfd.FileName; m_fileFmt = FileFormats.txt; } } } catch { MessageBox.Show("Could not save text file!"); } }
private void mnuFileXMLExport_Click(object sender, EventArgs e) { try { if (listBox1.Items.Count > 0) { using (var sfd = new SaveFileDialog()) { sfd.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; sfd.Title = "Save a XML file"; sfd.FilterIndex = 2; if (sfd.ShowDialog() == DialogResult.OK) { m_foodManager.XMLSerialize(sfd.FileName); hasSaved = true; latestSaved = sfd.FileName; m_fileFmt = FileFormats.xml; } } } } catch { MessageBox.Show("Could not export XML file!"); } }
public async Task<ImportPlaylistResult> ImportPlaylistsAsync(IList<string> fileNames) { ImportPlaylistResult finalResult = ImportPlaylistResult.Success; this.watcher.Suspend(); // Stop watching the playlist folder IList<ImportPlaylistResult> results = new List<ImportPlaylistResult>(); foreach (string fileName in fileNames) { if (FileFormats.IsSupportedStaticPlaylistFile(fileName)) { results.Add(await this.ImportStaticPlaylistAsync(fileName)); } else if (FileFormats.IsSupportedSmartPlaylistFile(fileName)) { results.Add(await this.ImportSmartPlaylistAsync(fileName)); } } this.watcher.Resume(); // Start watching the playlist folder if (results.Any(x => x.Equals(ImportPlaylistResult.Success))) { this.PlaylistFolderChanged(this, new EventArgs()); } return finalResult; }
private void LoadSettingFromDefaultFile( string fullPathToDirectory, Environments environment, FileFormats expectingFormat ) { if (this.SettingsFilename == null) { return; } if (this.SettingsFilename.Count <= 0) { return; } var Environment = environment.ToString(); if (!this.SettingsFilename.ContainsKey(Environment)) { return; } this.LoadSettingFromFile( string.Format(@"{0}\{1}", fullPathToDirectory, this.SettingsFilename[Environment]), expectingFormat ); }
/// <summary> /// Encodes the image and saves it to the specified stream /// </summary> /// <param name="stream">The stream.</param> /// <param name="image">The image.</param> /// <param name="format">The format.</param> /// <returns>True if it is encoded successfully, false otherwise</returns> public bool Encode(Stream stream, Image image, FileFormats format) { using (var TempWriter = new BinaryWriter(stream)) { return(Formats.First(x => x.Format == format).Encode(TempWriter, image)); } }
/// <summary> /// Encodes the animation and saves it to the specified file name /// </summary> /// <param name="stream">The stream.</param> /// <param name="animation">The animation.</param> /// <param name="format">The format.</param> /// <returns> /// True if it is encoded successfully, false otherwise /// </returns> public bool Encode(Stream stream, Animation animation, FileFormats format) { using (var TempWriter = new BinaryWriter(stream)) { return(AnimationFormats.First(x => x.Format == format).Encode(TempWriter, animation)); } }
public TestObject(FileFormats fileFormat, object value1, object value2, bool expectedResult) { FileFormat = fileFormat; Value1 = value1; Value2 = value2; ExpectedResult = expectedResult; }
public void LoadSection(FileFormats.DRM.Section section) { //this.Text += ": " + entry.Description; this.Data = new byte[section.Data.Length]; section.Data.Read(this.Data, 0, this.Data.Length); this.UpdatePreview(); }
public virtual Stream Convert(Image image, FileFormats format) { var imageStream = new MemoryStream(); new Manager().Encode(imageStream, image, format); return(new MemoryStream(imageStream.ToArray())); }
public void OpenReport() { try { updateDisplay(RsViewEngine.Locale.GetTagText("wait_Init")); createCrystalViewer(); //_Document.RefreshReport += new EventHandler(EH_RefreshReport); opened = true; updateDisplay(RsViewEngine.Locale.GetTagText("wait_Open") + "\n" + _RptFile); ReportProvider = new RsReportProvider(_RptFile); } catch (Exception E) { RsViewEngine.TreatCriticalError(E); } /// <summary> /// Collecting and if possible setting up datasource logon info /// </summary> updateDisplay(RsViewEngine.Locale.GetTagText("wait_DSBuild")); List <InternalConnectionInfo> lConnections = ReportProvider.GetAllConnections(); foreach (InternalConnectionInfo iConnInfo in lConnections) { string lConnectionName = iConnInfo.DatabaseName == "" ? iConnInfo.ServerName : iConnInfo.DatabaseName; if (FileFormats.IsExcel(lConnectionName)) { continue; } CSecurityNode lSec = RsViewEngine.RSSecurity.GetSecurityNode("report", lConnectionName, _RptFile); if (lSec == null) { lSec = RsViewEngine.RSSecurity.GetSecurityNode("DatasourceSecurity", lConnectionName); } if (lSec != null) { iConnInfo.SetLogon(lSec.UserName, lSec.Password); } else { if (!ShowAuthDialog(lConnectionName, iConnInfo)) { System.Windows.Forms.Application.Exit(); } } } addRptToViewer(); hideDisplay(); }
private async Task ImportFiles() { var tracks = new List <TrackInfo>(); await Task.Run(() => { lock (this.lockObject) { // Sort the files alphabetically this.files.Sort(); // Convert the files to tracks foreach (string path in this.files) { if (FileFormats.IsSupportedAudioFile(path)) { // The file is a supported audio format: add it directly. tracks.Add(IndexerUtils.Path2TrackInfo(path, "file-" + this.instanceGuid)); } else if (FileFormats.IsSupportedPlaylistFile(path)) { // The file is a supported playlist format: process the contents of the playlist file. List <string> audioFilePaths = this.ProcessPlaylistFile(path); foreach (string audioFilePath in audioFilePaths) { tracks.Add(IndexerUtils.Path2TrackInfo(audioFilePath, "file-" + this.instanceGuid)); } } else if (Directory.Exists(path)) { // The file is a directory: get the audio files in that directory. List <string> audioFilePaths = this.ProcessDirectory(path); foreach (string audioFilePath in audioFilePaths) { tracks.Add(IndexerUtils.Path2TrackInfo(audioFilePath, "file-" + this.instanceGuid)); } } else { // The file is unknown: do not process it. } } // When done importing files, clear the list. this.files.Clear(); } }); LogClient.Instance.Logger.Info("Number of tracks to play = {0}", tracks.Count); if (tracks.Count > 0) { LogClient.Instance.Logger.Info("Enqueuing {0} tracks.", tracks.Count); await this.playbackService.Enqueue(tracks); } }
static IQuandlRequest CreateRequest(string sym, Datacode dc, FileFormats form) { QuandlDownloadRequest qdr = new QuandlDownloadRequest(); qdr.APIKey = APIK; qdr.Datacode = dc; qdr.Format = form; return(qdr); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); Landable = rules.ReadBool("Landable"); AirportBound= rules.ReadBool("AirportBound"); Fighter= rules.ReadBool("Fighter"); Carryall= rules.ReadBool("Carryall"); FlyBy= rules.ReadBool("FlyBy"); FlyBack= rules.ReadBool("FlyBack"); }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); UseLineTrail = art.ReadBool("UseLineTrail"); LineTrailColor= art.ReadColor("LineTrailColor"); LineTrailColorDecrement= art.ReadInt("LineTrailColorDecrement"); Theater= art.ReadBool("Theater"); NewTheater= art.ReadBool("NewTheater"); Voxel= art.ReadBool("Voxel"); }
public static bool RegisterAssociation(FileFormats format) { switch (format) { case FileFormats.PCGRAPH: try { RegPCGRAPH(); return(true); } catch { return(false); } case FileFormats.PCV: try { RegPCV(); return(true); } catch { return(false); } case FileFormats.PCVDOC: try { RegPCVDOC(); return(true); } catch { return(false); } case FileFormats.PRRES: try { RegPRRES(); return(true); } catch { return(false); } case FileFormats.PCMACROS: try { RegPCMACROS(); return(true); } catch { return(false); } case FileFormats.PCMPACK: try { RegPCMPACK(); return(true); } catch { return(false); } default: return(false); } }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); Crawls = art.ReadBool("Crawls", true); FireUp= art.ReadInt("FireUp"); FireProne= art.ReadInt("FireProne"); SecondaryFire= art.ReadInt("SecondaryFire"); SecondaryProne= art.ReadInt("SecondaryProne"); SequenceName= art.ReadString("SequenceName"); }
private static Utils.BaseFileUtil GetConverter(string fullFilename, FileFormats expectingFormat) { Utils.BaseFileUtil Converter = null; switch (expectingFormat) { case FileFormats.XML: break; case FileFormats.JSON: Converter = new Utils.JSON(fullFilename); break; } return(Converter); }
public static void LoadListFromINI(FileFormats.Text.INI iniFile) { All.Clear(); if (iniFile.SectionExists("Tiberiums")) { foreach (var entry in iniFile.Sections["Tiberiums"].Entries) { var ident = entry.Value.Value; All.FindOrAllocate(ident); } } }
public virtual bool ReadFromINI(FileFormats.Text.INI iniFile) { if (iniFile.SectionExists(ID)) { iniFile.GetString(ID, "Name", ref Name); if (iniFile.GetString(ID, "UIName", ref UINameLabel)) { UIName = FileFormats.Binary.CSF.StringTable.GetValue(UINameLabel); } return true; } return false; }
public static string SaveFileDialog(DirectoryInfo directory, FileFormats formats) { var dialog = new Microsoft.Win32.SaveFileDialog(); dialog.InitialDirectory = directory.FullName; if (dialog.ShowDialog() !.Value) { return(dialog.FileName); } return(null); }
public void LoadSection(FileFormats.DRM.Section section) { //this.Text += ": " + entry.Description; this.Data = new byte[section.Data.Length]; section.Data.Read(this.Data, 0, this.Data.Length); this.tabPage1.Text = "File Info"; this.tabText1.Text = string.Format("ID:\t{0:X8}\nType:\t{1}\nFilesize:\t{2}", section.Id, section.Type, section.Data.Length); this.UpdatePreview(); }
public override bool ReadFromINI(FileFormats.Text.INI iniFile) { if (!base.ReadFromINI(iniFile)) { return false; } iniFile.GetInteger(ID, "Spread", ref Spread); iniFile.GetDouble(ID, "SpreadPercentage", ref SpreadPercentage); iniFile.GetInteger(ID, "Growth", ref Growth); iniFile.GetDouble(ID, "GrowthPercentage", ref GrowthPercentage); iniFile.GetInteger(ID, "Value", ref Value); iniFile.GetInteger(ID, "Power", ref Power); var ImageIndex = -1; iniFile.GetInteger(ID, "Image", ref ImageIndex); var lst = CCFactory<OverlayTypeClass, OverlayClass>.Get().FactoryItems; switch (ImageIndex) { case -1: break; case 2: ImageOverlay = new Helpers.WeakRef<OverlayTypeClass>(lst[0x1B]); NumFrames = NumImages = 12; break; case 3: ImageOverlay = new Helpers.WeakRef<OverlayTypeClass>(lst[0x7F]); NumFrames = NumImages = 12; NumExtraImages = 8; break; case 4: ImageOverlay = new Helpers.WeakRef<OverlayTypeClass>(lst[0x93]); NumFrames = NumImages = 12; NumExtraImages = 8; break; case 0: case 1: default: ImageOverlay = new Helpers.WeakRef<OverlayTypeClass>(lst[0x66]); NumFrames = NumImages = 12; NumExtraImages = 8; break; } return true; }
public static void LoadListFromINI(FileFormats.Text.INI iniFile) { var All = CCFactory<OverlayTypeClass, OverlayClass>.Get(); All.FactoryItems.Clear(); if (iniFile.SectionExists("OverlayTypes")) { foreach (var entry in iniFile.Sections["OverlayTypes"].Entries) { var ident = entry.Value.Value; All.FindOrAllocate(ident); } } }
public void FillFormatBox() { FileFormats.Add(EntityClasses.FileFormats.TextFormat); FileFormats.Add(EntityClasses.FileFormats.XmlFormat); FileFormats.Add(EntityClasses.FileFormats.HtmlFormat); FileFormats.Add(EntityClasses.FileFormats.AnyFormat); FileFormatBox.ItemsSource = from f in FileFormats select f.FullName; FileFormatBox.SelectedItem = FileFormatBox.Items.GetItemAt(0); FileFormatBox.SelectionChanged += FormatChange; }
/// <summary> /// Returns a base64 <see cref="string"/> that represents this instance. /// </summary> /// <param name="desiredFormat">The desired format.</param> /// <returns>A <see cref="string"/> that represents this instance as a base64 instance.</returns> public string ToString(FileFormats desiredFormat) { using (MemoryStream Stream = new MemoryStream()) { if (Save(Stream, desiredFormat)) { var TempArray = Stream.ToArray(); return(Convert.ToBase64String(TempArray, 0, TempArray.Length)); } return(string.Empty); } }
public Base LoadSettingFromString(string settingString, FileFormats stringFormat) { var Converter = GetConverter(null, stringFormat); if (Converter == null) { throw new NotImplementedException(); } Converter.PopulateStringToSettingInstance(this, settingString); return(this); }
private void mnOpen_Click(object sender, EventArgs e) { FileFormats ff = EditorForm.EditorFileFormats; IDocument[] items = this.OpenFromFile(ff); if (items != null) { foreach (DockContent item in items) { item.Show(this.dockPanel1); } } }
internal FileFormat GetDefaultFormat(object ob) { if (defaultFormat.CanWrite(ob)) { return(defaultFormat); } FileFormat[] formats = FileFormats.GetFileFormatsForObject(ob); if (formats.Length == 0) { throw new InvalidOperationException("Can't handle objects of type '" + ob.GetType() + "'"); } return(formats [0]); }
public void LoadResource(FileFormats.Game.CBitmapTexture texture) { this.hintLabel.Text = string.Format( "{0}, {1} : {2}x{3}", texture.Format, texture.Compression, texture.Width, texture.Height); //this.Text += ": " + entry.Description; this.Texture = texture; this.UpdatePreview(true); }
/// <summary> /// Checks whether the specified format is any kind of unknown format /// </summary> private static bool IsFileFormatUnknown(FileFormats format) { if (format == FileFormats._Unknown || format == FileFormats._ResFile || format == FileFormats._ResIdxFile) { return(true); } else { return(false); } }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); IsVeinhole = rules.ReadBool("IsVeinhole"); WaterBound = rules.ReadBool("WaterBound"); SpawnsTiberium = rules.ReadBool("SpawnsTiberium"); IsFlammable = rules.ReadBool("IsFlammable"); RadarColor = rules.ReadColor("RadarColor"); IsAnimated = rules.ReadBool("IsAnimated"); AnimationRate = rules.ReadInt("AnimationRate"); AnimationProbability = rules.ReadFloat("AnimationProbability"); TemperateOccupationBits = rules.ReadInt("TemperateOccupationBits", 7); SnowOccupationBits = rules.ReadInt("SnowOccupationBits", 7); }
public override bool CanLoadObject(string path) { path = path.ToLowerInvariant(); if (path.EndsWith(".b3d") || path.EndsWith(".csv")) { if (System.IO.File.Exists(path) && FileFormats.IsNautilusFile(path)) { return(false); } return(true); } return(false); }
public void Process(IntPtr fileHandle, FileFormats fileFormat) { var logFileParser = new LogFileParserSimpleFactory().Create(fileHandle, fileFormat); var logFile = logFileParser.Parse(); var statistics = new LogFileStatisticsEventArgs { WarningCount = logFile.Warnings.Count(), ErrorCount = logFile.Errors.Count() }; OnStatisticsCollected?.Invoke(this, statistics); }
public void LoadSection(FileFormats.DRM.Section section) { var texture = new FileFormats.PCD9File(); texture.Deserialize(section.Data); this.hintLabel.Text = string.Format( "{0} : {1}x{2}", texture.Format, texture.Width, texture.Height); //this.Text += ": " + entry.Description; this.Texture = texture; this.UpdatePreview(true); }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); WalkFrames = art.ReadInt("WalkFrames", 12); FiringFrames = art.ReadInt("FiringFrames"); StandingFrames = art.ReadInt("StandingFrames"); DeathFrames = art.ReadInt("DeathFrames"); DeathFrameRate = art.ReadInt("DeathFrameRate", 1); Facings = art.ReadInt("Facings", 8); StartStandFrame = art.ReadInt("StartStandFrame", -1); StartWalkFrame = art.ReadInt("StartWalkFrame", -1); StartFiringFrame = art.ReadInt("StartFiringFrame", -1); StartDeathFrame = art.ReadInt("StartDeathFrame", -1); MaxDeathCounter = art.ReadInt("MaxDeathCounter", -1); FiringSyncFrameX = art.ReadInt("FiringSyncFrameX", -1); }
public void LoadSection(FileFormats.DRM.Section section) { var texture = new FileFormats.PCD9File(); texture.Deserialize(section.Data); this.hintLabel.Text = string.Format( "{0} : {1}x{2} | Filesize: {3} Bytes", texture.Format, texture.Width, texture.Height, section.Data.Length); this.Text += string.Format(": {0:X8}", section.Id); this.Texture = texture; this.Section = section; this.UpdatePreview(true); }
public void Serialize(FileFormats.Unreal.ISerializer stream) { if (stream.Mode == FileFormats.Unreal.SerializeMode.Reading) { uint a = 0, b = 0, c = 0, d = 0; stream.Serialize(ref a); stream.Serialize(ref b); stream.Serialize(ref c); stream.Serialize(ref d); this.Hash = new FileHash(a, b, c, d); } else { throw new NotSupportedException(); } stream.Serialize(ref this.Instances); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); Land = rules.ReadEnum("Land", LandType.Clear); Strength = rules.ReadInt("Strength", 1); Wall = rules.ReadBool("Wall"); Tiberium = rules.ReadBool("Tiberium"); Crate = rules.ReadBool("Crate"); CrateTrigger = rules.ReadBool("CrateTrigger"); Explodes = rules.ReadBool("Explodes"); Overrides = rules.ReadBool("Overrides"); CellAnim = Get<Animation>(rules.ReadString("CellAnim")); DamageLevels = rules.ReadInt("DamageLevels", 1); RadarColor = rules.ReadColor("RadarColor"); NoUseLandTileType = rules.ReadBool("NoUseLandTileType", true); IsVeinholeMonster = rules.ReadBool("IsVeinholeMonster"); IsVeins = rules.ReadBool("IsVeins"); ChainReaction = rules.ReadBool("ChainReaction"); DrawFlat = rules.ReadBool("DrawFlat", true); IsARock = rules.ReadBool("IsARock"); IsRubble = rules.ReadBool("IsRubble"); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); DeployToFire = rules.ReadBool("DeployToFire"); IsSimpleDeployer = rules.ReadBool("IsSimpleDeployer"); Harvester = rules.ReadBool("Harvester"); Weeder = rules.ReadBool("Weeder"); SpeedType = rules.ReadEnum("SpeedType", SpeedType.Clear); IsTilter = rules.ReadBool("IsTilter"); CarriesCrate = rules.ReadBool("CarriesCrate"); TooBigToFitUnderBridge = rules.ReadBool("TooBigToFitUnderBridge"); HalfDamageSmokeLocation = rules.ReadXYZ("HalfDamageSmokeLocation"); UseTurretShadow = rules.ReadBool("UseTurretShadow"); Passive = rules.ReadBool("Passive"); MovementRestrictedTo = rules.ReadEnum("MovementRestrictedTo", LandType.Clear); CanBeach = rules.ReadBool("CanBeach"); SmallVisceroid = rules.ReadBool("SmallVisceroid"); LargeVisceroid = rules.ReadBool("LargeVisceroid"); NonVehicle = rules.ReadBool("NonVehicle"); BurstDelayX = rules.ReadInt("BurstDelayX", -1); AltImage = rules.ReadString("AltImage"); CrateGoodie = rules.ReadBool("CrateGoodie"); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); Image = rules.ReadString("Image"); AlphaImage = rules.ReadString("AlphaImage"); CrushSound = rules.ReadString("CrushSound"); AmbientSound = rules.ReadString("AmbientSound"); Crushable = rules.ReadBool("Crushable"); Bombable = rules.ReadBool("Bombable"); NoSpawnAlt = rules.ReadBool("NoSpawnAlt"); AlternateArcticArt = rules.ReadBool("AlternateArcticArt"); RadarInvisible = rules.ReadBool("RadarInvisible"); Selectable = rules.ReadBool("Selectable"); LegalTarget = rules.ReadBool("LegalTarget"); Armor = rules.ReadString("Armor"); Strength = rules.ReadInt("Strength"); Immune = rules.ReadBool("Immune"); Insignificant = rules.ReadBool("Insignificant"); HasRadialIndicator = rules.ReadBool("HasRadialIndicator"); RadialColor = rules.ReadColor("RadialColor"); IgnoresFirestorm = rules.ReadBool("IgnoresFirestorm"); }
public override bool ReadFromINI(FileFormats.Text.INI iniFile) { if (!base.ReadFromINI(iniFile)) { return false; } iniFile.GetInteger(ID, "DamageLevels", ref DamageLevels); iniFile.GetBool(ID, "Wall", ref Wall); iniFile.GetBool(ID, "Tiberium", ref Tiberium); iniFile.GetBool(ID, "Crate", ref Crate); iniFile.GetBool(ID, "CrateTrigger", ref CrateTrigger); iniFile.GetBool(ID, "NoUseLandTileType", ref NoUseTileLandType); iniFile.GetBool(ID, "IsVeinholeMonster", ref IsVeinholeMonster); iniFile.GetBool(ID, "IsVeins", ref IsVeins); iniFile.GetBool(ID, "Explodes", ref Explodes); iniFile.GetBool(ID, "ChainReaction", ref ChainReaction); iniFile.GetBool(ID, "Overrides", ref Overrides); iniFile.GetBool(ID, "DrawFlat", ref DrawFlat); iniFile.GetBool(ID, "IsRubble", ref IsRubble); iniFile.GetBool(ID, "IsARock", ref IsARock); return true; }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); }
private static DefinedSymbol ConvertPublicNameDefinition( FileFormats.Omf.PublicNameDefinition def, Dictionary<object, object> objectMap) { DefinedSymbol symbol = new DefinedSymbol(); if (def.BaseGroup != null) symbol.BaseGroup = (SegmentGroup)objectMap[def.BaseGroup]; if (def.BaseSegment != null) symbol.BaseSegment = (LogicalSegment)objectMap[def.BaseSegment]; symbol.BaseFrame = def.BaseFrame; symbol.Name = def.Name; symbol.TypeIndex = def.TypeIndex; symbol.Offset = (uint)def.Offset; if (def.IsLocal) symbol.Scope = SymbolScope.Private; else symbol.Scope = SymbolScope.Public; return symbol; }
/// <summary> /// Returns null if LibraryEnd record is encountered before /// MODEND or MODEND32 record is encountered. /// </summary> /// <param name="reader"></param> /// <returns></returns> private static ObjectModule LoadObject(FileFormats.Omf.Records.RecordContext context) { ObjectModule module = new ObjectModule(); Dictionary<object, object> objectMap = new Dictionary<object, object>(); // Convert meta-data. module.Name = context.ObjectName; module.SourceName = context.SourceName; // Convert segments. foreach (SegmentDefinition def in context.Segments) { LogicalSegment segment = ConvertSegmentDefinition(def, objectMap, module); objectMap[def] = segment; module.Segments.Add(segment); } // Convert segment groups. foreach (GroupDefinition def in context.Groups) { SegmentGroup group = ConvertGroupDefinition(def, objectMap); module.Groups.Add(group); objectMap[def] = group; } // Convert external names. foreach (ExternalNameDefinition def in context.ExternalNames) { ExternalSymbol symbol = new ExternalSymbol { Name = def.Name, TypeIndex = def.TypeIndex, }; module.ExternalNames.Add(symbol); objectMap[def] = symbol; } // Convert aliases. foreach (AliasDefinition def in context.Aliases) { module.Aliases.Add(new SymbolAlias { AliasName = def.AliasName, SubstituteName = def.SubstituteName }); } // Convert public names. foreach (PublicNameDefinition def in context.PublicNames) { module.DefinedNames.Add(ConvertPublicNameDefinition(def, objectMap)); } // Convert fixups. foreach (SegmentDefinition def in context.Segments) { LogicalSegment segment = (LogicalSegment)objectMap[def]; foreach (FixupDefinition f in def.Fixups) { segment.Fixups.Add(ConvertFixupDefinition(f, objectMap)); } } return module; }
/// <summary> /// Reads a Run Length Encoded stream, where only transparent bytes are RLE, and builds a <see cref="System.Drawing.Bitmap"/> /// </summary> /// <param name="stream">A stream with its <see cref="Stream.Position"/> set to the first byte of the header, which is two int16 values for width and height.</param> private Bitmap DecodeRleStream(Stream stream, FileFormats form) { //~600ms on large images in i_menu.res Stopwatch sw = new Stopwatch(); sw.Start(); byte[] frame_size_bytes; int width, //width in pixels, as read from the stream height, //height in pixels, as read from the stream calcSize; //number of pixels: height * width if (form == FileFormats.SpriteSpr) { frame_size_bytes = new byte[8]; stream.Read(frame_size_bytes, 0, 8); width = BitConverter.ToUInt16(frame_size_bytes, 4); height = BitConverter.ToUInt16(frame_size_bytes, 6); calcSize = height * width; } else if (form == FileFormats.ResIdxFramesSpr) { frame_size_bytes = new byte[4]; stream.Read(frame_size_bytes, 0, 4); width = BitConverter.ToUInt16(frame_size_bytes, 0); height = BitConverter.ToUInt16(frame_size_bytes, 2); calcSize = height * width; } else return null; //The max values here are arbitrary numbers that seem like reasonable cutoffs for 7KAA's purposes. //The purpose is to ensure this function is the only one that bothers to attempt to read the //stream's header. The game runs at 640x480 so there are no high-res images with a height //and width so large. The size is larger to allow for the few huge sprites with tons of frames. //Any file failing these tests are assumed to not be FileFormat.SpriteSpr. if (calcSize < 1 || calcSize > MaxByteSize || width > MaxPixelWidth || height > MaxPixelHeight) return null; byte[] resBmpData = new byte[calcSize]; //initialize it to an unused transparent-pixel-marker resBmpData = Enumerable.Repeat<byte>(0xff, calcSize).ToArray(); int pixelsToSkip = 0; int bytesRead = 8; //start after the header info byte pixel; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { if (pixelsToSkip != 0) //only if we found transparent bits on the last iteration and haven't parsed them all yet { if (pixelsToSkip >= width - x) //greater than one line { pixelsToSkip -= (width - x); // skip to next line break; } x += pixelsToSkip; //skip reading the indicated amount of bytes for transparent pictures pixelsToSkip = 0; } if (stream.Position + 1 > stream.Length) return null; pixel = (byte)stream.ReadByte(); bytesRead++; if (pixel < 0xf8) //normal pixel { resBmpData[width * y + x] = pixel; } else if (pixel == 0xf8) { if (stream.Position + 1 > stream.Length) return null; pixel = (byte)stream.ReadByte(); pixelsToSkip = (byte)pixel - 1; bytesRead++; } else //f9,fa,fb,fc,fd,fe,ff { pixelsToSkip = 255 - pixel; // skip this many pixels since they're pre-initialized to transparent } }//end inner for }//end outer for sw.Stop(); return GetBitmapFromRleBytes(resBmpData, this.Bitmap.Palette, height, width); }
public void Serialize(FileFormats.Unreal.ISerializer stream) { stream.Serialize(ref this.Strings); stream.Serialize(ref this.Resources); }
public void Serialize(FileFormats.Unreal.ISerializer stream) { stream.Serialize(ref this.PathIndex); stream.Serialize(ref this.NameIndex); stream.Serialize(ref this.ActorIndex); stream.Serialize(ref this.GroupIndex); stream.Serialize(ref this.LocaleIndex); stream.Serialize(ref this.FileIndex); stream.Serialize(ref this.IsPackage); stream.Serialize(ref this.Offset); stream.Serialize(ref this.Size); }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); Foundation = art.ReadSize("Foundation", new Size(1, 1)); }
public Bitmap SetBitmapFromRleStream(Stream str, FileFormats form) { this.Bitmap = DecodeRleStream(str, form); return this.Bitmap; }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); LandTargeting = rules.ReadInt("LandTargeting"); NavalTargeting = rules.ReadInt("NavalTargeting"); SpeedType = rules.ReadEnum<SpeedType>("SpeedType", SpeedType.Clear); TypeImmune = rules.ReadBool("TypeImmune"); WalkRate = rules.ReadFloat("WalkRate", 1); MoveRate = rules.ReadFloat("MoveRate"); MoveToShroud = rules.ReadBool("MoveToShroud", true); IsTrain = rules.ReadBool("IsTrain"); DoubleOwned = rules.ReadBool("DoubleOwned"); GuardRange = (int)rules.ReadFloat("GuardRange"); Explodes = rules.ReadBool("Explodes"); DeathWeapon = TypesRepository.GetWeaponType(rules.ReadString("DeathWeapon")); DeathWeaponDamageModifier = rules.ReadFloat("DeathWeaponDamageModifier", 1); FlightLevel = rules.ReadInt("FlightLevel", -1); IsDropship = rules.ReadBool("IsDropship"); PitchAngle = rules.ReadFloat("PitchAngle", 0.349066f); RollAngle = rules.ReadFloat("RollAngle", 0.523599f); PitchSpeed = rules.ReadFloat("PitchSpeed", 0.25f); Locomotor = Guid.Parse(rules.ReadString("Locomotor", "{4A582747-9839-11d1-B709-00A024DDAFD1}")); CloakingSpeed = rules.ReadInt("CloakingSpeed", 7); ThreatAvoidanceCoefficient = rules.ReadFloat("ThreatAvoidanceCoefficient"); SlowdownDistance = rules.ReadInt("SlowdownDistance", 500); DeaccelerationFactor = rules.ReadFloat("DeaccelerationFactor", 0.002f); AccelerationFactor = rules.ReadFloat("AccelerationFactor", 0.03f); Weight = rules.ReadFloat("Weight", 1); PhysicalSize = rules.ReadFloat("PhysicalSize", 2); Size = rules.ReadFloat("Size", 1); SizeLimit = rules.ReadFloat("SizeLimit"); HoverAttack = rules.ReadBool("HoverAttack"); VHPScan = rules.ReadEnum<VHPScan>("VHPScan", VHPScan.None); MaxDebris = rules.ReadInt("MaxDebris"); MinDebris = rules.ReadInt("MinDebris"); DebrisTypes = GetList<VoxelAnimation>(rules.ReadList("DebrisTypes")); DebrisMaximums = rules.ReadList("DebrisMaximums").Select(int.Parse).ToList(); DebrisAnims = GetList<VoxelAnimation>(rules.ReadList("DebrisAnims")); HasTurretTooltips = rules.ReadBool("HasTurretTooltips"); TurretCount = rules.ReadInt("TurretCount"); WeaponCount = rules.ReadInt("WeaponCount"); IsChargeTurret = rules.ReadBool("IsChargeTurret"); ClearAllWeapons = rules.ReadBool("ClearAllWeapons"); Primary = TypesRepository.GetWeaponType(rules.ReadString("Primary")); Secondary = TypesRepository.GetWeaponType(rules.ReadString("Secondary")); ElitePrimary = TypesRepository.GetWeaponType(rules.ReadString("ElitePrimary")); EliteSecondary = TypesRepository.GetWeaponType(rules.ReadString("EliteSecondary")); WeaponX = TypesRepository.GetWeaponType(rules.ReadString("WeaponX")); EliteWeaponX = TypesRepository.GetWeaponType(rules.ReadString("EliteWeaponX")); VoiceMove = GetList<Sound>(rules.ReadList("VoiceMove")); VoiceSelect =GetList<Sound>( rules.ReadList("VoiceSelect")); VoiceSelectEnslaved = GetList<Sound>( rules.ReadList("VoiceSelectEnslaved")); VoiceSelectDeactivated = GetList<Sound>( rules.ReadList("VoiceSelectDeactivated")); VoiceAttack = GetList<Sound>( rules.ReadList("VoiceAttack")); VoiceSpecialAttack = GetList<Sound>( rules.ReadList("VoiceSpecialAttack")); VoiceDie = GetList<Sound>( rules.ReadList("VoiceDie")); VoiceFeedback = GetList<Sound>( rules.ReadList("VoiceFeedback")); AuxSound1 = TypesRepository.GetSound(rules.ReadString("AuxSound1")); AuxSound2 = TypesRepository.GetSound(rules.ReadString("AuxSound2")); CreateSound = TypesRepository.GetSound(rules.ReadString("CreateSound")); DamageSound = TypesRepository.GetSound(rules.ReadString("DamageSound")); ImpactWaterSound = TypesRepository.GetSound(rules.ReadString("ImpactWaterSound")); ImpactLandSound = TypesRepository.GetSound(rules.ReadString("ImpactLandSound")); CrashingSound = TypesRepository.GetSound(rules.ReadString("CrashingSound")); SinkingSound = TypesRepository.GetSound(rules.ReadString("SinkingSound")); VoiceFalling = TypesRepository.GetSound(rules.ReadString("VoiceFalling")); VoiceCrashing = TypesRepository.GetSound(rules.ReadString("VoiceCrashing")); VoiceSinking = TypesRepository.GetSound(rules.ReadString("VoiceSinking")); VoiceEnter = TypesRepository.GetSound(rules.ReadString("VoiceEnter")); VoiceCapture = TypesRepository.GetSound(rules.ReadString("VoiceCapture")); CloakStop = rules.ReadBool("CloakStop"); Storage = rules.ReadInt("Storage"); BuildLimit = rules.ReadInt("BuildLimit", 2147483647); Category = rules.ReadEnum<Category>("Category", Category.None); Dock = GetList<BuildingType>(rules.ReadList("Dock")); DeploysInto = Get<BuildingType>("DeploysInto"); UndeploysInto = Get<VehicleType>("UndeploysInto"); PowersUnit = Get<VehicleType>(rules.ReadString("PowersUnit")); PoweredUnit = rules.ReadBool("PoweredUnit"); LightningRod = rules.ReadBool("LightningRod"); ManualReload = rules.ReadBool("ManualReload"); TurretSpins = rules.ReadBool("TurretSpins"); TiltCrashJumpjet = rules.ReadBool("TiltCrashJumpjet"); Turret = rules.ReadBool("Turret"); TurretRotateSound = TypesRepository.GetSound(rules.ReadString("TurretRotateSound")); EnterTransportSound = TypesRepository.GetSound(rules.ReadString("EnterTransportSound")); LeaveTransportSound = TypesRepository.GetSound(rules.ReadString("LeaveTransportSound")); MoveSound = GetList<Sound>(rules.ReadList("MoveSound")); DieSound = GetList<Sound>(rules.ReadList("DieSound")); DeploySound = TypesRepository.GetSound(rules.ReadString("DeploySound")); UndeploySound = TypesRepository.GetSound(rules.ReadString("UndeploySound")); ChronoInSound = TypesRepository.GetSound(rules.ReadString("ChronoInSound")); ChronoOutSound = TypesRepository.GetSound(rules.ReadString("ChronoOutSound")); VoiceHarvest = TypesRepository.GetSound(rules.ReadString("VoiceHarvest")); VoicePrimaryWeaponAttack = TypesRepository.GetSound(rules.ReadString("VoicePrimaryWeaponAttack")); VoicePrimaryEliteWeaponAttack = TypesRepository.GetSound(rules.ReadString("VoicePrimaryEliteWeaponAttack")); VoiceSecondaryWeaponAttack = TypesRepository.GetSound(rules.ReadString("VoiceSecondaryWeaponAttack")); VoiceSecondaryEliteWeaponAttack = TypesRepository.GetSound(rules.ReadString("VoiceSecondaryEliteWeaponAttack")); VoiceDeploy = TypesRepository.GetSound(rules.ReadString("VoiceDeploy")); VoiceUndeploy = TypesRepository.GetSound(rules.ReadString("VoiceUndeploy")); EnterGrinderSound = TypesRepository.GetSound(rules.ReadString("EnterGrinderSound")); LeaveGrinderSound = TypesRepository.GetSound(rules.ReadString("LeaveGrinderSound")); EnterBioReactorSound = TypesRepository.GetSound(rules.ReadString("EnterBioReactorSound")); LeaveBioReactorSound = TypesRepository.GetSound(rules.ReadString("LeaveBioReactorSound")); ActivateSound = TypesRepository.GetSound(rules.ReadString("ActivateSound")); DeactivateSound = TypesRepository.GetSound(rules.ReadString("DeactivateSound")); MindClearedSound = TypesRepository.GetSound(rules.ReadString("MindClearedSound")); Explosion = GetList<Animation>(rules.ReadList("Explosion")); DestroyAnim = GetList<Animation>(rules.ReadList("DestroyAnim")); NaturalParticleSystem = Get<ParticleSystem>(rules.ReadString("NaturalParticleSystem")); RefinerySmokeParticleSystem = Get<ParticleSystem>(rules.ReadString("RefinerySmokeParticleSystem")); NaturalParticleLocation = rules.ReadXYZ("NaturalPrules.cleLocation"); DamageParticleSystems = GetList<ParticleSystem>(rules.ReadList("DamageParticleSystems")); DestroyParticleSystems = GetList<ParticleSystem>(rules.ReadList("DestroyParticleSystems")); DamageSmokeOffset = rules.ReadXYZ("DamageSmokeOffset"); DamSmkOffScrnRel = rules.ReadBool("DamSmkOffScrnRel"); DestroySmokeOffset = rules.ReadXYZ("DestroySmokeOffset"); RefinerySmokeOffsetOne = rules.ReadXYZ("RefinerySmokeOffsetOne"); RefinerySmokeOffsetTwo = rules.ReadXYZ("RefinerySmokeOffsetTwo"); RefinerySmokeOffsetThree = rules.ReadXYZ("RefinerySmokeOffsetThree"); RefinerySmokeOffsetFour = rules.ReadXYZ("RefinerySmokeOffsetFour"); Nominal = rules.ReadBool("Nominal"); DontScore = rules.ReadBool("DontScore"); DamageSelf = rules.ReadBool("DamageSelf"); Cloakable = rules.ReadBool("Cloakable"); GapGenerator = rules.ReadBool("GapGenerator"); GapRadiusInCells = rules.ReadInt("GapRadiusInCells"); SuperGapRadiusInCells = rules.ReadInt("SuperGapRadiusInCells"); Teleporter = rules.ReadBool("Teleporter"); Sensors = rules.ReadBool("Sensors"); IsGattling = rules.ReadBool("IsGattling"); WeaponStages = rules.ReadInt("WeaponStages"); RateUp = rules.ReadInt("RateUp"); RateDown = rules.ReadInt("RateDown"); StageX = rules.ReadInt("StageX"); EliteStageX = rules.ReadInt("EliteStageX"); PipScale = rules.ReadEnum("PipScale", PipScale.none); PipsDrawForAll = rules.ReadBool("PipsDrawForAll"); LeptonMindControlOffset = rules.ReadInt("LeptonMindControlOffset", 70); PixelSelectionBracketDelta = rules.ReadBool("PixelSelectionBracketDelta"); PipWrap = rules.ReadInt("PipWrap"); Prerequisite = GetList<Prerequisite>(rules.ReadList("Prerequisite")); PrerequisiteOverride = GetList<Prerequisite>(rules.ReadList("PrerequisiteOverride")); Sight = rules.ReadInt("Sight"); ReselectIfLimboed = rules.ReadBool("ReselectIfLimboed"); RejoinTeamIfLimboed = rules.ReadBool("RejoinTeamIfLimboed"); SensorsSight = rules.ReadInt("SensorsSight"); DetectDisguiseRange = rules.ReadInt("DetectDisguiseRange"); BombSight = rules.ReadInt("BombSight"); LeadershipRating = rules.ReadInt("LeadershipRating", 5); MindControlRingOffset = rules.ReadInt("MindControlRingOffset", 140); BuildTimeMultiplier = rules.ReadFloat("BuildTimeMultiplier", 1); RevealToAll = rules.ReadBool("RevealToAll"); Drainable = rules.ReadBool("Drainable"); OpenTopped = rules.ReadBool("OpenTopped"); ResourceGatherer = rules.ReadBool("ResourceGatherer"); ResourceDestination = rules.ReadBool("ResourceDestination"); CanDisguise = rules.ReadBool("CanDisguise"); PermaDisguise = rules.ReadBool("PermaDisguise"); DetectDisguise = rules.ReadBool("DetectDisguise"); DisguiseWhenStill = rules.ReadBool("DisguiseWhenStill"); CanPassiveAquire = rules.ReadBool("CanPassiveAquire", true); CanRetaliate = rules.ReadBool("CanRetaliate", true); CanApproachTarget = rules.ReadBool("CanApproachTarget", true); CanRecalcApproachTarget = rules.ReadBool("CanRecalcApproachTarget", true); RequiresStolenThirdTech = rules.ReadBool("RequiresStolenThirdTech"); RequiresStolenSovietTech = rules.ReadBool("RequiresStolenSovietTech"); RequiresStolenAlliedTech = rules.ReadBool("RequiresStolenAlliedTech"); RequiredHouses = GetList<House>(rules.ReadList("RequiredHouses")); SecretHouses = GetList<House>(rules.ReadList("SecretHouses")); ForbiddenHouses = GetList<House>(rules.ReadList("ForbiddenHouses")); TechLevel = rules.ReadInt("TechLevel", 255); AirstrikeTeam = rules.ReadInt("AirstrikeTeam"); EliteAirstrikeTeam = rules.ReadInt("EliteAirstrikeTeam"); AirstrikeTeamType = Get<AircraftType>(rules.ReadString("AirstrikeTeamType")); EliteAirstrikeTeamType = Get<AircraftType>(rules.ReadString("EliteAirstrikeTeamType")); AirstrikeRechargeTime = rules.ReadInt("AirstrikeRechargeTime"); EliteAirstrikeRechargeTime = rules.ReadInt("EliteAirstrikeRechargeTime"); Speed = rules.ReadInt("Speed"); Cost = rules.ReadInt("Cost"); Soylent = rules.ReadInt("Soylent"); UnloadingClass = Get<VehicleType>(rules.ReadString("UnloadingClass")); DeployingAnim = Get<Animation>(rules.ReadString("DeployingAnim")); InitialAmmo = rules.ReadInt("InitialAmmo", -1); Ammo = rules.ReadInt("Ammo", -1); IFVMode = rules.ReadInt("IFVMode"); AirRangeBonus = rules.ReadFloat("AirRangeBonus"); RadialFireSegments = rules.ReadInt("RadialFireSegments"); DeployFireWeapon = rules.ReadInt("DeployFireWeapon", 1); DeployFire = rules.ReadBool("DeployFire"); DeployToLand = rules.ReadBool("DeployToLand"); MobileFire = rules.ReadBool("MobileFire", true); OpportunityFire = rules.ReadBool("OpportunityFire"); DistributedFire = rules.ReadBool("DistributedFire"); Reload = rules.ReadInt("Reload"); EmptyReload = rules.ReadInt("EmptyReload", -1); ReloadIncrement = rules.ReadInt("ReloadIncrement"); DamageReducesReadiness = rules.ReadBool("DamageReducesReadiness"); ReadinessReductionMultiplier = rules.ReadFloat("ReadinessReductionMultiplier"); BerserkFriendly = rules.ReadBool("BerserkFriendly"); SprayAttack = rules.ReadBool("SprayAttack"); Pushy = rules.ReadBool("Pushy"); Natural = rules.ReadBool("Natural"); Unnatural = rules.ReadBool("Unnatural"); CloseRange = rules.ReadBool("CloseRange"); PreventAttackMove = rules.ReadBool("PreventAttackMove"); Points = rules.ReadInt("Points"); ThreatPosed = rules.ReadInt("ThreatPosed"); Owner = GetList<House>(rules.ReadList("Owner")); AIBasePlanningSide = rules.ReadInt("AIBasePlanningSide", -1); Trainable = rules.ReadBool("Trainable", true); Crewed = rules.ReadBool("Crewed"); Gunner = rules.ReadBool("Gunner"); Naval = rules.ReadBool("Naval"); Repairable = rules.ReadBool("Repairable", true); Invisible = rules.ReadBool("Invisible"); RadarVisible = rules.ReadBool("RadarVisible"); SelfHealing = rules.ReadBool("SelfHealing"); NoAutoFire = rules.ReadBool("NoAutoFire"); ROT = rules.ReadInt("ROT"); Passengers = rules.ReadInt("Passengers"); FireAngle = rules.ReadInt("FireAngle", 8); DeployTime = rules.ReadFloat("DeployTime"); UndeployDelay = rules.ReadInt("UndeployDelay", -1); Disableable = rules.ReadBool("Disableable", true); ToProtect = rules.ReadBool("ToProtect"); TiberiumHeal = rules.ReadBool("TiberiumHeal"); ImmuneToVeins = rules.ReadBool("ImmuneToVeins"); AllowedToStartInMultiplayer = rules.ReadBool("AllowedToStrules.nMultiplayer", true); StupidHunt = rules.ReadBool("StupidHunt"); TargetLaser = rules.ReadBool("TargetLaser"); HunterSeeker = rules.ReadBool("HunterSeeker"); Crusher = rules.ReadBool("Crusher"); OmniCrusher = rules.ReadBool("OmniCrusher"); OmniCrushResistant = rules.ReadBool("OmniCrushResistant"); AutoCrush = rules.ReadBool("AutoCrush"); ImmuneToRadiation = rules.ReadBool("ImmuneToRadiation"); Underwater = rules.ReadBool("Underwater"); BalloonHover = rules.ReadBool("BalloonHover"); Slaved = rules.ReadBool("Slaved"); Enslaves = TypesRepository.GetInfantryType(rules.ReadString("Enslaves")); SlaveRegenRate = rules.ReadInt("SlaveRegenRate"); SlavesNumber = rules.ReadInt("SlavesNumber"); SlaveReloadRate = rules.ReadInt("SlaveReloadRate"); OpenTransportWeapon = rules.ReadInt("OpenTransportWeapon", -1); Spawned = rules.ReadInt("Spawned"); Spawns = TypesRepository.GetAircraftType(rules.ReadString("Spawns")); SpawnRegenRate = rules.ReadInt("SpawnRegenRate"); SpawnsNumber = rules.ReadInt("SpawnsNumber"); SpawnReloadRate = rules.ReadInt("SpawnReloadRate"); MissileSpawn = rules.ReadBool("MissileSpawn"); DefaultToGuardArea = rules.ReadBool("DefaultToGuardArea"); Warpable = rules.ReadBool("Warpable", true); Parasiteable = rules.ReadBool("Parasiteable"); ImmuneToPsionics = rules.ReadBool("ImmuneToPsionics"); ImmuneToPsionicWeapons = rules.ReadBool("ImmuneToPsionicWeapons"); ConsideredAircraft = rules.ReadBool("ConsideredAircraft"); Bunkerable = rules.ReadBool("Bunkerable"); Organic = rules.ReadBool("Organic"); ImmuneToPoison = rules.ReadBool("ImmuneToPoison"); SuppressionThreshold = rules.ReadFloat("SuppressionThreshold"); NoShadow = rules.ReadBool("NoShadow"); JumpjetTurnRate = rules.ReadInt("JumpjetTurnRate", 4); JumpjetSpeed = rules.ReadFloat("JumpjetSpeed", 14); JumpjetClimb = rules.ReadFloat("JumpjetClimb", 5); JumpjetCrash = rules.ReadFloat("JumpjetCrash", 5); JumpjetHeight = rules.ReadInt("JumpjetHeight", 500); JumpjetAccel = rules.ReadFloat("JumpjetAccel", 2); JumpjetWobbles = rules.ReadFloat("JumpjetWobbles", 0.15f); JumpjetNoWobbles = rules.ReadBool("JumpjetNoWobbles"); JumpjetDeviation = rules.ReadInt("JumpjetDeviation", 40); JumpJet = rules.ReadBool("JumpJet"); Crashable = rules.ReadBool("Crashable"); AttackFriendlies = rules.ReadBool("AttackFriendlies"); AttackCursorOnFriendlies = rules.ReadBool("AttackCursorOnFriendlies"); TurretRecoil = rules.ReadBool("TurretRecoil"); TurretTravel = rules.ReadInt("TurretTravel", 2); TurretCompressFrames = rules.ReadInt("TurretCompressFrames", 1); TurretHoldFrames = rules.ReadInt("TurretHoldFrames", 1); TurretRecoverFrames = rules.ReadInt("TurretRecoverFrames", 1); BarrelTravel = rules.ReadInt("BarrelTravel", 2); BarrelCompressFrames = rules.ReadInt("BarrelCompressFrames", 1); BarrelHoldFrames = rules.ReadInt("BarrelHoldFrames", 1); BarrelRecoverFrames = rules.ReadInt("BarrelRecoverFrames", 1); TiltsWhenCrushes = rules.ReadBool("TiltsWhenCrushes", true); Accelerates = rules.ReadBool("Accelerates", true); ZFudgeCliff = rules.ReadInt("ZFudgeCliff", 10); ZFudgeColumn = rules.ReadInt("ZFudgeColumn", 5); ZFudgeTunnel = rules.ReadInt("ZFudgeTunnel", 10); ZFudgeBridge = rules.ReadInt("ZFudgeBridge"); VeteranAbilities = ReadFlags<Abilities>(rules.ReadList("VeteranAbilities")); EliteAbilities = ReadFlags<Abilities>(rules.ReadList("EliteAbilities")); MyEffectivenessCoefficient = rules.ReadFloat("MyEffectivenessCoefficient"); TargetEffectivenessCoefficient = rules.ReadFloat("TargetEffectivenessCoefficient"); TargetSpecialThreatCoefficient = rules.ReadFloat("TargetSpecialThreatCoefficient"); TargetStrengthCoefficient = rules.ReadFloat("TargetStrengthCoefficient"); TargetDistanceCoefficient = rules.ReadFloat("TargetDistanceCoefficient"); SpecialThreatValue = rules.ReadFloat("SpecialThreatValue"); IsSelectableCombatant = rules.ReadBool("IsSelectableCombatant"); MovementZone = rules.ReadEnum<MovementZone>("MovementZone", MovementZone.Normal); }
public override void LoadArt(FileFormats.IniFile.IniSection art) { base.LoadArt(art); CanBeHidden = art.ReadBool("CanBeHidden", true); UseBuffer = art.ReadBool("UseBuffer"); Palette = art.ReadString("Palette"); TurretOffset = art.ReadXYZ("TurretOffset"); RotCount = art.ReadInt("RotCount"); Remapable = art.ReadBool("Remapable"); Normalized = art.ReadBool("Normalized"); VisibleLoad = art.ReadBool("VisibleLoad"); ShadowIndex = art.ReadInt("ShadowIndex"); DisableVoxelCache = art.ReadBool("DisableVoxelCache"); DisableShadowCache = art.ReadBool("DisableShadowCache"); Cameo = art.ReadString("Cameo"); AltCameo = art.ReadString("AltCameo"); WeaponXFLH = art.ReadXYZ("WeaponXFLH"); WeaponXBarrelLength = art.ReadInt("WeaponXBarrelLength"); WeaponXBarrelThickness = art.ReadInt("WeaponXBarrelThickness"); WeaponXTurretLocked = art.ReadBool("WeaponXTurretLocked"); EliteWeaponXFLH = art.ReadXYZ("EliteWeaponXFLH"); EliteWeaponXBarrelLength = art.ReadInt("EliteWeaponXBarrelLength"); EliteWeaponXBarrelThickness = art.ReadInt("EliteWeaponXBarrelThickness"); EliteWeaponXTurretLocked = art.ReadBool("EliteWeaponXTurretLocked"); PrimaryFireFLH = art.ReadXYZ("PrimaryFireFLH"); PBarrelLength = art.ReadInt("PBarrelLength"); PBarrelThickness = art.ReadInt("PBarrelThickness"); SecondaryFireFLH = art.ReadXYZ("SecondaryFireFLH"); SBarrelLength = art.ReadInt("SBarrelLength"); SBarrelThickness = art.ReadInt("SBarrelThickness"); ElitePrimaryFireFLH = art.ReadXYZ("ElitePrimaryFireFLH"); ElitePBarrelLength = art.ReadInt("ElitePBarrelLength"); ElitePBarrelThickness = art.ReadInt("ElitePBarrelThickness"); EliteSecondaryFireFLH = art.ReadXYZ("EliteSecondaryFireFLH"); EliteSBarrelLength = art.ReadInt("EliteSBarrelLength"); EliteSBarrelThickness = art.ReadInt("EliteSBarrelThickness"); AlternateFLHX = art.ReadXYZ("AlternateFLHX"); TurretNotExportedOnGround = art.ReadBool("TurretNotExportedOnGround"); SecondSpawnOffset = art.ReadXYZ("SecondSpawnOffset"); }