internal void AddDataFile(DataFile df) { if (!DataFiles.ContainsKey(df.Name)) { DataFiles.Add(df.Name, df); } }
public async void LoadData() { DataFiles.Clear(); await Task.Run(delegate { try { _subjectService.LoadSubjectData(DataFolder, _regionService.GetNodeCount()); // TODO: Get the ROI number from somewhere else?!? var subjects = _subjectService.GetSubjects(); foreach (var subject in subjects) { foreach (var graph in subject.Graphs) { var df = IoC.Get <DataFileViewModel>(); df.Title = graph.Value.DataSource; df.SubjectId = subject.SubjectId; DataFiles.Add(df); } } } catch (Exception) { } }); }
public override void HandlerThunkStr(string whence, string str) { if (Parent.FlushOnNextDataFile) { DataFiles.Clear(); Parent.FlushOnNextDataFile = false; } DataFiles.Add(str); }
/// <summary> /// Adds the given file to the mod install log. /// </summary> /// <remarks> /// Adding a file to a mod's install log indicates that said file was installed /// as part of the mod. /// </remarks> /// <param name="p_strDataPath">The file that was installed for the mod.</param> internal void AddFile(string p_strDataPath) { var strNormalizedPath = NormalizePath(p_strDataPath); if (!ListContains(DataFiles, strNormalizedPath)) { DataFiles.Add(strNormalizedPath); } }
public void AddDataFile(string fileName, string fileColmumn, Variable variable, string value) { //me fijo si ya exite el arcihvo if (!DataFiles.ContainsKey(fileName)) { DataFiles.Add(fileName, new DataFile(fileName)); } DataFiles[fileName].AddColumn(fileColmumn, variable, value); }
/// <summary> /// Called by the 'BuildEngine' method to handle /// anything that needs doing before the engine is built. /// </summary> protected override void PreCreateEngine() { // Register any configured files with the data update service. // Any files that have the 'update on startup' flag set // will be updated now. // Create the auto-update configuration and register it. foreach (var dataFileConfig in DataFileConfigs) { var dataFile = NewAspectEngineDataFile(); dataFile.Identifier = dataFileConfig.Identifier; dataFile.Configuration = dataFileConfig; dataFile.TempDataDirPath = TempDir; if (dataFileConfig.AutomaticUpdatesEnabled || dataFileConfig.UpdateOnStartup || dataFileConfig.FileSystemWatcherEnabled) { if (_dataUpdateService == null) { List <string> features = new List <string>(); if (dataFileConfig.AutomaticUpdatesEnabled) { features.Add("auto update"); } if (dataFileConfig.UpdateOnStartup) { features.Add("update on startup"); } if (dataFileConfig.FileSystemWatcherEnabled) { features.Add("file system watcher"); } throw new PipelineException( $"Some enabled features ({string.Join(",", features)}) " + "require an IDataUpdateService but one has not been supplied. " + "This can be corrected by passing an IDataUpdateService " + "instance to the engine builder constructor. " + "If building from configuration, an IServiceProvider " + "instance, able to resolve an IDataUpdateService, " + "must be passed to the pipeline builder."); } _dataUpdateService.RegisterDataFile(dataFile); } DataFiles.Add(dataFile); } }
public void DataFile_Load(Stream _s) { int num = _s.ReadInteger(); int num2 = _s.ReadInteger(); for (int i = 0; i < num2; i++) { Stream stream = _s; if (num == 800) { stream = _s.ReadStreamC(); } KeyValuePair <string, GMDataFile> keyValuePair = default(KeyValuePair <string, GMDataFile>); GMDataFile value = new GMDataFile(this, stream); keyValuePair = new KeyValuePair <string, GMDataFile>("datafile" + i, value); DataFiles.Add(keyValuePair); } }
public static DataFiles GetFormFiles(IFormFileCollection formFileCollection) { var files = new DataFiles(); for (int i = 0; i < formFileCollection.Count - 1; i++) { var name = "files" + i; var formFile = formFileCollection.GetFile(name); if (formFile == null) { throw new Exception("Mangler fil med navn '" + name + "'."); } var file = new HttpFormFile(formFile); files.Add(file.Filename, file); } return(files); }
public bool LoadDirectory(string directory) { foreach (string file in Directory.EnumerateFiles(directory)) { using (FileStream stream = new FileStream(file, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { BinaryReader reader = new BinaryReader(stream); string signature = Encoding.ASCII.GetString(reader.ReadBytes(8)); stream.Seek(0, SeekOrigin.Begin); if (signature == Mori4Game.ExpectedFileSignature) { /* Derive save language from size of Mori4Game */ if (stream.Length == 0x865C) { SaveDataHandler.SaveLanguage = SaveLanguages.English; } else if (stream.Length == 0x84DC) { SaveDataHandler.SaveLanguage = SaveLanguages.Japanese; } else { throw new Exception("Unexpected size for file of type Mori4Game"); } } switch (signature) { case Mori4Option.ExpectedFileSignature: DataFiles.Add(new Mori4Option(stream)); break; case Mori4Map.ExpectedFileSignature: DataFiles.Add(new Mori4Map(stream)); break; case Mori4Game.ExpectedFileSignature: DataFiles.Add(new Mori4Game(stream)); break; case Mori4GdCard.ExpectedFileSignature: DataFiles.Add(new Mori4GdCard(stream)); break; } } } return(IsDataLoaded); }
protected void readBinaryDataFiles(ArkArchive archive, bool dataFiles = true) { var count = archive.GetInt(); if (dataFiles) { DataFiles.Clear(); for (var n = 0; n < count; n++) { DataFiles.Add(archive.GetString()); } } else { for (var n = 0; n < count; n++) { archive.SkipString(); } } }
private void readBinaryDataFiles(ArkArchive archive, ReadingOptions options) { int count = archive.ReadInt(); DataFiles.Clear(); if (options.DataFiles) { for (int n = 0; n < count; n++) { DataFiles.Add(archive.ReadString()); } } else { archive.HasUnknownData = true; for (int n = 0; n < count; n++) { archive.SkipString(); } } }
public void Init() { Initialized = true; exp_table = new int[254]; for (int i = 1; i < exp_table.Length; ++i) { exp_table[i] = (int)Math.Round(Math.Pow(i, 3) * 133.1); } string[] files; if (!Directory.Exists(Constants.DataFilePath) || (files = Directory.GetFiles(Constants.DataFilePath, "*.edf")).Length != 12) { throw new WorldLoadException("Unable to find data files! Check that the data directory exists and has ALL the edf files copied over"); } for (DataFiles file = (DataFiles)1; file <= (DataFiles)12; ++file) { DataFiles.Add(file, new EDFFile(files[(int)file - 1], file)); } int maj, min, cli, lang, dropProtect; VersionMajor = m_config.GetValue(ConfigStrings.Version, ConfigStrings.Major, out maj) ? (byte)maj : Constants.MajorVersion; VersionMinor = m_config.GetValue(ConfigStrings.Version, ConfigStrings.Minor, out min) ? (byte)min : Constants.MinorVersion; VersionClient = m_config.GetValue(ConfigStrings.Version, ConfigStrings.Client, out cli) ? (byte)cli : Constants.ClientVersion; Language = m_config.GetValue(ConfigStrings.LANGUAGE, ConfigStrings.Language, out lang) ? (EOLanguage)lang : EOLanguage.English; PlayerDropProtectTime = m_config.GetValue(ConfigStrings.Custom, ConfigStrings.PlayerDropProtectTime, out dropProtect) ? dropProtect : Constants.PlayerDropProtectionSeconds; NPCDropProtectTime = m_config.GetValue(ConfigStrings.Custom, ConfigStrings.NPCDropProtectTime, out dropProtect) ? dropProtect : Constants.NPCDropProtectionSeconds; bool filter, strict; CurseFilterEnabled = m_config.GetValue(ConfigStrings.Chat, ConfigStrings.Filter, out filter) && filter; StrictFilterEnabled = m_config.GetValue(ConfigStrings.Chat, ConfigStrings.FilterAll, out strict) && strict; bool shadows, transitions, music, sound, bubbles; ShowShadows = !m_config.GetValue(ConfigStrings.Settings, ConfigStrings.ShowShadows, out shadows) || shadows; ShowTransition = !m_config.GetValue(ConfigStrings.Settings, ConfigStrings.ShowTransition, out transitions) || transitions; MusicEnabled = m_config.GetValue(ConfigStrings.Settings, ConfigStrings.Music, out music) && music; SoundEnabled = m_config.GetValue(ConfigStrings.Settings, ConfigStrings.Sound, out sound) && sound; ShowChatBubbles = !m_config.GetValue(ConfigStrings.Settings, ConfigStrings.ShowBaloons, out bubbles) || bubbles; bool logging, whispers, interaction, logChat; EnableLog = m_config.GetValue(ConfigStrings.Settings, ConfigStrings.EnableLogging, out logging) && logging; HearWhispers = !m_config.GetValue(ConfigStrings.Chat, ConfigStrings.HearWhisper, out whispers) || whispers; Interaction = !m_config.GetValue(ConfigStrings.Chat, ConfigStrings.Interaction, out interaction) || interaction; LogChatToFile = m_config.GetValue(ConfigStrings.Chat, ConfigStrings.LogChat, out logChat) && logChat; //do these last and throw non-fatal exceptions (default will be used) string host; int port; if (!m_config.GetValue(ConfigStrings.Connection, ConfigStrings.Host, out host)) { Host = Constants.Host; throw new ConfigStringLoadException(ConfigStrings.Host); } Host = host; if (!m_config.GetValue(ConfigStrings.Connection, ConfigStrings.Port, out port)) { Port = Constants.Port; throw new ConfigStringLoadException(ConfigStrings.Port); } Port = port; }
/// <summary> /// Called by the 'BuildEngine' method to handle /// anything that needs doing before the engine is built. /// </summary> protected override void PreCreateEngine() { // Register any configured files with the data update service. // Any files that have the 'update on startup' flag set // will be updated now. // Create the auto-update configuration and register it. foreach (var dataFileConfig in DataFileConfigs) { var dataFile = NewAspectEngineDataFile(); dataFile.Identifier = dataFileConfig.Identifier; dataFile.Configuration = dataFileConfig; dataFile.TempDataDirPath = TempDir; if (dataFileConfig.AutomaticUpdatesEnabled || dataFileConfig.UpdateOnStartup || dataFileConfig.FileSystemWatcherEnabled) { // If data update service is null then throw an exception. if (_dataUpdateService == null) { List <string> features = new List <string>(); if (dataFileConfig.AutomaticUpdatesEnabled) { features.Add("auto update"); } if (dataFileConfig.UpdateOnStartup) { features.Add("update on startup"); } if (dataFileConfig.FileSystemWatcherEnabled) { features.Add("file system watcher"); } string msg = string.Format(CultureInfo.InvariantCulture, Messages.ExceptionMissingDataUpdateService, string.Join(", ", features)); throw new PipelineException(msg); } // If license key is required for requesting data updates // but has not been set then throw an exception. if (dataFileConfig.LicenseKeyRequiredForUpdates && (dataFileConfig.AutomaticUpdatesEnabled || dataFileConfig.UpdateOnStartup) && (dataFileConfig.DataUpdateLicenseKeys == null || dataFileConfig.DataUpdateLicenseKeys.Count == 0 || dataFileConfig.DataUpdateLicenseKeys.All(k => string.IsNullOrEmpty(k)))) { List <string> features = new List <string>(); if (dataFileConfig.AutomaticUpdatesEnabled) { features.Add("auto update"); } if (dataFileConfig.UpdateOnStartup) { features.Add("update on startup"); } string msg = string.Format(CultureInfo.InvariantCulture, Messages.ExceptionMissingLicenseKey, string.Join(", ", features)); throw new PipelineConfigurationException(msg); } // Register the data file with the update service. _dataUpdateService.RegisterDataFile(dataFile); } DataFiles.Add(dataFile); } }
/// <summary> /// Loads all of the available Excel and Strings files to a hashtable. /// </summary> /// <returns>Returns true on success.</returns> public bool LoadTableFiles(bool ignorePatchedOut = false) { // want excel files and strings files foreach (PackFileEntry fileEntry in FileEntries.Values.Where(fileEntry => fileEntry.Name.EndsWith(ExcelFile.Extension) || (fileEntry.Name.EndsWith(StringsFile.Extention) && fileEntry.Path.Contains(Language)))) { byte[] fileBytes = GetFileBytes(fileEntry, ignorePatchedOut); if (fileBytes == null) { Debug.WriteLine("Warning: Failed to read file bytes in LoadTableFiles(). FileEntry = " + fileEntry.Name); continue; } //if (fileEntry.Name.Contains("stats")) //{ // int bp = 0; //} // parse file data DataFile dataFile; try { if (fileEntry.Name.EndsWith(ExcelFile.Extension)) { dataFile = new ExcelFile(fileBytes, fileEntry.Path, ClientVersion); } else { dataFile = new StringsFile(fileBytes, fileEntry.Path); } } catch (Exceptions.DataFileStringIdNotFound dataFileStringIdNotFound) { Debug.WriteLine(dataFileStringIdNotFound.ToString()); ExceptionLogger.LogException(dataFileStringIdNotFound); continue; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); ExceptionLogger.LogException(ex); Console.WriteLine(String.Format("Critical Error: Failed to load data file {0} (ClientVersion = {1})", fileEntry.Name, ClientVersion)); continue; } if (!dataFile.HasIntegrity) { String failedParse = "Error: Failed to load data file: " + dataFile.StringId; Debug.WriteLine(failedParse); // Console.WriteLine randomly (more often than not) just doesn't output to the Ouput window in VS during debugging Console.WriteLine(failedParse); continue; } if (dataFile.Attributes.IsEmpty) { continue; } try { DataFiles.Add(dataFile.StringId, dataFile); DataFileDelegators.Add(dataFile.StringId, dataFile.Delegator); // not sure if we need this still... } catch (Exception e) { Debug.WriteLine("Critical Error: Cannot add table data file to dictionary: " + dataFile + "\n" + e); Console.WriteLine("Critical Error: Cannot add table data file to dictionary: " + dataFile + "\n" + e); } } Debug.WriteLine("Loaded {0} {1} data files.", DataFiles.Count, ClientVersion); return(true); }