private static void GenerateWinDllConfig(string rootFolder, string dataPath) { var backupFolder = GetWinBackupDllFolder(rootFolder); var dllVersion = new DllVersion(); foreach (var file in Directory.GetFiles(backupFolder, "*.dll")) { var name = Path.GetFileNameWithoutExtension(file); var md5 = MD5Hashing.HashFile(file); var size = (new FileInfo(file)).Length; var dllInfo = new DllInfo() { dllName = name, MD5 = md5, size = size, }; dllVersion.Manifest.Add(name, dllInfo); FileUtil.MoveFileOrDirectory(file, backupFolder + "/" + dllInfo.ToFileName()); } dllVersion.Version = AssetManager.GetVisualDateTimeNow(); FileHelper.SaveJsonObj(dllVersion, backupFolder + "/" + dllVersion.ToFileName()); FileHelper.SaveJsonObj(dllVersion, dataPath + "/StreamingAssets/" + GameResPath.DLLVERSION_FILE); }
private static void GenerateAndroidDllConfig(string pathToBuildProject) { var backupFolder = GetAndroidBackupDllFolder(pathToBuildProject); var dllVersion = new DllVersion(); foreach (var file in Directory.GetFiles(backupFolder, "*.dll")) { var name = Path.GetFileNameWithoutExtension(file); var md5 = MD5Hashing.HashFile(file); var size = (new FileInfo(file)).Length; var dllInfo = new DllInfo() { dllName = name, MD5 = md5, size = size, }; dllVersion.Manifest.Add(name, dllInfo); FileUtil.MoveFileOrDirectory(file, backupFolder + "/" + dllInfo.ToFileName()); } dllVersion.Version = AssetManager.GetVisualDateTimeNow(); if (dllVersion.Version > DllHelper.Max_Versoin) { throw new Exception("dll版本号居然比限定的最大版本号还要大!"); } FileHelper.SaveJsonObj(dllVersion, backupFolder + "/" + dllVersion.ToFileName()); FileHelper.SaveJsonObj(dllVersion, GetDecodeApkFolder(pathToBuildProject) + "/assets/dllVersion.json"); ChangeAndroidManifestDllVersion(pathToBuildProject, dllVersion.Version); }
private static void GenerateAndroidDllConfig(string pathToBuildProject) { var backupFolder = GetAndroidBackupDllFolder(pathToBuildProject); var dllVersion = new DllVersion(); foreach (var file in Directory.GetFiles(backupFolder, "*.dll")) { var name = Path.GetFileNameWithoutExtension(file); var md5 = MD5Hashing.HashFile(file); var size = (new FileInfo(file)).Length; var dllInfo = new DllInfo() { dllName = name, MD5 = md5, size = size, }; dllVersion.Manifest.Add(name, dllInfo); FileUtil.MoveFileOrDirectory(file, backupFolder + "/" + dllInfo.ToFileName()); } dllVersion.Version = DateTime.UtcNow.ToFileTimeUtc(); FileHelper.SaveJsonObj(dllVersion, backupFolder + "/" + dllVersion.ToFileName()); FileHelper.SaveJsonObj(dllVersion, GetDecodeApkFolder(pathToBuildProject) + "/assets/dllVersion.json"); }
public void classLog(DllInfo dll, PlugInModel plug) { dll.ClassInfoList.Add( new ClassInfo() { Author = plug.Author, BaseClass = plug.BaseType.ToString(), CreateTime = plug.CreateDate, Mesg = plug.Description, RegName = plug.Key } ); }
//public IServiceBus AtawBus //{ // get; // set; //} public DllInfo dllLog(string dll) { //this.fLogInfo.DllInfoList.Add( var _dll = new DllInfo() { Name = dll, ClassInfoList = new List <ClassInfo>() }; this.fLogInfo.DllInfoList.Add(_dll); return(_dll); // ); }
private static void Main(string[] args) { try { DllInfo modelByProcessArguments = LocalDllUtils.GetModelByProcessArguments(); ConfigerParameterName name = new ConfigerParameterName(); CacheParameterName name2 = new CacheParameterName(); if (modelByProcessArguments != null) { if (modelByProcessArguments.IsOpen == 1) { //todo } } new single().Run(args); } catch (Exception) { } }
public static bool dllInfoToXML(DllInfo model) { try { string path = GetPath(); if (File.Exists(path)) { XmlHelper.RemoveChildNodes(path); } else { XmlHelper.CreateXmlByPath(path); } XmlDocument document = new XmlDocument(); document.Load(path); XmlNode node = document.SelectSingleNode("response"); XmlNode newChild = document.CreateElement("record"); node.AppendChild(newChild); PropertyInfo[] properties = typeof(DllInfo).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo info in properties) { if (info != null) { string str2 = string.Empty; if (info.GetValue(model, null) != null) { str2 = info.GetValue(model, null).ToString(); } XmlNode node3 = document.CreateElement(info.Name); node3.InnerText = str2; newChild.AppendChild(node3); } } document.Save(path); return(true); } catch (Exception) { return(false); } }
private static string GetLibraryPath(string libraryName, DllInfo dllInfo) { byte[] dllData = LoadResource(dllInfo.ResourceName); string hash = GetHash(dllData); string directory = null; var exceptions = new List <Exception>(); foreach (var candidateLocation in _libraryLoader.CandidateWritableLocations) { Exception exception = null; if (TryGetWritableDirectory( candidateLocation, libraryName, hash, out directory, ref exception)) { Debug.Assert(directory != null, "'directory' must not be null if TryGetWritableDirectory returns true."); break; } exceptions.Add(exception); } if (directory == null) { throw new AggregateException( string.Format( "Unable to obtain writable file path in candidate locations: {0}.", string.Join(", ", _libraryLoader.CandidateWritableLocations.Select(x => "'" + x + "'"))), exceptions.ToArray()); } var path = WriteDll(dllData, dllInfo.ResourceName, directory); foreach (var resourceName in dllInfo.AdditionalResourceNames) { dllData = LoadResource(resourceName); WriteDll(dllData, resourceName, directory); } return(path); }
public static DllInfo GetModelByProcessArguments() { try { string str = Console.ReadLine().ToUpper(CultureInfo.InvariantCulture); DllInfo model = new DllInfo(); if (string.IsNullOrEmpty(str)) { model.IsOpen = -1; } else { char[] separator = new char[] { '+' }; string[] strArray = str.Split(separator); if ((strArray != null) && (strArray.Length > 0)) { model.UserId = strArray[0]; model.UserName = strArray[1]; model.DepId = strArray[2]; model.DepName = strArray[3]; model.TypeId = int.Parse(strArray[4]); model.KeyWord = strArray[5]; model.IsOpen = int.Parse(strArray[6]); } else { return(null); } } if (model.IsOpen != 1) { dllInfoToXML(model); } return(model); } catch (Exception) { return(null); } }
public void SetAssamblyClassType(Type type, DllInfo dll) { //throw new NotImplementedException(); var code = Attribute.GetCustomAttribute(type, typeof(CodePlugAttribute)) as CodePlugAttribute; if (code != null) { if (type.IsEnum) { EnumCodeTable ect = new EnumCodeTable(type); var gg = AtawIocContext.Current.RegisterPlugIn <CodeTable <CodeDataModel> >(ect, code.RegName); gg.Description = "枚举类型的 " + type.Name; this.classLog(dll, gg); } else { try { var _gg = AtawIocContext.Current.RegisterPlugIn(type, code); this.classLog(dll, _gg); if (typeof(IAppRegistration).IsAssignableFrom(type)) { _gg.Description = "全局插件 " + type.Name; fAppRegistrationRegNames.Add(code.RegName); } } catch (Exception ex) { LogBuilder("注册插件失败: ", ex.Message, type.Name); } //Logger.Debug("注册插件", } } // AppRegistrationRegNames = fAppRegistrationRegNames; }
public Library(DllInfo dllInfo) { this.name = dllInfo.name; this.nugetPackage = dllInfo.rootPackage; this.path = dllInfo.path; }