예제 #1
0
        public static string[] _files(string nUrl)
        {
            List <string> result_    = new List <string>();
            UrlParser     urlParser_ = new UrlParser(nUrl);
            string        urlDir_    = urlParser_._urlDir();

            string[] fileUrls_ = Directory.GetFiles(urlDir_);
            foreach (string i in fileUrls_)
            {
                int    index_    = i.LastIndexOf(@"\");
                string fileName_ = i.Substring(index_ + 1);
                string urlName_  = nUrl + @"*" + fileName_;
                result_.Add(urlName_);
            }
            return(result_.ToArray());
        }
예제 #2
0
        public __t _findInterface <__t>(string nUrl)
        {
            if (null == nUrl || "" == nUrl)
            {
                return(default(__t));
            }
            __t       result_      = default(__t);
            UrlParser urlParser_   = new UrlParser(nUrl);
            string    assemblyUrl_ = urlParser_._noClassUrl();
            string    className_   = urlParser_._className();

            if (urlParser_._isPlugin())
            {
                if (urlParser_._isFile())
                {
                    PluginUfl pluginUlf_ = new PluginUfl();
                    pluginUlf_._runLoad(assemblyUrl_);
                    result_ = pluginUlf_._findFullClass <__t>(className_);
                }
                else
                {
                    AddinUdl addinUdl_ = new AddinUdl();
                    addinUdl_._runLoad(assemblyUrl_);
                    result_ = addinUdl_._findFullClass <__t>(className_);
                }
            }
            else
            {
                if (urlParser_._isFile())
                {
                    AssemblyUfl assemblyUfl_ = new AssemblyUfl();
                    assemblyUfl_._runLoad(assemblyUrl_);
                    result_ = assemblyUfl_._findFullClass <__t>(className_);
                }
                else
                {
                    AssemblyUdl assemblyUdl_ = new AssemblyUdl();
                    assemblyUdl_._runLoad(assemblyUrl_);
                    result_ = assemblyUdl_._findFullClass <__t>(className_);
                }
            }

            return(result_);
        }
예제 #3
0
        public void _newUdl <__t>(__t nT, string nUrl) where __t : IUdl
        {
            if (!this._isUdl(nUrl))
            {
                return;
            }
            if (this._haveUdl(nUrl))
            {
                return;
            }
            UrlParser urlParser_ = new UrlParser(nUrl);
            string    dirUrl_    = urlParser_._urlDir();

            Directory.CreateDirectory(dirUrl_);

            string        udlHeadstreamUrl_ = nUrl + @"*$descriptor.xml";
            UdlHeadstream udlHeadstream_    = nT._getUdlHeadstream();

            this._writeHeadstream(udlHeadstream_, udlHeadstreamUrl_);
        }
예제 #4
0
        public override void _runLoad(string nUrl)
        {
            UrlParser    urlParser_    = new UrlParser(nUrl);
            string       assemblyPath_ = urlParser_._returnResult();
            AssemblyName assemblyName_ = AssemblyName.GetAssemblyName(assemblyPath_);
            AppDomain    appDomain_    = AppDomain.CurrentDomain;

            Assembly[] assemblies_ = appDomain_.GetAssemblies();
            foreach (Assembly i in assemblies_)
            {
                if (string.Compare(i.FullName, assemblyName_.FullName) == 0)
                {
                    mAssembly = i;
                }
            }
            if (null == mAssembly)
            {
                mAssembly = Assembly.LoadFrom(assemblyPath_);
            }
            base._runLoad(nUrl);
        }
예제 #5
0
        public static string[] _fileUrls(string nUrl)
        {
            List <string> result_    = new List <string>();
            UrlParser     urlParser_ = new UrlParser(nUrl);
            string        urlDir_    = urlParser_._urlDir();

            string[] dirUrls_ = Directory.GetDirectories(urlDir_);
            foreach (string i in dirUrls_)
            {
                int    index_   = i.LastIndexOf(@"\");
                string dirName_ = i.Substring(index_ + 1);
                if (!dirName_.StartsWith(@"^file^"))
                {
                    continue;
                }
                index_ = dirName_.LastIndexOf(@"^");
                string fileName_ = dirName_.Substring(index_ + 1);
                string urlName_  = nUrl + @"\" + fileName_;
                result_.Add(urlName_);
            }
            return(result_.ToArray());
        }
예제 #6
0
        bool _udlHaveFile <__t>(__t nT, string nUrl) where __t : IUdl
        {
            UdlHeadstream udlHeadstream_ = nT._getUdlHeadstream();
            string        fileName_      = udlHeadstream_._getFileName();
            UrlParser     urlParser_     = new UrlParser(nUrl);
            string        archiveDir_    = urlParser_._urlDir();

            string[] files_ = Directory.GetFiles(archiveDir_);
            if (files_.Length > 3)
            {
                return(true);
            }
            foreach (string i in files_)
            {
                int    pos_  = i.LastIndexOf("\\");
                string temp_ = i.Substring(pos_ + 1);
                if (temp_ != "$descriptor.xml" && temp_ != fileName_ && temp_ != "$stringTable.xml")
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #7
0
        public string _findUrl(string nUrl)
        {
            UrlParser urlParser_ = new UrlParser();

            return(urlParser_._findUrl(nUrl));
        }
예제 #8
0
 public string[] _fileUrls(string nUrl)
 {
     return(UrlParser._fileUrls(nUrl));
 }
예제 #9
0
 public string[] _dirUrls(string nUrl)
 {
     return(UrlParser._dirUrls(nUrl));
 }
예제 #10
0
 public string[] _arcs(string nUrl)
 {
     return(UrlParser._arcs(nUrl));
 }
예제 #11
0
 public string[] _rootUrls()
 {
     return(UrlParser._rootUrls());
 }
예제 #12
0
        bool _isUdl(string nUrl)
        {
            UrlParser urlParser_ = new UrlParser(nUrl);

            return(urlParser_._isUdl());
        }
예제 #13
0
        public override void _runLoad(string nUrl)
        {
            base._runLoad(nUrl);

            string assemblyInfoUrl_ = nUrl + @"*$assembly.xml";

            mAssemblyInfo._runLoad(assemblyInfoUrl_);

            UdlHeadstream udlHeadstream_ = this._getUdlHeadstream();
            string        fileName_      = udlHeadstream_._getFileName();
            UrlParser     urlParser_     = new UrlParser(nUrl);
            string        assemblyPath_  = urlParser_._urlFile(fileName_);
            AssemblyName  assemblyName_  = AssemblyName.GetAssemblyName(assemblyPath_);
            AppDomain     appDomain_     = AppDomain.CurrentDomain;

            Assembly[] assemblies_ = appDomain_.GetAssemblies();
            foreach (Assembly i in assemblies_)
            {
                if (string.Compare(i.FullName, assemblyName_.FullName) == 0)
                {
                    mAssembly = i;
                    return;
                }
            }

            UidSingleton uidSingleton_ = __singleton <UidSingleton> ._instance();

            IEnumerable <Rid> rids_ = mAssemblyDescriptor._getRids();

            foreach (Rid i in rids_)
            {
                uidSingleton_._addRid(i);
            }

            IEnumerable <string> dependences_ = mAssemblyDescriptor._getDependences();

            foreach (string i in dependences_)
            {
                this._loadAssemblyUfl(i);
            }

            IEnumerable <Uid> uids_ = mAssemblyDescriptor._getUids();

            foreach (Uid i in uids_)
            {
                uidSingleton_._addUid(i);
                Uid    uid_    = i._getUid();
                string uidUrl_ = uid_._getOptimal();
                this._loadAssemblyUdl(uidUrl_);
            }

            IEnumerable <Uid> addins_ = mAssemblyDescriptor._getAddins();

            foreach (Uid i in addins_)
            {
                uidSingleton_._addUid(i);
                Uid    uid_    = i._getUid();
                string uidUrl_ = uid_._getOptimal();
                this._loadAddins(uidUrl_);
            }

            IEnumerable <string> plugins_ = mAssemblyDescriptor._getPlugins();

            foreach (string i in plugins_)
            {
                this._loadPlugins(i);
            }

            if (null == mAssembly)
            {
                mAssembly = Assembly.LoadFrom(assemblyPath_);
            }
        }