public InitializeLogger(int trc_Level)
 {
     logging_interval = 60000;
        log_size = 1000000;
        l = new CLogger();
        trc_level = trc_Level;
 }
 public InitializeLogger(uint interval, uint size, int trc_Level)
 {
     logging_interval = interval;
        log_size = size;
        l = new CLogger();
        trc_level = trc_Level;
 }
Пример #3
0
 public static void Log(CLogger logger, LogType logType, LogLevel logLevel, string header, string message, LogType defaultLogType)
 {
     try {
         if (logger != null) {
             logger.Log(logType, logLevel, header + " : " + message);
             return;
         }
     } catch {
     }
     Log(logger, logType, logLevel, header, message);
 }
Пример #4
0
 public static bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         L.SetLogLevel((LogLevel)((TraceLevel < 0 || TraceLevel > 4) ? 3 : TraceLevel));
         L.SetLogFile(@"C:\tmp\IISRecorderLog.log");
         L.SetTimerInterval(LogType.FILE, 0);
         L.SetLogFileSize(10000000);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("RemoteRecorderBase->InitializeLogger() ", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
Пример #5
0
        public byte[] GetRedirect(LoginClient client, short serverId)
        {
            if (GlobalRedirection != null)
            {
                string[] a = client._address.ToString().Split(':')[0].Split('.'), b = GlobalRedirection.mask.Split('.');
                byte[]   d = new byte[4];
                for (byte c = 0; c < 4; c++)
                {
                    d[c] = 0;

                    if (b[c] == "*")
                    {
                        d[c] = 1;
                    }
                    else if (b[c] == a[c])
                    {
                        d[c] = 1;
                    }
                    else if (b[c].Contains("/"))
                    {
                        byte n = byte.Parse(b[c].Split('/')[0]), x = byte.Parse(b[c].Split('/')[1]);
                        byte t = byte.Parse(a[c]);
                        d[c] = (t >= n && t <= x) ? (byte)1 : (byte)0;
                    }
                }

                if (d.Min() == 1)
                {
                    CLogger.info("Redirecting client to global " + GlobalRedirection.redirect + " on #" + serverId);
                    return(GlobalRedirection.redirectBits);
                }
            }
            else
            {
                if (redirects.Count == 0)
                {
                    return(null);
                }

                foreach (NetRedClass nr in redirects)
                {
                    if (nr.serverId == serverId)
                    {
                        string[] a = client._address.ToString().Split(':')[0].Split('.'), b = nr.mask.Split('.');
                        byte[]   d = new byte[4];
                        for (byte c = 0; c < 4; c++)
                        {
                            d[c] = 0;

                            if (b[c] == "*")
                            {
                                d[c] = 1;
                            }
                            else if (b[c] == a[c])
                            {
                                d[c] = 1;
                            }
                            else if (b[c].Contains("/"))
                            {
                                byte n = byte.Parse(b[c].Split('/')[0]), x = byte.Parse(b[c].Split('/')[1]);
                                byte t = byte.Parse(a[c]);
                                d[c] = (t >= n && t <= x) ? (byte)1 : (byte)0;
                            }
                        }

                        if (d.Min() == 1)
                        {
                            CLogger.info("Redirecting client to " + nr.redirect + " on #" + serverId);
                            return(nr.redirectBits);
                        }
                    }
                }
            }

            return(null);
        }
Пример #6
0
 protected internal override void write()
 {
     CLogger.getInstance().info("Send: opcode_3587_ACK");
     if (this._p.getRoom() != null && this._p.getRoom().getPlayerBySlot(_slot) != null)
     {
         Room    r = this._p.getRoom();
         Account p = r.getPlayerBySlot(_slot);
         CLogger.getInstance().info("Tipo1");
         writeD(1);                     // если есть инфа или игрок?
         writeS(p.getPlayerName(), 33); // Имя перса
         writeD(p.getExp());            // опыт
         writeD(p.getRank());           // ранк (0-54)
         writeD(0);                     // Пока не понятно за чего отвечают пустые байты...
         writeD(p.getGP());             // ГП
         writeD(0);                     // Рублики
         writeB(new byte[13]);          // Хз что это такое
         writeD(p.getPcCafe());         // Какое то извещение....Оо PC_Cafe(0x02 - Премиум, 0x01 - Нормал, 0x00 - нет пс_кафе) =)
         writeH(0);
         if (p.getClanId() == 0)
         {
             writeS("", 17); // Clan name 16 символов =) //ERRO PODE ESTAR AQUI PORQUE A QUANTIDADE DE CARACTERES NO MYINFO É DE 17 E AQUI É 16
             writeC(0);      // что то типа разделителя между названием клана и его рангом
             writeH(0);      // Ранг клана - 53 - max
             writeC(255);    // Лого1
             writeC(255);    // Лого2
             writeC(255);    // Лого3
             writeC(255);    // Лого4
             writeH(0);      // цвет названия клана.
         }
         if (p.getClanId() > 0)
         {
             Clan clan = ClanManager.getInstance().get(p.getClanId());
             writeS(clan.getClanName(), 17);     // Clan name 16 символов =)
             writeC(0);                          // что то типа разделителя между названием клана и его рангом
             writeH((short)clan.getClanRank());  // Ранг клана - 53 - max
             writeC((byte)clan.getLogo1());      // Лого1
             writeC((byte)clan.getLogo2());      // Лого2
             writeC((byte)clan.getLogo3());      // Лого3
             writeC((byte)clan.getLogo4());      // Лого4
             writeH((short)clan.getLogoColor()); // цвет названия клана.
         }
         writeD(0);                              // Непонятно чо
         writeD(0);
         writeD(0);
         writeD(p._statistic.getFights(true));     // Количество боев
         writeD(p._statistic.getWinFights(true));  // Количество побед
         writeD(p._statistic.getLostFights(true)); // Количество поражениев
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getKills(true));      // Количество убийств
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getDeaths(true));     // Количество смертей
         writeD(0);                                // Непонятно чо
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getEscapes(true));    // Количество побегов с поля боя
         writeD(p._statistic.getFights(true));     // Количество боев
         writeD(p._statistic.getWinFights(true));  // Количество побед
         writeD(p._statistic.getLostFights(true)); // Количество поражений
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getKills(true));      // Количество убийств
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getDeaths(true));     // Количество смертей
         writeD(0);                                // Непонятно чо
         writeD(0);                                // Непонятно чо
         writeD(p._statistic.getEscapes(true));    // Количество побегов с поля боя
         writeD(p.getCharRed());                   // Скин Мужчина стандартный красные.
         writeD(p.getCharBlue());                  // Скин Мужчина стандартный синие.
         writeD(p.getCharHelmet());                // Шлем.
         writeD(p.getCharBeret());                 // Берет.
         writeD(p.getCharDino());                  // Скин дино.
         writeD(p.getPrimaryWeapon());             // Основное оружие
         writeD(p.getSecondaryWeapon());           // Второстепенное оружие
         writeD(p.getMeleeWeapon());               // Ближнего боя
         writeD(p.getThrownNormalWeapon());        // Гранаты (Гранаты для взрыва)
         writeD(p.getThrownSpecialWeapon());       // Гранаты (Гранаты специальные, смок, слеповуха)
     }
     else
     {
         CLogger.getInstance().info("Tipo2");
         this.writeD(1);
     }
 }
Пример #7
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>
        /// アンマネージ リソースの解放およびリセットに関連付けられている
        /// アプリケーション定義のタスクを実行します。
        /// </summary>
        public void Dispose()
        {
            CLogger.add("音響リソースの解放をしています...");
            string strErr = string.Empty;

            try
            {
                if (cueBGM != null)
                {
                    cueBGM.Dispose();
                }
            }
            catch (Exception e)
            {
                strErr += e.ToString() + "\r\n";
            }
            try
            {
                if (soundBank != null)
                {
                    soundBank.Dispose();
                }
            }
            catch (Exception e)
            {
                strErr += e.ToString() + "\r\n";
            }
            try
            {
                if (waveBankBGM != null)
                {
                    waveBankBGM.Dispose();
                }
            }
            catch (Exception e)
            {
                strErr += e.ToString() + "\r\n";
            }
            try
            {
                if (waveBankSE != null)
                {
                    waveBankSE.Dispose();
                }
            }
            catch (Exception e)
            {
                strErr += e.ToString() + "\r\n";
            }
            try
            {
                if (engine != null)
                {
                    engine.Dispose();
                }
            }
            catch (Exception e)
            {
                strErr += e.ToString() + "\r\n";
            }
            if (strErr.Length > 0)
            {
                CLogger.add(
                    "音響処理の解放に失敗しました。" + Environment.NewLine +
                    "完全に終了しないうちにウィンドウを非アクティブにするとこの現象が起きやすいです。" +
                    Environment.NewLine + Environment.NewLine + strErr);
            }
            soundBank   = null;
            cueBGM      = null;
            waveBankBGM = null;
            waveBankSE  = null;
            engine      = null;
            CLogger.add("音響リソースの解放完了。");
        }
Пример #8
0
        public object ReturnMySQLObject(Hashtable Params, string CommandText, ClsUtility.ObjectEnum Obj)
        {
            int              i;
            string           cmdpara, cmdvalue, cmddbtype;
            MySqlCommand     theCmd   = new MySqlCommand();
            MySqlTransaction theTran  = (MySqlTransaction)this.Transaction;
            MySqlConnection  cnn      = null;
            StringBuilder    strParam = new StringBuilder();

            try
            {
                if (null == this.Connection)
                {
                    cnn = (MySqlConnection)DataMgr.GetMySQLConnection();
                }
                else
                {
                    cnn = (MySqlConnection)this.Connection;
                }

                if (null == this.Transaction)
                {
                    theCmd = new MySqlCommand(CommandText, cnn);
                }
                else
                {
                    theCmd = new MySqlCommand(CommandText, cnn, theTran);
                }

                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    cmdvalue  = Params[i + 2].ToString();
                    theCmd.Parameters.Add(cmdpara, cmddbtype).Value = cmdvalue;
                    i = i + 3;
                }

                theCmd.CommandType    = CommandType.StoredProcedure;
                theCmd.CommandTimeout = DataMgr.CommandTimeOut();
                string theSubstring = CommandText.Substring(0, 6).ToUpper();
                switch (theSubstring)
                {
                case "SELECT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "UPDATE":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "INSERT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "DELETE":
                    theCmd.CommandType = CommandType.Text;
                    break;
                }

                theCmd.Connection = cnn;

                if (Obj == ClsUtility.ObjectEnum.DataSet)
                {
                    MySqlDataAdapter theAdpt = new MySqlDataAdapter(theCmd);
                    DataSet          theDS   = new DataSet();
                    theAdpt.Fill(theDS);
                    theAdpt.Dispose();
                    return(theDS);
                }
                if (Obj == ClsUtility.ObjectEnum.DataTable)
                {
                    MySqlDataAdapter theAdpt = new MySqlDataAdapter(theCmd);
                    DataTable        theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT);
                }
                if (Obj == ClsUtility.ObjectEnum.DataRow)
                {
                    MySqlDataAdapter theAdpt = new MySqlDataAdapter(theCmd);
                    DataTable        theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT.Rows[0]);
                }
                if (Obj == ClsUtility.ObjectEnum.ExecuteNonQuery)
                {
                    int NoRowsAffected = theCmd.ExecuteNonQuery();
                    return(NoRowsAffected);
                }
                return(0);
            }
            catch (Exception err)
            {
                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    cmdvalue  = Params[i + 2].ToString();
                    strParam.Append("Name: " + cmdpara + ", Type: " + cmddbtype + ", Value: " + cmdvalue + " ");
                    strParam.Append(Environment.NewLine);

                    i = i + 3;
                }

                CLogger.WriteLog("Namespace: DataAccess.Entity, Class: ClsObject, Method: ReturnMySQLObject - Call started.", CommandText, strParam.ToString(), err.ToString());

                throw err;
            }
            finally
            {
                if (null != cnn)
                {
                    if (null == this.Connection)
                    {
                        DataMgr.ReleaseMySQLConnection(cnn);
                    }
                }
            }
        }
Пример #9
0
        public bool Initialize_Logger()
        {
            try
            {
                _l = new CLogger();
                switch (_trcLevel)
                {
                    case 0:
                        {
                            _l.SetLogLevel(LogLevel.NONE);
                        } break;
                    case 1:
                        {
                            _l.SetLogLevel(LogLevel.INFORM);
                        } break;
                    case 2:
                        {
                            _l.SetLogLevel(LogLevel.WARN);
                        } break;
                    case 3:
                        {
                            _l.SetLogLevel(LogLevel.ERROR);
                        } break;
                    case 4:
                        {
                            _l.SetLogLevel(LogLevel.DEBUG);
                        } break;
                }

                _l.SetLogFile(_errLog);
                _l.SetTimerInterval(LogType.FILE, LoggingInterval);
                _l.SetLogFileSize(LogSize);

                return true;
            }
            catch (Exception er)
            {
                EventLog.WriteEntry("Security Manager CryptTechHotspotV_1_0_1Recorder", er.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
        public void Test1(string dllPath, CLogger logger)
        {
            Assembly testAssembly = Assembly.LoadFile(dllPath);
            Type type = testAssembly.GetType("Parser.IISV_7_1_0Recorder");
            var instance = (CustomBase)Activator.CreateInstance(type);

            TestRecorder testRecorder = new TestRecorder();

            //instance.GetInstanceListService()["Security Manager Remote Recorder"] = new CustomServiceBase();
            //CustomServiceBase s = base.GetInstanceService("Security Manager Remote Recorder");

            string iisLogFileLocation = @"C:\tmp\iisLogs\";

            //Assembly içindeki erişilen tüm varieble'ların değerlerini gösterir.
            /*
            FieldInfo[] myFields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
            Console.WriteLine(type);

            for (int i = 0; i < myFields.Length; i++)
            {
                Console.WriteLine("The value of {0} is: {1}",
                    myFields[i].Name, myFields[i].GetValue(instance));
            }
             * */

            /*FieldInfo fieldInfoDir = type.GetField("Dir", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoDir.SetValue(instance, iisLogFileLocation);
            Console.WriteLine("Dir. {0}", fieldInfoDir.GetValue(instance));*/

            /* FieldInfo fieldInfoUsingRegistry = type.GetField("usingRegistry", BindingFlags.NonPublic | BindingFlags.Instance);
             fieldInfoUsingRegistry.SetValue(instance, false);
             Console.WriteLine("usingRegistry.{0}", fieldInfoUsingRegistry.GetValue(instance));*/

            /*FieldInfo fieldInfoLogFileLocation = type.GetField("logFileLocation", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLogFileLocation.SetValue(instance, @"C:\tmp\iis.log");
            Console.WriteLine("fieldInfoLogFileLocation.{0}", fieldInfoLogFileLocation.GetValue(instance));*/

            /*FieldInfo fieldInfoLogFileLocation = type.GetField("Log", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLogFileLocation.SetValue(instance, logger);
            Console.WriteLine("fieldInfoLogFileLocation.{0}", fieldInfoLogFileLocation.GetValue(instance));*/

            //readMethod
            //threadSleepTime
            //dontSend
            /*
            FieldInfo fieldInfodontSend = type.GetField("dontSend", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfodontSend.SetValue(instance, true);
            Console.WriteLine("threadSleepTime:'{0}'", fieldInfodontSend.GetValue(instance));
            */

            //FieldInfo fieldInfoTEST_ACTIVE = type.GetField("TEST_ACTIVE", BindingFlags.NonPublic | BindingFlags.Instance);
            //fieldInfoTEST_ACTIVE.SetValue(instance, testRecorder.GetInstanceService("Security Manager Remote Recorder"));

            FieldInfo fieldInfologFileSize = type.GetField("logFileSize", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfologFileSize.SetValue(instance, (uint)10000000);
            Console.WriteLine("LastKeywords:'{0}'", fieldInfologFileSize.GetValue(instance));

            FieldInfo fieldInfoLastKeywords = type.GetField("lastKeywords", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLastKeywords.SetValue(instance, "");
            Console.WriteLine("LastKeywords:'{0}'", fieldInfoLastKeywords.GetValue(instance));

            DateTime dt = DateTime.Now;
            string dateTime = dt.ToString(dateFormat);
            FieldInfo fieldInfoLastRecDate = type.GetField("LastRecDate", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLastRecDate.SetValue(instance, dateTime);
            Console.WriteLine("LastRecDate:'{0}'", fieldInfoLastRecDate.GetValue(instance));

            FieldInfo fieldInfothreadSleepTime = type.GetField("threadSleepTime", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfothreadSleepTime.SetValue(instance, 10);
            Console.WriteLine("threadSleepTime:'{0}'", fieldInfothreadSleepTime.GetValue(instance));

            FieldInfo fieldInfoRemoteHost = type.GetField("remoteHost", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoRemoteHost.SetValue(instance, "");
            Console.WriteLine("RemoteHost:'{0}'", fieldInfoRemoteHost.GetValue(instance));

            FieldInfo fieldInfoPosition = type.GetField("Position", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoPosition.SetValue(instance, 0);
            Console.WriteLine("Position:'{0}'", fieldInfoPosition.GetValue(instance));

            FieldInfo fieldInfoUser = type.GetField("user", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoUser.SetValue(instance, "Administrator");
            Console.WriteLine("User:'******'", fieldInfoUser.GetValue(instance));

            FieldInfo fieldInfoSleepTime = type.GetField("_SleepTime", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoSleepTime.SetValue(instance, 10);
            Console.WriteLine("_SleepTime:'{0}'", fieldInfoSleepTime.GetValue(instance));

            FieldInfo fieldInfoPassword = type.GetField("password", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoPassword.SetValue(instance, "");
            Console.WriteLine("Password:'******'", fieldInfoPassword.GetValue(instance));

            Console.WriteLine("Dir. '{0}'", FieldSetNewValue("Dir", type, instance, iisLogFileLocation));
            Console.WriteLine("UsingRegistry.'{0}'", FieldSetNewValue("usingRegistry", type, instance, false));

            RegistryKey regIn = Registry.LocalMachine.OpenSubKey("Software\\NATEK\\Security Manager\\Remote Recorder");
            string home = (String)regIn.GetValue("Home Directory");

            Console.WriteLine("home: {0}", home);
            Console.ReadLine();

            var Init =
                (string)
                    type.InvokeMember("Init", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null,
                                  instance, null);

            var Start =
                (string)
                    type.InvokeMember("Start", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null,
                                  instance, null);

            //Start
        }
Пример #11
0
        public void GetGames(List <ImportGameData> gameDataList, bool expensiveIcons = false)
        {
            string strPlatform = GetPlatformString(ENUM);

            // Get installed games
            string db = Path.Combine(GetFolderPath(SpecialFolder.ApplicationData), ITCH_DB);

            if (!File.Exists(db))
            {
                CLogger.LogInfo("{0} database not found.", _name.ToUpper());
                return;
            }

            try
            {
                using SQLiteConnection con = new($"Data Source={db}");
                con.Open();

                // Get both installed and not-installed games

                using (SQLiteCommand cmd = new("SELECT id, title, classification, cover_url, still_cover_url FROM games;", con))
                    using (SQLiteDataReader rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            if (!rdr.GetString(2).Equals("assets")) // i.e., just "game" or "tool"
                            {
                                int      id        = rdr.GetInt32(0);
                                string   strID     = $"itch_{id}";
                                string   strTitle  = rdr.GetString(1);
                                string   strAlias  = "";
                                string   strLaunch = "";
                                DateTime lastRun   = DateTime.MinValue;

                                string iconUrl = rdr.GetString(4);
                                if (string.IsNullOrEmpty(iconUrl))
                                {
                                    iconUrl = rdr.GetString(3);
                                }

                                // SELECT path FROM install_locations;
                                // SELECT install_folder FROM downloads;
                                using (SQLiteCommand cmd2 = new($"SELECT installed_at, last_touched_at, verdict, install_folder_name FROM caves WHERE game_id = {id};", con))
                                    using (SQLiteDataReader rdr2 = cmd2.ExecuteReader())
                                    {
                                        while (rdr2.Read())
                                        {
                                            if (!rdr2.IsDBNull(1))
                                            {
                                                lastRun = rdr2.GetDateTime(1);
                                                //CLogger.LogDebug("    last_touched_at: " + rdr2.GetString(1) + " -> " + lastRun.ToShortDateString());
                                            }
                                            //else if (!rdr2.IsDBNull(0))
                                            //    lastRun = rdr2.GetDateTime(0);
                                            string verdict = rdr2.GetString(2);
                                            //strAlias = rdr2.GetString(3);
                                            strAlias = GetAlias(strTitle);
                                            if (strAlias.Equals(strTitle, CDock.IGNORE_CASE))
                                            {
                                                strAlias = "";
                                            }

                                            using JsonDocument document = JsonDocument.Parse(@verdict, jsonTrailingCommas);
                                            string basePath = GetStringProperty(document.RootElement, "basePath");
                                            if (document.RootElement.TryGetProperty("candidates", out JsonElement candidates) && !string.IsNullOrEmpty(candidates.ToString()))
                                            {
                                                foreach (JsonElement jElement in candidates.EnumerateArray())
                                                {
                                                    strLaunch = string.Format("{0}\\{1}", basePath, GetStringProperty(jElement, "path"));
                                                }
                                            }
                                            // Add installed games
                                            if (!string.IsNullOrEmpty(strLaunch))
                                            {
                                                CLogger.LogDebug($"- {strTitle}");
                                                gameDataList.Add(new ImportGameData(strID, strTitle, strLaunch, strLaunch, "", strAlias, true, strPlatform, dateLastRun: lastRun));

                                                // Use still_cover_url, or cover_url if it doesn't exist, to download missing icons
                                                if (!(bool)(CConfig.GetConfigBool(CConfig.CFG_IMGDOWN)) &&
                                                    !Path.GetExtension(strLaunch).Equals(".exe", CDock.IGNORE_CASE))
                                                {
                                                    CDock.DownloadCustomImage(strTitle, iconUrl);
                                                }
                                            }
                                        }
                                    }
                                // Add not-installed games
                                if (string.IsNullOrEmpty(strLaunch) && !(bool)CConfig.GetConfigBool(CConfig.CFG_INSTONLY))
                                {
                                    CLogger.LogDebug($"- *{strTitle}");
                                    gameDataList.Add(new ImportGameData(strID, strTitle, "", "", "", "", false, strPlatform));

                                    // Use still_cover_url, or cover_url if it doesn't exist, to download not-installed icons
                                    if (!(bool)(CConfig.GetConfigBool(CConfig.CFG_IMGDOWN)))
                                    {
                                        CDock.DownloadCustomImage(strTitle, iconUrl);
                                    }
                                }
                            }
                        }
                    }
                con.Close();
            }
            catch (Exception e)
            {
                CLogger.LogError(e, string.Format("Malformed {0} database output!", _name.ToUpper()));
            }
            CLogger.LogDebug("-------------------");
        }
Пример #12
0
        private void GetPatientIPTDetails(Patient cust)
        {
            try
            {
                IIPTDetails iiptdetails;
                DataSet     ds = new DataSet();
                iiptdetails = new BIPTDetails();
                patientId   = cust.PatientId;
                ds          = iiptdetails.GetPatientIPTDetails(Convert.ToInt32(ConfigurationSettings.AppSettings["AppLocationId"].ToString())
                                                               , cust.PatientId);



                #region DataManupulation
                dsPatientDetails = ds;

                IEnumerable <DataRow> drTBbAssessment = (from fdata in ds.Tables[1].AsEnumerable()
                                                         where fdata.Field <Int32>("Ptn_Pk") == cust.PatientId
                                                         select fdata);



                List <CodeDeCodeTables> iptadherence        = new List <CodeDeCodeTables>();
                List <CodeDeCodeTables> iptcontraindication = new List <CodeDeCodeTables>();
                List <CodeDeCodeTables> iptdiscontinued     = new List <CodeDeCodeTables>();
                List <CodeDeCodeTables> tbstatus            = new List <CodeDeCodeTables>();

                iptadherence = (from dt in ds.Tables[0].AsEnumerable().Where(o => o.Field <string>("CodeName") == "IPTAdherence").ToList()
                                select new CodeDeCodeTables()
                {
                    CodeId = dt.Field <int>("CodeId"),
                    CodeName = dt.Field <string>("CodeName"),
                    DeCodeId = dt.Field <int>("DeCodeId"),
                    DeCodeName = dt.Field <string>("DeCodeName")
                }).ToList();

                iptcontraindication = (from dt in ds.Tables[0].AsEnumerable().Where(o => o.Field <string>("CodeName") == "IPTContraindication").ToList()
                                       select new CodeDeCodeTables()
                {
                    CodeId = dt.Field <int>("CodeId"),
                    CodeName = dt.Field <string>("CodeName"),
                    DeCodeId = dt.Field <int>("DeCodeId"),
                    DeCodeName = dt.Field <string>("DeCodeName")
                }).ToList();

                iptdiscontinued = (from dt in ds.Tables[0].AsEnumerable().Where(o => o.Field <string>("CodeName") == "IPTDiscontinued").ToList()
                                   select new CodeDeCodeTables()
                {
                    CodeId = dt.Field <int>("CodeId"),
                    CodeName = dt.Field <string>("CodeName"),
                    DeCodeId = dt.Field <int>("DeCodeId"),
                    DeCodeName = dt.Field <string>("DeCodeName")
                }).ToList();


                tbstatus = (from dt in ds.Tables[0].AsEnumerable().Where(o => o.Field <string>("CodeName") == "TB Status").ToList()
                            select new CodeDeCodeTables()
                {
                    CodeId = dt.Field <int>("CodeId"),
                    CodeName = dt.Field <string>("CodeName"),
                    DeCodeId = dt.Field <int>("DeCodeId"),
                    DeCodeName = dt.Field <string>("DeCodeName")
                }).ToList();

                DataTable dtResult = DatatTableUtil.LINQResultToDataTable(iptcontraindication);
                DataRow   theDR    = dtResult.NewRow();
                theDR["DeCodeName"] = "Select";
                theDR["DeCodeId"]   = 0;
                dtResult.Rows.InsertAt(theDR, 0);

                cbIPTContraindication.DataSource = null;
                cbIPTContraindication.Items.Clear();

                cbIPTContraindication.DisplayMember = "DeCodeName";
                cbIPTContraindication.ValueMember   = "DeCodeId";
                cbIPTContraindication.DataSource    = dtResult;

                dtResult = DatatTableUtil.LINQResultToDataTable(iptcontraindication);
                DataRow theDR1 = dtResult.NewRow();
                theDR1["DeCodeName"] = "Select";
                theDR1["DeCodeId"]   = 0;
                dtResult.Rows.InsertAt(theDR1, 0);

                //cbIPTContraindication.DataSource = null;
                //cbIPTContraindication.Items.Clear();

                //cbIPTContraindication.DisplayMember = "DeCodeName";
                //cbIPTContraindication.ValueMember = "DeCodeId";
                //cbIPTContraindication.DataSource = dtResult;

                dtResult = DatatTableUtil.LINQResultToDataTable(iptdiscontinued);
                DataRow theDR2 = dtResult.NewRow();
                theDR2["DeCodeName"] = "Select";
                theDR2["DeCodeId"]   = 0;
                dtResult.Rows.InsertAt(theDR2, 0);

                cbIPTDiscontinued.DataSource = null;
                cbIPTDiscontinued.Items.Clear();

                cbIPTDiscontinued.DisplayMember = "DeCodeName";
                cbIPTDiscontinued.ValueMember   = "DeCodeId";
                cbIPTDiscontinued.DataSource    = dtResult;

                this.cbIPTContraindication.SelectedValue = 0;

                this.cbIPTDiscontinued.SelectedValue = 0;

                string tbFindings     = string.Empty;
                string dtStartDate    = string.Empty;
                string dtEndDate      = string.Empty;
                int    eligibleforIPT = 0;
                this.chkEligibleForIPT.Checked = false;
                int    ddlIPTContraindication = 0, ddlIPTAdherence = 0, ddlIPTDiscontinued = 0;
                string strIPT = string.Empty, otherReasonDiscontinuedIPT = String.Empty, otherReasonDeclinedIPT = String.Empty;

                #endregion

                #region Data Extract
                IEnumerable <DataRow> filterdata1 =
                    (from fdata in ds.Tables[2].AsEnumerable()
                     where fdata.Field <Int32>("Ptn_Pk") == cust.PatientId
                     select fdata).OrderBy(o => o.Field <DateTime>("CreateDate"));

                foreach (DataRow drow in filterdata1)
                {
                    if (!DBNull.Value.Equals(drow["TBFindings"]))
                    {
                        tbFindings = drow["TBFindings"].ToString();
                    }
                    if (!DBNull.Value.Equals(drow["INHStartDate"]))
                    {
                        dtStartDate = DateTime.Parse(drow["INHStartDate"].ToString()).ToString();
                    }
                    if (!DBNull.Value.Equals(drow["INHEndDate"]))
                    {
                        dtEndDate = DateTime.Parse(drow["INHEndDate"].ToString()).ToString();
                    }
                    if (!DBNull.Value.Equals(drow["EligibleForIPT"]))
                    {
                        eligibleforIPT = Convert.ToInt32(drow["EligibleForIPT"].ToString());
                    }

                    if (!DBNull.Value.Equals(drow["IPTAdherence"]))
                    {
                        ddlIPTAdherence = Convert.ToInt32(drow["IPTAdherence"].ToString());
                    }

                    if (!DBNull.Value.Equals(drow["IPTContraindication"]))
                    {
                        ddlIPTContraindication = Convert.ToInt32(drow["IPTContraindication"].ToString());
                    }

                    if (!DBNull.Value.Equals(drow["IPTDiscontinued"]))
                    {
                        ddlIPTDiscontinued = Convert.ToInt32(drow["IPTDiscontinued"].ToString());
                    }
                    if (!DBNull.Value.Equals(drow["IPT"]))
                    {
                        strIPT = drow["IPT"].ToString();
                    }
                    if (!DBNull.Value.Equals(drow["OtherReasonDiscontinuedIPT"]))
                    {
                        otherReasonDiscontinuedIPT = drow["OtherReasonDiscontinuedIPT"].ToString();
                    }
                    if (!DBNull.Value.Equals(drow["OtherReasonDeclinedIPT"]))
                    {
                        otherReasonDeclinedIPT = drow["OtherReasonDeclinedIPT"].ToString();
                    }
                }

                #endregion

                #region Assign data

                String[] names = drTBbAssessment.Select(o => o["NAME"].ToString()).ToArray();
                this.txtTBAssessment.Text = string.Join(",", names);


                if (!string.IsNullOrEmpty(tbFindings))
                {
                    DataView theCodeDV = new DataView(ds.Tables[0]);
                    theCodeDV.RowFilter = "CodeName in ('TB Status','TBFindings') and DeCodeId = '" + tbFindings + "'";
                    DataTable theCodeDT = (DataTable)DatatTableUtil.CreateTableFromDataView(theCodeDV);

                    //string strTbFinding = tbstatus.Where(o => o.DeCodeId == Convert.ToInt32(tbFindings)).FirstOrDefault().DeCodeName;
                    string strTbFinding = theCodeDT.AsEnumerable().FirstOrDefault().Field <string>("DeCodeName").ToString();
                    this.txtTBFinding.Text = GetTBStatusName(strTbFinding);
                }

                if (eligibleforIPT == 1)
                {
                    this.chkEligibleForIPT.Checked = true;
                }

                this.dtIPTEndDate.Enabled          = false;
                this.cbIPTContraindication.Enabled = false;
                //this.cbIPTContraindication.Enabled = false;
                this.cbIPTDiscontinued.Enabled = false;
                this.chkEligibleForIPT.Enabled = false;
                this.rbCompletedIPT.Enabled    = false;
                this.rbDeclinedIpt.Enabled     = false;
                this.rbDiscontinued.Enabled    = false;

                //if (ValidatePatient(ds, cust.PatientId))
                //{
                this.chkEligibleForIPT.Enabled = false;
                this.rbCompletedIPT.Enabled    = true;
                this.rbDeclinedIpt.Enabled     = true;
                this.rbDiscontinued.Enabled    = true;

                if (!string.IsNullOrEmpty(dtStartDate))
                {
                    this.dtIPTStartDate.Format       = DateTimePickerFormat.Custom;
                    this.dtIPTStartDate.CustomFormat = "dd-MMM-yyyy";
                    this.dtIPTStartDate.Value        = DateTime.Parse(dtStartDate.ToString());
                }

                if (!string.IsNullOrEmpty(dtEndDate))
                {
                    this.dtIPTEndDate.Format       = DateTimePickerFormat.Custom;
                    this.dtIPTEndDate.CustomFormat = "dd-MMM-yyyy";
                    this.dtIPTEndDate.Value        = DateTime.Parse(dtEndDate.ToString());
                }


                this.cbIPTContraindication.SelectedValue = ddlIPTContraindication;
                this.cbIPTDiscontinued.SelectedValue     = ddlIPTDiscontinued;

                if (ddlIPTContraindication > 0)
                {
                    this.txtOtherReasonContraindication.Text = otherReasonDeclinedIPT;
                }

                if (ddlIPTDiscontinued > 0)
                {
                    this.txtOtherReasonDiscontinued.Text = otherReasonDiscontinuedIPT;
                }

                bool isValidForUpdate = true;
                if (!string.IsNullOrEmpty(strIPT))
                {
                    DataView theCodeDV = new DataView(ds.Tables[0]);
                    theCodeDV.RowFilter = "CodeName in ('IPT') and DeCodeId = '" + strIPT + "'";
                    DataTable theCodeDT = (DataTable)DatatTableUtil.CreateTableFromDataView(theCodeDV);
                    if (theCodeDT.Rows.Count > 0)
                    {
                        string str = theCodeDT.AsEnumerable().FirstOrDefault().Field <string>("DeCodeName").ToString();

                        switch (str.Trim().ToLower())
                        {
                        case "completed ipt":
                            this.rbCompletedIPT.Checked = true;
                            this.dtIPTEndDate.Enabled   = true;
                            isValidForUpdate            = false;
                            break;

                        case "discontinued":
                            this.rbDiscontinued.Checked    = true;
                            this.dtIPTEndDate.Enabled      = true;
                            this.cbIPTDiscontinued.Enabled = true;
                            isValidForUpdate = false;
                            break;

                        case "declined ipt":
                            this.rbDeclinedIpt.Checked         = true;
                            this.cbIPTContraindication.Enabled = true;
                            isValidForUpdate = false;
                            break;
                        }
                    }
                }


                if (!string.IsNullOrEmpty(dtStartDate.ToString()) &&
                    !string.IsNullOrEmpty(dtEndDate.ToString()))
                {
                    if (!isValidForUpdate)
                    {
                        MessageBox.Show("Patient is not eligible for IPT update.", "IQCare.IPT", MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                        this.btnSave.Enabled = false;
                    }
                }
                else
                {
                    this.btnSave.Enabled = true;
                }


                //this.dtIPTEndDate.SelectedDate = DateTime.Parse(inMyString);
                //}

                //else
                //{
                //    MessageBox.Show("Patient is not eligible for IPT update.", "IQCare.IPT", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    this.btnSave.Enabled = false;
                //}
                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "IQCare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CLogger.WriteLog(ELogLevel.ERROR, ex.ToString());
            }
        }
Пример #13
0
 protected internal override void run()
 {
     ConfigManager.getInstance().UpdateConfig(this.getClient().getPlayerId(), this.sound, this.music, this.mira, this.sensibilidade, this.visao, this.blood, this.mao, this.audio_enable);
     CLogger.getInstance().extra_info("As configurações do jogador " + this.getClient().getPlayer().getPlayerName() + " foram salvas com sucesso.");
 }
Пример #14
0
 internal void log()
 {
     CLogger.getInstance().info("|[SIIH]| Foram carregados " + (object)StartedInventoryItemsHolder._templates.Count + " itens iniciais.");
 }
Пример #15
0
        public ItemTable()
        {
            FileInfo file = new FileInfo(@"scripts\items_set.txt");

            using (StreamReader sreader = file.OpenText())
            {
                while (!sreader.EndOfStream)
                {
                    string line = sreader.ReadLine();
                    if (line.Length == 0 || line.StartsWith("#"))
                    {
                        continue;
                    }

                    string[] pt = line.Split('\t');

                    ItemSetTemplate set = new ItemSetTemplate();
                    set.armorId = Convert.ToInt32(pt[0]);

                    for (byte ord = 1; ord < pt.Length; ord++)
                    {
                        string parameter = pt[ord];
                        string value     = parameter.Substring(parameter.IndexOf('{') + 1); value = value.Remove(value.Length - 1);

                        switch (parameter.Split('{')[0].ToLower())
                        {
                        case "legs":
                            foreach (string str in value.Split(' '))
                            {
                                set.addLeg(Convert.ToInt32(str));
                            }
                            break;

                        case "helm":
                            foreach (string str in value.Split(' '))
                            {
                                set.addHelm(Convert.ToInt32(str));
                            }
                            break;

                        case "gloves":
                            foreach (string str in value.Split(' '))
                            {
                                set.addGloves(Convert.ToInt32(str));
                            }
                            break;

                        case "boots":
                            foreach (string str in value.Split(' '))
                            {
                                set.addBoot(Convert.ToInt32(str));
                            }
                            break;

                        case "shield":
                            foreach (string str in value.Split(' '))
                            {
                                set.addShield(Convert.ToInt32(str));
                            }
                            break;

                        case "set1":
                            set.set1(Convert.ToInt32(value.Split('-')[0]), Convert.ToInt32(value.Split('-')[1]));
                            break;

                        case "set2":
                            set.set2(Convert.ToInt32(value.Split('-')[0]), Convert.ToInt32(value.Split('-')[1]));
                            break;

                        case "set3":
                            set.set3(Convert.ToInt32(value.Split('-')[0]), Convert.ToInt32(value.Split('-')[1]));
                            break;
                        }
                    }

                    _sets.Add(set.armorId, set);
                }
            }

            file = new FileInfo(@"scripts\items_off.txt");
            using (StreamReader sreader = file.OpenText())
            {
                while (!sreader.EndOfStream)
                {
                    string line = sreader.ReadLine();
                    if (line.Length == 0 || line.StartsWith("#"))
                    {
                        continue;
                    }

                    string[] pt = line.Split('\t');

                    ItemTemplate item = new ItemTemplate();
                    item.ItemID = Convert.ToInt32(pt[1]);
                    item.Type   = (ItemTemplate.L2ItemType)Enum.Parse(typeof(ItemTemplate.L2ItemType), pt[0]);

                    if (_sets.ContainsKey(item.ItemID))
                    {
                        item.SetItem = true;
                    }

                    for (byte ord = 2; ord < pt.Length; ord++)
                    {
                        string parameter = pt[ord];
                        if (parameter.Length == 0)
                        {
                            continue;
                        }

                        string value = parameter.Substring(parameter.IndexOf('{') + 1);
                        try
                        {
                            value = value.Remove(value.Length - 1);
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("eh " + pt[ord]);
                        }

                        switch (parameter.Split('{')[0].ToLower())
                        {
                        case "body":
                            item.Bodypart = (ItemTemplate.L2ItemBodypart)Enum.Parse(typeof(ItemTemplate.L2ItemBodypart), value);
                            break;

                        case "armor_type":
                            item.armor_type = value;
                            break;

                        case "etcitem_type":
                            item.etcitem_type = value;
                            break;

                        case "delay_share_group":
                            item.delay_share_group = int.Parse(value);
                            break;

                        case "item_multi_skill_list":
                            item.addMultiSkills(value);
                            break;

                        case "item_skill":
                            item.addItemSkill(value);
                            break;

                        case "item_skill_enchanted_four":
                            item.addItemEnch4(value);
                            break;

                        case "recipe_id":
                            item._recipeId = int.Parse(value);
                            break;

                        case "blessed":
                            item.blessed = int.Parse(value);
                            break;

                        case "weight":
                            item.Weight = Convert.ToInt32(value);
                            break;

                        case "default_action":
                            item.default_action = value;
                            break;

                        case "consume_type":
                            item.StackType = value != "normal" ? ItemTemplate.L2ItemConsume.stackable : ItemTemplate.L2ItemConsume.normal;
                            break;

                        case "soulshot_count":
                            item.SoulshotCount = int.Parse(value);
                            break;

                        case "spiritshot_count":
                            item.SpiritshotCount = int.Parse(value);
                            break;

                        case "reduced_soulshot":
                            item.setReducingSoulShots(value);
                            break;

                        case "reduced_mp_consume":
                            item.setReducingMpConsume(value);
                            break;

                        case "immediate_effect":
                            item.immediate_effect = int.Parse(value);
                            break;

                        case "ex_immediate_effect":
                            item.ex_immediate_effect = int.Parse(value);
                            break;

                        case "drop_period":
                            item.drop_period = int.Parse(value);
                            break;

                        case "ex_drop_period":
                            item.ex_drop_period = int.Parse(value);
                            break;

                        case "duration":
                            item.Durability = Convert.ToInt32(value);
                            break;

                        case "use_skill_distime":
                            item.use_skill_distime = int.Parse(value);
                            break;

                        case "equip_reuse_delay":
                            item.equip_reuse_delay = int.Parse(value);
                            break;

                        case "default_price":
                            item.Price = Convert.ToInt32(value);
                            break;

                        case "crystal_type":
                            item.CrystallGrade = (ItemTemplate.L2ItemGrade)Enum.Parse(typeof(ItemTemplate.L2ItemGrade), value);
                            break;

                        case "crystal_count":
                            item._cryCount = Convert.ToInt64(value);
                            break;

                        case "keep_type":
                            item.keep_type = int.Parse(value);
                            break;

                        case "avoid_modify":
                            item.avoid_modify = Convert.ToInt32(value);
                            break;

                        case "pdef":
                            item.physical_defense = Convert.ToInt32(value);
                            break;

                        case "mdef":
                            item.magical_defense = Convert.ToInt32(value);
                            break;

                        case "mp_bonus":
                            item.mp_bonus = Convert.ToInt32(value);
                            break;

                        case "enchanted":
                            item.enchanted = Convert.ToInt16(value);
                            break;

                        case "patk":
                            item.physical_damage = Convert.ToInt32(value);
                            break;

                        case "random_damage":
                            item.random_damage = Convert.ToInt32(value);
                            break;

                        case "equip_condition":
                            item.setEquipCondition(value);
                            break;

                        case "item_equip_option":
                            item.setEquipOption(value);
                            break;

                        case "use_condition":
                            item.setUseCondition(value);
                            break;

                        case "base_attribute_attack":
                            item.setAttributeAttack(value);
                            break;

                        case "base_attribute_defend":
                            item.setAttributeDefend(value);
                            break;

                        case "can_move":
                            item.can_move = Convert.ToInt32(value);
                            break;

                        case "html":
                            item._htmFile = value;
                            break;

                        case "magic_weapon":
                            item.magic_weapon = Convert.ToInt32(value);
                            break;

                        case "unequip_skill":
                            item.setUnequipSkill(value);
                            break;

                        case "for_npc":
                            item.for_npc = Convert.ToInt32(value);
                            break;

                        case "weapon_type":
                            item.WeaponType = (ItemTemplate.L2ItemWeaponType)Enum.Parse(typeof(ItemTemplate.L2ItemWeaponType), value);
                            break;

                        case "critical":
                            item.critical = Convert.ToInt32(value);
                            break;

                        case "hit_modify":
                            item.hit_modify = Convert.ToDouble(value);
                            break;

                        case "attack_range":
                            item.attack_range = Convert.ToInt32(value);
                            break;

                        case "damage_range":
                            item.setDamageRange(value);
                            break;

                        case "attack_speed":
                            item.attack_speed = Convert.ToInt32(value);
                            break;

                        case "matk":
                            item.magical_damage = Convert.ToInt32(value);
                            break;

                        case "shield_defense":
                            item.shield_defense = Convert.ToInt32(value);
                            break;

                        case "shield_defense_rate":
                            item.shield_defense_rate = Convert.ToInt32(value);
                            break;

                        case "mp_consume":
                            item.MpConsume = Convert.ToInt32(value);
                            break;

                        case "period":
                            item.LimitedMinutes = Convert.ToInt32(value);
                            break;

                        case "reuse_delay":
                            item.reuse_delay = Convert.ToInt32(value);
                            break;

                        case "is_trade":
                            item.is_trade = int.Parse(value);
                            break;

                        case "is_destruct":
                            item.is_destruct = int.Parse(value);
                            break;

                        case "is_drop":
                            item.is_drop = int.Parse(value);
                            break;

                        case "is_premium":
                            item.is_premium = int.Parse(value);
                            break;

                        case "is_private_store":
                            item.is_private_store = int.Parse(value);
                            break;

                        case "enchant_enable":
                            item.enchant_enable = int.Parse(value);
                            break;

                        case "elemental_enable":
                            item.elemental_enable = int.Parse(value);
                            break;

                        case "is_olympiad_can_use":
                            item.is_olympiad_can_use = int.Parse(value);
                            break;
                        }
                    }

                    item.buildEffect();
                    if (_items.ContainsKey(item.ItemID))
                    {
                        CLogger.error("itemtable: dublicate " + item.ItemID);
                        _items.Remove(item.ItemID);
                    }

                    _items.Add(item.ItemID, item);
                }
            }

            file = new FileInfo(@"scripts\convertdata.txt");
            using (StreamReader sreader = file.OpenText())
            {
                while (!sreader.EndOfStream)
                {
                    string line = sreader.ReadLine();
                    if (line.Length == 0 || line.StartsWith("#"))
                    {
                        continue;
                    }

                    string[] pt = line.Split('>');

                    int id1 = int.Parse(pt[0]);
                    int id2 = int.Parse(pt[1]);

                    ConvertDataList.Add(id1, id2);
                    ConvertDataList.Add(id2, id1);
                }
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            CLogger.info("ItemTable: #" + _items.Count + " items, #" + _sets.Count + " sets, #" + ConvertDataList.Count + " convertable.");
        }
Пример #16
0
 public void log()
 {
     CLogger.getInstance().info("|[SIH]| Foram carregados " + (object)ShopItemHolder._weapons.Count + " equipamentos da loja.");
 }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int PatientId  = 0;
            int visitPK    = 0;
            int locationId = 0;
            int userId     = 0;

            if (!IsPostBack)
            {
                if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
                {
                    Response.Redirect("~/frmlogin.aspx", true);
                }

                if (!object.Equals(Session["PatientId"], null))
                {
                    PatientId = Convert.ToInt32(Session["PatientId"]);
                    if (PatientId == 0)
                    {
                        Response.Redirect("~/ClinicalForms/frmPatient_Home.aspx", true);
                    }
                    this.hidPID.Value = PatientId.ToString();
                }

                if (!object.Equals(Session["PatientVisitId"], null))
                {
                    if (!object.Equals(Request.QueryString["add"], null))
                    {
                        if (Request.QueryString["add"].ToString() == "0")
                        {
                            visitPK = 0;
                            Session["PatientVisitId"] = "0";
                        }
                    }
                    else
                    {
                        visitPK = Convert.ToInt32(Session["PatientVisitId"]);
                    }
                }
                else
                {
                    if (!object.Equals(Request.QueryString["add"], null))
                    {
                        if (Request.QueryString["add"].ToString() == "0")
                        {
                            visitPK = 0;
                        }
                    }
                }
                this.hidVId.Value = visitPK.ToString();

                if (!object.Equals(Session["AppLocationId"], null))
                {
                    locationId = Convert.ToInt32(Session["AppLocationId"]);
                }
                if (!object.Equals(Session["AppUserId"], null))
                {
                    userId = Convert.ToInt32(Session["AppUserId"]);
                }
                //if (!object.Equals(Session["PatientSex"], null))
                //{
                //    this.hidGender.Value = Session["PatientSex"].ToString();
                //}
                //if (!object.Equals(Session["PatientAge"], null))
                //{
                //    this.hidDOB.Value = Session["PatientAge"].ToString();
                //}
                //if (!object.Equals(Session["patientageinyearmonth"], null))
                //{
                //    this.hidPAYM.Value = Session["patientageinyearmonth"].ToString();
                //}
                if (!object.Equals(Session["TechnicalAreaName"], null))
                {
                    this.hidsrvNm.Value = Session["TechnicalAreaName"].ToString();
                }
                if (!object.Equals(Session["TechnicalAreaId"], null))
                {
                    this.hidMOD.Value = Session["TechnicalAreaId"].ToString();
                }

                Authenticate();

                if (!object.Equals(Request.QueryString["data"], null))
                {
                    string response = string.Empty;


                    if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
                    {
                        CLogger.WriteLog(ELogLevel.ERROR, "Session expired!!");

                        ResponseType responsetype = new ResponseType()
                        {
                            Success = EnumUtil.GetEnumDescription(Success.False), ErrorMessage = "Session expired"
                        };
                        response = SerializerUtil.ConverToJson <ResponseType>(responsetype);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "getdata")
                    {
                        response = GetPatientAdherenceBarriers(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }


                    if (Request.QueryString["data"].ToString() == "savedata")
                    {
                        System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        string jsonString         = "";
                        jsonString = sr.ReadToEnd();

                        response = SavePatientAdherenceBarriersData(jsonString, PatientId, visitPK, locationId, userId);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "deleteform")
                    {
                        response = DeleteForm();
                        SendResponse(response);
                    }
                }
            }
        }
Пример #18
0
        protected virtual NextInstruction InitializeLogger()
        {
            try
            {
                if (logger != null)
                    return NextInstruction.Do;
                if (String.IsNullOrEmpty(logFile))
                {
                    logFile = GetLogFileFromRegistry();
                    if (String.IsNullOrEmpty(logFile))
                        return NextInstruction.Abort;
                }

                logger = new CLogger();
                logger.SetLogLevel((LogLevel)traceLevel);
                logger.SetLogFile(logFile);
                logger.SetTimerInterval(logType, loggingInterval <= 0 ? 60000 : loggingInterval);
                logger.SetLogFileSize(logSize <= 0 ? 10 * 1024 * 1024 : logSize);
                return NextInstruction.Do;
            }
            catch (Exception er)
            {
                Log(LogLevel.ERROR, er.ToString());
                return NextInstruction.Abort;
            }
        }
Пример #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ds = (DataSet)dsPatientDetails;

                string   intIPT         = "0";
                string   decodeName     = string.Empty;
                DateTime?dtIPTEndDate   = null;
                DateTime?dtIPTStartDate = null;

                string   ddlIPTContraindication = string.Empty, ddlIPTAdherence = string.Empty, ddlIPTDiscontinued = string.Empty;
                DataView theCodeDV = new DataView(ds.Tables[0]);

                DataView dvPatient = new DataView(ds.Tables[2]);
                dvPatient.RowFilter = "Ptn_Pk = '" + patientId + "'";
                DataTable dtPatient    = (DataTable)DatatTableUtil.CreateTableFromDataView(dvPatient);
                bool      validateFlag = true;
                //ddlIPTAdherence = this.cbIPTContraindication.SelectedValue.ToString();
                ddlIPTContraindication = this.cbIPTContraindication.SelectedValue.ToString();
                ddlIPTDiscontinued     = this.cbIPTDiscontinued.SelectedValue.ToString();

                if (this.rbDiscontinued.Checked)
                {
                    if (this.cbIPTDiscontinued.SelectedValue.ToString() == "0")
                    {
                        validateFlag = false;
                    }
                }
                else if (this.rbDeclinedIpt.Checked)
                {
                    if (this.cbIPTContraindication.SelectedValue.ToString() == "0")
                    {
                        validateFlag = false;
                    }
                }

                if (validateFlag)
                {
                    if (this.rbCompletedIPT.Checked)
                    {
                        decodeName = "Completed IPT";
                    }
                    else if (this.rbDiscontinued.Checked)
                    {
                        decodeName = "Discontinued";
                    }
                    else if (this.rbDeclinedIpt.Checked)
                    {
                        decodeName = "Declined IPT";
                    }

                    if (string.IsNullOrEmpty(decodeName))
                    {
                        decodeName = "Start IPT";
                    }

                    theCodeDV.RowFilter = "CodeName in ('IPT') and DeCodeName = '" + decodeName + "'";
                    DataTable theCodeDT = (DataTable)DatatTableUtil.CreateTableFromDataView(theCodeDV);

                    intIPT = theCodeDT.AsEnumerable().FirstOrDefault().Field <int>("DeCodeId").ToString();


                    if (this.rbCompletedIPT.Checked || this.rbDiscontinued.Checked)
                    {
                        dtIPTEndDate = this.dtIPTEndDate.Value;
                    }
                    dtIPTStartDate = this.dtIPTStartDate.Value;
                    int visitId = 0;
                    if (dtPatient.Rows.Count > 0)
                    {
                        visitId = Convert.ToInt32(dtPatient.AsEnumerable().FirstOrDefault().Field <int>("Visit_Pk")
                                                  .ToString());
                    }
                    IIPTDetails iiptdetails;
                    iiptdetails = new BIPTDetails();
                    DataTable dt =
                        iiptdetails.SavePatientIPTDetails(
                            Convert.ToInt32(ConfigurationSettings.AppSettings["AppLocationId"].ToString())
                            , patientId
                            , visitId
                            , intIPT
                            , string.Empty
                            , ddlIPTContraindication
                            , ddlIPTDiscontinued
                            , dtIPTEndDate
                            , dtIPTStartDate
                            , 1
                            , this.txtOtherReasonContraindication.Text
                            , this.txtOtherReasonDiscontinued.Text
                            );

                    MessageBox.Show("IPT details saved successfully.", "IQCare", MessageBoxButtons.OK);

                    DataGridViewSelectedRowCollection rows = dgvPatients.SelectedRows;
                    foreach (DataGridViewRow row in rows)
                    {
                        ResetControls();

                        dsPatientDetails = new DataSet();

                        Patient cust = row.DataBoundItem as Patient;

                        GetPatientIPTDetails(cust);
                    }
                }
                else
                {
                    MessageBox.Show("Please select an option from the list.", "IQCare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "IQCare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CLogger.WriteLog(ELogLevel.ERROR, ex.ToString());
            }
        }
 protected bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         switch (TrcLevel)
         {
             case 0:
                 {
                     L.SetLogLevel(LogLevel.NONE);
                 }
                 break;
             case 1:
                 {
                     L.SetLogLevel(LogLevel.INFORM);
                 }
                 break;
             case 2:
                 {
                     L.SetLogLevel(LogLevel.WARN);
                 }
                 break;
             case 3:
                 {
                     L.SetLogLevel(LogLevel.ERROR);
                 }
                 break;
             case 4:
                 {
                     L.SetLogLevel(LogLevel.DEBUG);
                 }
                 break;
         }
         L.SetLogFile(ErrLog);
         L.SetTimerInterval(LogType.FILE, LoggingInterval);
         L.SetLogFileSize(LogSize);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("Security Manager IISUnified Recorder", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
Пример #21
0
        public void GetGames(List <ImportGameData> gameDataList, bool expensiveIcons = false)
        {
            List <RegistryKey> keyList = new();

            // Get installed games
            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(LEG_REG, RegistryKeyPermissionCheck.ReadSubTree)) // HKLM64
            {
                keyList = FindGameFolders(key, "");

                CLogger.LogInfo("{0} {1} games found", keyList.Count, _name.ToUpper());
                foreach (var data in keyList)
                {
                    string strID        = "";
                    string strTitle     = "";
                    string strLaunch    = "";
                    string strIconPath  = "";
                    string strUninstall = "";
                    string strAlias     = "";
                    string strPlatform  = GetPlatformString(ENUM);
                    try
                    {
                        strID = GetRegStrVal(data, "InstallerUUID");
                        if (string.IsNullOrEmpty(strID))
                        {
                            strID = data.Name;
                        }
                        strTitle = GetRegStrVal(data, "ProductName");
                        if (string.IsNullOrEmpty(strTitle))
                        {
                            strTitle = data.Name;
                        }
                        CLogger.LogDebug($"- {strTitle}");
                        string exeFile = GetRegStrVal(data, "GameExe");
                        strLaunch = Path.Combine(GetRegStrVal(data, "InstDir").Trim(new char[] { ' ', '"' }), exeFile);
                        if (expensiveIcons)
                        {
                            using RegistryKey key2 = Registry.LocalMachine.OpenSubKey(NODE32_REG, RegistryKeyPermissionCheck.ReadSubTree), // HKLM32
                                  key3             = Registry.LocalMachine.OpenSubKey(NODE64_REG, RegistryKeyPermissionCheck.ReadSubTree); // HKLM64
                            List <RegistryKey> unList = FindGameKeys(key2, GAME_DISPLAY_NAME, strTitle, new string[] { "Legacy Games Launcher" });
                            if (unList.Count <= 0)
                            {
                                unList = FindGameKeys(key3, GAME_DISPLAY_NAME, strTitle, new string[] { "Legacy Games Launcher" });
                            }
                            foreach (RegistryKey unKey in unList)
                            {
                                strUninstall = GetRegStrVal(unKey, GAME_UNINSTALL_STRING); //.Trim(new char[] { ' ', '"' });
                                strIconPath  = GetRegStrVal(unKey, GAME_DISPLAY_ICON);     //.Trim(new char[] { ' ', '"' });
                                break;
                            }
                        }
                        if (string.IsNullOrEmpty(strIconPath))
                        {
                            strIconPath = strLaunch;
                        }
                        strAlias = GetAlias(Path.GetFileNameWithoutExtension(exeFile));
                        if (strAlias.Length > strTitle.Length)
                        {
                            strAlias = GetAlias(strTitle);
                        }
                        if (strAlias.Equals(strTitle, CDock.IGNORE_CASE))
                        {
                            strAlias = "";
                        }
                    }
                    catch (Exception e)
                    {
                        CLogger.LogError(e);
                    }
                    if (!(string.IsNullOrEmpty(strLaunch)))
                    {
                        gameDataList.Add(
                            new ImportGameData(strID, strTitle, strLaunch, strIconPath, strUninstall, strAlias, true, strPlatform));
                    }
                }
            }

            if (expensiveIcons && keyList.Count <= 0)
            {
                // if no games found in registry, check manually

                List <string> libPaths = new();

                string file = Path.Combine(GetFolderPath(SpecialFolder.ApplicationData), LEG_JSON);
                if (!File.Exists(file))
                {
                    CLogger.LogInfo("{0} installed games not found in AppData", _name.ToUpper());
                    return;
                }
                else
                {
                    string strDocumentData = File.ReadAllText(file);

                    if (string.IsNullOrEmpty(strDocumentData))
                    {
                        CLogger.LogWarn(string.Format("Malformed {0} file: {1}", _name.ToUpper(), file));
                    }
                    else
                    {
                        try
                        {
                            using JsonDocument document = JsonDocument.Parse(@strDocumentData, jsonTrailingCommas);
                            foreach (JsonElement element in document.RootElement.EnumerateArray())
                            {
                                element.TryGetProperty("settings", out JsonElement settings);
                                if (!settings.Equals(null))
                                {
                                    settings.TryGetProperty("gameLibraryPath", out JsonElement paths);
                                    if (!paths.Equals(null))
                                    {
                                        foreach (JsonElement path in paths.EnumerateArray())
                                        {
                                            if (!path.Equals(null))
                                            {
                                                libPaths.Add(path.ToString());
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            CLogger.LogError(e, string.Format("Malformed {0} file: {1}", _name.ToUpper(), file));
                        }
                    }
                }

                foreach (string path in libPaths)
                {
                    List <string> dirs = new();

                    try
                    {
                        if (!path.Equals(null) && Directory.Exists(path))
                        {
                            dirs.AddRange(Directory.GetDirectories(path, "*.*", SearchOption.TopDirectoryOnly));
                            foreach (string dir in dirs)
                            {
                                string strID       = Path.GetFileName(dir);
                                string strLaunch   = "";
                                string strAlias    = "";
                                string strPlatform = GetPlatformString(ENUM);

                                CLogger.LogDebug($"- {strID}");
                                strLaunch = CGameFinder.FindGameBinaryFile(dir, strID);
                                strAlias  = GetAlias(Path.GetFileNameWithoutExtension(strLaunch));
                                if (strAlias.Length > strID.Length)
                                {
                                    strAlias = GetAlias(strID);
                                }
                                if (strAlias.Equals(strID, CDock.IGNORE_CASE))
                                {
                                    strAlias = "";
                                }
                                if (!(string.IsNullOrEmpty(strLaunch)))
                                {
                                    gameDataList.Add(
                                        new ImportGameData(strID, strID, strLaunch, strLaunch, "", strAlias, true, strPlatform));
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        CLogger.LogError(e);
                    }
                }
            }
            CLogger.LogDebug("--------------------");
        }
Пример #22
0
        public void GetGames(List <ImportGameData> gameDataList, bool expensiveIcons = false)
        {
            // Stop service (otherwise database is locked)
            ServiceController sc = new("OVRService");

            //bool restartSvc = false;
            try
            {
                if (sc.Status.Equals(ServiceControllerStatus.Running) || sc.Status.Equals(ServiceControllerStatus.StartPending))
                {
                    //restartSvc = true;
                    sc.Stop();
                    sc.WaitForStatus(ServiceControllerStatus.Stopped);
                }
            }
            catch (Exception e)
            {
                CLogger.LogError(e);
            }

            List <string> libPaths = new();
            Dictionary <ulong, string> exePaths = new();
            string db = Path.Combine(GetFolderPath(SpecialFolder.ApplicationData), OCULUS_DB);

            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(OCULUS_LIBS, RegistryKeyPermissionCheck.ReadSubTree))
            {
                if (key != null)
                {
                    foreach (string lib in key.GetSubKeyNames())
                    {
                        using RegistryKey key2 = Registry.CurrentUser.OpenSubKey(Path.Combine(OCULUS_LIBS, lib), RegistryKeyPermissionCheck.ReadSubTree);
                        libPaths.Add(GetRegStrVal(key2, OCULUS_LIBPATH));
                    }
                }
            }

            foreach (string lib in libPaths)
            {
                List <string> libFiles = new();
                try
                {
                    string manifestPath = Path.Combine(lib, "Manifests");
                    libFiles = Directory.GetFiles(manifestPath, "*.json.mini", SearchOption.TopDirectoryOnly).ToList();
                    CLogger.LogInfo("{0} {1} games found in library {2}", libFiles.Count, _name.ToUpper(), lib);
                }
                catch (Exception e)
                {
                    CLogger.LogError(e, string.Format("{0} directory read error: {1}", _name.ToUpper(), lib));
                    continue;
                }

                foreach (string file in libFiles)
                {
                    try
                    {
                        var options = new JsonDocumentOptions
                        {
                            AllowTrailingCommas = true
                        };

                        string strDocumentData = File.ReadAllText(file);

                        if (string.IsNullOrEmpty(strDocumentData))
                        {
                            CLogger.LogWarn(string.Format("Malformed {0} file: {1}", _name.ToUpper(), file));
                        }
                        else
                        {
                            using JsonDocument document = JsonDocument.Parse(@strDocumentData, options);
                            string name = GetStringProperty(document.RootElement, "canonicalName");
                            if (ulong.TryParse(GetStringProperty(document.RootElement, "appId"), out ulong id))
                            {
                                exePaths.Add(id, Path.Combine(lib, "Software", name, GetStringProperty(document.RootElement, "launchFile")));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        CLogger.LogError(e, string.Format("Malformed {0} file: {1}", _name.ToUpper(), file));
                    }
                }
            }

            try
            {
                CultureInfo ci       = new("en-GB");
                TextInfo    ti       = ci.TextInfo;
                string      userName = CConfig.GetConfigString(CConfig.CFG_OCULUSID);
                //ulong userId = 0;

                using var con = new SQLiteConnection($"Data Source={db}");
                con.Open();

                // Get the user ID to check entitlements for expired trials

                /*
                 *              using (var cmdU = new SQLiteCommand("SELECT hashkey, value FROM Objects WHERE typename = 'User'", con))
                 *              {
                 *                      using SQLiteDataReader rdrU = cmdU.ExecuteReader();
                 *                      while (rdrU.Read())
                 *                      {
                 *                              byte[] valU = new byte[rdrU.GetBytes(1, 0, null, 0, int.MaxValue) - 1];
                 *                              rdrU.GetBytes(1, 0, valU, 0, valU.Length);
                 *                              string strValU = System.Text.Encoding.Default.GetString(valU);
                 *
                 *                              string alias = ParseBlob(strValU, "alias", "app_entitlements");
                 *                              if (string.IsNullOrEmpty(userName))
                 *                              {
                 *                                      if (ulong.TryParse(rdrU.GetString(0), out userId))
                 *                                      {
                 *                                              userName = alias;
                 *                                              break;
                 *                                      }
                 *                              }
                 *                              else if (userName.Equals(alias, CDock.IGNORE_CASE))
                 *      {
                 *                                      ulong.TryParse(rdrU.GetString(0), out userId);
                 *                                      break;
                 *      }
                 *                      }
                 *              }
                 */

                using var cmd = new SQLiteCommand("SELECT hashkey, value FROM Objects WHERE typename = 'Application'", con);
                using SQLiteDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    string strID       = "";
                    string strTitle    = "";
                    string strLaunch   = "";
                    string strAlias    = "";
                    string strPlatform = GetPlatformString(ENUM);

                    string url = "";

                    /*
                     * string exePath = "", exePath2d = "", exeParams = "", exeParams2d = "";
                     * string state = "", time = "";
                     * bool isInstalled = false;
                     */
                    bool isInstalled = true;

                    if (ulong.TryParse(rdr.GetString(0), out ulong id))
                    {
                        strID = "oculus_" + id;
                    }
                    //else
                    //	strID = "oculus_" + name;

                    if (id == OCULUS_ENV_RIFT)
                    {
                        continue;
                    }

                    byte[] val = new byte[rdr.GetBytes(1, 0, null, 0, int.MaxValue) - 1];
                    rdr.GetBytes(1, 0, val, 0, val.Length);
                    string strVal = System.Text.Encoding.Default.GetString(val);

                    _ = ulong.TryParse(ParseBlob(strVal, "ApplicationAssetBundle", "can_access_feature_keys", -1, 0), out ulong assets);
                    //ulong.TryParse(ParseBlob(strVal, "PCBinary", "livestreaming_status", -1, 0), out ulong bin);
                    string name = ParseBlob(strVal, "canonical_name", "category");
                    strTitle = ParseBlob(strVal, "display_name", "display_short_description");
                    if (!string.IsNullOrEmpty(name) && string.IsNullOrEmpty(strTitle))
                    {
                        strTitle = ti.ToTitleCase(name.Replace('-', ' '));
                    }

                    using (var cmd2 = new SQLiteCommand($"SELECT value FROM Objects WHERE hashkey = '{assets}'", con))
                    {
                        using SQLiteDataReader rdr2 = cmd2.ExecuteReader();
                        while (rdr2.Read())
                        {
                            byte[] val2 = new byte[rdr2.GetBytes(0, 0, null, 0, int.MaxValue) - 1];
                            rdr2.GetBytes(0, 0, val2, 0, val2.Length);
                            string strVal2 = System.Text.Encoding.Default.GetString(val2);
                            url = ParseBlob(strVal2, "uri", "version_code", strStart1: "size");
                        }
                    }

                    // The exe's can be gotten from the .json files, which we have to get anyway to figure out the install path

                    /*
                     * using (var cmd3 = new SQLiteCommand($"SELECT value FROM Objects WHERE hashkey = '{bin}'", con))
                     * {
                     *  using SQLiteDataReader rdr3 = cmd3.ExecuteReader();
                     *  while (rdr3.Read())
                     *  {
                     *      byte[] val3 = new byte[rdr3.GetBytes(0, 0, null, 0, int.MaxValue) - 1];
                     *      rdr3.GetBytes(0, 0, val3, 0, val3.Length);
                     *      string strVal3 = System.Text.Encoding.Default.GetString(val3);
                     *      exePath = ParseBlob(strVal3, "launch_file", "launch_file_2d");
                     *      exePath2d = ParseBlob(strVal3, "launch_file_2d", "launch_parameters");
                     *      exeParams = ParseBlob(strVal3, "launch_parameters", "launch_parameters_2d");
                     *      exeParams2d = ParseBlob(strVal3, "launch_parameters_2d", "manifest_signature");
                     *  }
                     * }
                     *
                     * if (userId > 0)
                     * {
                     *  // TODO: If this is an expired trial, count it as not-installed
                     *  using var cmd5 = new SQLiteCommand($"SELECT value FROM Objects WHERE hashkey = '{userId}:{id}'", con);
                     *  using SQLiteDataReader rdr5 = cmd5.ExecuteReader();
                     *  while (rdr5.Read())
                     *  {
                     *      byte[] val5 = new byte[rdr5.GetBytes(0, 0, null, 0, int.MaxValue) - 1];
                     *      rdr5.GetBytes(0, 0, val5, 0, val5.Length);
                     *      string strVal5 = System.Text.Encoding.Default.GetString(val5);
                     *      state = ParseBlob(strVal5, "active_state", "expiration_time");
                     *      if (state.Equals("PERMANENT"))
                     *          isInstalled = true;
                     *      else
                     *      {
                     *          time = ParseBlob(strVal5, "expiration_time", "grant_reason");
                     *          CLogger.LogDebug($"expiry: {state} {time}");
                     *          //if (!...expired)
                     *          isInstalled = true;
                     *      }
                     *  }
                     * }
                     * else
                     *  isInstalled = true;
                     */

                    if (exePaths.ContainsKey(id))
                    {
                        CLogger.LogDebug($"- {strTitle}");
                        strLaunch = exePaths[id];
                        strAlias  = GetAlias(Path.GetFileNameWithoutExtension(exePaths[id]));
                        if (strAlias.Length > strTitle.Length)
                        {
                            strAlias = GetAlias(strTitle);
                        }
                        if (strAlias.Equals(strTitle, CDock.IGNORE_CASE))
                        {
                            strAlias = "";
                        }
                        gameDataList.Add(new ImportGameData(strID, strTitle, strLaunch, strLaunch, "", strAlias, isInstalled, strPlatform));
                    }
                    else
                    {
                        CLogger.LogDebug($"- *{strTitle}");
                        gameDataList.Add(new ImportGameData(strID, strTitle, "", "", "", "", false, strPlatform));

                        if (expensiveIcons && !string.IsNullOrEmpty(url))
                        {
                            // Download missing icons

                            string imgfile = Path.Combine(CDock.currentPath, CDock.IMAGE_FOLDER_NAME,
                                                          string.Concat(strTitle.Split(Path.GetInvalidFileNameChars())));
                            bool iconFound = false;
                            foreach (string ext in CDock.supportedImages)
                            {
                                if (File.Exists(imgfile + "." + ext))
                                {
                                    iconFound = true;
                                    break;
                                }
                            }
                            if (iconFound)
                            {
                                continue;
                            }

                            string zipfile = $"tmp_{_name}_{id}.zip";
                            try
                            {
#if DEBUG
                                // Don't re-download if file exists
                                if (!File.Exists(zipfile))
                                {
#endif
                                using var client = new WebClient();
                                client.DownloadFile(url, zipfile);
#if DEBUG
                            }
#endif
                                using ZipArchive archive = ZipFile.OpenRead(zipfile);
                                foreach (ZipArchiveEntry entry in archive.Entries)
                                {
                                    foreach (string ext in CDock.supportedImages)
                                    {
                                        if (entry.Name.Equals("cover_square_image." + ext, CDock.IGNORE_CASE))
                                        {
                                            entry.ExtractToFile(imgfile + "." + ext);
                                            break;
                                        }
                                    }
                                }
//#if !DEBUG
                                File.Delete(zipfile);
//#endif
                            }
                            catch (Exception e)
                            {
                                CLogger.LogError(e, string.Format("Malformed {0} zip file!", _name.ToUpper()));
                            }
                        }
                    }
                }
                con.Close();
            }
            catch (Exception e)
            {
                CLogger.LogError(e, string.Format("Malformed {0} database output!", _name.ToUpper()));
            }
            //if (restartSvc)
            //    sc.Start();

            CLogger.LogDebug("--------------------");
        }
Пример #23
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (!ValidateLogin())
        {
            Init_Form();
            return;
        }

        IUser LoginManager;

        try
        {
            //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() begin!");
            LoginManager = (IUser)ObjectFactory.CreateInstance("BusinessProcess.Security.BUser, BusinessProcess.Security");
            if (object.Equals(Session["SystemId"], null))
            {
                Session["SystemId"] = "1";
            }

            DataSet theDS = LoginManager.GetUserCredentials(txtuname.Text.Trim(), Convert.ToInt32(ddLocation.SelectedValue), Convert.ToInt32(Session["SystemId"]));
            if (theDS.Tables.Count > 0)
            {
                int FacilityExist = 1;
                if (theDS.Tables[5].Rows.Count > 0)
                {
                    DataView theDV = new DataView();
                    FacilityExist = 0;
                    foreach (DataRow theDR in theDS.Tables[5].Rows)
                    {
                        if (Convert.ToInt32(theDR["GroupId"]) > 1)
                        {
                            theDV           = new DataView(theDS.Tables[1]);
                            theDV.RowFilter = "FacilityID= " + ddLocation.SelectedValue + "";
                            if (theDV.ToTable().Rows.Count > 0)
                            {
                                FacilityExist = 1;
                            }
                        }
                        else if (Convert.ToInt32(theDR["GroupId"]) == 1)
                        {
                            FacilityExist = 1;
                        }
                    }
                }

                if (FacilityExist == 0)
                {
                    IQCareMsgBox.Show("AccessDenied", this);
                    ////CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                    return;
                }

                if (theDS.Tables[1].Rows.Count == 0)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "User Group";
                    IQCareMsgBox.Show("BlankList", theBuilder, this);
                    //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                    return;
                }

                Utility theUtil = new Utility();
                if (theDS.Tables[0].Rows.Count > 0)
                {
                    //if (theUtil.Decrypt(Convert.ToString(theDS.Tables[0].Rows[0]["Password"])) != txtpassword.Text.Trim())
                    if (Convert.ToString(theDS.Tables[0].Rows[0]["Password"]) != theUtil.Encrypt(txtpassword.Text.Trim().ToString()))
                    {
                        if ((Request.Browser.Cookies))
                        {
                            HttpCookie theCookie = Request.Cookies[txtuname.Text];
                            if (theCookie == null)
                            {
                                HttpCookie theNCookie = new HttpCookie(txtuname.Text);
                                theNCookie.Value = txtuname.Text + ",1";
                                DateTime theNewDTTime = Convert.ToDateTime(ViewState["theCurrentDate"]).AddMinutes(5);
                                theNCookie.Expires = theNewDTTime;
                                Response.Cookies.Add(theNCookie);
                            }

                            else
                            {
                                string[] theVal = (theCookie.Value.ToString()).Split(',');
                                if (Convert.ToInt32(theVal[1]) >= 3 && theCookie.Name == txtuname.Text)
                                {
                                    MsgBuilder theBuilder = new MsgBuilder();
                                    theBuilder.DataElements["MessageText"] = "User Account Locked. Try again after 5 Mins.";
                                    IQCareMsgBox.Show("#C1", theBuilder, this);
                                    return;
                                }
                                else
                                {
                                    theVal[1]       = (Convert.ToInt32(theVal[1]) + 1).ToString();
                                    theCookie.Value = txtuname.Text + "," + theVal[1];
                                    DateTime theAddNewDTTime = Convert.ToDateTime(ViewState["theCurrentDate"]).AddMinutes(5);
                                    theCookie.Expires = theAddNewDTTime;
                                    Response.Cookies.Add(theCookie);
                                }
                            }
                        }
                        IQCareMsgBox.Show("PasswordNotMatch", this);
                        Init_Form();
                        //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                        return;
                    }
                    else
                    {
                        HttpCookie theCookie = Request.Cookies[txtuname.Text];
                        if (theCookie != null)
                        {
                            string[] theVal = (theCookie.Value.ToString()).Split(',');
                            if (Convert.ToInt32(theVal[1]) >= 3)
                            {
                                MsgBuilder theBuilder = new MsgBuilder();
                                theBuilder.DataElements["MessageText"] = "User Account Locked. Try again after 5 Mins.";
                                IQCareMsgBox.Show("#C1", theBuilder, this);
                                //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                                return;
                            }
                        }
                    }
                }

                else
                {
                    IQCareMsgBox.Show("InvalidLogin", this);
                    Init_Form();
                    //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                    return;
                }

                Session["AppUserId"]   = Convert.ToString(theDS.Tables[0].Rows[0]["UserId"]);
                Session["AppUserName"] = Convert.ToString(theDS.Tables[0].Rows[0]["UserFirstName"]) + " " + Convert.ToString(theDS.Tables[0].Rows[0]["UserLastName"]);
                if (!string.IsNullOrEmpty(theDS.Tables[0].Rows[0]["Designation"].ToString()))
                {
                    Session["Signature"] = theDS.Tables[0].Rows[0]["UserName"].ToString() + " - " + theDS.Tables[0].Rows[0]["Designation"].ToString();
                }
                Session["EnrollFlag"]        = theDS.Tables[1].Rows[0]["EnrollmentFlag"].ToString();
                Session["CareEndFlag"]       = "0";
                Session["IdentifierFlag"]    = theDS.Tables[1].Rows[0]["IdentifierFlag"].ToString();
                Session["UserRight"]         = theDS.Tables[1];
                Session["UserFeatures"]      = theDS.Tables[6];
                Session["AppUserCustomList"] = theDS.Tables[7];
                DataTable theDT = theDS.Tables[2];
                Session["AppLocationId"]     = theDT.Rows[0]["FacilityID"].ToString();
                Session["AppLocation"]       = theDT.Rows[0]["FacilityName"].ToString();
                Session["AppCountryId"]      = theDT.Rows[0]["CountryID"].ToString();
                Session["AppPosID"]          = theDT.Rows[0]["PosID"].ToString();
                Session["AppSatelliteId"]    = theDT.Rows[0]["SatelliteID"].ToString();
                Session["GracePeriod"]       = theDT.Rows[0]["AppGracePeriod"].ToString();
                Session["AppDateFormat"]     = theDT.Rows[0]["DateFormat"].ToString();
                Session["BackupDrive"]       = theDT.Rows[0]["BackupDrive"].ToString();
                Session["SystemId"]          = theDT.Rows[0]["SystemId"].ToString();
                Session["AppCurrency"]       = theDT.Rows[0]["Currency"].ToString();
                Session["AppUserEmployeeId"] = theDS.Tables[0].Rows[0]["EmployeeId"].ToString();
                Session["FacilityID"]        = theDT.Rows[0]["FacilityID"].ToString();
                //Session["AppSystemId"] = theDT.Rows[0]["SystemId"].ToString();
                Session["Billing"] = theDT.Rows[0]["Billing"].ToString();
                //Session["Records"] = theDT.Rows[0]["Records"].ToString();
                Session["Wards"]          = theDT.Rows[0]["Wards"].ToString();
                Session["LMIS"]           = theDT.Rows[0]["LMIS"].ToString();
                Application["MasterData"] = theDS.Tables[8];
                #region "ModuleId"
                Session["AppModule"] = theDS.Tables[3];
                //DataView theSCMDV = new DataView(theDS.Tables[3]);
                //theSCMDV.RowFilter = "ModuleId=201";
                if (theDS.Tables[2].Rows[0]["PMSCM"].ToString() == "1")
                {
                    Session["SCMModule"] = "PMSCM";
                }
                #endregion
                IQWebUtils theIQUtils = new IQWebUtils();
                //theIQUtils.CreateSessionObject(Session.SessionID);
                Session["Paperless"] = theDT.Rows[0]["Paperless"].ToString();

                Session["Program"] = "";
                LoginManager       = null;

                //john screen size
                //Session["browserWidth"] = ScreenWidth.Value;
                //Session["browserHeight"] = ScreenHeight.Value;
                ///////////

                /*
                 * Commented by Gaurav & Suggested by Joseph
                 * Purpose: Everytime not to update appoinments
                 * Date: 23 Sept 2014
                 */
                /////////////// Appointment Updates//////////////////
                //UpdateAppointment();
                /////////////////////////////////////////////////////

                if (Convert.ToString(theDS.Tables[0].Rows[0]["forcelogin"]) == "0")
                {
                    string theUrl    = string.Format("{0}", "./AdminForms/frmAdmin_ChangePassword.aspx");
                    String msgString = "First time login: please change your password.\\n";
                    string script    = "<script language = 'javascript' defer ='defer' id = 'changePwd'>\n";
                    script += "alert('" + msgString + "');\n";
                    string url = Request.RawUrl.ToString();
                    Application["PrvFrm"]      = url;
                    Session["MandatoryChange"] = "1";
                    script += "window.location.href='" + theUrl + "'\n";
                    script += "</script>\n";
                    RegisterStartupScript("changePwd", script);
                }
                else if (theDS.Tables[3].Rows[0]["ExpPwdFlag"] != null && Convert.ToString(theDS.Tables[3].Rows[0]["ExpPwdFlag"]) != "")
                {
                    if (Convert.ToInt32(theDS.Tables[0].Rows[0]["UserId"]) != 1)
                    {
                        if (Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdFlag"]) == 1)
                        {
                            //DateTime lastcontDate = Convert.ToDateTime(theDS.Tables[0].Rows[0]["PwdDate"]).AddDays(Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"]));
                            //lastcontDate.AddDays(90);
                            DateTime lastcontDate      = Convert.ToDateTime(theDS.Tables[0].Rows[0]["PwdDate"]);
                            TimeSpan t                 = Convert.ToDateTime(theDS.Tables[4].Rows[0]["CurrentDate"]) - lastcontDate;
                            double   NrOfDaysdiffernce = t.TotalDays;
                            //int result = Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"]) - Convert.ToInt32(NrOfDays);
                            string msgString;
                            string theUrl = string.Format("{0}", "./AdminForms/frmAdmin_ChangePassword.aspx");
                            if (NrOfDaysdiffernce > Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"]))
                            {
                                msgString = "Your Password has expired. Please Change it now.\\n";
                                string script = "<script language = 'javascript' defer ='defer' id = 'changePwdfunction2'>\n";
                                script += "alert('" + msgString + "');\n";
                                string url = Request.RawUrl.ToString();
                                Application["PrvFrm"]      = url;
                                Session["MandatoryChange"] = "1";
                                script += "window.location.href='" + theUrl + "'\n";
                                script += "</script>\n";
                                RegisterStartupScript("changePwdfunction2", script);
                                //ClientScript.RegisterClientScriptBlock(this.GetType(), "changePwdfunction2", script,true);
                            }

                            else
                            {
                                // adding the false parameter value to continue the execution of current page....
                                Response.Redirect("frmFacilityHome.aspx", false);
                                // Response.Redirect("frmFindAddPatient.aspx");
                            }
                        }
                        else
                        {
                            // adding the false parameter value to continue the execution of current page....
                            Response.Redirect("frmFacilityHome.aspx", false);
                            // Response.Redirect("frmFindAddPatient.aspx");
                        }
                    }
                    else
                    {
                        // adding the false parameter value to continue the execution of current page....
                        Response.Redirect("frmFacilityHome.aspx", false);
                        // Response.Redirect("frmFindAddPatient.aspx");
                    }
                }
                else
                {
                    // adding the false parameter value to continue the execution of current page....
                    Response.Redirect("frmFacilityHome.aspx", false);
                    //Response.Redirect("frmFindAddPatient.aspx");
                }

                //Response.Redirect("frmFacilityHomenew.aspx");
            }
            else
            {
                IQCareMsgBox.Show("InvalidLogin", this);
                //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
                return;
            }
            //CLogger.WriteLog(ELogLevel.INFO, "Form: frmLogin, Method: btnLogin_Click() end!");
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            CLogger.WriteLog(ELogLevel.ERROR, "Form: frmLogin, Method: btnLogin_Click()", err);
        }
        finally
        {
            LoginManager = null;
        }
    }
        private Boolean InitializeLogger()
        {
            try
            {
                _log = new CLogger();
                switch (_traceLevel)
                {
                    case 0: { _log.SetLogLevel(LogLevel.NONE); } break;
                    case 1: { _log.SetLogLevel(LogLevel.INFORM); } break;
                    case 2: { _log.SetLogLevel(LogLevel.WARN); } break;
                    case 3: { _log.SetLogLevel(LogLevel.ERROR); } break;
                    case 4: { _log.SetLogLevel(LogLevel.DEBUG); } break;
                }

                _log.SetLogFile(_errLog);
                _log.SetTimerInterval(LogType.FILE, logging_interval);
                _log.SetLogFileSize(_logSize);

                return true;
            }
            catch (Exception er)
            {
                EventLog.WriteEntry("Security Manager MCAffeeUTMSyslogRecorder", er.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
Пример #25
0
        /// <summary>
        /// 断点续传下载
        /// </summary>
        /// <param name="task"></param>
        private void DownloadFromBreakPoint(DownloadTask task)
        {
            try
            {
                Uri uri = new Uri(task.url);
                _currentTaskFileName = task.file;
                //				Debug.Log("Download1");
                //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                ////				Debug.Log("Download2");
                //request.Timeout = TIME_OUT;
                //request.ReadWriteTimeout = TIME_OUT;
                //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                ////				Debug.Log("Download3");
                //long totalLength = response.ContentLength;
                //response.Close();
                //request.Abort();
                //Debug.LogWarning(totalLength);
                DownloadFileTransferInfo dfi = _transferMgr.GetDownloadFileInfo(_currentTaskFileName);
                long totalLength             = dfi.size;
                long receivedLength          = 0L;
                long toDownloadLength        = totalLength;

                if (File.Exists(task.storagePath))
                {
                    //FileInfo fileinfo = new FileInfo(tempFileName);
                    //if (fileinfo.Exists)
                    //{
                    //    receivedLength = fileinfo.Length;
                    //    toDownloadLength = totalLength - receivedLength;
                    //}
                    using (FileStream fileStream = new FileStream(task.storagePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
                    {
                        receivedLength   = fileStream.Length;
                        toDownloadLength = totalLength - receivedLength;
                        fileStream.Close();
                    }

                    if (receivedLength != dfi.receivedSize)
                    {
                        CLogger.Log(string.Format("DownloadThread::DownloadFromBreakPoint() - break point save receive size is wrong for file[{0}], saveSize={1}, fileSize={2}", _currentTaskFileName, dfi.receivedSize, receivedLength));
                    }
                }
                task.fileLength           = totalLength;
                task.receivedLength       = receivedLength;
                _currentTaskTotalBytes    = totalLength;
                _currentTaskReceivedBytes = receivedLength;

                bool transferOkay = true;
                if (toDownloadLength > 0L)
                {
                    CLogger.Log("DownloadThread::DownloadFromBreakPoint() - start http download, The request url is [" + uri + "] with range [" + receivedLength + "," + totalLength + "]");

                    HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(uri);
                    request2.Timeout          = kTimeOut;
                    request2.KeepAlive        = true;
                    request2.ReadWriteTimeout = kTimeOut;
                    request2.AddRange((int)receivedLength, (int)totalLength);

                    HttpWebResponse response2 = (HttpWebResponse)request2.GetResponse();
                    transferOkay = this.ReadBytesFromResponse(task, response2);
                    response2.Close();
                    request2.Abort();
                }
                if (transferOkay)
                {
                    this.OnDownloadFinished(task, null);
                }
            }
            catch (Exception ex)
            {
                CLogger.LogError("DownloadThread::DownloadFromBreakPoint() - ex: " + ex.Message + ",stackTrack:" + ex.StackTrace);
                this.OnDownloadFinished(task, ex);
            }
        }
Пример #26
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>
        /// <para>状態が開始された時に呼び出されます。</para>
        /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para>
        /// </summary>
        ///
        /// <param name="entity">この状態を適用されたオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        public override void setup(CEntity entity, CGame privateMembers)
        {
#if TRACE
            CLogger.add(sceneName + "シーンを開始します。");
#endif
        }
Пример #27
0
 internal void log()
 {
     CLogger.getInstance().info("[Channel] Loaded: " + ChannelInfoHolder._servers.Count + " channels.");
 }
Пример #28
0
        public object ReturnObject(Hashtable Params, string CommandText, ClsUtility.ObjectEnum Obj, DataTable theDataTable, string tablename)
        {
            int                i;
            string             cmdpara, cmdvalue, cmddbtype;
            ParameterDirection cmdDirection;
            SqlCommand         theCmd   = new SqlCommand();
            SqlTransaction     theTran  = (SqlTransaction)this.Transaction;
            SqlConnection      cnn      = null;
            StringBuilder      strParam = new StringBuilder();

            try
            {
                if (null == this.Connection)
                {
                    cnn = (SqlConnection)DataMgr.GetConnection();
                }
                else
                {
                    cnn = (SqlConnection)this.Connection;
                }

                if (null == this.Transaction)
                {
                    theCmd = new SqlCommand(CommandText, cnn);
                }
                else
                {
                    theCmd = new SqlCommand(CommandText, cnn, theTran);
                }

                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    if (Params[i + 2] != null)
                    {
                        if (Params[i + 2].GetType() != ParameterDirection.Output.GetType())
                        {
                            cmdvalue = Params[i + 2].ToString();
                            theCmd.Parameters.AddWithValue(cmdpara, cmddbtype).Value = cmdvalue;
                        }
                        else
                        {
                            cmdDirection = (ParameterDirection)Params[i + 2];
                            theCmd.Parameters.AddWithValue(cmdpara, (SqlDbType)Params[i + 1]).Direction = cmdDirection;
                        }
                    }
                    else
                    {
                        cmdvalue = string.Empty;
                        theCmd.Parameters.AddWithValue(cmdpara, cmddbtype).Value = cmdvalue;
                    }
                    i = i + 3;
                }
                if (theDataTable != null)
                {
                    if (theDataTable.Rows.Count > 0)
                    {
                        theCmd.Parameters.AddWithValue(tablename, theDataTable);
                    }
                }

                theCmd.CommandType    = CommandType.StoredProcedure;
                theCmd.CommandTimeout = DataMgr.CommandTimeOut();
                string theSubstring = CommandText.Substring(0, 6).ToUpper();
                switch (theSubstring)
                {
                case "SELECT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "UPDATE":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "INSERT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "DELETE":
                    theCmd.CommandType = CommandType.Text;
                    break;
                }

                theCmd.Connection = cnn;

                if (Obj == ClsUtility.ObjectEnum.DataSet)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataSet        theDS   = new DataSet();
                    theAdpt.Fill(theDS);
                    theAdpt.Dispose();
                    return(theDS);
                }

                if (Obj == ClsUtility.ObjectEnum.DataTable)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT);
                }

                if (Obj == ClsUtility.ObjectEnum.DataRow)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT.Rows[0]);
                }


                if (Obj == ClsUtility.ObjectEnum.ExecuteNonQuery)
                {
                    int NoRowsAffected = 0;
                    NoRowsAffected = theCmd.ExecuteNonQuery();
                    if (theCmd.Parameters.Contains("@idNEW"))
                    {
                        if ((int)theCmd.Parameters["@idNEW"].Value > 0)
                        {
                            NoRowsAffected = (int)theCmd.Parameters["@idNEW"].Value;
                        }
                    }

                    return(NoRowsAffected);
                }
                return(0);
            }
            catch (Exception err)
            {
                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    if (Params[i + 2] != null)
                    {
                        if (Params[i + 2].GetType() != ParameterDirection.Output.GetType())
                        {
                            cmdvalue = Params[i + 2].ToString();
                            strParam.Append("Name: " + cmdpara + ", Type: " + cmddbtype + ", Value: " + cmdvalue + ", Direction: Input");
                            strParam.Append(Environment.NewLine);
                        }
                        else
                        {
                            cmdDirection = (ParameterDirection)Params[i + 2];
                            strParam.Append("Name: " + cmdpara + ", Type: " + cmddbtype + ", Direction: Output");
                            strParam.Append(Environment.NewLine);
                        }
                    }
                    i = i + 3;
                }

                CLogger.WriteLog("Namespace: DataAccess.Entity, Class: ClsObject, Method: ReturnObject - Call started.", CommandText, strParam.ToString(), err.ToString());

                throw err;
            }
            finally
            {
                if (null != cnn)
                {
                    if (null == this.Connection)
                    {
                        DataMgr.ReleaseConnection(cnn);
                    }
                }
            }
        }
Пример #29
0
 protected internal override void write()
 {
     CLogger.getInstance().info("Send: PROTOCOL_LOBBY_REMOVE_FRIEND_ACK");
     this.writeH((short)285);
     this.writeB(new byte[] { 0x04, 0x00, 0x1D, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x12, 0x01, 0x00 });
 }
 protected internal override void read()
 {
     this.readH();
     this.slot = this.readD();
     CLogger.getInstance().info("Slot do novo dono: " + slot);
 }
Пример #31
0
        public void GetGames(List <ImportGameData> gameDataList, bool expensiveIcons = false)
        {
            List <RegistryKey> keyList;
            string             strPlatform = GetPlatformString(ENUM);

            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(BIGFISH_GAMES, RegistryKeyPermissionCheck.ReadSubTree))             // HKLM32
            {
                if (key == null)
                {
                    CLogger.LogInfo("{0} client not found in the registry.", _name.ToUpper());
                    return;
                }

                keyList = FindGameFolders(key, "");

                CLogger.LogInfo("{0} {1} games found", keyList.Count > 1 ? keyList.Count - 1 : keyList.Count, _name.ToUpper());
                foreach (var data in keyList)
                {
                    string wrap = Path.GetFileName(data.Name);
                    if (wrap.Equals(BIGFISH_CASINO_ID))                      // hide Big Fish Casino Activator
                    {
                        continue;
                    }

                    string strID        = "bfg_" + wrap;
                    string strTitle     = "";
                    string strLaunch    = "";
                    string strIconPath  = "";
                    string strUninstall = "";
                    string strAlias     = "";
                    try
                    {
                        //found = true;
                        bool isInstalled = false;
                        strTitle = GetRegStrVal(data, "Name");

                        // If this is an expired trial, count it as not-installed
                        int activated = (int)GetRegDWORDVal(data, "Activated");
                        int daysLeft  = (int)GetRegDWORDVal(data, "DaysLeft");
                        int timeLeft  = (int)GetRegDWORDVal(data, "TimeLeft");
                        if (activated > 0 || timeLeft > 0 || daysLeft > 0)
                        {
                            isInstalled = true;
                            CLogger.LogDebug($"- {strTitle}");
                        }
                        else
                        {
                            CLogger.LogDebug($"- *{strTitle}");
                        }

                        strLaunch = GetRegStrVal(data, BIGFISH_PATH);
                        strAlias  = GetAlias(strTitle);
                        if (strAlias.Equals(strTitle, CDock.IGNORE_CASE))
                        {
                            strAlias = "";
                        }
                        //strIconPath = GetRegStrVal(data, "Thumbnail");	// 80x80
                        strIconPath = GetRegStrVal(data, "feature");                                // 175x150

                        //ushort userRating = (ushort)GetRegDWORDVal(data, "Rating"); // Not used?
                        uint     numberRuns = (uint)GetRegDWORDVal(data, "PlayCount");
                        byte[]   dateData   = GetRegBinaryVal(data, "LastActionTime");
                        DateTime lastRun    = BFRegToDateTime(dateData);
                        //CLogger.LogDebug("    LastActionTime: " + BitConverter.ToString(dateData) + " -> " + lastRun.ToShortDateString());

                        List <RegistryKey> unKeyList;
                        using (RegistryKey key2 = Registry.LocalMachine.OpenSubKey(NODE32_REG, RegistryKeyPermissionCheck.ReadSubTree))                         // HKLM32
                        {
                            if (key2 != null)
                            {
                                unKeyList = FindGameFolders(key2, BIGFISH_PREFIX);
                                foreach (var data2 in unKeyList)
                                {
                                    if (GetRegStrVal(data2, BIGFISH_ID).Equals(wrap))
                                    {
                                        if (string.IsNullOrEmpty(strIconPath))
                                        {
                                            strIconPath = GetRegStrVal(data2, GAME_DISPLAY_ICON).Trim(new char[] { ' ', '"' });
                                        }
                                        strUninstall = GetRegStrVal(data2, GAME_UNINSTALL_STRING).Trim(new char[] { ' ', '"' });
                                    }
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(strIconPath) && expensiveIcons)
                        {
                            bool   success = false;
                            string dir     = Path.GetDirectoryName(strLaunch);
                            string xmlPath = Path.Combine(dir, "bfgstate.xml");
                            try
                            {
                                if (File.Exists(xmlPath))
                                {
                                    XmlDocument doc = new();
                                    doc.Load(xmlPath);
                                    //XmlNode node = doc.DocumentElement.SelectSingleNode("thumbnail");	// 80x80
                                    XmlNode node = doc.DocumentElement.SelectSingleNode("feature");                                             // 175x150
                                    if (node != null)
                                    {
                                        strIconPath = node.InnerText;
                                        if (File.Exists(strIconPath))
                                        {
                                            success = true;
                                        }
                                        else
                                        {
                                            // Use website to download missing icons
                                            if (!(bool)(CConfig.GetConfigBool(CConfig.CFG_IMGDOWN)))
                                            {
                                                if (CDock.DownloadCustomImage(strTitle, GetIconUrl(GetGameID(strID), strTitle)))
                                                {
                                                    success = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                CLogger.LogError(e);
                            }
                            if (!success)
                            {
                                strIconPath = CGameFinder.FindGameBinaryFile(dir, strTitle);
                            }
                        }
                        if (!(string.IsNullOrEmpty(strLaunch)))
                        {
                            gameDataList.Add(
                                new ImportGameData(strID, strTitle, strLaunch, strIconPath, strUninstall, strAlias, isInstalled, strPlatform, dateLastRun: lastRun, numRuns: numberRuns));
                        }
                    }
                    catch (Exception e)
                    {
                        CLogger.LogError(e);
                    }
                }
            }
            CLogger.LogDebug("------------------------");
        }
        protected internal override void read()
        {
            this._unk  = (int)base.readH();
            this._unk1 = (int)base.readC();
            this._item = base.readD();
            this._unk2 = (int)base.readC();
            bool flag = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 600000000;

            if (flag)
            {
                this._unk1 = 1;
            }
            bool flag2 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 700000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 600000000;

            if (flag2)
            {
                this._unk2 = 2;
            }
            bool flag3 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 800000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 700000000;

            if (flag3)
            {
                this._unk2 = 3;
            }
            bool flag4 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 900000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 800000000;

            if (flag4)
            {
                this._unk2 = 4;
            }
            bool flag5 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1000000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 900000000;

            if (flag5)
            {
                this._unk2 = 5;
            }
            bool flag6 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1001002000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1001001000;

            if (flag6)
            {
                this._unk2 = 6;
            }
            bool flag7 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1001003000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1001002000;

            if (flag7)
            {
                this._unk2 = 7;
            }
            bool flag8 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1104004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1104003000;

            if (flag8)
            {
                this._unk2 = 8;
            }
            bool flag9 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1105004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1105003000;

            if (flag9)
            {
                this._unk2 = 8;
            }
            bool flag10 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1102004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1102003000;

            if (flag10)
            {
                this._unk2 = 8;
            }
            bool flag11 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1103004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1103003000;

            if (flag11)
            {
                this._unk2 = 10;
            }
            bool flag12 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1006004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1006001000;

            if (flag12)
            {
                this._unk2 = 9;
            }
            bool flag13 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1301510000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1300002000;

            if (flag13)
            {
                this._unk2 = 11;
            }
            bool flag14 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 600000000;

            if (flag14)
            {
                this._unk1 = 1;
            }
            bool flag15 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 700000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 600000000;

            if (flag15)
            {
                this._unk1 = 1;
            }
            bool flag16 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 800000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 700000000;

            if (flag16)
            {
                this._unk1 = 1;
            }
            bool flag17 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 900000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 800000000;

            if (flag17)
            {
                this._unk1 = 1;
            }
            bool flag18 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1000000000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 900000000;

            if (flag18)
            {
                this._unk1 = 1;
            }
            bool flag19 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1001002000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1001001000;

            if (flag19)
            {
                this._unk1 = 2;
            }
            bool flag20 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1001003000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1001002000;

            if (flag20)
            {
                this._unk1 = 2;
            }
            bool flag21 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1104004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1104003000;

            if (flag21)
            {
                this._unk1 = 2;
            }
            bool flag22 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1102004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1102003000;

            if (flag22)
            {
                this._unk1 = 2;
            }
            bool flag23 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1102004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1102003000;

            if (flag23)
            {
                this._unk1 = 2;
            }
            bool flag24 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1105004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1105003000;

            if (flag24)
            {
                this._unk1 = 2;
            }
            bool flag25 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1103004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1103003000;

            if (flag25)
            {
                this._unk1 = 2;
            }
            bool flag26 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1006004000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1006001000;

            if (flag26)
            {
                this._unk1 = 2;
            }
            bool flag27 = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() < 1301510000 && ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId() > 1300002000;

            if (flag27)
            {
                this._unk1 = 3;
            }
            this._item_name = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemName();
            this._count     = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemCount();
            this._equip     = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemEquip();
            this._pgold     = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemGold();
            this._pcash     = ShopInfoManager.getInstance().getInfoItem2(this._item).getItemCash();
            CLogger.getInstance().warning("[Shop] " + base.getClient().getPlayer().getPlayerName().ToString() + " buy item name: " + ShopInfoManager.getInstance().getInfoItem(ShopInfoManager.getInstance().getInfoItem2(this._item).getItemId()).getItemName());
        }
Пример #33
0
 public StorageManager()
 {
     this.channels = new List <Channel>(10);
     CLogger.getInstance().info("[SM] Loaded.");
 }
 public EventLogWinApi()
 {
     Log = new CLogger();
     checkTimer = new Timer(2000);
     checkTimer.Elapsed += new ElapsedEventHandler(checkTimer_Elapsed);
 }
Пример #35
0
 /// <summary>
 /// The method converts SID string (user, group) into object name.
 /// Bu fonksiyon 06.08.2012 tarihinde Hazine Müsteþarlýðýnda bulunan sistemdeki 
 /// SID(Security Id)'leri anlamlý olan name'e translate etmek amacý ile Onur Sarýkaya tarafýndan eklenmiþtir. 
 /// </summary>
 /// <param name="name">SID string.</param>
 /// <returns>Object name in form domain\object_name.</returns>
 public static String GetName(CLogger L, string sid)
 {
     try
     {
         return new System.Security.Principal.SecurityIdentifier(sid).Translate(
                 typeof(System.Security.Principal.NTAccount)).ToString();
     }
     catch (Exception exception)
     {
         if (L != null)
             L.Log(LogType.FILE, LogLevel.ERROR, "Error on GetName: " + exception.Message);
         //WriteMessage("GetName Error: " + exception.Message);
         return sid;
     }
 }
Пример #36
0
        public Boolean InitializeLogger()
        {
            try
            {
                _log = new CLogger();

                switch (_traceLevel)
                {
                    case 0:
                        _log.SetLogLevel(LogLevel.NONE);
                        break;
                    case 1:
                        _log.SetLogLevel(LogLevel.INFORM);
                        break;
                    case 2:
                        _log.SetLogLevel(LogLevel.WARN);
                        break;
                    case 3:
                        _log.SetLogLevel(LogLevel.ERROR);
                        break;
                    case 4:
                        _log.SetLogLevel(LogLevel.DEBUG);
                        break;
                }

                _log.SetLogFile(_errLog);
                _log.SetTimerInterval(LogType.FILE, _loggingInterval);
                _log.SetLogFileSize(_logSize);

                return true;
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("Security Manager SQLServer Recorder", ex.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
Пример #37
0
        public ParserStub()
        {
            started = true;
              usingRegistry = true;
              usingKeywords = true;
              keywordsFound = false;
              startFromEndOnLoss = false;
              checkLineMismatch = true;
              lineLimit = 100;
              startLineCheckCount = 10;
              parsing = false;
              parseLock = new Mutex();
              disposeCheck = false;
              loadWatcher = false;
              readMethod = "sed";
              enc = Encoding.Default;

            #if STAYCONNECTED
            stayConnected = false;
            #endif

              Id = 0;

              /*checkTimer = new System.Timers.Timer(60000);
              checkTimer.Enabled = false;
              checkTimer.Elapsed += new System.Timers.ElapsedEventHandler(checkTimer_Elapsed);
              usingCheckTimer = false;*/

              checkTimerSSH = new System.Timers.Timer(10);
              checkTimerSSH.Enabled = false;
              checkTimerSSH.Elapsed += new System.Timers.ElapsedEventHandler(checkTimerSSH_Elapsed);

              Log = new CLogger();
              Log.SetLogLevel(LogLevel.ERROR);
        }
Пример #38
0
        public Parser(String file)
        {
            FileName = file;

            LoadWatcher();

            started = true;

            Log = new CLogger();

            Log.SetLogLevel(LogLevel.ERROR);
        }
        static void virusFound(ref CustomBase.Rec r, String line)
        {
            int file = 0;
            String[] arr = new String[100];
            arr = line.Split(',');
            for (int i = 1; i < arr.Length; i++)
            {
                //
                string[] temp = new String[100];
                string[] temp2 = new String[100];
                Boolean b;
                b = arr[i].Contains("Event time");
                if (b == false)
                {
                    //tüm par için
                    temp = arr[i].Split(':');
                    // temp kontrolü : olmayan satýrlar için
                    if (temp.Length > 1)
                    {
                        Allocate2(ref r, temp[0], temp[1].TrimEnd());
                        if (temp[0] == "Occurrences")
                        {
                            file = i;
                        }
                    }
                }
                else if (b == true)
                {
                    //dateandtime için sadece
                    //2009-03-09 09:00:00
                    temp2 = SpaceSplit(arr[i], false);

                    String date = temp2[2].Trim().Replace('-', '/') + " " + temp2[3].Trim();
                    DateTime dt = Convert.ToDateTime(date);
                    r.Datetime = dt.AddMinutes(zone).ToString("yyyy/MM/dd HH:mm:ss");

                    CLogger L2 = new CLogger();
                    L2.Log(LogType.FILE, LogLevel.DEBUG, "date" + date);
                }
            }
            //virus file
            r.CustomStr10 = arr[file + 1];
        }
Пример #40
0
        //initialize logging informations
        public bool Initialize_Logger()
        {
            try
            {
                L = new CLogger();
                switch (trc_level)
                {
                    case 0:
                        {
                            L.SetLogLevel(LogLevel.NONE);
                        } break;
                    case 1:
                        {
                            L.SetLogLevel(LogLevel.INFORM);
                        } break;
                    case 2:
                        {
                            L.SetLogLevel(LogLevel.WARN);
                        } break;
                    case 3:
                        {
                            L.SetLogLevel(LogLevel.ERROR);
                        } break;
                    case 4:
                        {
                            L.SetLogLevel(LogLevel.DEBUG);
                        } break;
                }

                L.SetLogFile("EventLogViewer.log");
                L.SetTimerInterval(LogType.FILE, Convert.ToUInt32(logging_interval));
                L.SetLogFileSize(Convert.ToUInt32(log_size));

                return true;
            }
            catch (Exception er)
            {
                EventLog.WriteEntry("Security Manager JuniperSyslogRecorder Recorder", er.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
Пример #41
0
 protected internal override void write()
 {
     CLogger.getInstance().info("Recebendo: SM_CLAN_SAVEINFO2");
     base.writeH(1365);
     base.writeD(0);
 }
        protected bool Initialize()
        {
            lock (_sync)
            {
                if ((_status & 2) == 2)
                    return true;
            }
            try
            {
                var logfile = ReadLogFilename();
                if (logfile != null)
                {
                    _logger = new CLogger();
                    _logger.SetLogFile(logfile);
                    _logger.SetLogLevel(ToLogLevel(_traceLevel, LogLevel.ERROR));

                    ProcessArgs();

                    lock (_sync)
                    {
                        _status |= 2;
                    }
                    return true;
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Security Manager NatekMdmApacheRecorder Read Registry", e.ToString(), EventLogEntryType.Error);
            }
            return false;
        }
Пример #43
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session["PatientInformation"]
            //Session["PatientSex"] = "Female";
            //Session["PatientAge"] = "12";
            int PatientId  = 0;
            int visitPK    = 0;
            int locationId = 0;
            int userId     = 0;

            if (!IsPostBack)
            {
                if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
                {
                    Response.Redirect("~/frmlogin.aspx", true);
                }

                if (!object.Equals(Session["PatientId"], null))
                {
                    PatientId = Convert.ToInt32(Session["PatientId"]);
                    if (PatientId == 0)
                    {
                        Response.Redirect("~/ClinicalForms/frmPatient_Home.aspx", true);
                    }
                    this.hidPID.Value = PatientId.ToString();
                }

                if (!object.Equals(Session["PatientVisitId"], null))
                {
                    if (!object.Equals(Request.QueryString["add"], null))
                    {
                        if (Request.QueryString["add"].ToString() == "0")
                        {
                            visitPK = 0;
                            Session["PatientVisitId"] = "0";
                        }
                    }
                    else
                    {
                        visitPK = Convert.ToInt32(Session["PatientVisitId"]);
                    }
                }
                else
                {
                    if (!object.Equals(Request.QueryString["add"], null))
                    {
                        if (Request.QueryString["add"].ToString() == "0")
                        {
                            visitPK = 0;
                        }
                    }
                }
                this.hidVId.Value = visitPK.ToString();

                if (!object.Equals(Session["AppLocationId"], null))
                {
                    locationId = Convert.ToInt32(Session["AppLocationId"]);
                }
                if (!object.Equals(Session["AppUserId"], null))
                {
                    userId = Convert.ToInt32(Session["AppUserId"]);
                }
                if (!object.Equals(Session["PatientSex"], null))
                {
                    this.hidGender.Value = Session["PatientSex"].ToString();
                }
                if (!object.Equals(Session["PatientAge"], null))
                {
                    this.hidDOB.Value = Session["PatientAge"].ToString();
                }
                if (!object.Equals(Session["patientageinyearmonth"], null))
                {
                    this.hidPAYM.Value = Session["patientageinyearmonth"].ToString();
                }
                if (!object.Equals(Session["TechnicalAreaName"], null))
                {
                    this.hidsrvNm.Value = Session["TechnicalAreaName"].ToString();
                }
                if (!object.Equals(Session["TechnicalAreaId"], null))
                {
                    this.hidMOD.Value = Session["TechnicalAreaId"].ToString();
                }

                string tabName = "triage";// ((HtmlInputHidden)this.hidTabName).Value.ToString();
                if (!object.Equals(Request.QueryString["data"], null))
                {
                    if (Request.QueryString["data"].ToString() == "gettriagedata")
                    {
                        tabName = "triage";
                    }
                    if (Request.QueryString["data"].ToString() == "getassessmentdata")
                    {
                        tabName = "assessment";
                    }
                    if (Request.QueryString["data"].ToString() == "getinitiationdata")
                    {
                        tabName = "initiation";
                    }

                    if (Request.QueryString["data"].ToString() == "getzscore")
                    {
                        tabName = "triage";
                    }
                }

                Authenticate();

                if (!object.Equals(Request.QueryString["data"], null))
                {
                    string response = string.Empty;


                    if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
                    {
                        CLogger.WriteLog(ELogLevel.ERROR, "Session expired!!");

                        ResponseType responsetype = new ResponseType()
                        {
                            Success = EnumUtil.GetEnumDescription(Success.False), ErrorMessage = "Session expired"
                        };
                        response = SerializerUtil.ConverToJson <ResponseType>(responsetype);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "gettriagedata")
                    {
                        response = GetPrEPTriage(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }
                    if (Request.QueryString["data"].ToString() == "getassessmentdata")
                    {
                        response = GetPrEPAssessment(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }
                    if (Request.QueryString["data"].ToString() == "getinitiationdata")
                    {
                        response = GetPrEPInitiation(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }
                    if (Request.QueryString["data"].ToString() == "getfacility")
                    {
                        response = GetFacilities(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }
                    if (Request.QueryString["data"].ToString() == "getzscore")
                    {
                        response = GetZScoreDetails(Convert.ToInt32(PatientId), visitPK, locationId);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "savetriage")
                    {
                        System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        string jsonString         = "";
                        jsonString = sr.ReadToEnd();

                        response = SavePrEPTriage(jsonString, PatientId, visitPK, locationId, userId);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "saveassessment")
                    {
                        System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        string jsonString         = "";
                        jsonString = sr.ReadToEnd();

                        //response = SaveAssessmentData(jsonString, PatientId, visitPK, locationId, userId);
                        SendResponse(response);
                    }
                    if (Request.QueryString["data"].ToString() == "saveinitiation")
                    {
                        System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        string jsonString         = "";
                        jsonString = sr.ReadToEnd();

                        response = SaveInitiationData(jsonString, PatientId, visitPK, locationId, userId);
                        SendResponse(response);
                    }

                    if (Request.QueryString["data"].ToString() == "deleteform")
                    {
                        response = DeleteForm();
                        SendResponse(response);
                    }
                }
            }
        }
        static String dateandtime(String w3, String w4, String w5)
        {
            //String dType = arr[3] + " " + arr[4] + " " + arr[5];
            String mounth, day, year, time;
            day = w4;
            time = w5;
            year = DateTime.Now.Year.ToString();
            switch (w3)
            {
                case "Jan":
                    mounth = "01";
                    break;
                case "Feb":
                    mounth = "02";
                    break;
                case "Mar":
                    mounth = "03";
                    break;
                case "Apr":
                    mounth = "04";
                    break;
                case "May":
                    mounth = "05";
                    break;
                case "Jun":
                    mounth = "06";
                    break;
                case "Jul":
                    mounth = "07";
                    break;
                case "Aug":
                    mounth = "08";
                    break;
                case "Sep":
                    mounth = "09";
                    break;
                case "Oct":
                    mounth = "10";
                    break;
                case "Nov":
                    mounth = "11";
                    break;
                case "Dec":
                    mounth = "12";
                    break;
                default:
                    mounth = DateTime.Now.Month.ToString();
                    break;

            }
            String dType = mounth + "/" + day + "/" + year + " " + time;
            Boolean dtError = false;
            DateTime dt = DateTime.MinValue;
            try
            {
                dt = Convert.ToDateTime(dType);
            }
            catch
            {
                dtError = true;
            }
            if (dtError)
            {
                try
                {
                    dType = day + "/" + mounth + "/" + year + " " + time;
                    dt = Convert.ToDateTime(dType);
                }
                catch
                {
                    return "";
                }
            }
            dType = dt.AddMinutes(zone).ToString("yyyy/MM/dd HH:mm:ss");

            CLogger L2 = new CLogger();
            L2.Log(LogType.FILE, LogLevel.DEBUG, "date" + dType);

            return dType;
        }
Пример #45
0
        private string GetPrEPTriage(int ptn_pk, int visitPK, int locationId)
        {
            string result = string.Empty;

            try
            {
                IQCareUtils theUtils = new IQCareUtils();
                DataSet     theDSXML = new DataSet();
                theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));
                double            age         = Convert.ToDouble(Session["patientageinyearmonth"].ToString());
                List <CodeDeCode> collections = new List <CodeDeCode>();

                DataView theCodeDV = new DataView(theDSXML.Tables["MST_CODE"]);
                theCodeDV.RowFilter = "DeleteFlag=0 and Name in ('KeyPopulation')";
                DataTable theCodeDT = (DataTable)theUtils.CreateTableFromDataView(theCodeDV);
                DataTable theDT     = new DataTable();
                if (theCodeDT.Rows.Count > 0)
                {
                    foreach (DataRow row in theCodeDT.Rows)
                    {
                        DataView theDV = new DataView(theDSXML.Tables["MST_DECODE"]);
                        theDV.RowFilter = "DeleteFlag=0 and CodeID=" + row["CodeId"] + "";

                        theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                        List <CodeDeCode> collections1 = new List <CodeDeCode>();
                        collections1 = (from dt in theDT.AsEnumerable()
                                        select new CodeDeCode()
                        {
                            CodeId = dt.Field <int>("codeid"),
                            CodeName = dt.Field <string>("CodeName"),
                            DeCodeId = dt.Field <int>("Id"),
                            DeCodeName = dt.Field <string>("NAME")
                        }).ToList();

                        collections.AddRange(collections1);
                    }
                }

                IPrEP iPrep = (IPrEP)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPrEP, BusinessProcess.Clinical");
                Entities.Common.PrEP prep = iPrep.GetPrEPTriageData(ptn_pk, visitPK, locationId);
                if (collections.Count > 0)
                {
                    prep.DropDownValues.AddRange(collections);
                }

                theCodeDV = new DataView(oCommonData.getAllEmployees());
                theCodeDT = (DataTable)theUtils.CreateTableFromDataView(theCodeDV);
                if (theCodeDT.Rows.Count > 0)
                {
                    foreach (DataRow row in theCodeDT.Rows)
                    {
                        UserDesignation ud = new UserDesignation();
                        ud.UserID      = Convert.ToInt32(row["userid"].ToString());
                        ud.UserName    = row["UserName"].ToString();
                        ud.Designation = row["Designation"].ToString();
                        ud.DeleteFlag  = Convert.ToInt32(row["DeleteFlag"].ToString());

                        prep.UserDesignation.Add(ud);
                    }
                }

                string facilitylist = SerializerUtil.ConverToJson <List <Entities.Common.Facility> >(prep.FacilityList);
                Session["FacilityList"] = facilitylist;

                result = SerializerUtil.ConverToJson <Entities.Common.PrEP>(prep);
            }
            catch (Exception ex)
            {
                CLogger.WriteLog(ELogLevel.ERROR, "GetPrEPTriageData() exception: " + ex.ToString());
                ResponseType response = new ResponseType()
                {
                    Success = EnumUtil.GetEnumDescription(Success.False)
                };
                result = SerializerUtil.ConverToJson <ResponseType>(response);
            }
            finally
            {
            }
            return(result);
        }
 public bool Initialize_Logger()
 {
     try
     {
         L = new CLogger();
         switch (trc_level)
         {
             case 0:
                 {
                     L.SetLogLevel(LogLevel.NONE);
                 } break;
             case 1:
                 {
                     L.SetLogLevel(LogLevel.INFORM);
                 } break;
             case 2:
                 {
                     L.SetLogLevel(LogLevel.WARN);
                 } break;
             case 3:
                 {
                     L.SetLogLevel(LogLevel.ERROR);
                 } break;
             case 4:
                 {
                     L.SetLogLevel(LogLevel.DEBUG);
                 } break;
         }
         if (!string.IsNullOrEmpty(LogLocation))
             err_log = Path.Combine(LogLocation, @"EventLogFileAuditRecorder" + Id + ".log");
         L.SetLogFile(err_log);
         L.SetTimerInterval(LogType.FILE, logging_interval);
         L.SetLogFileSize(log_size);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("Security Manager RedHatSecure Recorder", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
Пример #47
0
        private string GetZScoreDetails(int ptn_pk, int visitPK, int locationId)
        {
            string result = string.Empty;

            try
            {
                IPrEP iPrepFacility     = (IPrEP)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPrEP, BusinessProcess.Clinical");
                Entities.Common.PrEP pz = iPrepFacility.GetPrEPTriageData(ptn_pk, visitPK, locationId);

                DataSet         zscoreds = new DataSet();
                IKNHStaticForms knhs     = (IKNHStaticForms)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BKNHStaticForms, BusinessProcess.Clinical");
                string          height   = string.IsNullOrEmpty(pz.PatientVitals.Height) == true ? "0" : pz.PatientVitals.Height;
                zscoreds = knhs.GetZScoreNewImplementation(ptn_pk, Session["patientsex"].ToString(), height.ToString());

                ZScoreDetails zs = new ZScoreDetails();
                zs.WFA  = new ZScore();
                zs.WFH  = new ZScore();
                zs.BMIz = new ZScore();
                if (zscoreds.Tables[0].Rows.Count > 0)
                {
                    DataColumnCollection columns = zscoreds.Tables[0].Columns;
                    if (columns.Contains("L"))
                    {
                        zs.WFA.L = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["L"].ToString());
                        zs.WFA.M = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["M"].ToString());
                        zs.WFA.S = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["S"].ToString());
                    }
                }

                if (zscoreds.Tables[1].Rows.Count > 0)
                {
                    DataColumnCollection columns = zscoreds.Tables[1].Columns;
                    if (columns.Contains("L"))
                    {
                        zs.WFH.L = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["L"].ToString());
                        zs.WFH.M = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["M"].ToString());
                        zs.WFH.S = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["S"].ToString());
                    }
                }

                if (zscoreds.Tables[2].Rows.Count > 0)
                {
                    DataColumnCollection columns = zscoreds.Tables[2].Columns;
                    if (columns.Contains("L"))
                    {
                        zs.BMIz.L = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["L"].ToString());
                        zs.BMIz.M = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["M"].ToString());
                        zs.BMIz.S = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["S"].ToString());
                    }
                }

                zscoreds.Dispose();

                result = SerializerUtil.ConverToJson <Entities.Common.ZScoreDetails>(zs);
            }
            catch (Exception ex)
            {
                CLogger.WriteLog(ELogLevel.ERROR, "getzscoredetails() exception: " + ex.ToString());
                ResponseType response = new ResponseType()
                {
                    Success = EnumUtil.GetEnumDescription(Success.False)
                };
                result = SerializerUtil.ConverToJson <ResponseType>(response);
            }
            finally
            {
            }
            return(result);
        }
Пример #48
0
 public bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         L.SetLogLevel((LogLevel)((trcLevel < 0 || trcLevel > 4) ? 3 : trcLevel));
         L.SetLogFile(errLog);
         L.SetTimerInterval(LogType.FILE, loggingInterval);
         L.SetLogFileSize(logSize);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("RemoteRecorderBase->InitializeLogger() ", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
 protected internal void ignore(int in_offset)
 {
     this._offset += in_offset;
     CLogger.getInstance().info("Ignore " + in_offset + "bytes");
 }
Пример #50
0
        public bool Initialize_Logger()
        {
            try
            {
                L = new CLogger();
                switch (trc_level)
                {
                    case 0:
                        {
                            L.SetLogLevel(LogLevel.NONE);
                        } break;
                    case 1:
                        {
                            L.SetLogLevel(LogLevel.INFORM);
                        } break;
                    case 2:
                        {
                            L.SetLogLevel(LogLevel.WARN);
                        } break;
                    case 3:
                        {
                            L.SetLogLevel(LogLevel.ERROR);
                        } break;
                    case 4:
                        {
                            L.SetLogLevel(LogLevel.DEBUG);
                        } break;
                }

                L.SetLogFile(err_log);
                L.SetTimerInterval(LogType.FILE, logging_interval);
                L.SetLogFileSize(log_size);
                return true;
            }
            catch (Exception er)
            {
                EventLog.WriteEntry("Security Manager NetScalerNetworkBalancerV_1_0_0Recorder Recorder", er.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
Пример #51
0
 protected internal override void read()
 {
     base.readH();
     this.slot = base.readD();
     CLogger.getInstance().info("[Slot] the new owner: " + this.slot);
 }