Exemplo n.º 1
0
        public override void Register()
        {
            App.Singleton <CsvStore>().Alias <ICsvStore>().Alias("csv.store").Resolving((app, bind, obj) => {
                CsvStore store = obj as CsvStore;

                IConfigStore confStore = app.Make <IConfigStore>();

                string root = confStore.Get(typeof(CsvStore), "root", null);

                if (root != null)
                {
                    IEnv env      = app.Make <IEnv>();
                    IIOFactory io = app.Make <IIOFactory>();
                    IDisk disk    = io.Disk();

                                        #if UNITY_EDITOR
                    if (env.DebugLevel == DebugLevels.Auto || env.DebugLevel == DebugLevels.Dev)
                    {
                        disk.SetConfig(new Hashtable()
                        {
                            { "root", env.AssetPath + env.ResourcesNoBuildPath }
                        });
                    }
                                        #endif


                    store.SetDirctory(disk.Directory(root));
                }

                return(store);
            });;
        }
Exemplo n.º 2
0
        public override void Init()
        {
            //由于是demo需要所以强制更改默认路径
            Env env = App[typeof(Env)] as Env;

            env.SetResourcesBuildPath(Global.BasePath + "/CsvStore/Resources");
            env.SetResourcesNoBuildPath(Global.BasePath + "/CsvStore/Resources");
            env.SetDebugLevel(DebugLevels.Dev);

            //单纯由于是demo所以强制更改全局配置的路径,正常项目请不要这样用
            IIOFactory io = App.Make <IIOFactory>();

            Store.CsvStore csvStore = App[typeof(Store.CsvStore)] as Store.CsvStore;
            csvStore.SetDirctory(io.Disk().Directory(Global.BasePath + "/CsvStore/Resources"));
        }