public void UpdateSalesCallFactView()
        {
            // read ini sql
            string validCallSql = "";
            if (_dbManager.SalesppIniPath != null && _dbManager.SalesppIniPath != string.Empty)
            {
                IniFile iniFile = new IniFile(_dbManager.SalesppIniPath);
                validCallSql = iniFile.IniReadValue("FieldInformer", "VALIDCALL");
            }

            // run sproc
            SqlConnection conn = _dbManager.GetDataSourceConnection();
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            try
            {
                cmd.CommandText = "EXEC spp.proc_create_V_OLAP_SALESCALL_FACT '" + validCallSql.Replace("'", "''") + "'";
                cmd.ExecuteNonQuery();
            }
            catch (Exception exc)
            {
                // ignore error cause otherwise default view will be created inside sproc
                exc = null;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
            }
        }
Example #2
0
		public static unsafe Bitmap ExtractThumb(IniFile map) {
			var prevSection = map.GetSection("Preview");
			var size = prevSection.ReadString("Size").Split(',');
			var previewSize = new Rectangle(int.Parse(size[0]), int.Parse(size[1]), int.Parse(size[2]), int.Parse(size[3]));
			var preview = new Bitmap(previewSize.Width, previewSize.Height, PixelFormat.Format24bppRgb);

			byte[] image = new byte[preview.Width * preview.Height * 3];
			var prevDataSection = map.GetSection("PreviewPack");
			var image_compressed = Convert.FromBase64String(prevDataSection.ConcatenatedValues());
			Format5.DecodeInto(image_compressed, image, 5);

			// invert rgb->bgr
			BitmapData bmd = preview.LockBits(new Rectangle(0, 0, preview.Width, preview.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
			int idx = 0;
			for (int y = 0; y < bmd.Height; y++) {
				byte* row = (byte*)bmd.Scan0 + bmd.Stride * y;
				byte* p = row;
				for (int x = 0; x < bmd.Width; x++) {
					byte b = image[idx++];
					byte g = image[idx++];
					byte r = image[idx++];
					*p++ = r;
					*p++ = g;
					*p++ = b;
				}
			}

			preview.UnlockBits(bmd);
			return preview;
		}
Example #3
0
		protected GameCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art) {
			Engine = engine;
			Theater = theater;
			Type = type;
			Rules = rules;
			Art = art;
		}
Example #4
0
        public Walkability(string templatesFile)
        {
            var file = new IniFile( FileSystem.Open( templatesFile ) );

            foreach (var section in file.Sections)
            {
                var tile = new TileTemplate
                {
                    Size = new int2(
                        int.Parse(section.GetValue("width", "0")),
                        int.Parse(section.GetValue("height", "0"))),
                    TerrainType = section
                        .Where(p => p.Key.StartsWith("tiletype"))
                        .ToDictionary(
                            p => int.Parse(p.Key.Substring(8)),
                            p => (TerrainType)Enum.Parse(typeof(TerrainType),p.Value)),
                    Name = section.GetValue("Name", null).ToLowerInvariant(),
                    Bridge = section.GetValue("bridge", null),
                    HP = float.Parse(section.GetValue("hp", "0"))
                };

                tile.Index = -1;
                int.TryParse(section.Name.Substring(3), out tile.Index);

                templates[tile.Name] = tile;
            }
        }
Example #5
0
 public IniLineProcessor(IniFile iniFile)
 {
     _iniFile = iniFile;
     _currentSection = null;
     _currentKeyValue = null;
     _currentComments = new List<string>();
 }
Example #6
0
        /// <summary>
        /// Artificial constructor called when the plugin is loaded
        /// Uses the obsolete mysql_connection.ini if connect string is empty.
        /// </summary>
        /// <param name="connect">connect string</param>
        public void Initialise(string connect)
        {
            if (connect != String.Empty)
            {
                database = new MySQLManager(connect);
            }
            else
            {
                m_log.Warn("Using deprecated mysql_connection.ini.  Please update database_connect in GridServer_Config.xml and we'll use that instead");

                IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
                string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
                string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
                string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
                string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
                string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
                string settingPort = GridDataMySqlFile.ParseFileReadValue("port");

                database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword,
                                            settingPooling, settingPort);
            }

            // This actually does the roll forward assembly stuff
            Assembly assem = GetType().Assembly;
            Migration m = new Migration(database.Connection, assem, "LogStore");

            // TODO: After rev 6000, remove this.  People should have
            // been rolled onto the new migration code by then.
            TestTables(m);

            m.Update();

        }
        /// <summary>
        /// <para>Initialises Inventory interface</para>
        /// <para>
        /// <list type="bullet">
        /// <item>Loads and initialises the MySQL storage plugin</item>
        /// <item>warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
        /// <item>Check for migration</item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="connect">connect string</param>
        public void Initialise(string connect)
        {
            if (connect != String.Empty)
            {
                database = new MySQLManager(connect);
            }
            else
            {
                m_log.Warn("Reverting to deprecated mysql_connection.ini file for connection info");
                IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
                string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
                string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
                string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
                string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
                string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
                string settingPort = GridDataMySqlFile.ParseFileReadValue("port");

                database =
                    new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
                                     settingPort);
            }

            // This actually does the roll forward assembly stuff
            Assembly assem = GetType().Assembly;
            Migration m = new Migration(database.Connection, assem, "InventoryStore");
            m.Update();
        }
Example #8
0
 public Theater(TheaterType theaterType, EngineType engine, IniFile rules, IniFile art)
 {
     _theaterType = theaterType;
     _engine = engine;
     _rules = rules;
     _art = art;
 }
Example #9
0
        /// <summary>
        /// Initialises the Grid Interface
        /// </summary>
        /// <param name="connectionString">connect string</param>
        /// <remarks>use mssql_connection.ini</remarks>
        override public void Initialise(string connectionString)
        {
            if (!string.IsNullOrEmpty(connectionString))
            {
                database = new MSSQLManager(connectionString);
            }
            else
            {
                // TODO: make the connect string actually do something
                IniFile iniFile = new IniFile("mssql_connection.ini");

                string settingDataSource = iniFile.ParseFileReadValue("data_source");
                string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
                string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
                string settingUserId = iniFile.ParseFileReadValue("user_id");
                string settingPassword = iniFile.ParseFileReadValue("password");

                m_regionsTableName = iniFile.ParseFileReadValue("regionstablename");
                if (m_regionsTableName == null)
                {
                    m_regionsTableName = "regions";
                }

                database =
                    new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
                                     settingPassword);
            }

            //New migrations check of store
            database.CheckMigration(_migrationStore);
        }
        public void CreateIniFileBasicTest()
        {
            var file = new IniFile();

            var section1 = file.Sections.Add("Section 1.");
            var section2 = file.Sections.Add("Section 2.");
            var section3 = file.Sections.Add("Section 3.");

            var key1 = section1.Keys.Add("Key 1.", "Value 1.");
            var key2 = section2.Keys.Add("Key 2.", "Value 2.");
            var key3 = section3.Keys.Add("Key 3.", "Value 3.");

            Assert.AreEqual(3, file.Sections.Count);

            Assert.AreEqual("Section 1.", section1.Name);
            Assert.AreEqual("Section 2.", section2.Name);
            Assert.AreEqual("Section 3.", section3.Name);

            Assert.AreEqual(1, section1.Keys.Count);
            Assert.AreEqual(1, section2.Keys.Count);
            Assert.AreEqual(1, section3.Keys.Count);

            Assert.AreEqual("Key 1.", key1.Name);
            Assert.AreEqual("Value 1.", key1.Value);
            Assert.AreEqual("Key 2.", key2.Name);
            Assert.AreEqual("Value 2.", key2.Value);
            Assert.AreEqual("Key 3.", key3.Name);
            Assert.AreEqual("Value 3.", key3.Value);
        }
        public void SerializeDeserializeAttributeTest()
        {
            var file = new IniFile();
            var section = file.Sections.Add("Sample Attributed Class");

            var serializedClass = new SampleAttributedClass();
            serializedClass.Initialize();

            section.Serialize(serializedClass);
            Assert.IsNull(section.Keys["FirstSampleProperty"]);
            Assert.IsNotNull(section.Keys["SecondSampleProperty"]);
            Assert.IsNotNull(section.Keys["3. Sample Property"]);
            Assert.IsNotNull(section.Keys["FourthSampleProperty"]);

            var deserializedClass = section.Deserialize<SampleAttributedClass>();
            Assert.AreNotEqual(serializedClass.FirstSampleProperty, deserializedClass.FirstSampleProperty);
            Assert.IsNull(deserializedClass.FirstSampleProperty);
            Assert.AreEqual(serializedClass.SecondSampleProperty, deserializedClass.SecondSampleProperty);
            Assert.AreEqual(serializedClass.ThirdSampleProperty, deserializedClass.ThirdSampleProperty);
            Assert.IsTrue(
                // null
                string.IsNullOrEmpty(serializedClass.FourthSampleProperty) &&
                // string.Empty
                string.IsNullOrEmpty(deserializedClass.FourthSampleProperty));
        }
Example #12
0
        static void Main(string[] args)
        {
            #region 处理来自参数的快速启动请求,跳过对OPCSERVER的三分钟等待
            foreach (string arg in args)
            {
                if (arg.Contains("fast"))
                {
                    waitMillionSecond = 1000;
                    break;
                }

            }
            #endregion
            bool createNew;
            //try
            //{
            //Console.WriteLine(Application.ProductName);
            using (System.Threading.Mutex m = new System.Threading.Mutex(true, "Global\\" + Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    IniFile ini = new IniFile(AppDomain.CurrentDomain.BaseDirectory + "MicroDAQ.ini");

                    DatabaseManager = new DatabaseManager(ini.GetValue("Database", "Address"),
                                                        ini.GetValue("Database", "Port"),
                                                        ini.GetValue("Database", "Database"),
                                                        ini.GetValue("Database", "Username"),
                                                        ini.GetValue("Database", "Password"));
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    Form MainForm = null;
                    while (!BeQuit)
                        try
                        {
                            MainForm = new MainForm();
                            //frmMain = new TestAlarm();
                            Application.Run(MainForm);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("OH. NO!" + ex.ToString());
                        }
                        finally
                        {
                            if (MainForm != null) MainForm.Dispose();
                        }
                    Environment.Exit(Environment.ExitCode);
                }
                else
                {
                    MessageBox.Show("程序已经在运行,无法再次启动。", "已启动", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            //}
            //catch
            //{
            //    MessageBox.Show("Only one instance of this application is allowed!");
            //}
        }
Example #13
0
        /// <summary>
        /// Initialises asset interface
        /// </summary>
        /// <para>
        /// a string instead of file, if someone writes the support
        /// </para>
        /// <param name="connectionString">connect string</param>
        override public void Initialise(string connectionString)
        {
            m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks;

            if (!string.IsNullOrEmpty(connectionString))
            {
                m_database = new MSSQLManager(connectionString);
            }
            else
            {
                IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini");
                string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source");
                string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog");
                string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info");
                string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id");
                string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password");

                m_database =
                    new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
                                     settingPassword);
            }

            //New migration to check for DB changes
            m_database.CheckMigration(_migrationStore);
        }
Example #14
0
        public void AddsSection()
        {
            var iniFile = new IniFile(new Sentence());

            var s1 = iniFile.AddSection("foo");
            Assert.AreEqual(s1, iniFile["foo"]);
            Assert.AreEqual(s1, ((dynamic)iniFile).foo);
        }
Example #15
0
 protected override void LoadConditions(IniFile ini) {
     if (KunosCareerType == KunosCareerObjectType.SingleEvents) {
         base.LoadConditions(ini);
     } else {
         ConditionType = null;
         FirstPlaceTarget = SecondPlaceTarget = ThirdPlaceTarget = null;
     }
 }
 public RBACManagerModel(string settingsPath)
 {
     this.settingsPath = settingsPath;
     databaseSettings = new MysqlModel();
     ini = new IniFile();
     LoadSettings();
     mysqlConnection = new Mysql(databaseSettings);
 }
Example #17
0
        public void CreatesIniFile()
        {
            var iniFile = new IniFile(new Sentence());
            Assert.IsNull(iniFile["foo"]);
            Assert.IsFalse(iniFile.Sections.Any());

            IniSection sec = ((dynamic)iniFile).foo;
            Assert.IsNull(sec);
        }
Example #18
0
        void cmdMnuControl_TrimFileDialogPressed(object sender, TrimCommandMenu.TrimFileDialogEventsArgs e)
        {
            if (e.Filedialog == "Open")
            {
                string _fileName = string.Empty;
                this.openFD.Title = "Open a Robot Trim File";
                this.openFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                this.openFD.FileName = string.Empty;
                this.openFD.Filter = "Robot Trim files|*.rcb|All files|*.*";
                if (this.openFD.ShowDialog() != DialogResult.Cancel)
                {
                    trimFile = new IniFile(this.openFD.FileName);
                    if (trimFile.Exists())
                    {
                        if (trimFile.Load())
                        {
                            try
                            {
                                // Load the selected trim file
                                saServo = trimFile["Trim"]["Prm"].Split(',');
                                // Position the sliders on the UI
                                trimservosSlider(saServo);
                                // Send the servo trim values to the server
                                trimservos.changeAllChannels(saServo);
                            }
                            catch
                            {
                                MessageBox.Show("No Trim file...");
                            }
                        }
                    }
                }

            }
            else if (e.Filedialog == "Save")
            {
                string str = string.Empty;
                string[] strArray = new string[StaticUtilities.numberOfServos];
                for (int i = 0; i < StaticUtilities.numberOfServos; i++)
                {
                    strArray[i] = horizontalSliderArray[i].sliderValue.ToString();
                }
                str = string.Join(",", strArray);
                this.saveFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                this.saveFD.Title = "Save the Robot Trim File";
                this.saveFD.Filter = "Robot Trim Files|*.rcb|All files|*.*";
                this.saveFD.AddExtension = true;
                if (this.saveFD.ShowDialog() != DialogResult.Cancel)
                {
                    trimFile = new IniFile(this.saveFD.FileName);
                    IniSection section = new IniSection();
                    section.Add("Prm", str);
                    trimFile.Add("Trim", section);
                    trimFile.Save();
                }
            }
        }
        public sealed override void Set(IniFile file) {
            try {
                if (file["REMOTE"].GetBool("ACTIVE", false) || file["REMOTE"].GetBool("BENCHMARK", false)) return;

                var weatherId = file["WEATHER"].GetNonEmpty("NAME");
                var weather = weatherId == null ? null : WeatherManager.Instance.GetById(weatherId);
                _requiresDisposal = weather != null && SetOverride(weather);
            } catch (Exception e) {
                Logging.Warning($"[{GetType().Name}] Set(): " + e);
                _requiresDisposal = false;
            }
        }
        public void SerializeDeserializeTest()
        {
            var file = new IniFile();
            var section = file.Sections.Add("Sample Class");

            var serializedClass = new SampleClass();
            serializedClass.Initialize();

            section.Serialize(serializedClass);
            var deserializedClass = section.Deserialize<SampleClass>();

            Assert.IsTrue(serializedClass.Equals(deserializedClass));
        }
Example #21
0
        public void MergesDuplicateSection()
        {
            var iniFile = new IniFile(new Sentence(), new IniSettings
            {
                DuplicateSectionHandling = DuplicateSectionHandling.Merge
            });

            iniFile.AddSection("foo");
            iniFile.AddSection("foo");

            Assert.IsTrue(iniFile.Sections.Count() == 1);
            Assert.IsTrue(iniFile.Sections.Count(x => x == "foo") == 1);
        }
Example #22
0
        public void RendersIniWithoutFormattingOptions()
        {
            var iniFile = new IniFile();
            var bar = iniFile.AddSection("bar");
            bar.AddComment("foo");
            bar.AddProperty("baz", "baaz");
            bar.AddProperty("qux", "quux");

            var baar = iniFile.AddSection("baar");
            baar.AddProperty("baaz", "baaaz");
            baar.AddProperty("quux", "quuux");

            var iniText = IniRenderer.Render(iniFile.GlobalSection, FormattingOptions.None);
        }
Example #23
0
 public dynamic GetIniValue( string file, string section, string key )
 {
     dynamic configIniFile = null;
     try {
         if(file == PrefsConfigFile()) {
             configIniFile = new IniFile( PrefsConfigFile() );
         } else if(file == ConfigFile()) {
             configIniFile = new IniFile( ConfigFile() );
         }
     } catch(Exception)
     {
         return null;
     }
     return configIniFile.Read( section, key );
 }
        public KHR_1HV_MotionFile()
        {
            khr_1hv_motion = new IniFile("");
            IniSection section = new IniSection();

            section.Add("Type", "0");
            section.Add("Width", "854");
            section.Add("Height", "480");
            section.Add("Items", "0");
            section.Add("Links", "0");
            section.Add("Start", "-1");
            section.Add("Name", "");
            section.Add("Ctrl", "65535");
            khr_1hv_motion.Add("GraphicalEdit", section);
        }
Example #25
0
        private void LoadIniFile()
        {
            IniFile iniFile = new IniFile(strINIPath);

            D0200.Text = iniFile.GetString("PARAMETER", "Cycle Run", "");
            D0201.Text = iniFile.GetString("PARAMETER", "MFC Flow Set", "");
            D0202.Text = iniFile.GetString("PARAMETER", "MFC Flow Time Set", "");
            D0203.Text = iniFile.GetString("PARAMETER", "Lock in Pressure", "");
            D0204.Text = iniFile.GetString("PARAMETER", "Lock in Pressure Alarm", "");
            D0205.Text = iniFile.GetString("PARAMETER", "Watt value Set", "");
            D0206.Text = iniFile.GetString("PARAMETER", "Watt value Alarm", "");
            D0207.Text = iniFile.GetString("PARAMETER", "Current value Set", "");
            D0208.Text = iniFile.GetString("PARAMETER", "Current value Alarm", "");
            D0209.Text = iniFile.GetString("PARAMETER", "LVG", "");
            D0210.Text = iniFile.GetString("PARAMETER", "HVG", "");   
        }
Example #26
0
        private void SaveIniFile()
        {
            IniFile iniFile = new IniFile(strINIPath);

            iniFile.WriteValue("PARAMETER", "Cycle Run", D0200.Text);
            iniFile.WriteValue("PARAMETER", "MFC Flow Set", D0201.Text);
            iniFile.WriteValue("PARAMETER", "MFC Flow Time Set", D0202.Text);
            iniFile.WriteValue("PARAMETER", "Lock in Pressure", D0203.Text);
            iniFile.WriteValue("PARAMETER", "Lock in Pressure Alarm", D0204.Text);
            iniFile.WriteValue("PARAMETER", "Watt value Set", D0205.Text);
            iniFile.WriteValue("PARAMETER", "Watt value Alarm", D0206.Text);
            iniFile.WriteValue("PARAMETER", "Current value Set", D0207.Text);
            iniFile.WriteValue("PARAMETER", "Current value Alarm", D0208.Text);
            iniFile.WriteValue("PARAMETER", "LVG", D0209.Text);
            iniFile.WriteValue("PARAMETER", "HVG", D0210.Text);
        }
        //=======================
        //  DEFAULT CONSTRUCTOR
        //=======================
        public KHR_1HV_IniFile()
        {
            khr_1hv_ini = new IniFile("./KHR-1HV.ini");
            if (khr_1hv_ini.Exists())
                khr_1hv_ini.Load();
            else
            {
                IniSection section = new IniSection();
                section.Add("IPAddress", "0.0.0.0");
                section.Add("Grid", "1");
                section.Add("GridWidth", "5");
                section.Add("GridHeight", "5");
                section.Add("Form", "804,900,-2147483633");
                section.Add("Bmp", "");
                section.Add("Background", "0");
                section.Add("CH1", "1,0,0,-2147483633,0,1,CH1");
                section.Add("CH2", "1,0,31,-2147483633,0,1,CH2");
                section.Add("CH3", "1,0,62,-2147483633,0,1,CH3");
                section.Add("CH4", "1,0,93,-2147483633,0,1,CH4");
                section.Add("CH5", "1,0,124,-2147483633,0,1,CH5");
                section.Add("CH6", "1,0,155,-2147483633,0,1,CH6");
                section.Add("CH7", "1,0,186,-2147483633,0,1,CH7");
                section.Add("CH8", "1,0,217,-2147483633,0,1,CH8");
                section.Add("CH9", "1,0,248,-2147483633,0,1,CH9");
                section.Add("CH10", "1,0,279,-2147483633,0,1,CH10");
                section.Add("CH11", "1,0,310,-2147483633,0,1,CH11");
                section.Add("CH12", "1,0,341,-2147483633,0,1,CH12");
                section.Add("CH13", "1,329,0,-2147483633,0,1,CH13");
                section.Add("CH14", "1,329,31,-2147483633,0,1,CH14");
                section.Add("CH15", "1,329,62,-2147483633,0,1,CH15");
                section.Add("CH16", "1,329,93,-2147483633,0,1,CH16");
                section.Add("CH17", "1,329,124,-2147483633,0,1,CH17");
                section.Add("CH18", "1,329,155,-2147483633,0,1,CH18");
                section.Add("CH19", "1,329,186,-2147483633,0,1,CH19");
                section.Add("CH20", "1,329,217,-2147483633,0,1,CH20");
                section.Add("CH21", "1,329,248,-2147483633,0,1,CH21");
                section.Add("CH22", "1,329,279,-2147483633,0,1,CH22");
                section.Add("CH23", "1,329,310,-2147483633,0,1,CH23");
                section.Add("CH24", "1,329,341,-2147483633,0,1,CH24");
                section.Add("SPEED", "1,0,372,-2147483633");
                section.Add("CMD", "1,0,403,-2147483633");
                section.Add("LINK", "1,329,372,-2147483633");
                khr_1hv_ini.Add("KHR-1HV", section);

                khr_1hv_ini.Save();
            }
        }
Example #28
0
		public ObjectCollection(CollectionType type, TheaterType theater, EngineType engine, IniFile rules, IniFile art,
			IniFile.IniSection objectsList, PaletteCollection palettes)
			: base(type, theater, engine, rules, art) {

			Palettes = palettes;
			if (engine >= EngineType.RedAlert2) {
				string fireNames = Rules.ReadString(Engine == EngineType.RedAlert2 ? "AudioVisual" : "General",
					"DamageFireTypes", "FIRE01,FIRE02,FIRE03");
				FireNames = fireNames.Split(new[] { ',', '.' }, StringSplitOptions.RemoveEmptyEntries);
			}

			foreach (var entry in objectsList.OrderedEntries) {
				if (!string.IsNullOrEmpty(entry.Value)) {
					Logger.Trace("Loading object {0}.{1}", objectsList.Name, entry.Value);
					AddObject(entry.Value);
				}
			}
		}
Example #29
0
        /// <summary>
        /// Fills a field with the radii found in the default profile
        /// </summary>
        /// <param name="comboBox">The ComboBox to fill</param>
        /// <param name="listBox">The ListBox to fill</param>
        public void FillField(ComboBox comboBox, [Optional, DefaultParameterValue(null)] ListBox listBox)
        {
            // Method vars
            int counter = 0; string iniValue; string[] iniSplit;

            // Clear the current items
            if (listBox == null && comboBox != null)
                comboBox.Items.Clear();
            else if (listBox != null && comboBox == null)
                listBox.Items.Clear();

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>current profile</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");

                while (counter != -1)
                {
                    // Read the radius value
                    iniValue = iniFile.ReadValue("RADII", counter.ToString());

                    if (iniValue != "")
                    {
                        // Split the radius string
                        iniSplit = iniValue.Split(',');

                        // Add the new item to the list
                        if (listBox == null && comboBox != null)
                            comboBox.Items.Add(iniSplit[0].ToString() + " (" + iniSplit[1] + ")");
                        else if (listBox != null && comboBox == null)
                            listBox.Items.Add(iniSplit[0].ToString() + " (" + iniSplit[1] + ")");

                        // Increase the counter
                        counter++;
                    }
                    else
                    {
                        // Break out of the loop
                        counter = -1;
                    }
                }
            }
        }
Example #30
0
		public Theater(TheaterType theaterType, EngineType engine) {
			_theaterType = theaterType;
			_engine = engine;
			if (engine == EngineType.RedAlert2 || engine == EngineType.TiberianSun) {
				_rules = VFS.Open<IniFile>("rules.ini");
				_art = VFS.Open<IniFile>("art.ini");
			}
			else if (engine == EngineType.YurisRevenge) {
				_rules = VFS.Open<IniFile>("rulesmd.ini");
				_art = VFS.Open<IniFile>("artmd.ini");
			}
			else if (engine == EngineType.Firestorm) {
				_rules = VFS.Open<IniFile>("rules.ini");
				var fsRules = VFS.Open<IniFile>("firestrm.ini");
				Logger.Info("Merging Firestorm rules with TS rules");
				_rules.MergeWith(fsRules);
				_art = VFS.Open<IniFile>("artmd.ini");
			}
		}