public MpSelfArticlesController(IMpSelfArticleAppService mpSelfArticleAppService, IUserMpAppService userMpAppService, IFileServer fileServer) { _mpSelfArticleAppService = mpSelfArticleAppService; _userMpAppService = userMpAppService; _fileServer = fileServer; }
public CustomerArticlesController(ICustomerArticleAppService CustomerArticleAppService, IUserMpAppService userMpAppService, IFileServer fileServer) { _CustomerArticleAppService = CustomerArticleAppService; _userMpAppService = userMpAppService; _fileServer = fileServer; }
static void Main1() { IFileServer iFileServer = (IFileServer)Activator.GetObject(typeof(IFileServer), "tcp://localhost:1244/MyFileServer"); Byte[] arrData = iFileServer.getFile("Test.txt"); Console.WriteLine("Received " + arrData.Length + "bytes from server"); }
public SelfKeFuMessageHandler(ICacheManager cacheManager, ICYConfigAppService cYConfigAppService, IMpAccountAppService mpAccountAppService, IAccessTokenContainer accessTokenContainer, ICustomerServiceResponseTextAppService customerServiceResponseTextAppService, ICustomerServiceConversationAppService customerServiceConversationAppService, ICustomerServiceConversationMsgAppService customerServiceConversationMsgAppService, IMpFanAppService mpFanAppService, ISignalrCustomerService signalrCustomerService, ICustomerServiceOnlineAppService customerServiceOnlineAppService, IFileServer fileServer, IWebUrlService webUrlService, IBackgroundJobManager backgroundJobManager) { _accessTokenContainer = accessTokenContainer; _mpAccountAppService = mpAccountAppService; _mpFanAppService = mpFanAppService; _cacheManager = cacheManager; _signalrCustomerService = signalrCustomerService; _cYConfigAppService = cYConfigAppService; _customerServiceResponseTextAppService = customerServiceResponseTextAppService; _customerServiceConversationAppService = customerServiceConversationAppService; _customerServiceConversationMsgAppService = customerServiceConversationMsgAppService; _fileServer = fileServer; _webUrlService = webUrlService; _customerServiceOnlineAppService = customerServiceOnlineAppService; Logger = NullLogger.Instance; _backgroundJobManager = backgroundJobManager; }
public CustomerServiceResponseTypesController(ICustomerServiceResponseTypeAppService CustomerServiceResponseTypeAppService, IUserMpAppService userMpAppService, IFileServer fileServer, IWxMediaUpload wxMediaUpload) { _CustomerServiceResponseTypeAppService = CustomerServiceResponseTypeAppService; _userMpAppService = userMpAppService; _fileServer = fileServer; _wxMediaUpload = wxMediaUpload; }
public MpMediaArticlesController(IMpMediaArticleAppService mpMediaArticleAppService, IUserMpAppService userMpAppService, IHostingEnvironment host, IWxMediaUpload wxMediaUpload, IFileServer fileServer , IMpMediaImageAppService mpMediaImageAppService , IWebUrlService webUrlService , IMatialFileService matialFileService , IMpAccountAppService mpAccountAppService , IMpUserMemberAppService mpUserMemberAppService , IWxMediaAppService wxMediaAppService) { _mpMediaArticleAppService = mpMediaArticleAppService; _userMpAppService = userMpAppService; _host = host; _wxMediaUpload = wxMediaUpload; _fileServer = fileServer; _mpMediaImageAppService = mpMediaImageAppService; _webUrlService = webUrlService; _matialFileService = matialFileService; _mpAccountAppService = mpAccountAppService; _mpUserMemberAppService = mpUserMemberAppService; _wxMediaAppService = wxMediaAppService; }
public MpMediaVoicesController(IMpMediaVoiceAppService mpMediaVoiceAppService, IUserMpAppService userMpAppService, IWxMediaUpload wxMediaUpload, IFileServer fileServer) { _mpMediaVoiceAppService = mpMediaVoiceAppService; _userMpAppService = userMpAppService; _wxMediaUpload = wxMediaUpload; _fileServer = fileServer; }
public CustomerMediaVideosController(ICustomerMediaVideoAppService CustomerMediaVideoAppService, IUserMpAppService userMpAppService, IWxMediaUpload wxMediaUpload, IFileServer fileServer) { _CustomerMediaVideoAppService = CustomerMediaVideoAppService; _userMpAppService = userMpAppService; _wxMediaUpload = wxMediaUpload; _fileServer = fileServer; }
public MpShoppingMallPicsController(IMpShoppingMallPicAppService MpShoppingMallPicAppService, IUserMpAppService userMpAppService, IFileServer fileServer) { _MpShoppingMallPicAppService = MpShoppingMallPicAppService; _userMpAppService = userMpAppService; _fileServer = fileServer; }
public void AttachFileServer(IFileServer fileServer) { MountVolumes mountVolumes = EnsureMountVolumes(); if (mountVolumes.FileServers == null) { mountVolumes.FileServers = new List <FileServerReference>(); } mountVolumes.FileServers.Add(fileServer.Inner); }
public CustomerServiceOnlinesController(ICustomerServiceOnlineAppService CustomerServiceOnlineAppService, IUserMpAppService userMpAppService, IMpAccountAppService mpAccountAppService, IFileServer fileServer, IWxMediaUpload wxMediaUpload, IWxMediaAppService wxMediaAppService, IWebUrlService webUrlService, IMatialFileService matialFileService) { _CustomerServiceOnlineAppService = CustomerServiceOnlineAppService; _userMpAppService = userMpAppService; _mpAccountAppService = mpAccountAppService; _fileServer = fileServer; _wxMediaUpload = wxMediaUpload; _wxMediaAppService = wxMediaAppService; _webUrlService = webUrlService; _matialFileService = matialFileService; }
/// <summary> /// 保存对当前账号的修改 /// </summary> private void SaveAccount() { JToken jtoken = JToken.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(CurPassWordBookModel)); JArray jArray = new JArray(); foreach (var item in CurPassWordBookModel.PassWordBooks) { jArray.Add(JToken.Parse(item.ConverToJson())); } jtoken["PassWordBooks"] = jArray; IFileServer.SavePropertyFile(jtoken.ToString(), string.Format("{0}data\\{1}\\{1}.json", BasePath, CurPassWordBookModel.Account)); }
static void Main() { IFileServer iFileServer = (IFileServer)Activator.GetObject(typeof(IFileServer), "tcp://127.0.0.1:6010/MyFileServer"); Console.WriteLine(iFileServer.getTime()); Byte[] arrData = iFileServer.getFile("Del.txt"); Console.WriteLine("Received " + arrData.Length + "bytes from server"); // FileStream fs = File.Create("D:/Object/delete/temp2/Winter.jpg"); // fs.Write(arrData, 0, arrData.Length); // fs.Close(); }
public CustomerMediaImagesController(ICustomerMediaImageAppService CustomerMediaImageAppService, IUserMpAppService userMpAppService, IWxMediaUpload wxMediaUpload , IFileServer fileServer , IWebUrlService webUrlService, IAppFolders appFolders ) { _CustomerMediaImageAppService = CustomerMediaImageAppService; _userMpAppService = userMpAppService; _wxMediaUpload = wxMediaUpload; _fileServer = fileServer; _webUrlService = webUrlService; remotingUploadUrl = _webUrlService.GetRemotingFileUploadUrl(); _appFolders = appFolders; }
/// <summary> /// 保存账号密保 /// </summary> /// <param name="filePath"></param> public void SaveShield(string filePath, string password) { string account = CurPassWordBookModel.Account; string accountMd5 = IEncryptAndDecodeServer.GetMd532(account); //1、SHA512 account = IEncryptAndDecodeServer.GetSha512(account); //2、数组逆转 var oldArray = account.ToArray(); Char[] newArray = new Char[oldArray.Length]; for (int i = 0; i < oldArray.Length; i++) { newArray[oldArray.Length - 1] = oldArray[i]; } //3、获取MD5 account = IEncryptAndDecodeServer.GetMd532(new string(newArray)); if (CurPassWordBookModel.IsComputer) { string computerStr = getComputer(); string computerMd5 = IEncryptAndDecodeServer.GetMd532(computerStr); //1、机器码SHA computerStr = IEncryptAndDecodeServer.GetSha1(computerStr); //2、数组逆转 oldArray = computerStr.ToArray(); newArray = new Char[oldArray.Length]; for (int i = 0; i < oldArray.Length; i++) { newArray[oldArray.Length - 1] = oldArray[i]; } //3、获取MD5 computerStr = IEncryptAndDecodeServer.GetMd532(new string(newArray)); //4、加密AES密码 password = IEncryptAndDecodeServer.AesEncryption(password, computerStr); //5、验证数据拼接 password = computerMd5 + password + IEncryptAndDecodeServer.GetMd532((computerMd5 + password)); } else { string zero = "00000000000000000000000000000000"; password = zero + password + IEncryptAndDecodeServer.GetMd532((zero + password)); } account = IEncryptAndDecodeServer.AesEncryption(password, account); IFileServer.SaveFile(account, accountMd5, filePath); }
public KindEditorController(IHostingEnvironment _host , IWxMediaAppService wxMediaAppService , IMpArticleInsideImageAppService mpArticleInsideImageAppService , IUserMpAppService userMpAppService , IFileServer fileServer , IWxMediaUpload wxMediaUpload , IWebUrlService webUrlService) { host = _host; _wxMediaAppService = wxMediaAppService; _mpArticleInsideImageAppService = mpArticleInsideImageAppService; _userMpAppService = userMpAppService; _fileServer = fileServer; _wxMediaUpload = wxMediaUpload; _webUrlService = webUrlService; SavePath = _webUrlService.KindEditorSavePath; }
/// <summary> /// 初始化主账号 /// </summary> /// <param name="account">账户名</param> /// <param name="password">密码明文</param> public void InitAccount(string account, string password, string passWordHelp, string remark, bool isComputer) { //1、创建目录 System.IO.Directory.CreateDirectory(BasePath + "data\\" + account); //2、创建主账号配置文件 Newtonsoft.Json.Linq.JToken jtoken = new Newtonsoft.Json.Linq.JObject(); jtoken["Account"] = account; jtoken["Remark"] = remark; jtoken["PassWordHelp"] = passWordHelp; jtoken["PassWordCertificate"] = GetPassWordCertificate(account, password, isComputer); jtoken["Phone"] = ""; jtoken["Email"] = ""; jtoken["CreateDate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); jtoken["IsComputer"] = isComputer; jtoken["PassWordBooks"] = new Newtonsoft.Json.Linq.JArray(); IFileServer.SavePropertyFile(jtoken.ToString(), string.Format("{0}data\\{1}\\{1}.json", BasePath, account)); //3、设置配置文件。设置默认账号 //4、加载默认账号 RefreshAccount(); }
/// <summary> /// 重新加载数据 /// </summary> /// <returns></returns> public void RefreshAccount() { string filePath = string.Empty; if (System.IO.Directory.Exists(BasePath + "data")) { var list = System.IO.Directory.GetDirectories(BasePath + "data"); if (list != null && list.Length > 1)//存在多账号取默认 { //回头再修改 throw new Exception("还未实现"); } else { string fileName = list[0].Split('\\').Last(); filePath = list[0] + "\\" + fileName + ".json"; } } string propertyFileStr = IFileServer.GetPropertyFile(filePath); JToken jtoken = Newtonsoft.Json.JsonConvert.DeserializeObject <JToken>(propertyFileStr); _curAccountModel = new Model.AccountModel() { Account = jtoken["Account"].ToString(), CreateDate = jtoken["CreateDate"].Value <DateTime>(), Email = jtoken["Email"].ToString(), IsComputer = jtoken["IsComputer"].Value <bool>(), Phone = jtoken["Phone"].ToString(), Remark = jtoken["Remark"].ToString(), PassWordCertificate = jtoken["PassWordCertificate"].ToString(), PassWordHelp = jtoken["PassWordHelp"].ToString(), //PassWordBooks = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.PassWordBookModel>>(jtoken["PassWordBooks"].ToString()) }; foreach (JToken item in jtoken["PassWordBooks"]) { var model = new Model.PassWordBookModel(); model.ConverToData(item.ToString()); _curAccountModel.PassWordBooks.Add(model); } }
public BackupServiceModule(IFileServer server) { Server = server; }
/// <summary> /// 保存单个密码本 /// </summary> /// <param name="passwordbook">数据</param> /// <param name="type">密保类型</param> /// <param name="secondpwd">二次密码</param> /// <returns>物理认证加密后的密保文件</returns> public string SavePassWordBook(Model.PassWordBookModel passwordbook, PassWordBookSaveType type, string secondpwd) { if (!CachePassWordSecurity.GetInstance().IsCache) { throw new ExceptionSecurityTimeout("密码验证超时需要再次做密码验证"); } if (type == PassWordBookSaveType.AuthPassWord && string.IsNullOrEmpty(secondpwd)) { throw new Exception("使用二次密码认证,二次密码不能为空"); } string savePhysicsStr = string.Empty; //设置时间标记 passwordbook.CreateDate = DateTime.Now; Newtonsoft.Json.Linq.JToken jtoken = new JObject(); jtoken["SecondAuthentication"] = type.ToString(); jtoken["PassWord"] = passwordbook.PassWord; //移除密码显示存储。 passwordbook.PassWord = string.Empty; jtoken["Data"] = Newtonsoft.Json.JsonConvert.SerializeObject(passwordbook.Data); string saveStr = jtoken.ToString(); //针对不同类型进行不同的加密处置方式 switch (type) { case PassWordBookSaveType.Null: break; case PassWordBookSaveType.AuthEmailCode: break; case PassWordBookSaveType.AuthPhoneCode: break; case PassWordBookSaveType.AuthPassWord: saveStr = SecondPwdEncryptionData(secondpwd, saveStr, type); break; case PassWordBookSaveType.PhysicsCode: secondpwd = GetRandomPassWord(12); saveStr = SecondPwdEncryptionData(secondpwd, saveStr, type); //创建物理的密钥文件 savePhysicsStr = IEncryptAndDecodeServer.AesEncryption(secondpwd, CachePassWordSecurity.GetInstance().Security); break; default: break; } //使用密码证书做AES加密 saveStr = IEncryptAndDecodeServer.AesEncryption(saveStr, CachePassWordSecurity.GetInstance().Security); //保存密码本文件 IFileServer.SaveFile(saveStr, CurPassWordBookModel.PassWordCertificate, passwordbook.FilePath); CurPassWordBookModel.PassWordBooks.Add(passwordbook); SaveAccount(); return(savePhysicsStr); }
/// <summary> /// 忘记密码 /// </summary> /// <param name="filePath">密保文件</param> /// <returns></returns> public string FotgotPassWord(string filePath) { string result = string.Empty; string account = CurPassWordBookModel.Account; string accountMd5 = IEncryptAndDecodeServer.GetMd532(account); //1、SHA512 account = IEncryptAndDecodeServer.GetSha512(account); //2、数组逆转 var oldArray = account.ToArray(); Char[] newArray = new Char[oldArray.Length]; for (int i = 0; i < oldArray.Length; i++) { newArray[oldArray.Length - 1] = oldArray[i]; } //3、获取MD5 account = IEncryptAndDecodeServer.GetMd532(new string(newArray)); try { //1、获取密保文件。引发NullReferenceException异常则文件被修改或者选择错误 result = IFileServer.GetFileString(filePath, accountMd5); //2、账号解密 result = IEncryptAndDecodeServer.AesDecryption(result, account); //3、数据完整性检查 string computerCheck = result.Substring(0, 32); string db = result.Substring(0, result.Length - 32); string md5 = result.Replace(db, ""); if (md5 == IEncryptAndDecodeServer.GetMd532(db)) { result = db.Replace(computerCheck, ""); } else { return("数据文件被修改或者配置错误"); } //4、是否机器加密 string zero = "00000000000000000000000000000000"; if (computerCheck == zero)//非机器加密 { return(result); } else { string computerStr = getComputer(); string computerMd5 = IEncryptAndDecodeServer.GetMd532(computerStr); if (computerCheck != computerMd5) { return("密保文件记录的机器码和当前计算机不匹配"); } //1、机器码SHA computerStr = IEncryptAndDecodeServer.GetSha1(computerStr); //2、数组逆转 oldArray = computerStr.ToArray(); newArray = new Char[oldArray.Length]; for (int i = 0; i < oldArray.Length; i++) { newArray[oldArray.Length - 1] = oldArray[i]; } //3、获取MD5 computerStr = IEncryptAndDecodeServer.GetMd532(new string(newArray)); //4、加密AES密码 result = IEncryptAndDecodeServer.AesDecryption(result, computerStr); } } catch (NullReferenceException e) { return(e.Message); } return(result); }
public static void Build(IConfigurationRoot configurationRoot) { Instance = new FileServer(configurationRoot); }
public MpProductTypesController(IMpProductTypeAppService mpProductTypeAppService , IFileServer fileServer) { _mpProductTypeAppService = mpProductTypeAppService; _fileServer = fileServer; }