本文整理汇总了C#中IniParser.FileIniDataParser.LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileIniDataParser.LoadFile方法的具体用法?C# FileIniDataParser.LoadFile怎么用?C# FileIniDataParser.LoadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniParser.FileIniDataParser
的用法示例。
在下文中一共展示了FileIniDataParser.LoadFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Console.WriteLine("Reading Generation Info File \n");
FileIniDataParser parser = new FileIniDataParser();
IniData genData = parser.LoadFile("generation.ini");
Console.WriteLine("Generation Info File Read \n");
foreach (SectionData genSection in genData.Sections)
{
Console.WriteLine(String.Format("Analyzing {0} \n", genSection.SectionName));
Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
GenerationInfo info = new GenerationInfo();
info.CompanyName = genSection.Keys["companyname"].Replace(";", "");
info.DataNameSpace = genSection.Keys["datanamespace"].Replace(";", "");
info.FolderPath = genSection.Keys["path"].Replace(";", "");
info.ServerName = genSection.Keys["server"].Replace(";", "");
info.DataBase = genSection.Keys["database"].Replace(";", "");
MGenerator.Tools.Generator.GenerateFromDatabase(info);
Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
Console.WriteLine(String.Format("done \n", genSection.SectionName));
Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
示例2: getReports
List<Report> getReports()
{
if (reports == null)
{
reports = new List<Report>();
var dir = new DirectoryInfo(GraphPkgInfo.ReportsDir);
foreach (var reportDir in dir.GetDirectories())
{
// parse the ini and create the report object
var parser = new FileIniDataParser();
var infoTxtPath = Path.Combine(reportDir.FullName, "info.txt");
if (File.Exists(infoTxtPath) == false)
continue;
var infoData = parser.LoadFile(infoTxtPath, relaxedIniRead: true);
var report = new Report
{
Key = reportDir.Name,
Name = getInfoData(infoData, "Name"),
Description = getInfoData(infoData, "Description"),
ReportDir = reportDir.FullName
};
report.ThemeFile = getInfoData(infoData, "Theme", report.ThemeFile);
report.TemplateFile = getInfoData(infoData, "Template", report.TemplateFile);
report.ScriptFile = getInfoData(infoData, "Script", report.ScriptFile);
report.TemplateLayoutFile = getInfoData(infoData, "TemplateLayout", report.TemplateLayoutFile);
reports.Add(report);
}
}
return reports;
}
示例3: Main
public static void Main()
{
//Create an instance of a ini file parser
FileIniDataParser fileIniData = new FileIniDataParser();
if (File.Exists("NewTestIniFile.ini"))
File.Delete("NewTestIniFile.ini");
//Parse the ini file
IniData parsedData = fileIniData.LoadFile("TestIniFile.ini");
//Write down the contents of the ini file to the console
Console.WriteLine("---- Printing contents of the INI file ----\n");
Console.WriteLine(parsedData.ToString());
//Get concrete data from the ini file
Console.WriteLine("---- Printing contents concrete data from the INI file ----");
Console.WriteLine("setMaxErrors = " + parsedData["GeneralConfiguration"]["setMaxErrors"]);
Console.WriteLine();
//Modify the INI contents and save
Console.WriteLine();
//Write down the contents of the modified ini file to the console
Console.WriteLine("---- Printing contents of the new INI file ----\n");
IniData modifiedParsedData = ModifyINIData(parsedData);
Console.WriteLine(modifiedParsedData.ToString());
//Save to a file
fileIniData.SaveFile("NewTestIniFile.ini", modifiedParsedData);
}
示例4: Main
static void Main(string[] args)
{
string server_ini_file = @"Ini\servers.ini";
C("HTTP Server Starting");
if (File.Exists(server_ini_file))
{
C("Using File {0} for configuration", server_ini_file);
FileIniDataParser parser = new FileIniDataParser();
var servers = parser.LoadFile(server_ini_file);
servers.Sections
.ToList()
.ForEach(server_config =>
{
NSServer server = new NSServer(server_config.Keys["listenon"], Int32.Parse(server_config.Keys["port"]), "/");
server.CreateHttpServer();
C("Starting Server {0} : listening on http://{1}:{2}/", server_config.SectionName, server_config.Keys["listenon"], server_config.Keys["port"]);
});
C("Servers have been started.");
}
Console.WriteLine("Waiting...");
Console.Read();
}
示例5: Config
private Config(string path)
{
FilePath = path;
FileHandler = new FileIniDataParser();
ConfigHandler = FileHandler.LoadFile(path);
//Fill Dictionary
ReplacingData.Add("$(root)",Global.AppDir);
}
示例6: Issue11_Tests
public void Issue11_Tests()
{
FileIniDataParser parser = new FileIniDataParser();
IniData parsedData = parser.LoadFile("Issue11_example.ini",true);
Assert.That(parsedData.Global[".reg (Win)"], Is.EqualTo("notepad.exe"));
}
示例7: allow_duplicated_sections
public void allow_duplicated_sections()
{
FileIniDataParser parser = new FileIniDataParser();
IniData parsedData = parser.LoadFile("Issue11_example.ini");
Assert.That(parsedData.Global[".reg (Win)"], Is.EqualTo("notepad.exe"));
}
示例8: main
public main()
{
IniParser.FileIniDataParser parser = new FileIniDataParser();
IniData parsedData = parser.LoadFile("setting/ui-setting.ini");
rubyPath = parsedData["PATH"]["ruby"];
compassPath = parsedData["PATH"]["compass"];
dirListPath = parsedData["PATH"]["dirlist"];
frameworkPath = parsedData["PATH"]["framework"];
///
components = new System.ComponentModel.Container();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem0 = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
// Initialize contextMenu1
this.contextMenu1.MenuItems.AddRange(
new System.Windows.Forms.MenuItem[] { this.menuItem0,this.menuItem1 });
// Initialize menuItem1
this.menuItem1.Index = 1;
this.menuItem1.Text = "E&xit";
this.menuItem1.Click += new System.EventHandler(this.exitWindowHander);
this.menuItem0.Index = 0;
this.menuItem0.Text = "H&ide";
this.menuItem0.Click += new System.EventHandler(this.showWindowHander);
// Set up how the form should be displayed.
this.ClientSize = new System.Drawing.Size(292, 266);
this.Text = "Compass Bundle UI";
// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = new Icon(Directory.GetCurrentDirectory()+"/icon/compass_icon.ico");
// The ContextMenu property sets the menu that will
// appear when the systray icon is right clicked.
notifyIcon1.ContextMenu = this.contextMenu1;
// The Text property sets the text that will be displayed,
// in a tooltip, when the mouse hovers over the systray icon.
notifyIcon1.Text = "Compass Bundle UI";
notifyIcon1.Visible = true;
// Handle the DoubleClick event to activate the form.
notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
//MessageBox.Show(compassBatPath);
InitializeComponent();
this.loadList();
this.add2CLI("load the default folder list.");
this.write2Xml();
this.initCreateList();
this.Show();
}
示例9: confForm
public confForm()
{
IniParser.FileIniDataParser parser = new FileIniDataParser();
IniData parsedData = parser.LoadFile("d:/tmp/compass-bundle/ui-setting.ini");
compassBatPath = parsedData["PATH"]["compass_bat"];
dirListPath = parsedData["PATH"]["dirlist"];
InitializeComponent();
txtCompassBatPath.Text = compassBatPath;
txtPathListPath.Text = dirListPath;
}
示例10: WampServer
public WampServer(string path)
{
rootPath = path;
FileIniDataParser parser = new FileIniDataParser();
IniData data = parser.LoadFile(Path.Combine(path, "wampmanager.conf"));
string version = data["apache"]["apacheVersion"];
apacheVersion = version.Trim('"', '\'');
this.ApacheConfigPath = Path.Combine(path, "alias\\");
this.ServerRootPath = Path.Combine(path, "www");
}
示例11: Main
protected static void Main(string[] args)
{
DateTime buildDate = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).LastWriteTime;
string buildDateStr = buildDate.ToString("G");
Console.Title = "EO Proxy";
Console.WriteLine("EO Proxy =-= Build : " + System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion + " (" + buildDateStr + ")\n");
Console.WriteLine();
Console.WriteLine("Loading Configs\n\n");
IniParser.FileIniDataParser parser = new FileIniDataParser();
parser.CommentDelimiter = '#';
IniData settings = parser.LoadFile("config.ini");
AuthAddress = settings["IP"]["AuthAddress"];
ProxyAddress = settings["IP"]["ProxyAddress"];
Console.WriteLine("Connecting to the Authentication server on: " + AuthAddress);
Console.WriteLine("Proxy is redirecting game server connects to: " + ProxyAddress);
ConsoleLogging = Convert.ToBoolean(settings["Options"]["ConsoleLogging"]);
DebugMode = Convert.ToBoolean(settings["Options"]["DebugMode"]);
WriteToBytes = Convert.ToBoolean(settings["Options"]["WriteToBytes"]);
PacketSniffingPath = settings["Options"]["PacketLocation"];
Console.WriteLine("\nPackets will be saved to: " + PacketSniffingPath);
Console.WriteLine("\nAll Settings Loaded.\n\n\n");
Console.WriteLine("Preparing Connections...\n");
KeyValuePair<ushort, ushort>[] bindings = new KeyValuePair<ushort,ushort>[2];
bindings[0] = new KeyValuePair<ushort, ushort>(4444, 9958); // Again, here are the ports that the client
bindings[1] = new KeyValuePair<ushort, ushort>(4445, 9959); // can use to connect. Make sure that yours is
foreach (KeyValuePair<ushort, ushort> bindpair in bindings)
{
Console.WriteLine(" Launching AuthServer [" + bindpair.Value + "] on " + bindpair.Key + "...");
var server = new AsyncSocket(bindpair.Key, bindpair.Value);
server.ClientConnect += new Action<AsyncWrapper>(accountServer_ClientConnect); // This is initializing the socket
server.ClientReceive += new Action<AsyncWrapper, byte[]>(accountServer_ClientReceive); // system... basic Async. This is
server.ClientDisconnect += new Action<object>(accountServer_ClientDisconnect); // for each auth port.
server.Listen();
}
Console.WriteLine(" Launching GameServer [5816] on 4446...");
var gameServer = new AsyncSocket(WorldPort, 5816);
gameServer.ClientConnect += new Action<AsyncWrapper>(gameServer_ClientConnect); // This is the game server's socket
gameServer.ClientReceive += new Action<AsyncWrapper, byte[]>(gameServer_ClientReceive); // system. Notice the actions... right
gameServer.ClientDisconnect += new Action<object>(gameServer_ClientDisconnect); // click them and say "Go to definition".
gameServer.Listen();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\nProxy is online.\n");
Console.ForegroundColor = ConsoleColor.White;
while (true)
Console.ReadLine();
}
示例12: Issue17_Tests
public void Issue17_Tests()
{
FileIniDataParser parser = new FileIniDataParser();
IniData parsedData = parser.LoadFile("Issue17_example.ini");
Assert.That(parsedData.Sections.Count, Is.EqualTo(1));
Assert.That(parsedData.Sections.ContainsSection("{E3729302-74D1-11D3-B43A-00AA00CAD128}"), Is.True);
Assert.That(parsedData.Sections["{E3729302-74D1-11D3-B43A-00AA00CAD128}"].ContainsKey("key"), Is.True);
Assert.That(parsedData.Sections["{E3729302-74D1-11D3-B43A-00AA00CAD128}"]["key"], Is.EqualTo("value"));
}
示例13: Load
internal IniData Load(string path)
{
parser = new FileIniDataParser();
IniData data = new IniData();
try
{
data = parser.LoadFile(path);
}
catch (ParsingException e)
{
throw e.InnerException;
}
return data;
}
示例14: ReadConfig
public string ReadConfig(string key)
{
var ini = new FileIniDataParser();
try
{
var parsedData = ini.LoadFile(AppDomain.CurrentDomain.BaseDirectory + @"config.ini");
return parsedData["settings"][key];
}
catch
{
// ignored
}
return null;
}
示例15: Form1
public Form1()
{
InitializeComponent();
//if (!AllocConsole())
// MessageBox.Show("Failed");
//set up ini file parcer
parcer = new FileIniDataParser();
iniFile = parcer.LoadFile("config.ini");
//set default backup location
bkuploc = iniFile["appdata"]["defaultBackuploc"];
output = "Click backup to begin.....";
outputlabel.Text = output;
dbclient = new DropNetClient("ogpmt0vuae0mkr4", "8s77mh9omajr7x9");
newUser = false;
}