示例#1
0
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            //读取Main.ini  
            Ini ini = new Ini(AppDomain.CurrentDomain.BaseDirectory + "Main.ini");
            string password_content = ini.ReadValue("Option", "sPassword");

            //MD5加密
            byte[] results = Encoding.Default.GetBytes(this.pwdPassword.Password);
            MD5 md5s = new MD5CryptoServiceProvider();
            byte[] outputs = md5s.ComputeHash(results);
            string password = BitConverter.ToString(outputs).Replace("-", "");

            // 密码确认
            if (password_content.Equals(password))
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                //MessageBox.Show("密码错误!请重新输入!");
                this.lblErrMsg.Content = "您输入的密码有误,请重新输入。";
                this.pwdPassword.Clear();
                //this.managementPassword.Focus();
                return;
            }
        }
示例#2
0
        private void btnModify_OnClick(object sender, RoutedEventArgs e)
        {
            //读取Main.ini  
            Ini ini = new Ini(AppDomain.CurrentDomain.BaseDirectory + "Main.ini");
            string password_content = ini.ReadValue("Option", "sPassword");

            //MD5加密
            byte[] result = Encoding.Default.GetBytes(Password_old_text.Password);
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            string password_content_text = BitConverter.ToString(output).Replace("-", "");

            Password_old_error.Content = "";
            Password_new_error.Content = "";
            Password_new_confirm_text_error.Content = "";
            if (Password_old_text.Password == "")
            {
                Password_old_error.Content = "请输入当前密码";
            }
            else if (Password_new_text.Password == "")
            {
                Password_new_error.Content = "请输入新密码";
            }
            else if (Password_new_text.Password != Password_new_confirm_text.Password)
            {
                Password_new_confirm_text_error.Content = "两次输入的密码不一致";
            }
            else if (password_content_text != password_content)
            {
                Password_old_error.Content = "密码错误,请重新输入!";
            }
            else if (password_content_text == password_content)
            {
                //MD5加密
                byte[] results = Encoding.Default.GetBytes(Password_new_text.Password);
                MD5 md5s = new MD5CryptoServiceProvider();
                byte[] outputs = md5s.ComputeHash(results);
                string password_content_texts = BitConverter.ToString(outputs).Replace("-", "");
                //写入Main.ini
                ini.Writue("Option", "sPassword", password_content_texts);

                Password_old_text.Password = "";
                Password_new_text.Password = "";
                Password_new_confirm_text.Password = "";
                MessageBox.Show("密码修改成功!", MainControl.MainConst.MESSAGE_BOX_TITLE);
            }
        }
示例#3
0
        private void OtherSettingReset()
        {
            //读取Main.ini  
            Ini ini = new Ini(AppDomain.CurrentDomain.BaseDirectory + "Main.ini");
            //上传模式(分类上传或直接上传)
            string categoFlag = ini.ReadValue("Zhimin", "categoFlag");
            if (categoFlag == "1")
            {
                chbUploadWithCatego.IsChecked = true;
            }
            else
            {
                chbUploadWithCatego.IsChecked = false;
            }
            //视频是否压缩
            string compressFlag = ini.ReadValue("Zhimin", "compressFlag");
            if (compressFlag == "1")
            {
                chbCompressVedio.IsChecked = true;
            }
            else
            {
               chbCompressVedio.IsChecked = false;
            }
            //兼容模式
            string compatibleFlag = ini.ReadValue("Zhimin", "compatibleFlag");
            if (compatibleFlag == "1")
            {
                chbCompatibilityMode.IsChecked = true;
            }
            else
            {
                chbCompatibilityMode.IsChecked = false;
            }
            //禁用鼠标键盘
            string UsbFlg = ini.ReadValue("Server", "UsbFlg");
            if (UsbFlg == "1")
            {
                chbForbidUsb.IsChecked = true;
            }
            else
            {
                chbForbidUsb.IsChecked = false;
            }

        }
示例#4
0
 private void SystemSettingReset()
 {
     //读取Main.ini  
     Ini ini = new Ini(AppDomain.CurrentDomain.BaseDirectory + "Main.ini");
     //是否需要上传
     string serverFlag = ini.ReadValue("Server", "serverType");
     if(serverFlag.Equals("local")){
         serverType.IsChecked = true;
         txbNetUri.IsEnabled = false;
         txbUser.IsEnabled = false;
         txbPwd.IsEnabled = false;
         txbIp.IsEnabled = false;
         btnTest.IsEnabled = false;
     }else{
         serverType.IsChecked = false;
         txbNetUri.IsEnabled = true;
         txbUser.IsEnabled = true;
         txbPwd.IsEnabled = true;
         txbIp.IsEnabled = true;
         btnTest.IsEnabled = true;
     }
     
     //网络路径
     string sRemoteDir = ini.ReadValue("Server", "sRemoteDir");
     txbNetUri.Text = sRemoteDir;
     //用户名
     string sRemoteUser = ini.ReadValue("Server", "sRemoteUser");
     txbUser.Text = sRemoteUser;
     //密码
     string sRemotePin = ini.ReadValue("Server", "sRemotePin");
     txbPwd.Password = sRemotePin;
     //网络IP
     string sIP = ini.ReadValue("Server", "sIP");
     txbIp.Text = sIP;
     //系统重启
     string sRebootTime = ini.ReadValue("Timer", "sRebootTime");
     txbRestart.Text = sRebootTime;
     //缩略图目录
     string ThumbnailPath = ini.ReadValue("Thumbnail", "path");
     txbShortcutDir.Text = ThumbnailPath;
     //缓存目录
     string sCacheDir = ini.ReadValue("Local", "sCacheDir");
     txbCacheDir.Text = sCacheDir;
     //声音警告
     string iDriveQuota = ini.ReadValue("Local", "iDriveQuota");
     txbWrnDiscSpace.Text = iDriveQuota;
     //文件缓存期限
     string iDays = ini.ReadValue("Local", "iDays");
     txbFileCachedDays.Text = iDays;
     //空闲时上传文件、时间设定
     //string bIdleUpload = ini.ReadValue("Server", "bIdleUpload");
     //if (bIdleUpload == "1")
     //{
     //    chbUploadOnFree.IsChecked = true;
     //}
     //string sIdleTime = ini.ReadValue("Server", "sIdleTime");
     //txbUploadOnFree.Text = sIdleTime;
 }
示例#5
0
        //Refresh the Date Time on MainWindow
        private void OnStatusTimer(object sender, EventArgs e)
        {
            Ini mainIni = new Ini(AppDomain.CurrentDomain.BaseDirectory + "Main.ini");

            //服务器ip
            string sIP = mainIni.ReadValue("Server", "sIP");
            SolidColorBrush sClrBrush = new SolidColorBrush();

            Uri uriImageCp;
            if (PingNetAddress(sIP))
            {
                uriImageCp = new Uri(@"/DAMS;component/Resources/Green3_S.png", UriKind.Relative);
            }
            else
            {
                uriImageCp = new Uri(@"/DAMS;component/Resources/Orage3_S.png", UriKind.Relative);
            }
            //显示硬盘空间
            string iDriveQuota = mainIni.ReadValue("Local", "iDriveQuota");
            string sCacheDir = mainIni.ReadValue("Local", "sCacheDir");
            string hdPath = sCacheDir.Split(':')[0];
            
            this.imgIpStatus.Source = new BitmapImage(uriImageCp);
            long totalHD = GetHardDiskSpace(hdPath);
            long freeHD = GetHardDiskFreeSpace(hdPath);
            this.hdTotal.Content = "合计 " + totalHD + "GB";
            this.hdFree.Content = "剩余 " + freeHD + "GB";
            this.hdStatus.Minimum = 0;
            this.hdStatus.Maximum = 100;
            if (0 != totalHD)
            {
                this.hdStatus.Value = ((totalHD -freeHD) * 100.0 / totalHD);
            }
            else
            {
                this.hdStatus.Value = 0;
            }

            iDriveQuota = (iDriveQuota == "" )? "0" : iDriveQuota;
            
            if (Convert.ToDouble(iDriveQuota) > freeHD)
            {
               Console.Beep(800, 5000);
               MessageBox.Show("硬盘可用空间即将达到设定的上限,请联系管理员!", MainControl.MainConst.MESSAGE_BOX_TITLE);
            }

            //Monitor this DA station and insert info into DB
            daMonitor.Monitor();

            statusTimer.Interval = new TimeSpan(0, 0, 15, 0);
            
        }