本文整理汇总了C#中IniFile.Load方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.Load方法的具体用法?C# IniFile.Load怎么用?C# IniFile.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniFile
的用法示例。
在下文中一共展示了IniFile.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompressAndDecompressTest
public void CompressAndDecompressTest()
{
var file = new IniFile();
var section = file.Sections.Add("Compression Test");
for (int i = 0; i < 1000; i++)
section.Keys.Add(
new IniKey(file, "Key " + i, Guid.NewGuid().ToString()));
var compressedFile = new IniFile(new IniOptions() { Compression = true });
compressedFile.Sections.Add(section.Copy(compressedFile));
var fileStream = new MemoryStream();
file.Save(fileStream);
var compressedFileStream = new MemoryStream();
compressedFile.Save(compressedFileStream);
Assert.That(compressedFileStream.Length, Is.LessThan(fileStream.Length));
compressedFile.Sections.Clear();
compressedFile.Load(compressedFileStream);
Assert.AreEqual(file.Sections[0].Name, compressedFile.Sections[0].Name);
for (int i = 0; i < file.Sections[0].Keys.Count; i++)
{
Assert.AreEqual(file.Sections[0].Keys[i].Name, compressedFile.Sections[0].Keys[i].Name);
Assert.AreEqual(file.Sections[0].Keys[i].Value, compressedFile.Sections[0].Keys[i].Value);
}
}
示例2: EncryptAndDecryptTest
public void EncryptAndDecryptTest()
{
var file = new IniFile();
var section = file.Sections.Add("Encrypt Test");
section.Keys.Add("Key 1", "Value 1");
section.Keys.Add("Key 2", "Value 2");
var encryptedFile = new IniFile(new IniOptions() { EncryptionPassword = @"abcdef" });
encryptedFile.Sections.Add(section.Copy(encryptedFile));
var encryptedFileWriter = new StringWriter();
encryptedFile.Save(encryptedFileWriter);
var encryptedFileContent = encryptedFileWriter.ToString();
Assert.IsFalse(encryptedFileContent.Contains("Encrypt Test"));
Assert.IsFalse(encryptedFileContent.Contains("Key 1"));
Assert.IsFalse(encryptedFileContent.Contains("Value 1"));
Assert.IsFalse(encryptedFileContent.Contains("Key 2"));
Assert.IsFalse(encryptedFileContent.Contains("Value 2"));
encryptedFile.Sections.Clear();
encryptedFile.Load(new StringReader(encryptedFileContent));
Assert.AreEqual("Encrypt Test", encryptedFile.Sections[0].Name);
Assert.AreEqual("Key 1", encryptedFile.Sections[0].Keys[0].Name);
Assert.AreEqual("Value 1", encryptedFile.Sections[0].Keys[0].Value);
Assert.AreEqual("Key 2", encryptedFile.Sections[0].Keys[1].Name);
Assert.AreEqual("Value 2", encryptedFile.Sections[0].Keys[1].Value);
}
示例3: Init
// Method
//
public static bool Init()
{
string applicationFolder = Path.GetDirectoryName(Application.ExecutablePath);
_Data = new IniFile(string.Format("{0}\\{1}", applicationFolder, Filename));
Log.Module = Module;
if (_Data.Exists())
{
Log.WriteLineSucces(string.Format("Opening: {0}", Filename));
if (_Data.Load())
{
_connected = true;
Log.WriteLineSucces(string.Format("Loading: {0}", Filename));
return true;
}
Log.WriteLineFail(string.Format("Loading: {0}", Filename));
_connected = CreateTrim();
return _connected;
}
else
{
Log.WriteLineFail(string.Format("Opening: {0}", Filename));
_connected = CreateTrim();
return _connected;
}
}
示例4: LoadIniFileContent
public static IniFile LoadIniFileContent(string iniFileContent, IniOptions options)
{
IniFile file = new IniFile(options);
using (var stream = new MemoryStream(options.Encoding.GetBytes(iniFileContent)))
file.Load(stream);
return file;
}
示例5: GetSingleGameStats
/// <summary>
/// Returns the 4 values from the ini for the game sent to this
/// times played, last time played , average, total time
/// </summary>
/// <param name="systemName"></param>
/// <param name="romName"></param>
/// <returns></returns>
public void GetSingleGameStats(DatabaseGame game)
{
IniFile ini = new IniFile();
ini.Load(RLPath + "\\Data\\Statistics\\" + SystemName + ".ini");
var i = ini.GetSection(RomName);
if (i == null)
return;
try { TimesPlayed = Convert.ToInt32(ini.GetKeyValue(RomName, "Number_of_Times_Played")); }
catch (Exception) { }
try { LastTimePlayed = Convert.ToDateTime(ini.GetKeyValue(RomName, "Last_Time_Played")); }
catch (Exception) { }
try
{
var avgTime = TimeSpan.Parse(ini.GetKeyValue(RomName, "Average_Time_Played")).Days;
AvgTimePlayed = new TimeSpan(0, 0, avgTime);
}
catch (Exception) { }
try
{
var TotalTime = TimeSpan.Parse(ini.GetKeyValue(RomName, "Total_Time_Played")).Days;
TotalTimePlayed = new TimeSpan(0, 0, TotalTime);
TotalOverallTime = TotalOverallTime + TotalTimePlayed;
}
catch (Exception)
{
}
}
示例6: loadSnmpConfigFile
private void loadSnmpConfigFile()
{
IniFile ini = new IniFile("SNMP Config.ini");
if (ini.Exists())
{
ini.Load();
}
foreach (string section in ini.GetSections())
{
ListViewItem lst = SnmpHostListView.Items.Add(ini[section]["HostName"]);
lst.SubItems.Add(ini[section]["Port"]);
lst.SubItems.Add(ini[section]["Community"]);
lst.SubItems.Add(ini[section]["Version"]);
lst.SubItems.Add(ini[section]["User"]);
lst.SubItems.Add(ini[section]["Password"]);
lst.SubItems.Add(""); //SnmpError field
}
}
示例7: Main
//.........这里部分代码省略.........
} else if (al.Equals("sections") || al.Equals("sections-asc")) {
ini.SectionsSortOption = SortOption.Ascending;
} else if (al.Equals("sections-desc")) {
ini.SectionsSortOption = SortOption.Descending;
} else if (al.Equals("!sections")) {
ini.SectionsSortOption = SortOption.None;
} else if (al.Equals("entries") || al.Equals("entries-asc")) {
ini.EntriesSortOption = SortOption.Ascending;
} else if (al.Equals("entries-desc")) {
ini.EntriesSortOption = SortOption.Descending;
} else if (al.Equals("!entries")) {
ini.EntriesSortOption = SortOption.None;
} else {
if (!quiet) {
Console.WriteLine("Unknown option: " + a);
}
}
} else {
if (ini.FileName == null || ini.FileName.Length == 0) {
ini.FileName = a;
while (ini.FileName.StartsWith("\"") && ini.FileName.EndsWith("\"")) {
ini.FileName = ini.FileName.Substring(1, ini.FileName.Length - 2);
}
} else if (outfile == null || outfile.Length == 0) {
outfile = a;
} else {
if (!quiet) {
Console.WriteLine("Unknown option: " + a);
}
}
}
}
if (StdInEx.IsInputRedirected) {
// Ignore the specified `file` (if exists)..
ini.FileName = StdInEx.RedirectInputToFile();
} else if (ini.FileName == null || (ini.FileName = ini.FileName.Trim()).Length == 0) {
throw new ArgumentNullException("file");
} else if (!File.Exists(ini.FileName)) {
throw new ArgumentException("The specified file was not found (or is inaccessible)", "file");
}
try {
// LOAD & SORT
if (!ini.Load()) {
throw new Exception("Could not load specified file");
}
// SORT
ini.Sort();
// OUTPUT
if (!StdInEx.IsOutputRedirected && (outfile == null || outfile.Length == 0)) {
// Write back to the input file..
if (!ini.Save()) {
throw new InvalidOperationException("Failed saving back to file");
}
} else {
if (outfile != null && outfile.Length > 0) {
if (!ini.Save(outfile)) {
throw new InvalidOperationException("Failed saving to outfile");
}
}
if (StdInEx.IsOutputRedirected) {
string tmpOut;
DeleteFileWhenDone tmpDel;
if (outfile != null && outfile.Length > 0) {
tmpOut = outfile; // just output the new file..
} else {
tmpOut = Path.GetTempFileName();
tmpDel = new DeleteFileWhenDone(tmpOut);
if (!ini.Save(tmpOut)) {
throw new InvalidOperationException("Failed saving to temporary output (for stdout)");
}
}
Console.WriteLine(File.ReadAllText(tmpOut));
}
}
} catch (Exception ex) {
StringBuilder s = new StringBuilder();
s.AppendLine("**** ERROR OCURRED")
.AppendLine(ex.Message);
Console.Error.WriteLine(s.ToString());
if (outfile != null && outfile.Length > 0) {
// Write the error to the destination file..
File.WriteAllText(outfile, s.ToString());
}
return 1;
}
if (!quiet) {
Console.WriteLine("SUCCESS");
}
return 0;
}
示例8: ToolStrip_ItemClicked
private void ToolStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
Roboard.NetworkClient.messageHandler -= new NetworkClient.NewMessageEventHandler(NetworkClient_messageHandler);
ToolStripItem item = e.ClickedItem;
// parse the string sender to enum
eToolStripMenu tsMenuNum = (eToolStripMenu)Enum.Parse(typeof(eToolStripMenu), item.Text.ToUpper());
switch (tsMenuNum)
{
//
// MAIN MENU
//
case eToolStripMenu.LOAD:
this.openFD.Title = "Open a Roboard Motion File";
this.openFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
this.openFD.FileName = string.Empty;
this.openFD.Filter = "Roboard Motion File (RMF)|*.RMF|Kondo RCB files|*.RCB|All files|*.*";
if (this.openFD.ShowDialog() != DialogResult.Cancel)
{
fileName = this.openFD.SafeFileName;
chosenFile = this.openFD.FileName;
currentMotion = new IniFile(chosenFile);
if (currentMotion.Exists())
{
currentMotion.Load();
// check of de geladen rcb file wel een goede is.
this.tcDataSheet.TabPages[0].Text = "EDIT " + currentMotion["GraphicalEdit"]["Name"];
this.DataSheet.Size = new Size(Convert.ToInt32(currentMotion["GraphicalEdit"]["Width"]), Convert.ToInt32(currentMotion["GraphicalEdit"]["Height"]));
// Get file extension
string fileExtension = Path.GetExtension(chosenFile);
if (fileExtension == ".RCB") // This file needs to be converted.
// convert
{
convertMotionFile();
}
// teken de motion.
}
}
break;
case eToolStripMenu.SAVE:
this.saveFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
this.saveFD.Title = "Save the Roboard Motion File";
this.saveFD.AddExtension = true;
this.saveFD.DefaultExt = ".RMF";
this.saveFD.FileName = chosenFile;
this.saveFD.Filter = "Roboard Motion File (RMF) files|*.RMF|All files|*.*";
if (this.saveFD.ShowDialog() != DialogResult.Cancel)
{
chosenFile = saveFD.FileName;
currentMotion.FileName = chosenFile;
currentMotion.Save();
}
break;
case eToolStripMenu.PROPERTIES:
KHR_1HV_Properties propForm = new KHR_1HV_Properties();
propForm.sizeWidth = this.DataSheet.Width;
propForm.sizeHeight = this.DataSheet.Height;
propForm.GridX = this.KHR1HV_Ini.GridWidth;
propForm.GridY = this.KHR1HV_Ini.GridHeight;
propForm.ToolMenu = this.tsToolMenu.Visible;
propForm.PartsMenu = this.tsObjectMenu.Visible;
propForm.CommSettings = this.tsCommunicationsMenu.Visible;
propForm.CommandMenu = this.tsCommandMenu.Visible;
propForm.ShowDialog();
if (propForm.DialogResult == DialogResult.OK)
{
this.DataSheet.Size = new System.Drawing.Size(propForm.sizeWidth, propForm.sizeHeight);
this.currentMotion[Roboard.StaticUtilities.SectionGraphicalEdit][Roboard.StaticUtilities.GraphicalEditWidth] = propForm.sizeWidth.ToString();
this.currentMotion[Roboard.StaticUtilities.SectionGraphicalEdit][Roboard.StaticUtilities.GraphicalEditHeight] = propForm.sizeHeight.ToString();
this.tsToolMenu.Visible = propForm.ToolMenu;
this.tsObjectMenu.Visible = propForm.PartsMenu;
this.tsCommunicationsMenu.Visible = propForm.CommSettings;
this.tsCommandMenu.Visible = propForm.CommandMenu;
this.KHR1HV_Ini.GridWidth = propForm.GridX;
this.KHR1HV_Ini.GridHeight = propForm.GridY;
}
break;
case eToolStripMenu.INFORMATION:
if (this.RoboardConnected)
{
KHR_1HV_Information InformationForm = new KHR_1HV_Information();
InformationForm.ShowDialog();
}
break;
case eToolStripMenu.EXIT:
if (exitForm() == true)
{
Application.Exit();
}
break;
//
// COMMAND MENU
//
case eToolStripMenu.TRIM:
if (RoboardConnected)
{
// get trim values from the server
KHR_1HV_Trim secondForm = new KHR_1HV_Trim();
secondForm.ShowDialog();
//.........这里部分代码省略.........
示例9: getSingleGameStats
/// <summary>
/// Returns the 4 values from the ini for the game sent to this
/// times played, last time played , average, total time
/// </summary>
/// <param name="systemName"></param>
/// <param name="romName"></param>
/// <returns></returns>
public static List<string> getSingleGameStats(string systemName, string romName)
{
IniFile ini = new IniFile();
ini.Load(StatsPath + "\\" + systemName + ".ini");
var i = ini.GetSection(romName);
if (i == null)
return new List<string>();
// List<string> gameStatsList = new List<string>();
gameStatsList.Add(ini.GetKeyValue(romName, "Number_of_Times_Played"));
gameStatsList.Add(ini.GetKeyValue(romName, "Last_Time_Played"));
gameStatsList.Add(ini.GetKeyValue(romName, "Average_Time_Played"));
gameStatsList.Add(ini.GetKeyValue(romName, "Total_Time_Played"));
return gameStatsList;
}
示例10: Test
//.........这里部分代码省略.........
#region IniFile ContainsKey function
AssertEqual(testIni1.ContainsKey("Key 1"), true);
AssertEqual(testIni1.ContainsKey("Nothing"), false);
testIni1.BeginGroup("Group 1");
AssertEqual(testIni1.ContainsKey("Key 2"), true);
AssertEqual(testIni1.ContainsKey("Nothing"), false);
testIni1.BeginGroup("Subgroup 1");
AssertEqual(testIni1.ContainsKey("Key 3"), true);
AssertEqual(testIni1.ContainsKey("Nothing"), false);
testIni1.EndGroup();
AssertEqual(testIni1.ContainsKey("Subgroup 1/Key 4"), true);
AssertEqual(testIni1.ContainsKey("Subgroup 1/Nothing"), false);
testIni1.EndGroup();
AssertEqual(testIni1.ContainsKey("Group 2/Key 5"), true);
AssertEqual(testIni1.ContainsKey("Group 2/Nothing"), false);
AssertEqual(testIni1.ContainsKey("Group 2/Subgroup 1/Key 6"), true);
AssertEqual(testIni1.ContainsKey("Group 2/Subgroup 1/Nothing"), false);
AssertEqual(testIni1.ContainsKey("Group 2/Subgroup 2/Key 7"), true);
AssertEqual(testIni1.ContainsKey("Group 2/Subgroup 2/Nothing"), false);
#endregion
// ---------------------------------------------------------------------------------
#region IniFile Save/Load functions
testIni1.Save("UnitTest");
testIni2.Load("UnitTest");
AssertEqual(testIni1, testIni2);
AssertEqual(testIni1.count, 7);
AssertEqual(testIni1.keys.Count, 7);
AssertEqual(testIni1.values.Count, 7);
AssertEqual(testIni1.currentGroup, "");
keys = testIni1.keys;
values = testIni1.values;
AssertEqual(keys[0], "Key 1");
AssertEqual(keys[1], "Group 1/Key 2");
AssertEqual(keys[2], "Group 1/Subgroup 1/Key 3");
AssertEqual(keys[3], "Group 1/Subgroup 1/Key 4");
AssertEqual(keys[4], "Group 2/Key 5");
AssertEqual(keys[5], "Group 2/Subgroup 1/Key 6");
AssertEqual(keys[6], "Group 2/Subgroup 2/Key 7");
AssertEqual(values[0].key, "Key 1");
AssertEqual(values[1].key, "Group 1/Key 2");
AssertEqual(values[2].key, "Group 1/Subgroup 1/Key 3");
AssertEqual(values[3].key, "Group 1/Subgroup 1/Key 4");
AssertEqual(values[4].key, "Group 2/Key 5");
AssertEqual(values[5].key, "Group 2/Subgroup 1/Key 6");
AssertEqual(values[6].key, "Group 2/Subgroup 2/Key 7");
AssertEqual(values[0].value, "1");
AssertEqual(values[1].value, "0.2");
AssertEqual(values[2].value, "0.3");
AssertEqual(values[3].value, "True");
AssertEqual(values[4].value, "010204080F235DA7D8");
示例11: loadInfoMartConfigFile
private void loadInfoMartConfigFile()
{
IniFile ini = new IniFile("InfoMart Config.ini");
if (ini.Exists())
{
ini.Load();
}
if (InfoMartJobConfig != null)
{
InfoMartJobConfig.hostname = ini["InfoMart DB"]["HostName"];
InfoMartJobConfig.port = ini["InfoMart DB"]["Port"];
InfoMartJobConfig.service = ini["InfoMart DB"]["Service"];
InfoMartJobConfig.table = ini["InfoMart DB"]["Table"];
InfoMartJobConfig.username = ini["InfoMart DB"]["Username"];
InfoMartJobConfig.password = ini["InfoMart DB"]["Password"];
}
}
示例12: mainServer_messageHandler
//
//
public static void mainServer_messageHandler(object sender, NewMessageEventsArgs e)
{
networkBusy = true;
Log.WriteLineMessage(e.NewMessage);
string sendMsg = string.Empty;
string[] message;
string[] Msg;
message = e.NewMessage.Split(','); // first index contains the command
// Make a command parser.
//
switch(message[0])
{
//
// Main Menu
case "Information":
sendMsg = string.Empty;
sendMsg = string.Format("{0},{1},{2},{3},{4},{5}",
RCServo.CPU(), RCServo.Version(), Convert.ToString(RCServo.Connected),
Convert.ToString(I2C.Connected),
Convert.ToString(AD7918.Connected),
Convert.ToString(SPI.Connected));
break;
case "Options":
switch (message[1])
{
case "Read":
string tmp = string.Empty;
sendMsg = Server.MainIni.MotionReplay.ToString() + "," +
Server.MainIni.EnableRemoteControl.ToString() + "," +
Server.MainIni.PowerUpMotion + "," +
Server.MainIni.LowPowerMotion + "," +
Server.MainIni.LowPowerVoltage.ToString() + "," +
Server.MainIni.TimeBase.ToString();
for (int i = 0; i < StaticUtilities.numberOfServos; i++)
{
tmp += string.Format(",{0}", Server.MainIni.ChannelFunction[i]);
}
sendMsg = sendMsg + tmp;
break;
case "Write":
Server.MainIni.MotionReplay = Convert.ToBoolean(message[2]);
Server.MainIni.EnableRemoteControl = Convert.ToBoolean(message[3]);
Server.MainIni.PowerUpMotion = Convert.ToInt32(message[4]);
Server.MainIni.LowPowerMotion = Convert.ToInt32(message[5]);
Server.MainIni.LowPowerVoltage = Convert.ToInt32(message[6]);
Server.MainIni.TimeBase = Convert.ToInt32(message[7]);
int[] temp = new int[StaticUtilities.numberOfServos];
for (int i = 0; i < StaticUtilities.numberOfServos; i++)
{
temp[i] = Convert.ToInt32(message[8 + i]);
}
Server.MainIni.ChannelFunction = temp;
Server.MainIni.Save();
Server.RCServo.Close();
Server.RCServo.Init();
if (MainIni.EnableRemoteControl)
if (!Server.XBox360.Open)
Server.XBox360.Init();
sendMsg = "Ok";
break;
default:
break;
}
break;
case "ReadMotionFile":
switch(message[1])
{
case "Open":
// Get the selected motion index and check
// in the motiontable if the motion exists
// return true if the file exist.
selectedMotionIndex = Convert.ToInt32(message[2]) + 1;
string file = Server.Table.MotionTable["Motion" + selectedMotionIndex.ToString()]["Filename"];
if (file != string.Empty)
{
khr_1hv_motion = new IniFile(file);
khr_1hv_motion.Load();
sendMsg = "Ok";
}
else
{
sendMsg = "No motion to read";
}
break;
case "GraphicalEdit":
Msg = new string[8];
Msg[0] = khr_1hv_motion["GraphicalEdit"]["Type"];
Msg[1] = khr_1hv_motion["GraphicalEdit"]["Width"];
Msg[2] = khr_1hv_motion["GraphicalEdit"]["Height"];
Msg[3] = khr_1hv_motion["GraphicalEdit"]["Items"];
Msg[4] = khr_1hv_motion["GraphicalEdit"]["Links"];
Msg[5] = khr_1hv_motion["GraphicalEdit"]["Start"];
Msg[6] = khr_1hv_motion["GraphicalEdit"]["Name"];
Msg[7] = khr_1hv_motion["GraphicalEdit"]["Ctrl"];
Items = 0;
//.........这里部分代码省略.........
示例13: loadConfigFile
private void loadConfigFile()
{
string currentPath = Directory.GetCurrentDirectory();
IniFile ini = new IniFile(currentPath + "\\config.ini");
if (ini.Exists())
{
ini.Load();
}
foreach (string section in ini.GetSections())
{
ListViewItem lst = HostListView.Items.Add(ini[section]["HostName"]);
lst.SubItems.Add(ini[section]["Port"]);
lst.SubItems.Add(ini[section]["Community"]);
lst.SubItems.Add(ini[section]["Version"]);
lst.SubItems.Add(ini[section]["User"]);
lst.SubItems.Add(ini[section]["Password"]);
lst.SubItems.Add(""); //SnmpError field
}
}
示例14: mainForm_Load
private void mainForm_Load(object sender, EventArgs e)
{
this.Text = "PawnoSharp";
//Create the ToolTip component not available in the designer.
ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
//Create the tooltips for the bar buttons.
toolTip1.SetToolTip(this.newFileButton, "New File...");
toolTip1.SetToolTip(this.openFileButton, "Open File...");
toolTip1.SetToolTip(this.saveFileButton, "Save File");
toolTip1.SetToolTip(this.compileFileButton, "Compile");
//Set the scintilla1 RichTextBox margin width to 50 to allow for large line numbers
//to show properly. (Up to 100,000?)
scintilla1.Margins[0].Width = 50;
//Load the application settings!
IniFile fsINI = new IniFile();
Uri uri = new Uri(settingsFile);
fsINI.Load(uri.LocalPath + "\\Settings.ini");
string fontName = fsINI.GetKeyValue("User", "FontName");
string fontSize = fsINI.GetKeyValue("User", "FontSize");
float fontSizeF = 0F;
string FormW = fsINI.GetKeyValue("Application", "FormW");
string FormH = fsINI.GetKeyValue("Application", "FormH");
int FormWI = Convert.ToInt32(FormW);
int FormHI = Convert.ToInt32(FormH);
string FormX = fsINI.GetKeyValue("Application", "FormX");
string FormY = fsINI.GetKeyValue("Application", "FormY");
int FormXI = Convert.ToInt32(FormX);
int FormYI = Convert.ToInt32(FormY);
string FormMaximized = fsINI.GetKeyValue("Application", "Maximized");
int FormMaximizedI = Convert.ToInt16(FormMaximized);
string FormFileTitle = fsINI.GetKeyValue("User", "FileInTitle");
int FormFileTitleI = Convert.ToInt16(FormFileTitle);
float.TryParse(fontSize, out fontSizeF);
Point FormPos = new Point();
FormPos.X = FormXI;
FormPos.Y = FormYI;
Size FormSize = new Size();
FormSize.Width = FormWI;
FormSize.Height = FormHI;
//Apply the application settings!
Font font = new Font(fontName, fontSizeF);
SetFont(font);
fontDialog1.Font = font;
this.Location = FormPos;
this.Size = FormSize;
if (FormMaximizedI == 1)
{
this.WindowState = FormWindowState.Maximized;
}
}
示例15: SaveRomsPreferences
private void SaveRomsPreferences(string rom="")
{
IniFile file = new IniFile(new IniOptions());
if (File.Exists ("config/" + rom + ".ini"))
file.Load ("config/" + rom + ".ini");
else
file.Save ("config/" + rom + ".ini");
file.Sections.Add(
new IniSection(file, rom + " config",
new IniKey(file, "gl_glsl", ckbOpenGLGLSL.Active.ToString())
));
file.Save("config/" + rom + ".ini");
}