LoadFile() private method

private LoadFile ( string filePath ) : IniParser.IniData
filePath string
return IniParser.IniData
示例#1
0
        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);
        }
示例#2
0
        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();
        }
示例#3
0
        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);
        }
 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;
 }
示例#5
0
        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"));
        }
示例#6
0
文件: Ini.cs 项目: andrusender/YesPos
 private Config(string path)
 {
     FilePath = path;
     FileHandler = new FileIniDataParser();
     ConfigHandler = FileHandler.LoadFile(path);
     //Fill Dictionary
     ReplacingData.Add("$(root)",Global.AppDir);
 }
        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
0
        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
0
        public string GetSectionDetails(string section_nm, string delimeter)
        {
            parsedData = parser.LoadFile(this.path);
            string strCon = "";

            foreach (SectionData section in parsedData.Sections)
            {
                if (section.SectionName == section_nm)
                {
                    foreach (KeyData key in section.Keys)
                    {
                        strCon += key.KeyName + "=" + key.Value + delimeter;
                    }
                    break;
                }
            }
            return(strCon);
        }
示例#10
0
 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
0
 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;
 }
示例#12
0
        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
0
文件: Program.cs 项目: halo779/EoEmu
        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();
        }
示例#14
0
 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
0
 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;
 }
示例#16
0
 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;
 }
        private void Initialize()
        {
            var parser = new FileIniDataParser();
            var data = parser.LoadFile("config.ini");
            _host = data["database"]["hostname"];
            _database = data["database"]["database"];
            _username = data["database"]["user"];
            _password = data["database"]["password"];
            _port = data["database"]["port"];

            var conString = string.Format(
                "SERVER={0};PORT={1};DATABASE={2};UID={3};PASSWORD={4};",
                _host, _port, _database, _username, _password);

            _connection = new MySqlConnection(conString);
        }
示例#18
0
        public static HashFile OpenFile(string filePath)
        {
            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.Delete(filePath);
            }
            using (var newFile = System.IO.File.Create(filePath))
            {
                newFile.Flush();
            }

            IniParser.FileIniDataParser parser = new IniParser.FileIniDataParser();
            var iniData = parser.LoadFile(filePath);

            return new HashFile(iniData) { FileName = filePath };
        }
示例#19
0
        static MasterServerClient CreateMasterServerClient(GameServer server)
        {
            IniData data = null;

            try
            {
                IniParser.FileIniDataParser parser = new IniParser.FileIniDataParser();
                data = parser.LoadFile("GameServer.ini");
            }
            catch (System.Exception ex)
            {
                Logger.Error(ex.Message);
            }

            return(new MasterServerClient(server,
                                          GetValue(data, "Master", "GUID", "none")));
        }
示例#20
0
        static GameServer CreateServer()
        {
            IniData data = null;

            try
            {
                IniParser.FileIniDataParser parser = new IniParser.FileIniDataParser();
                data = parser.LoadFile("GameServer.ini");
            }
            catch (System.Exception ex)
            {
                Logger.Error(ex.Message);
            }

            return(new GameServer(
                       GetValue(data, "General", "Name", "Default server name"),
                       GetValue(data, "General", "Port", 14242)));
        }
示例#21
0
        public static HashFile OpenFile(string filePath)
        {
            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.Delete(filePath);
            }
            using (var newFile = System.IO.File.Create(filePath))
            {
                newFile.Flush();
            }

            IniParser.FileIniDataParser parser = new IniParser.FileIniDataParser();
            var iniData = parser.LoadFile(filePath);

            return(new HashFile(iniData)
            {
                FileName = filePath
            });
        }
        public TeamPilgrimSettings()
        {
            _parser = new FileIniDataParser();

            try
            {
                _iniData = _parser.LoadFile(GetSettingsFilePath);
            }
            catch (Exception)
            {
                _iniData = new IniData();
                SelectedWorkItemCheckinAction = SelectedWorkItemCheckinAction;
                PreviouslySelectedWorkItemQueriesValueSeperator = PreviouslySelectedWorkItemQueriesValueSeperator;
                PreviouslySelectedWorkItemQueriesMaxCount = PreviouslySelectedWorkItemQueriesMaxCount;
                PreserveShelvedChangesLocally = PreserveShelvedChangesLocally;
                EvaluatePoliciesDuringShelve = EvaluatePoliciesDuringShelve;
                Save();
            }

            PreviouslySelectedWorkItemsQueries = new PreviouslySelectedWorkItemsQueriesCollection(this);
        }
示例#23
0
        static void Main(string[] args)
        {
            Functions.InitColors();

            FileIniDataParser Info = new FileIniDataParser();
            IniData Values = null;
            try
            {
                Values = Info.LoadFile("config.ini");
            }
            catch
            {
                Console.WriteLine ("Could not read config.ini!");
                Console.ReadLine ();
                return;
            }

            IPAddress IP = IPAddress.Any;

            string[] serverInfo = new string[]
            {
              	Values["SERVER"]["SERVPORT"],
              	Values["POOL"]["POOL"],
              	Values["POOL"]["POOLPORT"],
            };

            foreach(string s in serverInfo)
            {
                if (string.IsNullOrEmpty (s))
                {
                    Console.WriteLine("Error in config.ini!");
                    Console.ReadLine ();
                    return;
                }
            }

            startServer (IP, int.Parse(serverInfo[0]), serverInfo[1], int.Parse(serverInfo[2]));
        }
示例#24
0
        private string GetEmuleAdunanzATcpPort()
        {
            //Create an instance of a ini file parser
            IniParser.FileIniDataParser iniparser = new FileIniDataParser();

            IniData data = iniparser.LoadFile(GetEmuleAdunanzAConfigPath());

            return data["eMule"]["Port"];
        }
示例#25
0
        public void Issue4_Tests()
        {
            FileIniDataParser fileParser = new FileIniDataParser();

            IniData data = fileParser.LoadFile(strBadSectionINIFilePath, true);

            Assert.That(data, Is.Not.Null);
            Assert.That(data.Sections.Count, Is.EqualTo(2));
            Assert.That(data.Sections.GetSectionData("seccion1").Keys.Count, Is.EqualTo(2));

            data = fileParser.LoadFile(strBadKeysINIFilePath, true);

            Assert.That(data, Is.Not.Null);
            Assert.That(data.Sections.GetSectionData("seccion1").Keys.Count, Is.EqualTo(1));
        }
示例#26
0
        private void SetEmuleAdunanzAUdpPort(int port)
        {
            if ((port > 65554) && (port == 0))
            {
                throw new Exception("la Porta UDP da configurare non e' valida");
            }

            //Create an instance of a ini file parser
            IniParser.FileIniDataParser iniparser = new FileIniDataParser();

            IniData data = iniparser.LoadFile(GetEmuleAdunanzAConfigPath());
            data["eMule"]["UDPPort"] = port.ToString();
        }
 private static AnyDVDDiscInf GetAnyDVDDiscInf(Disc disc)
 {
     var discInf = disc.FileSystem.Files.AnyDVDDiscInf;
     if (discInf == null)
         return null;
     var parser = new FileIniDataParser();
     var data = parser.LoadFile(discInf.FullName);
     var discData = data["disc"];
     var anyDVDDiscInf = new AnyDVDDiscInf
         {
             AnyDVDVersion = discData["version"],
             VolumeLabel = discData["label"],
             Region = RegionCodeParser.Parse(discData["region"])
         };
     return anyDVDDiscInf;
 }
示例#28
0
        private static void ReadConfiguration(string cfgFile)
        {
            var ini = new FileIniDataParser();
            var data = ini.LoadFile(cfgFile);

            try
            {
                s_appId = Int32.Parse(data["VKApplication"]["id"]);
            }
            catch (Exception)
            {
                throw new AppConfigurationException("VKApplication.id");
            }
        }
示例#29
0
文件: Program.cs 项目: st4l/BEsharp
        private static bool ParseBatchFile(string batchFile, CommandExecutor executor)
        {
            var parser = new FileIniDataParser { CommentDelimiter = (char)0 };
            IniData data;
            try
            {
                data = parser.LoadFile(batchFile);
            }
            catch (ParsingException pex)
            {
                Console.WriteLine(pex.Message);
                return false;
            }

            if (!ValidateIniSettingExists(data, "Servers")
                || !ValidateIniSettingExists(data, "Commands"))
            {
                return false;
            }

            // Get db settings even if we don't need to get the servers from it
            executor.DbConnectionString = GetIniDbConnectionString(data);

            if (IsIniTrue(data["Servers"]["UseBNetDb"]))
            {
                if (executor.DbConnectionString == null)
                {
                    Console.WriteLine("Invalid or not specified connection string.");
                    return false;
                }

                executor.Servers = executor.GetDbServers();
            }
            else
            {
                var serverUris = from keyData in data["Servers"]
                                 where keyData.KeyName != "UseBNetDb"
                                 select keyData.Value;
                executor.Servers = ParseServerUris(serverUris);
            }

            if (executor.Servers == null || !executor.Servers.Any())
            {
                Console.WriteLine("No servers specified.");
                return false;
            }

            executor.Commands = from keyData in data["Commands"] select keyData.Value;
            if (!executor.Commands.Any())
            {
                Console.WriteLine("No commands specified.");
                return false;
            }

            return true;
        }
        public void configureGamepad(string customCfgFile)
        {
            var profileINI = new FileIniDataParser();
            IniData profileData = profileINI.LoadFile(customCfgFile);

            buttonMap["A"] = Convert.ToUInt32(profileData["ButtonMapping"]["buttonA"]);
            buttonMap["B"] = Convert.ToUInt32(profileData["ButtonMapping"]["buttonB"]);
            buttonMap["X"] = Convert.ToUInt32(profileData["ButtonMapping"]["buttonX"]);
            buttonMap["Y"] = Convert.ToUInt32(profileData["ButtonMapping"]["buttonY"]);
            buttonMap["LStick"] = Convert.ToUInt32(profileData["ButtonMapping"]["Lstick"]);
            buttonMap["RStick"] = Convert.ToUInt32(profileData["ButtonMapping"]["Rstick"]);
            buttonMap["LBump"] = Convert.ToUInt32(profileData["ButtonMapping"]["Lbump"]);
            buttonMap["RBump"] = Convert.ToUInt32(profileData["ButtonMapping"]["Rbump"]);
            buttonMap["Back"] = Convert.ToUInt32(profileData["ButtonMapping"]["back"]);
            buttonMap["Start"] = Convert.ToUInt32(profileData["ButtonMapping"]["start"]);
            buttonMap["Guide"] = Convert.ToUInt32(profileData["ButtonMapping"]["guide"]);

            directionMap["Neutral"] = -1;
            directionMap["Up"] = 0;
            directionMap["UpRight"] = 4500;
            directionMap["Right"] = 9000;
            directionMap["DownRight"] = 13500;
            directionMap["Down"] = 18000;
            directionMap["DownLeft"] = 22500;
            directionMap["Left"] = 27000;
            directionMap["UpLeft"] = 31500;

            if (Convert.ToBoolean(profileData["TriggerSettings"]["trigAsBttn"]))
            {
                buttonMap["LTrig"]  = Convert.ToUInt32(profileData["TriggerSettings"]["Ltrig"]);
                buttonMap["RTrig"]  = Convert.ToUInt32(profileData["TriggerSettings"]["Rtrig"]);

                axisMap["LX"] = HID_USAGES.HID_USAGE_X;
                axisMap["LY"] = HID_USAGES.HID_USAGE_Y;
                axisMap["RX"] = HID_USAGES.HID_USAGE_Z;
                axisMap["RY"] = HID_USAGES.HID_USAGE_RZ;
            }
            else
            {
                axisMap["LX"] = HID_USAGES.HID_USAGE_X;
                axisMap["LY"] = HID_USAGES.HID_USAGE_Y;
                axisMap["RX"] = HID_USAGES.HID_USAGE_RX;
                axisMap["RY"] = HID_USAGES.HID_USAGE_RY;
                axisMap["LTrig"] = HID_USAGES.HID_USAGE_Z;
                axisMap["RTrig"] = HID_USAGES.HID_USAGE_RZ;
            }
        }
示例#31
0
文件: Settings.cs 项目: Jaex/SMBStats
        public bool Load()
        {
            if (File.Exists(SettingFile))
            {
                try
                {
                    FileIniDataParser parser = new FileIniDataParser();
                    IniData data = parser.LoadFile(SettingPath);

                    string autoLoad = data["Settings"]["AutoLoad"];
                    if (!string.IsNullOrEmpty(autoLoad)) AutoLoad = CheckBool(autoLoad);

                    string autoUpdate = data["Settings"]["AutoUpdate"];
                    if (!string.IsNullOrEmpty(autoUpdate)) AutoUpdate = CheckBool(autoUpdate);

                    LastLoadPath = data["Settings"]["LastLoadPath"];

                    string steamID = data["Settings"]["SteamID"];
                    if (!string.IsNullOrEmpty(steamID)) SteamID = Convert.ToInt64(steamID);

                    UserKey = data["Settings"]["UserKey"];

                    return true;
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                }
            }

            return false;
        }
示例#32
0
        private void readConfiguration(String filePath)
        {
            FileIniDataParser parser = new FileIniDataParser();

            int i = 3;

            while (i != 0)
            {
                try
                {
                    config = parser.LoadFile(filePath);

                    EntriesInView = Convert.ToInt32(config["settings"]["entriesInView"]);
                    Boolean autoTrigger = Convert.ToBoolean(config["settings"]["autoTrigger"]);
                    isEnabled = Convert.ToBoolean(config["settings"]["enableDisable"]);
                    TriggerDelay = Convert.ToInt32(config["settings"]["triggerDelay"]);
                    this.tourEnabled = Convert.ToBoolean(config["settings"]["tourEnabled"]);
                    setHotkeys(config);

                    if (autoTrigger)
                    {
                        Mode = TriggerMode.AUTO_TRIGGER;
                    }
                    else
                    {
                        Mode = TriggerMode.MANUAL_TRIGGER;
                    }
                    break;
                }
                catch (ParsingException e)
                {
                    Thread.Sleep(100);
                    i--;
                }
            }
        }
示例#33
0
        public injector(String path)
        {
            this.path = path;

            parsedData = parser.LoadFile(path);
        }
示例#34
0
 private void loadPreset()
 {
     parsedData  = parser.LoadFile(path);
     name        = parsedData["preset"]["name"];
     description = parsedData["preset"]["description"];
 }