Exemplo n.º 1
0
        static JdUnion_GlbObject()
        {
            Type        t       = typeof(JdUnion_ModuleProcessClass);
            List <Type> subList = getAllSubClass(t);

            modules = new JdUnion_Modules();
            subList.ForEach(a => {
                JdUnion_ModuleClass mdl = new JdUnion_ModuleClass();
                mdl.ClassName           = a.Name;
                mdl.AccessUrl           = "";
                mdl.ModuleName          = a.Name;
                mdl.RequestModel        = "";
                modules.Modules.Add(mdl);
            });
            string json = modules.ToJson();
            string path = new JdUnion_SystemClass().getJsonPath("system.config.modules");

            if (!File.Exists(path))
            {
                SaveFile(path, json);
            }
            else
            {
                string strJson = File.OpenText(path).ReadToEnd();
                modules = modules.GetFromJson <JdUnion_Modules>(strJson);
            }
            modules.Modules.ForEach(a => mlist.Add(a.ClassName, a));
            subList.ForEach(a => {
                if (mlist.ContainsKey(a.Name))
                {
                    AllModuleClass.Add(a.Name, a);
                    JdUnion_ModuleProcessClass obj = Activator.CreateInstance(a) as JdUnion_ModuleProcessClass;
                    if (obj != null)
                    {
                        obj.InitClass(mlist[a.Name]);
                    }
                    //if(obj is AccessTokenClass)
                    //{
                    //    AccessObj = obj as AccessTokenClass;
                    //    AccessObj.InitRequestJson();
                    //}
                    if (obj is JdUnion_RequestClass)
                    {
                        (obj as JdUnion_RequestClass).InitRequestJson();
                    }
                }
            });
            //string strtest = Access_token;
        }
Exemplo n.º 2
0
        public static string getText(string filepath, string folder = "", string type = "")
        {
            string file = new JdUnion_SystemClass().getFilePath(filepath, folder, type);

            if (!File.Exists(file))
            {
                return(null);
            }
            try
            {
                return(File.ReadAllText(file));
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public static string getJsonText(string filepath)
        {
            string file = new JdUnion_SystemClass().getJsonPath(filepath);

            if (!File.Exists(file))
            {
                return(null);
            }
            try
            {
                return(File.ReadAllText(file));
            }
            catch
            {
                return(null);
            }
        }