public void Save(string iFileName)
        {
            XmlTextWriter xmlTextWriter = new XmlTextWriter(iFileName, Encoding.UTF8);

            xmlTextWriter.Indentation = 2;
            xmlTextWriter.Formatting  = Formatting.Indented;
            xmlTextWriter.WriteStartDocument();
            xmlTextWriter.WriteStartElement("RandomStatics");
            xmlTextWriter.WriteAttributeString("Chance", StringType.FromInteger(this.m_Freq));

            IEnumerator enumerator = this.InnerList.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    RandomStaticCollection randomStaticCollection = (RandomStaticCollection)enumerator.Current;
                    randomStaticCollection.Save(xmlTextWriter);
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    ((IDisposable)enumerator).Dispose();
                }
            }
            xmlTextWriter.WriteEndElement();
            xmlTextWriter.WriteEndDocument();
            xmlTextWriter.Close();
        }
        public void Add(RandomStaticCollection Value)
        {
            this.InnerList.Add(Value);
            byte count = checked ((byte)Value.Count);

            for (byte i = 0; i <= count; i = checked ((byte)(i + 1)))
            {
                this.m_Random.Add(Value, null, null, null);
            }
        }
        public void Add(RandomStaticCollection Value)
        {
            this.InnerList.Add(Value);
            byte arg_17_0 = 0;
            byte b        = checked ((byte)Value.Count);

            for (byte b2 = arg_17_0; b2 <= b; b2 += 1)
            {
                this.m_Random.Add(Value, null, null, null);
            }
        }
        public void Add(RandomStaticCollection Value)
        {
            this.InnerList.Add((object)Value);
            int  num1 = 0;
            byte num2 = checked ((byte)Value.Count);

            for (byte index = (byte)num1; (int)index <= (int)num2; ++index)
            {
                this.m_Random.Add((object)Value, (string)null, (object)null, (object)null);
            }
        }
Example #5
0
        public RandomStatics(string iFileName)
        {
            this.m_Random = new Collection();
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                #region Data Directory Modification

                string filename = string.Format("{0}Data\\Engine\\TerrainTypes\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName);

                #endregion

                xmlDocument.Load(filename);
                XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics");
                this.m_Freq = (int)XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));

                IEnumerator enumerator = xmlElement.SelectNodes("Statics").GetEnumerator();

                try
                {
                    while (enumerator.MoveNext())
                    {
                        XmlElement             xmlInfo = (XmlElement)enumerator.Current;
                        RandomStaticCollection randomStaticCollection = new RandomStaticCollection(xmlInfo);
                        this.InnerList.Add(randomStaticCollection);
                        if (randomStaticCollection.Freq > 0)
                        {
                            byte arg_AC_0 = 1;
                            byte b        = checked ((byte)randomStaticCollection.Freq);
                            for (byte b2 = arg_AC_0; b2 <= b; b2 += 1)
                            {
                                this.m_Random.Add(randomStaticCollection, null, null, null);
                            }
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        ((IDisposable)enumerator).Dispose();
                    }
                }
            }
            catch (Exception expr_F8)
            {
                ProjectData.SetProjectError(expr_F8);
                Interaction.MsgBox("Can not find:" + iFileName, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
        }
        public RandomStatics(string iFileName)
        {
            this.m_Random = new Collection();
            XmlDocument xmlDocument = new XmlDocument();
            try
            {
                string filename = string.Format("{0}Data\\Statics\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName);
                xmlDocument.Load(filename);
                XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics");
                this.m_Freq = (int)XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));

                IEnumerator enumerator = xmlElement.SelectNodes("Statics").GetEnumerator();

                try
                {
                    while (enumerator.MoveNext())
                    {
                        XmlElement xmlInfo = (XmlElement)enumerator.Current;
                        RandomStaticCollection randomStaticCollection = new RandomStaticCollection(xmlInfo);
                        this.InnerList.Add(randomStaticCollection);
                        if (randomStaticCollection.Freq > 0)
                        {
                            byte arg_AC_0 = 1;
                            byte b = checked((byte)randomStaticCollection.Freq);
                            for (byte b2 = arg_AC_0; b2 <= b; b2 += 1)
                            {
                                this.m_Random.Add(randomStaticCollection, null, null, null);
                            }
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        ((IDisposable)enumerator).Dispose();
                    }
                }
            }
            catch (Exception expr_F8)
            {
                ProjectData.SetProjectError(expr_F8);
                Interaction.MsgBox("Can not find:" + iFileName, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
        }
        public RandomStatics(string iFileName)
        {
            IEnumerator enumerator = null;

            this.m_Random = new Collection();
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                string str = string.Format("{0}Data\\Statics\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName);
                xmlDocument.Load(str);
                XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics");
                this.m_Freq = XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));
                try
                {
                    enumerator = xmlElement.SelectNodes("Statics").GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        RandomStaticCollection randomStaticCollection = new RandomStaticCollection((XmlElement)enumerator.Current);
                        this.InnerList.Add(randomStaticCollection);
                        if (randomStaticCollection.Freq > 0)
                        {
                            byte freq = checked ((byte)randomStaticCollection.Freq);
                            for (byte i = 1; i <= freq; i = checked ((byte)(i + 1)))
                            {
                                this.m_Random.Add(randomStaticCollection, null, null, null);
                            }
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        ((IDisposable)enumerator).Dispose();
                    }
                }
            }
            catch (Exception exception)
            {
                ProjectData.SetProjectError(exception);
                Interaction.MsgBox(string.Concat("Can not find:", iFileName), MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
        public RandomStatics(string iFileName)
        {
            this.m_Random = new Collection();
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                string filename = string.Format("{0}Data\\Statics\\{1}", (object)AppDomain.CurrentDomain.BaseDirectory, (object)iFileName);
                xmlDocument.Load(filename);
                XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics");
                this.m_Freq = (int)XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));
                try
                {
                    foreach (XmlElement xmlInfo in xmlElement.SelectNodes("Statics"))
                    {
                        RandomStaticCollection staticCollection = new RandomStaticCollection(xmlInfo);
                        this.InnerList.Add((object)staticCollection);
                        if (staticCollection.Freq > 0)
                        {
                            int  num1 = 1;
                            byte num2 = checked ((byte)staticCollection.Freq);
                            for (byte index = (byte)num1; (int)index <= (int)num2; ++index)
                            {
                                this.m_Random.Add((object)staticCollection, (string)null, (object)null, (object)null);
                            }
                        }
                    }
                }
                finally
                {
                    IEnumerator enumerator;
                    if (enumerator is IDisposable)
                    {
                        ((IDisposable)enumerator).Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                int num = (int)Interaction.MsgBox((object)("Can not find:" + iFileName), MsgBoxStyle.OKOnly, (object)null);
                ProjectData.ClearProjectError();
            }
        }
 public RandomStatics(string iFileName)
 {
     IEnumerator enumerator = null;
     this.m_Random = new Collection();
     XmlDocument xmlDocument = new XmlDocument();
     try
     {
         string str = string.Format("{0}Data\\Statics\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName);
         xmlDocument.Load(str);
         XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics");
         this.m_Freq = XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));
         try
         {
             enumerator = xmlElement.SelectNodes("Statics").GetEnumerator();
             while (enumerator.MoveNext())
             {
                 RandomStaticCollection randomStaticCollection = new RandomStaticCollection((XmlElement)enumerator.Current);
                 this.InnerList.Add(randomStaticCollection);
                 if (randomStaticCollection.Freq > 0)
                 {
                     byte freq = checked((byte)randomStaticCollection.Freq);
                     for (byte i = 1; i <= freq; i = checked((byte)(i + 1)))
                     {
                         this.m_Random.Add(randomStaticCollection, null, null, null);
                     }
                 }
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 ((IDisposable)enumerator).Dispose();
             }
         }
     }
     catch (Exception exception)
     {
         ProjectData.SetProjectError(exception);
         Interaction.MsgBox(string.Concat("Can not find:", iFileName), MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
        public void Display(ListBox iList)
        {
            iList.Items.Clear();

            IEnumerator enumerator = this.InnerList.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    RandomStaticCollection item = (RandomStaticCollection)enumerator.Current;
                    iList.Items.Add(item);
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    ((IDisposable)enumerator).Dispose();
                }
            }
        }
 public RandomStatics(string iFileName)
 {
     this.m_Random = new Collection();
       XmlDocument xmlDocument = new XmlDocument();
       try
       {
     string filename = string.Format("{0}Data\\Statics\\{1}", (object) AppDomain.CurrentDomain.BaseDirectory, (object) iFileName);
     xmlDocument.Load(filename);
     XmlElement xmlElement = (XmlElement) xmlDocument.SelectSingleNode("//RandomStatics");
     this.m_Freq = (int) XmlConvert.ToInt16(xmlElement.GetAttribute("Chance"));
     try
     {
       foreach (XmlElement xmlInfo in xmlElement.SelectNodes("Statics"))
       {
     RandomStaticCollection staticCollection = new RandomStaticCollection(xmlInfo);
     this.InnerList.Add((object) staticCollection);
     if (staticCollection.Freq > 0)
     {
       int num1 = 1;
       byte num2 = checked ((byte) staticCollection.Freq);
       for (byte index = (byte) num1; (int) index <= (int) num2; ++index)
         this.m_Random.Add((object) staticCollection, (string) null, (object) null, (object) null);
     }
       }
     }
     finally
     {
       IEnumerator enumerator;
       if (enumerator is IDisposable)
     ((IDisposable) enumerator).Dispose();
     }
       }
       catch (Exception ex)
       {
     ProjectData.SetProjectError(ex);
     int num = (int) Interaction.MsgBox((object) ("Can not find:" + iFileName), MsgBoxStyle.OKOnly, (object) null);
     ProjectData.ClearProjectError();
       }
 }
 public void Remove(RandomStaticCollection Value)
 {
     this.InnerList.Remove(Value);
 }
 public void Remove(RandomStaticCollection Value)
 {
     this.InnerList.Remove(Value);
 }
 public void Add(RandomStaticCollection Value)
 {
     this.InnerList.Add(Value);
     byte arg_17_0 = 0;
     byte b = checked((byte)Value.Count);
     for (byte b2 = arg_17_0; b2 <= b; b2 += 1)
     {
         this.m_Random.Add(Value, null, null, null);
     }
 }
 public void Add(RandomStaticCollection Value)
 {
     this.InnerList.Add(Value);
     byte count = checked((byte)Value.Count);
     for (byte i = 0; i <= count; i = checked((byte)(i + 1)))
     {
         this.m_Random.Add(Value, null, null, null);
     }
 }
 public void Add(RandomStaticCollection Value)
 {
     this.InnerList.Add((object) Value);
       int num1 = 0;
       byte num2 = checked ((byte) Value.Count);
       for (byte index = (byte) num1; (int) index <= (int) num2; ++index)
     this.m_Random.Add((object) Value, (string) null, (object) null, (object) null);
 }