예제 #1
0
        private void PopulateDataList(string db)
        {
            dynamic rxdata = TempData[db];

            DataListBoxes[db].Items.Clear();
            IronRuby.Builtins.RubyArray ra = (IronRuby.Builtins.RubyArray)rxdata;
            for (int i = 1; i < ra.Count; i++) //its a one-based index
            {
                if (rxdata[i] != null)         //safety
                {
                    int    id   = rxdata[i].id;
                    string name = rxdata[i].name.ToString();
                    DataListBoxes[db].Items.Add(id.ToString("D4") + ": " + name);
                }
            }
        }
예제 #2
0
        public void WriteMapInfos(MapInfos infos)
        {
            List <IronRuby.Builtins.RubyArray> maps = new List <IronRuby.Builtins.RubyArray>();

            foreach (MapInfo info in infos.Maps)
            {
                IronRuby.Builtins.RubyArray ra = new IronRuby.Builtins.RubyArray();
                ra.Add(info.Id);
                ra.Add(info.Name);
                ra.Add(info.ParentId);
                ra.Add(info.Order);
                ra.Add(info.Expanded);
                ra.Add(info.ScrollX);
                ra.Add(info.ScrollY);
                ra.Add(info.Map.rbMap); //ta-da, found a way
                maps.Add(ra);
            }
            rbhelper.save_map_infos(maps);
        }
예제 #3
0
        protected static IronRuby.Builtins.RubyArray ParseArray(char[] json, ref int index, ref bool success)
        {
            IronRuby.Builtins.RubyArray array = RhoRuby.createArray();

            NextToken(json, ref index);

            bool done = false;

            while (!done)
            {
                int token = LookAhead(json, index);
                if (token == TOKEN_NONE)
                {
                    success = false;
                    return(null);
                }
                else if (token == TOKEN_COMMA)
                {
                    NextToken(json, ref index);
                }
                else if (token == TOKEN_SQUARED_CLOSE)
                {
                    NextToken(json, ref index);
                    break;
                }
                else
                {
                    object value = ParseValue(json, ref index, ref success);
                    if (!success)
                    {
                        return(null);
                    }

                    array.Add(value);
                }
            }

            return(array);
        }
예제 #4
0
파일: Ruby.cs 프로젝트: Glitchfinder/OpenXP
 public void WriteScriptHive(ScriptHive hive)
 {
     try
     {
         IronRuby.Builtins.RubyArray ra = new IronRuby.Builtins.RubyArray();
         foreach (Script s in hive.Scripts)
         {
             IronRuby.Builtins.RubyArray ra_entry = new IronRuby.Builtins.RubyArray();
             ra_entry.Add(s.MagicNumber);
             ra_entry.Add(s.Name);
             var ms = new IronRuby.Builtins.MutableString();
             ms = ms.ChangeEncoding(IronRuby.Builtins.RubyEncoding.Binary, true);
             ms.Append(GameData.DataHelper.Deflate(s.Contents));
             ra_entry.Add(ms);
             ra.Add(ra_entry);
         }
         rbhelper.save_scripts(ra);
     }
     catch (Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Message);
     }
 }