GetTemplateFromResource() public static method

Получает содержимое текстового файла из внутреннего ресурса приложения.
public static GetTemplateFromResource ( string FileName ) : string
FileName string Внутреннее имя ресурсного файла
return string
Esempio n. 1
0
 /// <summary>
 /// Компилирует VMT файл из VTF.
 /// </summary>
 /// <param name="FileName">Имя VMT файла с полным путём до него</param>
 private void CompileFromVTF(string FileName)
 {
     // Начинаем...
     using (StreamWriter CFile = new StreamWriter(FileName))
     {
         try { CFile.WriteLine(CoreLib.GetTemplateFromResource(Properties.Resources.PI_TemplateFile).Replace("{D}", Path.Combine("vgui", "logos", Path.GetFileNameWithoutExtension(FileName)))); } catch (Exception Ex) { CoreLib.WriteStringToLog(Ex.Message); }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Сохраняет содержимое редактора на форме в файл Hosts.
 /// </summary>
 /// <param name="Path">Путь к файлу Hosts</param>
 private void WriteTableToHosts(string Path)
 {
     using (StreamWriter CFile = new StreamWriter(Path, false, Encoding.Default))
     {
         try { CFile.WriteLine(CoreLib.GetTemplateFromResource(Properties.Resources.AHE_TemplateFile)); } catch (Exception Ex) { CoreLib.WriteStringToLog(Ex.Message); }
         foreach (DataGridViewRow Row in HEd_Table.Rows)
         {
             if ((Row.Cells[0].Value != null) && (Row.Cells[1].Value != null))
             {
                 if (IPAddress.TryParse(Row.Cells[0].Value.ToString(), out IPAddress IPAddr))
                 {
                     CFile.WriteLine("{0} {1}", IPAddr, Row.Cells[1].Value);
                 }
             }
         }
     }
 }