Ejemplo n.º 1
0
        private Dictionary <string, Object> getWidgetInfoHeaderEx(String str, bool isString)
        {
            this.newLua();

            try
            {
                if (isString)
                {
                    lua.DoString(str);
                }
                else
                {
                    lua.DoFile(str);
                }
            }
            catch (Exception exp)
            {
                //errror parsing widget, lets hope the info header was already read...
                Console.WriteLine("Non-crititcal widget parser error: " + exp.Message);
            }

            lua.DoString("____getInfoResultTable = widget:GetInfo()");
            LuaTable winfo = (LuaTable)lua.GetValue("____getInfoResultTable");

            if (winfo == null)
            {
                throw new Exception("Widget file info header could not be parsed correctly");
            }

            return(SimpleLuaParser.luaTable2DictionaryObject(winfo));
        }
Ejemplo n.º 2
0
        public ModBrowser(string springFolder, string modFolderName)
        {
            this.springFolder = springFolder;
            this.modFolder    = Path.Combine(this.springFolder, modFolderName);
            this.dataFileName = Path.Combine(this.springFolder, "sd_modWidgets.dat");
            this.luaParser    = new SimpleLuaParser(this.springFolder);

            LoadFileEntries();
        }
Ejemplo n.º 3
0
        public Dictionary <String, Double> getWidgetConfigOrder(String orderFilename)
        {
            if (!System.IO.File.Exists(orderFilename))
            {
                throw new Exception("Order file not found: " + orderFilename);
            }

            DateTime lastWrite = File.GetLastWriteTime(orderFilename);

            if (!orderFileCache.ContainsKey(orderFilename) || (orderFileCache[orderFilename].lastWrite != lastWrite))
            {
                if (!orderFileCache.ContainsKey(orderFilename))
                {
                    orderFileCache.Add(orderFilename, new CachedOrderInfo());
                }
                this.orderFileCache[orderFilename].lastWrite = lastWrite;

                LuaTable ltab = ReadConfigOrder(orderFilename);
                this.orderFileCache[orderFilename].widgets = SimpleLuaParser.luaOrderTable2DictionaryDouble(ltab);
            }
            return(orderFileCache[orderFilename].widgets);
        }