public ActionResult About()
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                var fm = new FileLogManager();
                fm.LogExceptions(new ExceptionEntry
                {
                    Title       = Constants.ApplicationName,
                    Message     = ex.Message,
                    Id          = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                    Priority    = "Medium",
                    SessionId   = Guid.NewGuid().ToString(),
                    Severity    = TraceEventType.Error.ToString(),
                    Exception   = fm.CreateExceptionString(ex),
                    StackStrace = ex.StackTrace
                });
            }

            ViewBag.Message = "Your application description page.";

            return(View());
        }
        public override void OnActionExecuted(ActionExecutedContext actionExecutedContext)
        {
            var eventEntry = GetEventEntry(actionExecutedContext);
            var fileLogger = new FileLogManager();

            fileLogger.LogApplicationCalls(eventEntry);
            base.OnActionExecuted(actionExecutedContext);
        }
Exemple #3
0
        /// <summary>
        /// CAP 메시지를 기반으로 헤드라인 문자열 작성.
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string MakeHeadline(CAP msg)
        {
            System.Diagnostics.Debug.Assert(msg != null);

            try
            {
                StringBuilder builder = new StringBuilder();
                foreach (InfoType msgInfo in msg.Info)
                {
                    if (msgInfo.Language.ToUpper() == BasisData.DEFAULT_LANGUAGECODE.ToUpper())
                    {
                        builder.Append(msgInfo.Headline);
                        break;
                    }
                }

                if (builder.Length < 1)
                {
                    OrderMode modeInfo = BasisData.FindOrderModeInfoByCode(msg.MessageStatus.Value);
                    if (modeInfo == null || string.IsNullOrEmpty(modeInfo.Name))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 모드 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 모드 정보를 찾을 수 없습니다.");
                    }

                    if (msg.Info == null || msg.Info.Count < 1 || string.IsNullOrEmpty(msg.Info[0].Event))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 이벤트 코드 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 이벤트 코드 정보를 찾을 수 없습니다.");
                    }
                    string disasterKindName = msg.Info[0].Event;

                    string targets = ExtractTargetNamesFromCAP(msg);
                    if (string.IsNullOrEmpty(targets))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 발령 대상 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 발령 대상 정보를 찾을 수 없습니다.");
                    }

                    builder.Append(msg.SentDateTime.ToString());
                    builder.Append(" [" + modeInfo.Name + "]");
                    builder.Append(" [" + targets.Replace(',', '/') + "] 대상으로");
                    builder.Append(" [" + disasterKindName + "]");
                    builder.Append(" 발령");
                }

                return(builder.ToString());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[CAPInfo] MakeHeadline( Exception=[ " + ex.ToString() + "] )");
                FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( Exception=[" + ex.ToString() + "] )");

                throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 처리 중 예외가 발생하였습니다.");
            }
        }
Exemple #4
0
        private void SetAttackParameters(Character ch)
        {
            if (!ch.AttackConfigurationMap[AttackConfigKey].Item2.HasMultipleAttackers)
            {
                if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsHit)
                {
                    ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackResult = AttackResultOption.Hit;
                }
                else
                {
                    ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackResult = AttackResultOption.Miss;
                }
            }
            else
            {
                foreach (AttackResult ar in ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackResults)
                {
                    ar.AttackResultOption = ar.IsHit ? AttackResultOption.Hit : AttackResultOption.Miss;
                }
            }

            if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsDead)
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackEffectOption = AttackEffectOption.Dead;
            }
            else if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsDying)
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackEffectOption = AttackEffectOption.Dying;
            }
            else if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsUnconcious)
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackEffectOption = AttackEffectOption.Unconcious;
            }
            else if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsStunned)
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackEffectOption = AttackEffectOption.Stunned;
            }
            else
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.AttackEffectOption = AttackEffectOption.None;
            }

            if (ch.AttackConfigurationMap[AttackConfigKey].Item2.IsKnockedBack)
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.KnockBackOption = KnockBackOption.KnockBack;
            }
            else
            {
                ch.AttackConfigurationMap[AttackConfigKey].Item2.KnockBackOption = KnockBackOption.None;
                FileLogManager.ForceLog("Setting None as Knockback option for {0}", ch.Name);
            }

            ch.RefreshAttackConfigurationParameters();
        }
Exemple #5
0
        public OrderRecord ToOrderRecord()
        {
            OrderRecord recordInfo = new OrderRecord();

            try
            {
                recordInfo.CAPID        = this.CAPData.MessageID;
                recordInfo.OrderedTime  = this.CAPData.SentDateTime;
                recordInfo.RefType      = this.RefType;
                recordInfo.RefRecordID  = this.RefRecordID;
                recordInfo.LocationKind = this.LocationKind;

                if (this.Mode != null)
                {
                    recordInfo.OrderMode = this.Mode.Code;
                }
                else
                {
                    // [2016-03-31] 기본 발령 정보를 시험으로 생성 - by Gonzi
                    //recordInfo.OrderMode = StatusType.Actual;
                    recordInfo.OrderMode = StatusType.Test;
                }

                if (this.Disaster != null && this.Disaster.Kind != null && !string.IsNullOrEmpty(this.Disaster.Kind.Code))
                {
                    recordInfo.DisasterKindCode = this.Disaster.Kind.Code;
                }
                else
                {
                    recordInfo.DisasterKindCode = string.Empty;
                }

                recordInfo.ClearState = new AlertingClearState();
                recordInfo.ClearState.DeepCopyFrom(BasisData.AlertingClearStateInfo[this.clearAlertState]);

                if (this.CAPData != null)
                {
                    recordInfo.CapText = this.CAPData.WriteToXML();
                }
                else
                {
                    recordInfo.CapText = string.Empty;
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[OrderInfo] ToOrderRecord( Exception=[" + ex.ToString() + "] )");
                FileLogManager.GetInstance().WriteLog("[OrderInfo] ToOrderRecord ( Exception=[" + ex.ToString() + "] )");

                return(null);
            }

            return(recordInfo);
        }
Exemple #6
0
        public ProfileHashCheckReqData(uint requestID, uint totalCount)
        {
            if (totalCount <= 0)
            {
                FileLogManager.GetInstance().WriteLog("[DataSyncInfo] ProfileHashCheckReqData ( Invalid Total Count. )");
                throw new Exception("Invalid Total Count.");
            }

            this.reqEventID = requestID;
            this.totalCnt   = totalCount;

            this.lstProfileHash = new List <SASProfileHash>((int)totalCount);
            for (int index = 0; index < totalCount; index++)
            {
                SASProfileHash hash = new SASProfileHash();
                this.lstProfileHash.Add(hash);
            }
        }
Exemple #7
0
        public ProfileUpdateReqData(uint requestID, uint totalCount, ProfileUpdateMode mode)
        {
            if (totalCount <= 0)
            {
                FileLogManager.GetInstance().WriteLog("[DataSyncInfo] ProfileUpdateReqData ( Invalid Total Count. )");

                throw new Exception("Invalid Total Count.");
            }

            this.reqEventID = requestID;
            this.totalCnt   = totalCount;
            this.mode       = mode;

            this.lstSASProfile = new List <SASProfile>((int)totalCount);
            for (int index = 0; index < totalCount; index++)
            {
                SASProfile system = new SASProfile();
                this.lstSASProfile.Add(system);
            }
        }
Exemple #8
0
        public void OnException(ExceptionContext filterContext)
        {
            //ILogManager dbLogger = new DbLogManager();
            //dbLogger.LogExceptions(new ExceptionEntry
            //{
            //    Exception = filterContext.Exception.ToString(),
            //    Title = Constants.ApplicationName
            //});

            ILogManager fileLogger = new FileLogManager();

            fileLogger.LogExceptions(new ExceptionEntry
            {
                Title       = Constants.ApplicationName,
                Message     = filterContext.Exception.Message,
                Id          = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                Priority    = "Medium",
                SessionId   = Guid.NewGuid().ToString(),
                Severity    = TraceEventType.Error.ToString(),
                Exception   = filterContext.Exception.ToString(),
                StackStrace = filterContext.Exception.StackTrace,
                IpAddress   = filterContext.HttpContext.Request.UserHostAddress,
            });
        }
 public virtual void OnButtonClick()
 {
     FileLogManager.LogEntry(MessageToLog);
 }
Exemple #10
0
        public static RegionProfile FindRegion(string regionCode)
        {
            if (string.IsNullOrEmpty(regionCode))
            {
                return(null);
            }
            if (!IsRegionDataLoaded())
            {
                return(null);
            }

            RegionProfile profile = null;

            try
            {
                if (Regions.LstRegion.ContainsKey(regionCode))
                {
                    profile = Regions.LstRegion[regionCode];
                }
                else
                {
                    bool isFound = false;
                    bool check2  = true;
                    foreach (RegionProfile region1 in Regions.LstRegion.Values)
                    {
                        if (region1.LstSubRegion == null || region1.LstSubRegion.Count <= 0)
                        {
                            continue;
                        }
                        if (check2)
                        {
                            check2  = false;
                            isFound = region1.LstSubRegion.ContainsKey(regionCode); // 시군구
                            if (isFound)
                            {
                                profile = region1.LstSubRegion[regionCode];
                                break;
                            }
                        }

                        foreach (RegionProfile region2 in region1.LstSubRegion.Values)
                        {
                            if (region2.LstSubRegion == null || region2.LstSubRegion.Count <= 0)
                            {
                                continue;
                            }
                            isFound = region2.LstSubRegion.ContainsKey(regionCode);
                            if (isFound)
                            {
                                profile = region2.LstSubRegion[regionCode];
                                break;
                            }
                        }

                        if (isFound)
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[BasisData] FindRegion ( Exception: " + ex.ToString() + " )");
                FileLogManager.GetInstance().WriteLog("[BasisData] FindRegion ( Exception: " + ex.ToString() + " )");
            }

            return(profile);
        }
Exemple #11
0
        public string GetHeadlineString()
        {
            if (this == null)
            {
                return(string.Empty);
            }

            try
            {
                CAPHelper     helper      = new CAPHelper();
                StringBuilder headline    = new StringBuilder();
                string        association = string.Empty;

                if (this.LocationKind == OrderLocationKind.Other)
                {
                    association = "[연계] ";
                }

                CAP    msg            = new CAP(this.CapText);
                string headlineNormal = helper.MakeHeadline(msg);
                if (string.IsNullOrEmpty(headlineNormal))
                {
                    headline.Append(headlineNormal);
                }

                if (headline.Length < 1)
                {
                    OrderMode mode = BasisData.FindOrderModeInfoByCode(this.OrderMode);
                    if (mode == null)
                    {
                        headline.Append(this.OrderedTime + " [ Unknown ]");
                    }
                    else
                    {
                        headline.Append(this.OrderedTime + " [" + mode.Name + "]");
                    }

                    string targets = helper.ExtractTargetNamesFromCAP(msg);
                    if (!string.IsNullOrEmpty(targets))
                    {
                        headline.Append("[" + targets.Replace(',', '/') + "] 대상으로");
                    }
                    else
                    {
                        headline.Append("[ Unknown ] 대상으로");
                    }

                    string disasterName = "Unknown";
                    if (msg.Info != null && msg.Info.Count > 0)
                    {
                        disasterName = msg.Info[0].Event;
                    }
                    else
                    {
                        DisasterKind disasterKind = BasisData.FindDisasterKindByCode(this.DisasterKindCode);
                        if (disasterKind != null)
                        {
                            disasterName = disasterKind.Name;
                        }
                    }

                    headline.Append(" [" + disasterName + "]");
                    headline.Append(" 발령");

                    if (this.RefType == OrderReferenceType.Cancel)
                    {
                        headline.Append(" 취소");
                    }
                }

                return(association + headline.ToString());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[OrderInfo] GetHeadlineString( Exception=[" + ex.ToString() + "] )");
                FileLogManager.GetInstance().WriteLog("[OrderInfo] GetHeadlineString ( Exception=[" + ex.ToString() + "] )");

                return(string.Empty);
            }
        }
        /// <summary>
        /// Xml 데이터에서 기상특보통보문 데이터를 클래스로 파싱.
        /// </summary>
        /// <returns></returns>
        public SWRWarningItemProfile GetWarningItemProfile()
        {
            System.Diagnostics.Debug.Assert(this != null);
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(this.originalWarningItemReport));

            SWRWarningItemProfile profile = new SWRWarningItemProfile();

            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(this.originalWarningItemReport);

                XmlNodeList xNodes = xmlDoc.SelectNodes("/swr/item");
                if (xNodes == null || xNodes.Count <= 0)
                {
                    return(null);
                }

                foreach (XmlNode item in xNodes)
                {
                    foreach (XmlNode node in item.ChildNodes)
                    {
                        string value = node.InnerText;
                        switch (node.Name)
                        {
                        case "stnId":
                        {
                            profile.StationID = value;
                        }
                        break;

                        case "tmFc":
                        {
                            DateTime temp = new DateTime();
                            if (DateTime.TryParse(value, out temp))
                            {
                                profile.AnnounceTime = temp;
                            }
                        }
                        break;

                        case "tmSeq":
                        {
                            int temp = 0;
                            if (int.TryParse(value, out temp))
                            {
                                profile.SequenceNo = temp;
                            }
                        }
                        break;

                        case "warFc":
                        {
                            profile.CommandCode = value;
                        }
                        break;

                        case "t1":
                        {
                            profile.Title = value;
                        }
                        break;

                        case "t2":
                        {
                            profile.TargetAreas = value;
                        }
                        break;

                        case "t3":
                        {
                            profile.EffectStartInfo = value;
                        }
                        break;

                        case "t4":
                        {
                            profile.Contents = value;
                        }
                        break;

                        case "t5":
                        {
                            DateTime temp = new DateTime();
                            if (DateTime.TryParse(value, out temp))
                            {
                                profile.PresentConditionTime = temp;
                            }
                        }
                        break;

                        case "t6":
                        {
                            profile.PresentConditionContents = value;
                        }
                        break;

                        case "t7":
                        {
                            profile.PreliminaryConditionContents = value;
                        }
                        break;

                        case "other":
                        {
                            profile.Other = value;
                        }
                        break;

                        default:
                        {
                            // 이외에 빠진 항목은 없는지 확인하자
                            System.Console.WriteLine("[SpecialWeatherReportInfo] GetWarningItemProfile( Unknown Element: " + node.Name + " )");
                        }
                        break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[SpecialWeatherReportInfo] GetWarningItemProfile( Exception Occured: " + ex.ToString() + " )");
                FileLogManager.GetInstance().WriteLog("[SpecialWeatherReportInfo] GetWarningItemProfile ( Exception=[" + ex.ToString() + "] )");

                return(null);
            }

            return(profile);
        }
Exemple #13
0
        private List <CollisionInfo> FindObstructingObjects(Vector3 sourcePositionVector, Vector3 targetPositionVector, List <Character> otherCharacters)
        {
            List <CollisionInfo> collisions  = new List <CollisionInfo>();
            Vector3 sourceFacingTargetVector = targetPositionVector - sourcePositionVector;
            Vector3 targetFacingSourceVector = sourcePositionVector - targetPositionVector;

            if (sourceFacingTargetVector == targetFacingSourceVector)
            {
                return(null);
            }
            if (sourceFacingTargetVector != Vector3.Zero)
            {
                sourceFacingTargetVector.Normalize();
            }
            if (targetFacingSourceVector != Vector3.Zero)
            {
                targetFacingSourceVector.Normalize();
            }
            // Calculate points A and B to the left and right of source
            Vector3 pointA = Helper.GetAdjacentPoint(sourcePositionVector, sourceFacingTargetVector, true);
            Vector3 pointB = Helper.GetAdjacentPoint(sourcePositionVector, sourceFacingTargetVector, false);
            // Calculate points C and D to left and right of target
            Vector3 pointC = Helper.GetAdjacentPoint(targetPositionVector, targetFacingSourceVector, false);
            Vector3 pointD = Helper.GetAdjacentPoint(targetPositionVector, targetFacingSourceVector, true);
            // Now we have four co-ordinates of rectangle ABCD.  Need to check if any of the other characters falls within this rectangular region
            List <Character> obstructingCharacters = new List <Characters.Character>();

            try
            {
                foreach (Character otherCharacter in otherCharacters)
                {
                    if (Helper.IsPointWithinQuadraticRegion(pointA, pointB, pointC, pointD, otherCharacter.CurrentPositionVector))
                    {
                        obstructingCharacters.Add(otherCharacter);
                    }
                }
            }
            catch
            {
                FileLogManager.ForceLog(string.Format("Boundary case found for obstacle collision. Source vector {0}, Target vector {1}, other characters {2}", sourcePositionVector, targetPositionVector, string.Join(", ", otherCharacters.Select(c => c.Name))));
            }

            Dictionary <BodyPart, bool> bodyPartMap = new Dictionary <BodyPart, bool>();

            bodyPartMap.Add(BodyPart.BottomMiddle, true);
            bodyPartMap.Add(BodyPart.Middle, true);
            bodyPartMap.Add(BodyPart.TopMiddle, true);
            bodyPartMap.Add(BodyPart.Top, true);

            Dictionary <BodyPart, CollisionInfo> bodyPartCollisionMap = GetCollisionPointsForBodyParts(sourcePositionVector, targetPositionVector, bodyPartMap);
            bool hasCollision = false;

            foreach (BodyPart key in bodyPartCollisionMap.Keys)
            {
                if (bodyPartCollisionMap[key] != null)
                {
                    hasCollision = true;
                    break;
                }
            }
            if (hasCollision)
            {
                var collisionDistance = bodyPartCollisionMap.Values.Min(d => d != null ? d.CollisionDistance : 10000f);
                collisions.Add(new CollisionInfo {
                    CollidingObject = "WALL", CollisionDistance = collisionDistance
                });
            }
            foreach (Character obsChar in obstructingCharacters)
            {
                float obsDist = Vector3.Distance(sourcePositionVector, obsChar.CurrentPositionVector);
                collisions.Add(new CollisionInfo {
                    CollidingObject = obsChar, CollisionDistance = obsDist
                });
            }

            return(collisions);
        }