示例#1
0
        private string GetCfg(string Key, bool Decrypt)
        {
            string empty = string.Empty;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                GlobalConfig globalConfig = new GlobalConfig();
                globalConfig = rPMGlobalConfig.GetConfigRecord(Key);
                if (globalConfig != null)
                {
                    empty = globalConfig.Value;
                    if (Decrypt)
                    {
                        try
                        {
                            empty = CryptoIO.Decrypt(empty);
                        }
                        catch (Exception exception)
                        {
                            empty = string.Empty;
                        }
                    }
                }
            }
            return(empty);
        }
示例#2
0
        public bool TestConnection()
        {
            bool flag = false;

            try
            {
                using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
                {
                    if (rPMGlobalConfig.GetConfigValue("PRODUCT_KEY") != null)
                    {
                        flag = true;
                    }
                }
            }
            catch (Exception exception)
            {
                flag = false;
            }
            return(flag);
        }
示例#3
0
 private void LoadConfig()
 {
     using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
     {
         GlobalConfig globalConfig = new GlobalConfig();
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_ACCOUNT_PATH");
         if (globalConfig != null)
         {
             this.AccountPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYSTEM_PATH");
         if (globalConfig != null)
         {
             this.SystemPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DB_ACCOUNT");
         if (globalConfig != null)
         {
             this.String_0 = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DATABASE");
         if (globalConfig != null)
         {
             this.Database = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_PWD");
         if (globalConfig != null)
         {
             this.DBPwd = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYS_ENABLED");
         if (globalConfig != null)
         {
             this.IsEnabled = Convert.ToBoolean(globalConfig.Value);
         }
     }
 }
示例#4
0
        public static bool CheckPassword(string pwd)
        {
            bool flag = false;

            Utility.PwdMsg = string.Empty;
            int  num   = 3;
            bool flag1 = false;
            bool flag2 = false;
            bool flag3 = false;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                bool flag4 = Convert.ToBoolean(rPMGlobalConfig.GetConfigValue("PWD_POLICY_ENABLED"));
                flag3 = flag4;
                if (flag4)
                {
                    flag1 = Convert.ToBoolean(rPMGlobalConfig.GetConfigValue("PWD_UPPERCASE", "False"));
                    flag2 = Convert.ToBoolean(rPMGlobalConfig.GetConfigValue("PWD_NUMBER", "False"));
                    num   = Convert.ToInt32(rPMGlobalConfig.GetConfigValue("PWD_MIN_LEN", "3"));
                }
            }
            bool flag5 = false;
            bool flag6 = true;
            bool flag7 = true;

            if (!flag3)
            {
                flag = true;
            }
            else
            {
                if (pwd.Length >= num)
                {
                    flag5 = true;
                }
                if (flag2)
                {
                    if (!pwd.Any <char>((char c) => char.IsDigit(c)))
                    {
                        flag6 = false;
                    }
                }
                if (flag1)
                {
                    if (!pwd.Any <char>((char c) => char.IsUpper(c)))
                    {
                        flag7 = false;
                    }
                }
                bool flag8 = flag7 & flag6 & flag5;
                flag = flag8;
                if (!flag8)
                {
                    using (RPM_GlobalConfig rPMGlobalConfig1 = new RPM_GlobalConfig())
                    {
                        string str = string.Format("Password Requirements\nLength: {0}", num);
                        if (flag2)
                        {
                            str = string.Concat(str, "\nAt least one number");
                        }
                        if (flag1)
                        {
                            str = string.Concat(str, "\nAt least one upper case letter");
                        }
                        Utility.PwdMsg = str;
                    }
                }
            }
            return(flag);
        }
示例#5
0
        public bool DeleteSlideFile(int days)
        {
            this.sRecord.Action = ACTION.NONE;
            bool flag = false;

            if (days > 0 && (this.sRecord.dRecord.Classification.ToUpper().Equals("UNCLASSIFIED") || string.IsNullOrEmpty(this.sRecord.dRecord.Classification)))
            {
                DateTime value = this.sRecord.dRecord.FileAddedTimestamp.Value;
                value = value.AddDays((double)days);
                if (DateTime.Now > value)
                {
                    this.picDelete.Visible = true;
                    Application.DoEvents();
                    DateTime now  = DateTime.Now;
                    object[] year = new object[] { now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, now.Millisecond };
                    string   str  = string.Format("{0}{1:00}{2:00}_{3:00}{4:00}{5:00}.{6:0000}.zip", year);
                    string   str1 = Path.Combine(this.sRecord.dRecord.UNCName, this.sRecord.dRecord.UNCPath);
                    string   str2 = Path.Combine(Network.FormatPath(str1), string.Format("{0}{1}", this.sRecord.dRecord.StoredFileName, this.sRecord.dRecord.FileExtension));
                    if (!File.Exists(str2))
                    {
                        MessageBox.Show(this, string.Format(LangCtrl.GetString("sld_SourceFile", "Source File Not Found: {0}"), str2), "File Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        string empty  = string.Empty;
                        string empty1 = string.Empty;
                        using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
                        {
                            GlobalConfig configRecord = rPMGlobalConfig.GetConfigRecord("RET_UNC_ROOT");
                            if (configRecord != null)
                            {
                                empty = configRecord.Value;
                            }
                            configRecord = rPMGlobalConfig.GetConfigRecord("RET_UNC_PATH");
                            if (configRecord != null)
                            {
                                empty1 = configRecord.Value;
                            }
                        }
                        if (!string.IsNullOrEmpty(empty) && !string.IsNullOrEmpty(empty1))
                        {
                            string str3 = Network.FormatPath(Path.Combine(empty, empty1));
                            if (!Directory.Exists(str3))
                            {
                                MessageBox.Show(this, LangCtrl.GetString("sld_ArchiveFolder", "Archive Folder Not Set!\nContact your system administrator."), "Archive Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            else if (Zip.ZipToFile(str2, str3, str))
                            {
                                using (RPM_DataFile rPMDataFile = new RPM_DataFile())
                                {
                                    DataFile dataFile = rPMDataFile.GetDataFile(this.sRecord.dRecord.Id);
                                    dataFile.PurgeFileName  = str;
                                    dataFile.PurgeTimestamp = new DateTime?(DateTime.Now);
                                    dataFile.IsPurged       = new bool?(true);
                                    rPMDataFile.SaveUpdate(dataFile);
                                    rPMDataFile.Save();
                                    try
                                    {
                                        File.Delete(str2);
                                    }
                                    catch (Exception exception1)
                                    {
                                        Exception exception = exception1;
                                        MessageBox.Show(this, exception.Message, "Delete Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                    }
                                    if (!File.Exists(str2))
                                    {
                                        Global.Log("USER DELETE", string.Format("File: {0}", str2));
                                        flag = true;
                                    }
                                }
                            }
                        }
                    }
                    this.picDelete.Visible = false;
                    Application.DoEvents();
                }
            }
            return(flag);
        }
示例#6
0
        private void Run()
        {
            int num = 0;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                GlobalConfig configRecord = rPMGlobalConfig.GetConfigRecord("FILEDELETE_MINDAYS");
                if (configRecord != null)
                {
                    num = Convert.ToInt32(configRecord.Value);
                }
            }
            int num1 = 0;

            for (int i1 = 0; i1 < this.FilePanel.Controls.Count; i1++)
            {
                if (((Slide)this.FilePanel.Controls[i1]).sRecord.IsSelected)
                {
                    num1++;
                }
            }
            int num2 = 0;

            this.progBar.Maximum = num1;
            try
            {
                bool flag = false;
                if (num > 0)
                {
                    int num3 = 0;
                    base.BeginInvoke(new MethodInvoker(() => {
                        for (int i = this.FilePanel.Controls.Count - 1; i >= 0; i--)
                        {
                            Slide item = (Slide)this.FilePanel.Controls[i];
                            if (item.sRecord.IsSelected)
                            {
                                this.msgText.Text = item.sRecord.dRecord.ShortDesc;
                                this.pic.Image    = Utilities.ByteArrayToImage(item.sRecord.dRecord.Thumbnail);
                                num2++;
                                this.progBar.Value = num2;
                                flag = true;
                                if (!item.sRecord.dRecord.IsIndefinite & !item.sRecord.dRecord.IsEvidence && item.DeleteSlideFile(num))
                                {
                                    num3++;
                                    this.FilePanel.Controls.Remove(item);
                                }
                            }
                            if (this.IsCancel)
                            {
                                break;
                            }
                        }
                        string str = string.Format(LangCtrl.GetString("txt_FilesDeleted", "Files Deleted: {0}"), num3);
                        if (num2 != num3 && flag)
                        {
                            str = string.Concat(str, LangCtrl.GetString("txt_FilesDeleted2", "\nSome files could not be deleted. Minimum delete days."));
                        }
                        MessageBox.Show(this, str, "Files", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        base.Close();
                    }));
                }
            }
            catch (Exception exception)
            {
                Logger.Logging.WriteSystemLog(VMGlobal.LOG_ACTION.CODE_ERROR, exception.Message, this.Account_ID);
            }
            base.BeginInvoke(new MethodInvoker(() => base.Close()));
        }