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


C# IniFile.Exists方法代码示例

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


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

示例1: HddSnmpMonitor

        public HddSnmpMonitor()
        {
            InitializeComponent();

            //Host List
            HostListView.Columns.Add("HostName").Width=150;
            HostListView.Columns.Add("Port").Width=0;
            HostListView.Columns.Add("Communtity").Width = 0;
            HostListView.Columns.Add("Version").Width = 0;
            HostListView.Columns.Add("User").Width = 0;
            HostListView.Columns.Add("Password").Width = 0;
            HostListView.Columns.Add("Error").Width = 0;

            HostlvwColumnSorter = new ListViewColumnSorter();
            HostListView.ListViewItemSorter = HostlvwColumnSorter;

            //HDD Results List
            HDDResultListView.Columns.Add("id").Width=0;
            HDDResultListView.Columns.Add("HostName").Width=150;
            HDDResultListView.Columns.Add("Disk").TextAlign= HorizontalAlignment.Center;
            HDDResultListView.Columns.Add("%Free").TextAlign = HorizontalAlignment.Center;
            HDDResultListView.Columns.Add("Size").TextAlign = HorizontalAlignment.Center;
            HDDResultListView.Columns.Add("Used").TextAlign = HorizontalAlignment.Center;
            HDDResultListView.Columns.Add("Free").TextAlign = HorizontalAlignment.Center;

            HDDResultlvwColumnSorter = new ListViewColumnSorter();
            HDDResultListView.ListViewItemSorter = HDDResultlvwColumnSorter;

            //CPU Results List
            CPUResultListView.Columns.Add("id").Width = 0;
            CPUResultListView.Columns.Add("HostName").Width = 150;
            CPUResultListView.Columns.Add("CPU Id").TextAlign = HorizontalAlignment.Center;
            CPUResultListView.Columns.Add("CPU Load").TextAlign = HorizontalAlignment.Center;

            CPUResultlvwColumnSorter = new ListViewColumnSorter();
            CPUResultListView.ListViewItemSorter = CPUResultlvwColumnSorter;

            string currentPath = Directory.GetCurrentDirectory();
            IniFile ini = new IniFile(currentPath + "\\config.ini");
            if (ini.Exists())
            {
                loadConfigFile();
            }
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:44,代码来源:HddSnmpMonitorGuiMain.cs

示例2: 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
            }
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:20,代码来源:HddSnmpMonitorGuiMain.cs

示例3: 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();
//.........这里部分代码省略.........
开发者ID:Subwolf666,项目名称:KHR-1HV-Client,代码行数:101,代码来源:KHR-1HV_Main.cs

示例4: SetLoginOrCreate

 /// <summary>
 /// Sets the login info of the character or creates the base character file if first time logging in.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="Account">The account.</param>
 /// <param name="DatabaseUID">The database UID.</param>
 /// <param name="EntityUID">The entity UID.</param>
 public static void SetLoginOrCreate(SocketClient client, string Account, int DatabaseUID, uint EntityUID)
 {
     IniFile characterfile = new IniFile(DatabaseLocation + "\\Characters\\" + DatabaseUID + ".ini", "Character");
     if (!characterfile.Exists())
         characterfile.Write<bool>("New", true);
     characterfile.WriteString("Account", Account);
     characterfile.Write<uint>("LastEntityUID", EntityUID);
 }
开发者ID:kenlacoste843,项目名称:ProjectXV3,代码行数:15,代码来源:ServerDatabase.cs

示例5: 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
            }
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:19,代码来源:Dashboard.cs

示例6: loadSNMPConfig

        private void loadSNMPConfig()
        {
            //Host List
            SnmpHostListView.Columns.Add("HostName").Width = 150;
            SnmpHostListView.Columns.Add("Port").Width = 0;
            SnmpHostListView.Columns.Add("Communtity").Width = 0;
            SnmpHostListView.Columns.Add("Version").Width = 0;
            SnmpHostListView.Columns.Add("User").Width = 0;
            SnmpHostListView.Columns.Add("Password").Width = 0;
            SnmpHostListView.Columns.Add("Error").Width = 0;

            SnmpHostlvwColumnSorter = new ListViewColumnSorter();
            SnmpHostListView.ListViewItemSorter = SnmpHostlvwColumnSorter;

            //HDD Results List
            SnmpHDDResultListView.Columns.Add("id").Width = 0;
            SnmpHDDResultListView.Columns.Add("HostName").Width = 150;
            SnmpHDDResultListView.Columns.Add("Disk").TextAlign = HorizontalAlignment.Center;
            SnmpHDDResultListView.Columns.Add("%Free").TextAlign = HorizontalAlignment.Center;
            SnmpHDDResultListView.Columns.Add("Size").TextAlign = HorizontalAlignment.Center;
            SnmpHDDResultListView.Columns.Add("Used").TextAlign = HorizontalAlignment.Center;
            SnmpHDDResultListView.Columns.Add("Free").TextAlign = HorizontalAlignment.Center;

            SnmpHDDResultlvwColumnSorter = new ListViewColumnSorter();
            SnmpHDDResultListView.ListViewItemSorter = SnmpHDDResultlvwColumnSorter;

            //CPU Results List
            SnmpCPUResultListView.Columns.Add("id").Width = 0;
            SnmpCPUResultListView.Columns.Add("HostName").Width = 150;
            SnmpCPUResultListView.Columns.Add("CPU Id").TextAlign = HorizontalAlignment.Center;
            SnmpCPUResultListView.Columns.Add("CPU Load").TextAlign = HorizontalAlignment.Center;

            SnmpCPUResultlvwColumnSorter = new ListViewColumnSorter();
            SnmpCPUResultListView.ListViewItemSorter = SnmpCPUResultlvwColumnSorter;

            IniFile ini = new IniFile("SNMP config.ini");
            if (ini.Exists())
            {
                loadSnmpConfigFile();
            }

            //Refresh
            SnmpHostListView.Refresh();
            SnmpHDDResultListView.Refresh();
            SnmpCPUResultListView.Refresh();
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:46,代码来源:Dashboard.cs

示例7: 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"];
            }
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:18,代码来源:Dashboard.cs

示例8: loadGVPConfigFile

        private void loadGVPConfigFile()
        {
            IniFile ini = new IniFile("GVP Config.ini");
            if (ini.Exists())
            {
                ini.Load();
            }

            if (GVPReportingConfig != null)
            {
                GVPReportingConfig.hostname = ini["GVP Report DB"]["HostName"];
                GVPReportingConfig.port = ini["GVP Report DB"]["Port"];
                GVPReportingConfig.service = ini["GVP Report DB"]["Service"];
                GVPReportingConfig.table = ini["GVP Report DB"]["Table"];
                GVPReportingConfig.username = ini["GVP Report DB"]["Username"];
                GVPReportingConfig.password = ini["GVP Report DB"]["Password"];
            }
        }
开发者ID:arnaudcoquelet,项目名称:Genesys_DashBoard,代码行数:18,代码来源:Dashboard.cs


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