public async Task <ResourceConfig> GetBrokerConfigAsync(int brokerId, TimeSpan timeout) { var resource = new ConfigResource { Name = brokerId.ToString(), Type = ResourceType.Broker }; var options = new DescribeConfigsOptions { RequestTimeout = timeout }; ICollection <DescribeConfigsResult> results; try { results = await _adminClient.DescribeConfigsAsync(new[] { resource }, options); } catch (KafkaException e) { throw new AdminClientException("Unable to get broker config.", e); } return(Map(results.First())); }
public static void Read(ConfigResource propsFileInfo, SciTEProperties props, bool supressImports) { s_props = props; s_supressImports = supressImports; Read(propsFileInfo, PropertyRead); }
static InternalTopicManagerUtils() { brokerConfigResource = new ConfigResource { Type = ResourceType.Broker }; }
public void Equality() { ConfigResource a = new ConfigResource { Name = "a", Type = ResourceType.Broker }; ConfigResource b = new ConfigResource { Name = "b", Type = ResourceType.Broker }; ConfigResource a1 = new ConfigResource { Name = "a", Type = ResourceType.Group }; ConfigResource a2 = new ConfigResource { Name = "a", Type = ResourceType.Broker }; Assert.NotEqual(a, b); Assert.NotEqual(a, a1); Assert.NotEqual(b, a1); Assert.Equal(a, a2); Assert.True(a == a2); Assert.False(a != a2); Assert.True(a != b); Assert.False(a == b); Assert.True(a.Equals(a2)); Assert.False(a.Equals(b)); }
public ApplicationnOptions() { loadedConfig = LoadConfigResourceOrDefault(); if (loadedConfig == null) { throw new InvalidOperationException("Could not load config"); } }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <param name="propertyType"></param> /// <param name="keyQueue"></param> /// <param name="key"></param> /// <param name="data"></param> /// <returns></returns> protected static bool PropertyRead(ConfigResource resource, PropertyType propertyType, Queue <string> keyQueue, string key, string var) { bool success = false; string filePatternPrefix = "file.patterns."; string languageNameListPrefix = "language.names"; string lang, extList; if (s_props != null) { switch (propertyType) { case PropertyType.Property: success = true; s_props[key] = var; if (key.StartsWith(languageNameListPrefix)) { extList = s_props.Evaluate(var); s_props.AddLanguageNames(var.Split(' ')); } else if (key.StartsWith(filePatternPrefix)) { lang = key.Substring(filePatternPrefix.Length); if (lang.LastIndexOf('.') == -1) { extList = s_props.Evaluate(var); s_props.AddFileExtentionMapping(extList, lang); } } break; case PropertyType.If: if (s_props.ContainsKey(var)) { success = !Convert.ToBoolean(s_props[var]); } break; case PropertyType.Import: if (!s_supressImports) { ConfigResource res = resource.GetLocalConfigResource(string.Format(@"{0}.properties", var)); success = res.Exists; //FileInfo fileToImport = new FileInfo(string.Format(@"{0}\{1}.properties", file.Directory.FullName, var)); //success = fileToImport.Exists; } break; } } return(success); }
private void comboBoxSample_SelectedIndexChanged(object sender, EventArgs e) { string lang = this.comboBoxSample.SelectedItem.ToString(); this.scintillaControlSample.ConfigurationLanguage = lang; ConfigResource resource = new ConfigResource(System.Reflection.Assembly.GetExecutingAssembly(), "Scintilla.Configuration.Samples", lang); if (resource.Exists) { StreamReader reader = new StreamReader(resource.OpenRead()); this.scintillaControlSample.SetText(reader.ReadToEnd()); reader.Close(); } }
private static bool PropertyRead(ConfigResource file, SciTEPropertyType propertyType, Queue <string> keyQueue, string key, string var) { bool success = false; string filePatternPrefix = "file.patterns."; string languageNameListPrefix = "language.names"; string lang, extList; if (s_props != null) { switch (propertyType) { case SciTEPropertyType.Property: success = true; s_props[key] = var; if (key.StartsWith(languageNameListPrefix)) { extList = s_props.Evaluate(var); s_props.AddLanguageNames(var.Split(' ')); } else if (key.StartsWith(filePatternPrefix)) { lang = key.Substring(filePatternPrefix.Length); if (lang.LastIndexOf('.') == -1) { extList = s_props.Evaluate(var); s_props.AddFileExtentionMapping(extList, lang); } } break; case SciTEPropertyType.If: if (s_props.ContainsKey(var)) { success = !Convert.ToBoolean(s_props[var]); } break; case SciTEPropertyType.Import: if (!s_supressImports) { success = file.Exists; } break; } } return(success); }
private void MoreLabel_Click(object sender, MouseButtonEventArgs e) { int index = this.SettingTab.SelectedIndex; string pdf = ""; switch (index) { case 0: pdf = ConfigResource.GetRDP_PDF_PATH(); break; case 1: pdf = ConfigResource.GetGAME_PDF_PATH(); break; //case 2: // pdf = ConfigResource.GetSCREEN_PDF_PATH(); // break; case 2: pdf = ConfigResource.GetLONGCENNECT_PDF_PATH(); break; case 3: pdf = ConfigResource.GetNAS_PDF_PATH(); break; case 4: pdf = ConfigResource.GetSOFTWAREUSE_PDF_PATH(); break; } Process rdcProcess = new Process(); rdcProcess.StartInfo.FileName = "cmd.exe"; rdcProcess.StartInfo.UseShellExecute = false; rdcProcess.StartInfo.RedirectStandardInput = true; //接受来自调用程序的输入信息 rdcProcess.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息 rdcProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出 rdcProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口 //rdcProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; rdcProcess.Start(); rdcProcess.StandardInput.WriteLine("\"" + pdf + "\"" + "&exit"); rdcProcess.StandardInput.AutoFlush = true; rdcProcess.Close(); }
public void ReadConfigFromRecipeHelper(RecipeHelper rh) { ItemPrefab = rh.GetPrefabName(); CraftingStation = rh.GetCraftingStation(); //Recipe rec = rh.GetRecipeInstance(); MinimumStationLevel = rh.GetRecipeInstance().m_minStationLevel; ResourceElement[] resources = rh.GetResourceElements(); List <ConfigResource> lcr = new List <ConfigResource>(); foreach (var re in resources) { ConfigResource tempCR = new ConfigResource(); tempCR.ItemPrefab = re.prefabItemName; tempCR.CraftingCost = re.amount; tempCR.UpgradePerLevelCost = re.amountPerLevel; lcr.Add(tempCR); } CraftingRequirementsArray = lcr.ToArray(); }
private void Label_More_Click(object sender, MouseButtonEventArgs e) { string pdf = ""; switch (current) { case REMOTEDESKTOP: pdf = ConfigResource.GetRDP_PDF_PATH(); break; case GAME: pdf = ConfigResource.GetGAME_PDF_PATH(); break; case LONGIN: pdf = ConfigResource.GetLONGCENNECT_PDF_PATH(); break; case NAS: pdf = ConfigResource.GetNAS_PDF_PATH(); break; case SCREEN: pdf = ConfigResource.GetSCREEN_PDF_PATH(); //this.Close(); break; } Process rdcProcess = new Process(); rdcProcess.StartInfo.FileName = "cmd.exe"; rdcProcess.StartInfo.UseShellExecute = false; rdcProcess.StartInfo.RedirectStandardInput = true; //接受来自调用程序的输入信息 rdcProcess.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息 rdcProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出 rdcProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口 //rdcProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; rdcProcess.Start(); rdcProcess.StandardInput.WriteLine("\"" + pdf + "\"" + "&exit"); rdcProcess.StandardInput.AutoFlush = true; rdcProcess.Close(); }
public static void AdminClient_AlterConfigs(string bootstrapServers, string singlePartitionTopic, string partitionedTopic) { LogToFile("start AdminClient_AlterConfigs"); using (var adminClient = new AdminClientBuilder(new AdminClientConfig { BootstrapServers = bootstrapServers }).Build()) { // 1. create a new topic to play with. string topicName = Guid.NewGuid().ToString(); adminClient.CreateTopicsAsync( new List <TopicSpecification> { new TopicSpecification { Name = topicName, NumPartitions = 1, ReplicationFactor = 1 } }).Wait(); Thread.Sleep(TimeSpan.FromSeconds(1)); // without this, sometimes describe topic throws unknown topic/partition error. // 2. do an invalid alter configs call to change it. var configResource = new ConfigResource { Name = topicName, Type = ResourceType.Topic }; var toUpdate = new Dictionary <ConfigResource, List <ConfigEntry> > { { configResource, new List <ConfigEntry> { new ConfigEntry { Name = "flush.ms", Value = "10001" }, new ConfigEntry { Name = "ubute.invalid.config", Value = "42" } } } }; try { adminClient.AlterConfigsAsync(toUpdate).Wait(); Assert.True(false); } catch (Exception e) { Assert.True(e.InnerException.GetType() == typeof(AlterConfigsException)); var ace = (AlterConfigsException)e.InnerException; Assert.Single(ace.Results); Assert.Contains("Unknown", ace.Results[0].Error.Reason); } // 3. test that in the failed alter configs call for the specified config resource, the // config that was specified correctly wasn't updated. List <DescribeConfigsResult> describeConfigsResult = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource }).Result; Assert.NotEqual("10001", describeConfigsResult[0].Entries["flush.ms"].Value); // 4. do a valid call, and check that the alteration did correctly happen. toUpdate = new Dictionary <ConfigResource, List <ConfigEntry> > { { configResource, new List <ConfigEntry> { new ConfigEntry { Name = "flush.ms", Value = "10011" } } } }; adminClient.AlterConfigsAsync(toUpdate); describeConfigsResult = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource }).Result; Assert.Equal("10011", describeConfigsResult[0].Entries["flush.ms"].Value); // 4. test ValidateOnly = true does not update config entry. toUpdate = new Dictionary <ConfigResource, List <ConfigEntry> > { { configResource, new List <ConfigEntry> { new ConfigEntry { Name = "flush.ms", Value = "20002" } } } }; adminClient.AlterConfigsAsync(toUpdate, new AlterConfigsOptions { ValidateOnly = true }).Wait(); describeConfigsResult = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource }).Result; Assert.Equal("10011", describeConfigsResult[0].Entries["flush.ms"].Value); // 5. test updating broker resource. toUpdate = new Dictionary <ConfigResource, List <ConfigEntry> > { { new ConfigResource { Name = "0", Type = ResourceType.Broker }, new List <ConfigEntry> { new ConfigEntry { Name = "num.network.threads", Value = "2" } } } }; adminClient.AlterConfigsAsync(toUpdate).Wait(); // 6. test updating more than one resource. string topicName2 = Guid.NewGuid().ToString(); adminClient.CreateTopicsAsync( new List <TopicSpecification> { new TopicSpecification { Name = topicName2, NumPartitions = 1, ReplicationFactor = 1 } }).Wait(); Thread.Sleep(TimeSpan.FromSeconds(1)); // without this, sometimes describe topic throws unknown topic/partition error. var configResource2 = new ConfigResource { Name = topicName2, Type = ResourceType.Topic }; toUpdate = new Dictionary <ConfigResource, List <ConfigEntry> > { { configResource, new List <ConfigEntry> { new ConfigEntry { Name = "flush.ms", Value = "222" } } }, { configResource2, new List <ConfigEntry> { new ConfigEntry { Name = "flush.ms", Value = "333" } } } }; adminClient.AlterConfigsAsync(toUpdate).Wait(); describeConfigsResult = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource, configResource2 }).Result; Assert.Equal(2, describeConfigsResult.Count); Assert.Equal("222", describeConfigsResult[0].Entries["flush.ms"].Value); Assert.Equal("333", describeConfigsResult[1].Entries["flush.ms"].Value); } Assert.Equal(0, Library.HandleCount); LogToFile("end AdminClient_AlterConfigs"); }
public static void Read(ConfigResource resource, SciTEPropertyDelegate propertyRead) { if (!resource.Exists) return; StreamReader reader = new StreamReader(resource.OpenRead()); char c = ' ', prev = '\\'; int lastStart = 0, ignoreCount = 0; bool ignoreProperties = false; string key = null, var = null; StringBuilder currentVar = new StringBuilder(); StringBuilder currentToken = new StringBuilder(); Queue<string> queue = new Queue<string>(); StringBuilder currentTokenPiece = new StringBuilder(); ReadMode mode = ReadMode.Key; ReadMode nextModeAfterSpaces = ReadMode.Key; string line = reader.ReadLine(); while (line != null) { int start = 0; bool skipLine = false; while ((start < line.Length) && char.IsWhiteSpace(line[start])) ++start; if (start >= line.Length) { PropertyRead(resource, SciTEPropertyType.EmptyLine, queue, string.Empty, string.Empty); } else if (line[start] == '#') { PropertyRead(resource, SciTEPropertyType.Comment, queue, "#", line); } else { if (ignoreProperties) { if ((ignoreCount == 0) || (start == lastStart)) { ignoreCount++; lastStart = start; skipLine = true; } else { ignoreCount = 0; ignoreProperties = false; } } if (skipLine) { PropertyRead(resource, SciTEPropertyType.EmptyLine, queue, string.Empty, string.Empty); } else { for (int i = start; i < line.Length; i++) { c = line[i]; if (mode == ReadMode.Key) { if (c == '=') { if (currentTokenPiece.Length > 0) { queue.Enqueue(currentTokenPiece.ToString()); } currentTokenPiece.Remove(0, currentTokenPiece.Length); key = currentToken.ToString(); currentToken.Remove(0, currentToken.Length); mode = ReadMode.Value; continue; } else if (char.IsWhiteSpace(c)) { key = currentToken.ToString(); currentToken.Remove(0, currentToken.Length); currentTokenPiece.Remove(0, currentTokenPiece.Length); if (key == "if") { nextModeAfterSpaces = ReadMode.If; } else if (key == "import") { nextModeAfterSpaces = ReadMode.Import; } else { break; } mode = ReadMode.FlushWhiteSpace; continue; } else if (c == '.') { currentToken.Append(c); queue.Enqueue(currentTokenPiece.ToString()); currentTokenPiece.Remove(0, currentTokenPiece.Length); } else { currentTokenPiece.Append(c); currentToken.Append(c); } } else if (mode == ReadMode.FlushWhiteSpace) { if (!char.IsWhiteSpace(c)) { currentToken.Append(c); mode = nextModeAfterSpaces; } } else if (mode == ReadMode.Import) { currentToken.Append(c); } else if (mode == ReadMode.If) { currentToken.Append(c); } else if (mode == ReadMode.Value) { currentToken.Append(c); } prev = c; } if (prev != '\\') { var = currentToken.ToString(); if (mode == ReadMode.If) { ignoreProperties = PropertyRead(resource, SciTEPropertyType.If, queue, key, var); } else if (mode == ReadMode.Import) { // Open another file inline with this one. if (PropertyRead(resource, SciTEPropertyType.Import, queue, key, var)) { if (resource.Exists) { Read(resource, propertyRead); } } } else if (mode == ReadMode.Value) { PropertyRead(resource, SciTEPropertyType.Property, queue, key, var); } currentToken.Remove(0, currentToken.Length); queue.Clear(); key = null; mode = ReadMode.Key; } else { currentToken.Remove(currentToken.Length - 1, 1); } } } line = reader.ReadLine(); } reader.Close(); if (key != null) { var = currentToken.ToString(); PropertyRead(resource, SciTEPropertyType.Property, queue, key, var); } }
public static void Read(ConfigResource propsFileInfo, SciTEProperties props) { Read(propsFileInfo, props, false); }
public static void Read(ConfigResource resource, SciTEPropertyDelegate propertyRead) { if (!resource.Exists) { return; } StreamReader reader = new StreamReader(resource.OpenRead()); char c = ' ', prev = '\\'; int lastStart = 0, ignoreCount = 0; bool ignoreProperties = false; string key = null, var = null; StringBuilder currentVar = new StringBuilder(); StringBuilder currentToken = new StringBuilder(); Queue <string> queue = new Queue <string>(); StringBuilder currentTokenPiece = new StringBuilder(); ReadMode mode = ReadMode.Key; ReadMode nextModeAfterSpaces = ReadMode.Key; string line = reader.ReadLine(); while (line != null) { int start = 0; bool skipLine = false; while ((start < line.Length) && char.IsWhiteSpace(line[start])) { ++start; } if (start >= line.Length) { PropertyRead(resource, SciTEPropertyType.EmptyLine, queue, string.Empty, string.Empty); } else if (line[start] == '#') { PropertyRead(resource, SciTEPropertyType.Comment, queue, "#", line); } else { if (ignoreProperties) { if ((ignoreCount == 0) || (start == lastStart)) { ignoreCount++; lastStart = start; skipLine = true; } else { ignoreCount = 0; ignoreProperties = false; } } if (skipLine) { PropertyRead(resource, SciTEPropertyType.EmptyLine, queue, string.Empty, string.Empty); } else { for (int i = start; i < line.Length; i++) { c = line[i]; if (mode == ReadMode.Key) { if (c == '=') { if (currentTokenPiece.Length > 0) { queue.Enqueue(currentTokenPiece.ToString()); } currentTokenPiece.Remove(0, currentTokenPiece.Length); key = currentToken.ToString(); currentToken.Remove(0, currentToken.Length); mode = ReadMode.Value; continue; } else if (char.IsWhiteSpace(c)) { key = currentToken.ToString(); currentToken.Remove(0, currentToken.Length); currentTokenPiece.Remove(0, currentTokenPiece.Length); if (key == "if") { nextModeAfterSpaces = ReadMode.If; } else if (key == "import") { nextModeAfterSpaces = ReadMode.Import; } else { break; } mode = ReadMode.FlushWhiteSpace; continue; } else if (c == '.') { currentToken.Append(c); queue.Enqueue(currentTokenPiece.ToString()); currentTokenPiece.Remove(0, currentTokenPiece.Length); } else { currentTokenPiece.Append(c); currentToken.Append(c); } } else if (mode == ReadMode.FlushWhiteSpace) { if (!char.IsWhiteSpace(c)) { currentToken.Append(c); mode = nextModeAfterSpaces; } } else if (mode == ReadMode.Import) { currentToken.Append(c); } else if (mode == ReadMode.If) { currentToken.Append(c); } else if (mode == ReadMode.Value) { currentToken.Append(c); } prev = c; } if (prev != '\\') { var = currentToken.ToString(); if (mode == ReadMode.If) { ignoreProperties = PropertyRead(resource, SciTEPropertyType.If, queue, key, var); } else if (mode == ReadMode.Import) { // Open another file inline with this one. if (PropertyRead(resource, SciTEPropertyType.Import, queue, key, var)) { if (resource.Exists) { Read(resource, propertyRead); } } } else if (mode == ReadMode.Value) { PropertyRead(resource, SciTEPropertyType.Property, queue, key, var); } currentToken.Remove(0, currentToken.Length); queue.Clear(); key = null; mode = ReadMode.Key; } else { currentToken.Remove(currentToken.Length - 1, 1); } } } line = reader.ReadLine(); } reader.Close(); if (key != null) { var = currentToken.ToString(); PropertyRead(resource, SciTEPropertyType.Property, queue, key, var); } }
private static bool PropertyRead(ConfigResource file, SciTEPropertyType propertyType, Queue<string> keyQueue, string key, string var) { bool success = false; string filePatternPrefix = "file.patterns."; string languageNameListPrefix = "language.names"; string lang, extList; if (s_props != null) { switch (propertyType) { case SciTEPropertyType.Property: success = true; s_props[key] = var; if (key.StartsWith(languageNameListPrefix)) { extList = s_props.Evaluate(var); s_props.AddLanguageNames(var.Split(' ')); } else if (key.StartsWith(filePatternPrefix)) { lang = key.Substring(filePatternPrefix.Length); if (lang.LastIndexOf('.') == -1) { extList = s_props.Evaluate(var); s_props.AddFileExtentionMapping(extList, lang); } } break; case SciTEPropertyType.If: if (s_props.ContainsKey(var)) { success = !Convert.ToBoolean(s_props[var]); } break; case SciTEPropertyType.Import: if (!s_supressImports) { success = file.Exists; } break; } } return success; }
public void AdminClient_DescribeConfigs(string bootstrapServers) { LogToFile("start AdminClient_DescribeConfigs"); using (var adminClient = new AdminClientBuilder(new AdminClientConfig { BootstrapServers = bootstrapServers }).Build()) { // broker configs // --- var configResource = new ConfigResource { Name = "0", Type = ResourceType.Broker }; var results = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource }).Result; Assert.Single(results); Assert.True(results[0].Entries.Count > 50); // note: unlike other parts of the api, Entries is kept as a dictionary since it's convenient for // the most typical use case. Assert.Single(results[0].Entries.Where(e => e.Key == "advertised.listeners")); Assert.Single(results[0].Entries.Where(e => e.Key == "num.network.threads")); var a = results.Select(aa => aa.Entries.Where(b => b.Value.Synonyms.Count > 0).ToList()).ToList(); // topic configs, more than one. // --- results = adminClient.DescribeConfigsAsync(new List <ConfigResource> { new ConfigResource { Name = singlePartitionTopic, Type = ResourceType.Topic }, new ConfigResource { Name = partitionedTopic, Type = ResourceType.Topic } }).Result; Assert.Equal(2, results.Count); Assert.True(results[0].Entries.Count > 20); Assert.True(results[1].Entries.Count > 20); Assert.Single(results[0].Entries.Where(e => e.Key == "compression.type")); Assert.Single(results[0].Entries.Where(e => e.Key == "flush.ms")); // options are specified. // --- results = adminClient.DescribeConfigsAsync(new List <ConfigResource> { configResource }, new DescribeConfigsOptions { RequestTimeout = TimeSpan.FromSeconds(10) }).Result; Assert.Single(results); Assert.True(results[0].Entries.Count > 20); // empty config resource // --- try { results = adminClient.DescribeConfigsAsync(new List <ConfigResource> { new ConfigResource() }).Result; Assert.True(false); } catch (ArgumentException) { // expected. } // invalid config resource // --- try { results = adminClient.DescribeConfigsAsync( new List <ConfigResource> { new ConfigResource { Name = "invalid.name.for.resource", Type = ResourceType.Broker } } ).Result; Assert.True(false); } catch (AggregateException ex) { Assert.True(ex.InnerException.GetType() == typeof(KafkaException)); var ace = (KafkaException)ex.InnerException; Assert.Contains("Expected an int32", ace.Message); } // invalid topic. // --- // // TODO: this creates the topic, then describes what it just created. what we want? does java explicitly not do this? // // results = adminClient.DescribeConfigsAsync(new List<ConfigResource> { // new ConfigResource { Name = "my-nonsense-topic", ResourceType = ConfigType.Topic } // }).Result; } Assert.Equal(0, Library.HandleCount); LogToFile("end AdminClient_DescribeConfigs"); }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <param name="propertyType"></param> /// <param name="keyQueue"></param> /// <param name="key"></param> /// <param name="data"></param> /// <returns></returns> protected static bool PropertyRead(ConfigResource resource, PropertyType propertyType, Queue<string> keyQueue, string key, string var) { bool success = false; string filePatternPrefix = "file.patterns."; string languageNameListPrefix = "language.names"; string lang, extList; if (s_props != null) { switch (propertyType) { case PropertyType.Property: success = true; s_props[key] = var; if (key.StartsWith(languageNameListPrefix)) { extList = s_props.Evaluate(var); s_props.AddLanguageNames(var.Split(' ')); } else if (key.StartsWith(filePatternPrefix)) { lang = key.Substring(filePatternPrefix.Length); if (lang.LastIndexOf('.') == -1) { extList = s_props.Evaluate(var); s_props.AddFileExtentionMapping(extList, lang); } } break; case PropertyType.If: if (s_props.ContainsKey(var)) { success = !Convert.ToBoolean(s_props[var]); } break; case PropertyType.Import: if (!s_supressImports) { ConfigResource res = resource.GetLocalConfigResource(string.Format(@"{0}.properties", var)); success = res.Exists; //FileInfo fileToImport = new FileInfo(string.Format(@"{0}\{1}.properties", file.Directory.FullName, var)); //success = fileToImport.Exists; } break; } } return success; }