当前位置: 首页>>代码示例>>C#>>正文


C# IniFile.ReadString方法代码示例

本文整理汇总了C#中IniFile.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.ReadString方法的具体用法?C# IniFile.ReadString怎么用?C# IniFile.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IniFile的用法示例。


在下文中一共展示了IniFile.ReadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public bool Load()
        {
            try {
                IniFile mpi = new IniFile(FilePath);
                this.Height = mpi.ReadInt("display", "height", 1);
                this.Width = mpi.ReadInt("display", "width", 1);

                this.Title = mpi.ReadString("info", "title", System.IO.Path.GetFileName(FilePath));
                this.Author = mpi.ReadString("info", "author", " ");
                this.Url = mpi.ReadString("info", "url", " ");

                /*string tmp =mpi.ReadString("device", "tablet", " ");

                if(String.IsNullOrEmpty(tmp))
                    this.Tablet = false;
                 */
                int tmp =mpi.ReadInt("device", "tablet", 0);

                if(tmp ==1) {
                    this.Tablet = true;
                } else
                    this.Tablet = false;
                //this.Tablet = Convert.ToBoolean(mpi.ReadString("device", "tablet", " "));
                return true;

            } catch  {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), MainClass.Languages.Translate("error_load_resolution_file", FilePath), Gtk.MessageType.Error,null);
                ms.ShowDialog();
                return false;
            }
        }
开发者ID:moscrif,项目名称:ide,代码行数:31,代码来源:EmulatorDisplay.cs

示例2: WmeProject

        //////////////////////////////////////////////////////////////////////////
        public WmeProject(string ProjectFilename)
        {
            List<ProjectPackage> Packages = new List<ProjectPackage>();

            if (ProjectFilename != string.Empty)
            {
                // get the project package directories and scan them
                IniFile ProjectFile = new IniFile(ProjectFilename);
                int NumPackages = ProjectFile.ReadInt("General", "NumPackages", 0);

                string BasePath = Path.GetDirectoryName(ProjectFilename) + Path.DirectorySeparatorChar;

                for (int i = 1; i <= NumPackages; i++)
                {
                    string Name = ProjectFile.ReadString("Package" + i.ToString(), "Folder");
                    if (Name == string.Empty) continue;

                    string Description = ProjectFile.ReadString("Package" + i.ToString(), "Description");

                    int Priority = ProjectFile.ReadInt("Package" + i.ToString(), "Priority");

                    Packages.Add(new ProjectPackage(BasePath + Name, Name, Description, Priority));
                }
                // sort packages by priority ascending
                Packages.Sort(ComparePriorityAscending);
            }
            this.Packages = Packages.ToArray();
        }
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:29,代码来源:WmeProject.cs

示例3: CentrEd

        public CentrEd()
        {
            InitializeComponent();
            pbServer.BackgroundImage = pbClient.BackgroundImage = pbData.BackgroundImage = Image.FromStream(Resources.GetStream(@"Icons.centred", "wrong", "png"));
            pbServer.Tag = pbClient.Tag = pbData.Tag = true;

            var profdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("CentrED-plus", "Profiles"));
            var profiles = Directory.GetDirectories(profdata, "*", SearchOption.TopDirectoryOnly);
            foreach (var profile in profiles) {
                var config = Path.Combine(profile, "login.ini");
                if (!File.Exists(config)) continue;
                var inifile = new IniFile(config);
                var entry = new CentrEdProfile();

                entry.Publ = true;
                entry.Name = Path.GetFileName(profile);
                entry.Host = inifile.ReadString("Connection", "Host", "localhost", false);
                entry.Port = inifile.ReadInt("Connection", "Port", 0, false);
                entry.User = inifile.ReadString("Connection", "Username", String.Empty, false);

                entry.Data = inifile.ReadString("Data", "Path", String.Empty, false);
            }

            var confdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("CentrED-plus", "Configs"));
            if (!Directory.Exists(confdata)) Directory.CreateDirectory(confdata);
            var configes = Directory.GetDirectories(confdata, "*", SearchOption.TopDirectoryOnly);

            //var app = ;
            var ini = new IniFile(@"D:\AppData\Local\CentrED-plus\Profiles\map0\login.ini");
            var port = ini.ReadInt("Connection", "Port", 2597, false);
        }
开发者ID:svn2github,项目名称:fiddler-plus,代码行数:31,代码来源:CentrEd.cs

示例4: LoadRules

		public override void LoadRules(IniFile.IniSection rules) {
			base.LoadRules(rules);

            WeaponType = rules.ReadEnum<WeaponType>("WeaponType", null);
			Action = rules.ReadEnum<Action>("Action", Action.MultiMissile);
			IsPowered = rules.ReadBool("IsPowered", true);
			DisableableFromShell = rules.ReadBool("DisableableFromShell");
			SidebarFlashTabFrames = rules.ReadInt("SidebarFlashTabFrames", -1);
			AIDefendAgainst = rules.ReadBool("AIDefendAgainst");
			PreClick = rules.ReadBool("PreClick");
			PostClick = rules.ReadBool("PostClick");
			ShowTimer = rules.ReadBool("ShowTimer");
			SpecialSound = Get<Sound>(rules.ReadString("SpecialSound"));
			StartSound = Get<Sound>(rules.ReadString("StartSound"));
			Range = rules.ReadFloat("Range", 0);
			LineMultiplier = rules.ReadInt("LineMultiplier", 0);
			Type = rules.ReadEnum<AbstractType>("Type", null);
			PreDependent = rules.ReadEnum<WeaponType>("PreDependent", null);
			AuxBuilding = Get<BuildingType>(rules.ReadString("AuxBuilding"));
			UseChargeDrain = rules.ReadBool("UseChargeDrain");
			ManualControl = rules.ReadBool("ManualControl");
			RechargeTime = rules.ReadFloat("RechargeTime", 5.0f);
			SidebarImage = rules.ReadString("SidebarImage", "");

		}
开发者ID:dkeetonx,项目名称:ccmaps-net,代码行数:25,代码来源:SuperWeaponType.cs

示例5: LangInit

        public void LangInit()
        {
            string ts = null;

            if (File.Exists("Bin/config.ini"))
            {
                IniFile loc = new IniFile(Directory.GetCurrentDirectory() + "/Bin/config.ini");
                if (loc.ReadString("language", "Language") != "") { ts = loc.ReadString("language", "Language"); }
            }

            if (File.Exists("Langs\\" + ts + ".ini"))
            {
                IniFile l = new IniFile(Directory.GetCurrentDirectory() + "/Langs/" + ts + ".ini");
                if (l.ReadString("editor", "file") != "") { файлToolStripMenuItem.Text = l.ReadString("editor", "file"); }
                if (l.ReadString("editor", "edit") != "") { toolStripMenuItem1.Text = l.ReadString("editor", "edit"); }
                if (l.ReadString("editor", "exit") != "") { выходToolStripMenuItem.Text = l.ReadString("editor", "exit"); }
                if (l.ReadString("editor", "save") != "") { toolStripMenuItem2.Text = l.ReadString("editor", "save"); }
                if (l.ReadString("editor", "undo") != "") { toolStripMenuItem3.Text = toolStripMenuItem5.Text = l.ReadString("editor", "undo"); }
                if (l.ReadString("editor", "redo") != "") { toolStripMenuItem4.Text = toolStripMenuItem6.Text = l.ReadString("editor", "redo"); }
                if (l.ReadString("editor", "cut") != "") { вырезатьToolStripMenuItem1.Text = вырезатьToolStripMenuItem.Text = l.ReadString("editor", "cut"); }
                if (l.ReadString("editor", "copy") != "") { копироватьToolStripMenuItem.Text = копироватьToolStripMenuItem1.Text = l.ReadString("editor", "copy"); }
                if (l.ReadString("editor", "del") != "") { toolStripMenuItem8.Text = toolStripMenuItem7.Text = l.ReadString("editor", "del"); }
                if (l.ReadString("editor", "paste") != "") { вставитьToolStripMenuItem.Text = вставитьToolStripMenuItem1.Text = l.ReadString("editor", "paste"); }
                if (l.ReadString("editor", "checkall") != "") { выделитьВсёToolStripMenuItem.Text = выделитьВсёToolStripMenuItem1.Text = l.ReadString("editor", "checkall"); }
                if (l.ReadString("editor", "str") != "") { str = l.ReadString("editor", "str"); }
                if (l.ReadString("editor", "yes") != "") { yes = l.ReadString("editor", "yes"); }
                if (l.ReadString("editor", "no") != "") { no = l.ReadString("editor", "no"); }
                if (l.ReadString("editor", "canc") != "") { canc = l.ReadString("editor", "canc"); }
            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:30,代码来源:Editor.cs

示例6: LoadProfile

        private static IniFile _file; //内置了一个对象

        #endregion Fields

        #region Methods

        public static void LoadProfile()
        {
            string strPath = AppDomain.CurrentDomain.BaseDirectory;
            _file = new IniFile(strPath + "Cfg.ini");
            G_BAUDRATE = _file.ReadString("CONFIG", "BaudRate", "4800");    //读数据,下同
            G_DATABITS = _file.ReadString("CONFIG", "DataBits", "8");
            G_STOP = _file.ReadString("CONFIG", "StopBits", "1");
            G_PARITY = _file.ReadString("CONFIG", "Parity", "NONE");
        }
开发者ID:ren-oak,项目名称:PCCommunicationAssistant_SerialAssistant,代码行数:15,代码来源:Profile.cs

示例7: LoadProfile

        private static IniFile _file; //内置了一个对象

        #endregion Fields

        #region Methods

        public static void LoadProfile()
        {
            string strPath = AppDomain.CurrentDomain.BaseDirectory;
            _file = new IniFile(strPath + "Cfg.ini");
            G_PictureNumbers = _file.ReadString("CONFIG", "PictureNumbers", "0");
            G_StartSector = _file.ReadString("CONFIG", "StartSector", "0");
            G_SectorNumbers = _file.ReadString("CONFIG", "SectorNumbers", "0");
            G_PictureHeight = _file.ReadString("CONFIG", "PictureHeight", "0");
            G_PictureWidth = _file.ReadString("CONFIG",  "PictureWidth", "0");
        }
开发者ID:XiaoYuQin,项目名称:CSharpTest,代码行数:16,代码来源:Profile.cs

示例8: getpath

 private static int[] getpath()
 {
     int[] str = new int[4];
     IniFile ini = new IniFile(System.Windows.Forms.Application.StartupPath + @"\Config.ini");
     str[0] = Convert.ToChar(ini.ReadString("config", "ExcelFL")) - 'A';
     str[1] = Convert.ToChar(ini.ReadString("config", "ExcelDT")) - 'A';
     str[2] = Convert.ToChar(ini.ReadString("config", "ExcelLS")) - 'A';
     str[3] = Convert.ToChar(ini.ReadString("config", "ExcelDP")) - 'A';
     return str;
 }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:10,代码来源:Excel_operation.cs

示例9: LoadRules

		public override void LoadRules(IniFile.IniSection rules) {
			base.LoadRules(rules);

			Normalized = rules.ReadBool("Normalized");
			Translucent = rules.ReadBool("Translucent");
			IsTiberium = rules.ReadBool("IsTiberium");
			IsMeteor = rules.ReadBool("IsMeteor");
			Elasticity = rules.ReadFloat("Elasticity", 0.8f);
			MinAngularVelocity = rules.ReadFloat("MinAngularVelocity");
			MaxAngularVelocity = rules.ReadFloat("MaxAngularVelocity", 0.174528f);
			Duration = rules.ReadInt("Duration", 30);
			MinZVel = rules.ReadFloat("MinZVel", 3.5f);
			MaxZVel = rules.ReadFloat("MaxZVel", 5f);
			MaxXYVel = rules.ReadFloat("MaxXYVel", 15f);
			Spawns = Get<VoxelAnimation>(rules.ReadString("Spawns"));
			SpawnCount = rules.ReadInt("SpawnCount");
			ShareBodyData = rules.ReadBool("ShareBodyData");
			ShareTurretData = rules.ReadBool("ShareTurretData");
			ShareBarrelData = rules.ReadBool("ShareBarrelData");
			VoxelIndex = rules.ReadInt("VoxelIndex");
			StartSound = Get<Sound>(rules.ReadString("StartSound"));
			StopSound = Get<Sound>(rules.ReadString("StopSound"));
			BounceAnim = Get<Animation>(rules.ReadString("BounceAnim"));
			ExpireAnim = Get<Animation>(rules.ReadString("ExpireAnim"));
			TrailerAnim = Get<Animation>(rules.ReadString("TrailerAnim"));
			Damage = rules.ReadInt("Damage");
			DamageRadius = rules.ReadInt("DamageRadius");
			Warhead = Get<WarheadType>(rules.ReadString("Warhead"));
			AttachedSystem = Get<ParticleSystem>(rules.ReadString("AttachedSystem"));
			ShareSource = Get<TechnoType>(rules.ReadString("ShareSource"));
		}
开发者ID:dkeetonx,项目名称:ccmaps-net,代码行数:31,代码来源:VoxelAnimation.cs

示例10: carregarDados

        /*******************************************************************************************************************************************/
        private void carregarDados()
        {
            if (File.Exists("./Config.ini"))
            {
                var iniFile = new IniFile("./Config.ini");

                txtAssunto1.Text = iniFile.ReadString("Assunto", "assunto1");
                txtAssunto2.Text = iniFile.ReadString("Assunto", "assunto2");
                txtAssunto3.Text = iniFile.ReadString("Assunto", "assunto3");
            }
        }
开发者ID:wllfl,项目名称:automatizador,代码行数:12,代码来源:frmAssunto.cs

示例11: DbConnectForm_Load

        private void DbConnectForm_Load(object sender, EventArgs e)
        {
            string curDir = Directory.GetCurrentDirectory();
            string filePath = curDir + "\\hips.ini";
            aIniFile = new IniFile(filePath);

            Dsn = aIniFile.ReadString("DataBase", "DSN", "").Trim();
            Uid = aIniFile.ReadString("DataBase", "UID", "").Trim();
            Pwd = aIniFile.ReadString("DataBase", "PWD", "").Trim();

        }
开发者ID:y-kawamoto,项目名称:99_common_o,代码行数:11,代码来源:DbConnectDialog.cs

示例12: Init

        public void Init()
        {
            comboBox1.Items.Clear();
            comboBox1.Items.Add("Russian");

            if (Directory.Exists("Langs"))
            {
                var dir = new System.IO.DirectoryInfo("Langs");
                FileInfo[] files = dir.GetFiles("*.*");

                comboBox1.Items.AddRange(files);
            }

            for (int i = 0; i < (comboBox1.Items.Count); i++)
            {
                if (Convert.ToString(comboBox1.Items[i]).EndsWith(".ini") == true)
                {
                    comboBox1.Items[i] = Convert.ToString(comboBox1.Items[i]).Replace(".ini", "");
                }
            }
            if (File.Exists("Bin/config.ini"))
            {
                IniFile loc = new IniFile(Directory.GetCurrentDirectory() + "/Bin/config.ini");
                if (loc.ReadString("language", "Language") != "") { comboBox1.SelectedItem = loc.ReadString("language", "Language"); }
                try
                {
                    if (loc.ReadString("sound", "Notification") != "") { checkBox1.Checked = Convert.ToBoolean(loc.ReadString("sound", "Notification")); }
                }
                catch (Exception)
                {
                    checkBox1.Checked = false;
                }
                try
                {
                    if (loc.ReadString("message", "Time") != "") { numericUpDown1.Value = Convert.ToInt32(loc.ReadString("message", "Time")); }
                }
                catch (Exception)
                {
                    checkBox1.Checked = false;
                }
            }

            if (File.Exists("Langs\\" + comboBox1.SelectedItem + ".ini"))
            {
                IniFile l = new IniFile(Directory.GetCurrentDirectory() + "/Langs/" + comboBox1.SelectedItem + ".ini");
                if (l.ReadString("settings", "Lang") != "") { lang = label1.Text = l.ReadString("settings", "Lang");}
                if (l.ReadString("settings", "Cancel") != "") { cancel = button1.Text = l.ReadString("settings", "Cancel"); }
                if (l.ReadString("settings", "Ok") != "") {ok = button2.Text = l.ReadString("settings", "Ok"); }
                if (l.ReadString("settings", "Sound") != "") { sound = checkBox1.Text = l.ReadString("settings", "Sound"); }
                if (l.ReadString("settings", "Mes_time") != "") { mtime = label2.Text = l.ReadString("settings", "Mes_time"); }
            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:52,代码来源:Settings.cs

示例13: getpath

 public static string getpath()
 {
     string str;
     IniFile ini = new IniFile(Application.StartupPath + @"\人员维护.ini");
     str = ini.ReadString("config", "Path");
     return str;
 }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:7,代码来源:Form1.cs

示例14: getpassword

 public static string getpassword()
 {
     string str;
     IniFile ini = new IniFile(Application.StartupPath + @"\设备维修配置文件.ini");
     str = ini.ReadString("config", "Password");
     return str;
 }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:7,代码来源:Form2.cs

示例15: LoadInfo

        //////////////////////////////////////////////////////////////////////////
        private void LoadInfo()
        {
            int LanguageIndex = ListLanguages.SelectedIndex;

            ListLanguages.Items.Clear();

            if (Directory.Exists(TxtPsPadInstallDir.Text))
            {
                PsPadIni = Path.Combine(TxtPsPadInstallDir.Text, "PSPad.ini");
                if (File.Exists(PsPadIni))
                {
                    try
                    {
                        IniFile Ini = new IniFile(PsPadIni);
                        for (int i = 0; i <= 4; i++)
                        {
                            string Key = "UserHighLighterName";
                            if (i > 0) Key += i.ToString();

                            string Val = Ini.ReadString("Config", Key, "");
                            if (Val == null || Val == string.Empty) Val = "<empty slot>";

                            ListLanguages.Items.Add(Val);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            if (LanguageIndex >= 0 && LanguageIndex < ListLanguages.Items.Count)
                ListLanguages.SelectedIndex = LanguageIndex;

            SetState();
        }
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:36,代码来源:ModPsPad.cs


注:本文中的IniFile.ReadString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。