public void Initialize(IApplication application) { var applicationLoadBehavior = new ApplicationLoadBehavior(); applicationLoadBehavior.AttachTo(application); applicationLoadBehavior.Subscribe(applicationWindow => { var downloadbehaviour = new DownloadBehavior(); downloadbehaviour.AttachTo(applicationWindow); }); }
public void Initialize(IApplication application) { var applicationLoadBehavior = new ApplicationLoadBehavior(); applicationLoadBehavior.AttachTo(application); applicationLoadBehavior.Subscribe(applicationWindow => { var downloadbehaviour = new DownloadBehavior(); downloadbehaviour.AttachTo(applicationWindow); }); this.cacheNativeService = new CacheNativeService(); this.externalNativeService = new ExternalNativeService(); this.systemInfoNativeService = new SystemInfoNativeService(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static Config() { using (var md5 = new MD5Cng()) { _ApplicationID = BitConverter.ToString(md5.ComputeHash(Encoding.UTF8.GetBytes(filepath))).ToLower().Replace("-", ""); } var serializer = new DataContractSerializer(typeof(Savedata)); try { using (var xmlr = XmlReader.Create(filepath)) { var data = (Savedata)serializer.ReadObject(xmlr); Enc_Check_drive_password = data.DrivePasswordCheck; if (data.LogToFile != false) { LogToFile = data.LogToFile; } if (data.SaveCacheCompressed != true) { SaveGZConfig = data.SaveCacheCompressed; } if (data.SaveEncrypted != false) { SaveEncrypted = data.SaveEncrypted; } if (data.UploadBandwidthLimit != default(double)) { UploadLimit = data.UploadBandwidthLimit; } if (data.DownloadBandwidthLimit != default(double)) { DownloadLimit = data.DownloadBandwidthLimit; } if (data.ParallelDownload != default(int)) { ParallelDownload = data.ParallelDownload; } if (data.ParallelUpload != default(int)) { ParallelUpload = data.ParallelUpload; } if (data.DownloadBufferSize != default(int)) { DownloadBufferSize = data.DownloadBufferSize; } if (data.UploadBufferSize != default(int)) { UploadBufferSize = data.UploadBufferSize; } if (data.Main_Size != null) { Main_Size = data.Main_Size; } if (data.Main_Location != null) { Main_Location = data.Main_Location; } if (data.UploadConflictBehavior != default(UploadBehavior)) { UploadConflictBehavior = data.UploadConflictBehavior; } if (data.DownloadConflictBehavior != default(DownloadBehavior)) { DownloadConflictBehavior = data.DownloadConflictBehavior; } if (data.FFplayer != default(SavedataFFplayer)) { if (data.FFplayer.FFmoduleKeybinds != null) { if (data.FFplayer.FFmoduleKeybinds.Count() >= ConfigFFplayer.FFmoduleKeybinds.Count()) { ConfigFFplayer.FFmoduleKeybinds = data.FFplayer.FFmoduleKeybinds; } else { data.FFplayer.FFmoduleKeybinds.ToList().ForEach(x => ConfigFFplayer.FFmoduleKeybinds[x.Key] = x.Value); } } if (data.FFplayer.FontFilePath != default(string)) { ConfigFFplayer.FontFilePath = data.FFplayer.FontFilePath; } if (data.FFplayer.FontPtSize != default(int)) { ConfigFFplayer.FontPtSize = data.FFplayer.FontPtSize; } if (data.FFplayer.AutoResize != true) { ConfigFFplayer.AutoResize = data.FFplayer.AutoResize; } if (data.FFplayer.fullscreen != default(bool)) { ConfigFFplayer.fullscreen = data.FFplayer.fullscreen; } if (data.FFplayer.display != default(bool)) { ConfigFFplayer.display = data.FFplayer.display; } if (data.FFplayer.volume != default(double)) { ConfigFFplayer.volume = data.FFplayer.volume; } if (data.FFplayer.mute != default(bool)) { ConfigFFplayer.mute = data.FFplayer.mute; } if (data.FFplayer.width != default(int)) { ConfigFFplayer.width = data.FFplayer.width; } if (data.FFplayer.hight != default(int)) { ConfigFFplayer.hight = data.FFplayer.hight; } if (data.FFplayer.x != default(int)) { ConfigFFplayer.x = data.FFplayer.x; } if (data.FFplayer.y != default(int)) { ConfigFFplayer.y = data.FFplayer.y; } } if (data.TSplayer != default(SavedataTSsend)) { if (data.TSplayer.SendToPort != default(int)) { ConfigTSsend.SendToPort = data.TSplayer.SendToPort; } if (data.TSplayer.SendPacketNum != default(int)) { ConfigTSsend.SendPacketNum = data.TSplayer.SendPacketNum; } if (data.TSplayer.SendDelay != default(int)) { ConfigTSsend.SendDelay = data.TSplayer.SendDelay; } if (data.TSplayer.SendLongOffset != default(int)) { ConfigTSsend.SendLongOffset = data.TSplayer.SendLongOffset; } if (data.TSplayer.SendRatebySendCount != default(int)) { ConfigTSsend.SendRatebySendCount = data.TSplayer.SendRatebySendCount; } if (data.TSplayer.SendRatebyTOTCount != default(int)) { ConfigTSsend.SendRatebyTOTCount = data.TSplayer.SendRatebyTOTCount; } if (data.TSplayer.SendVK != default(System.Windows.Forms.Keys)) { ConfigTSsend.SendVK = data.TSplayer.SendVK; } if (!string.IsNullOrWhiteSpace(data.TSplayer.SendVK_Application)) { ConfigTSsend.SendVK_Application = data.TSplayer.SendVK_Application; } } } } catch (Exception) { Save(); } }