Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Tag">The asn1 tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="asn1Class">The asn1 class.</param>
 public Asn1TagInfo(Asn1Tag asn1Tag, ConstructType constructType, Asn1Class asn1Class)
 {
     this.Asn1ClassType = asn1Class;
     this.Asn1ConstructType = constructType;
     this.Asn1SnmpTagType = Asn1SnmpTag.NotSnmpData;
     this.Asn1TagType = asn1Tag;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1SnmpTag">The asn1 SNMP tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 public Asn1TagInfo(Asn1SnmpTag asn1SnmpTag, ConstructType constructType)
 {
     Asn1ClassType     = Asn1Class.Application;
     Asn1ConstructType = constructType;
     Asn1SnmpTagType   = asn1SnmpTag;
     Asn1TagType       = Asn1Tag.NotAsn1Data;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1SnmpTag">The asn1 SNMP tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 public Asn1TagInfo(Asn1SnmpTag asn1SnmpTag, ConstructType constructType)
 {
     this.Asn1ClassType = Asn1Class.Application;
     this.Asn1ConstructType = constructType;
     this.Asn1SnmpTagType = asn1SnmpTag;
     this.Asn1TagType = Asn1Tag.NotAsn1Data;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Tag">The asn1 tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 public Asn1TagInfo(Asn1Tag asn1Tag, ConstructType constructType)
 {
     this.Asn1ClassType = Asn1Class.Universal;
     this.Asn1ConstructType = constructType;
     this.Asn1SnmpTagType = Asn1SnmpTag.NotSnmpData;
     this.Asn1TagType = asn1Tag;
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Tag">The asn1 tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 public Asn1TagInfo(Asn1Tag asn1Tag, ConstructType constructType)
 {
     Asn1ClassType     = Asn1Class.Universal;
     Asn1ConstructType = constructType;
     Asn1SnmpTagType   = Asn1SnmpTag.NotSnmpData;
     Asn1TagType       = asn1Tag;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Tag">The asn1 tag.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="asn1Class">The asn1 class.</param>
 public Asn1TagInfo(Asn1Tag asn1Tag, ConstructType constructType, Asn1Class asn1Class)
 {
     Asn1ClassType     = asn1Class;
     Asn1ConstructType = constructType;
     Asn1SnmpTagType   = Asn1SnmpTag.NotSnmpData;
     Asn1TagType       = asn1Tag;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Class">The asn1 class.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="tagType">Type of the tag.</param>
 internal Asn1TagInfo(int asn1Class, int constructType, int tagType)
 {
     Asn1ClassType     = (Asn1Class)asn1Class;
     Asn1ConstructType = (ConstructType)constructType;
     if (Asn1ClassType == Asn1Class.Application)
     {
         Asn1SnmpTagType = (Asn1SnmpTag)tagType;
         Asn1TagType     = Asn1Tag.NotAsn1Data;
     }
     else
     {
         Asn1TagType     = (Asn1Tag)tagType;
         Asn1SnmpTagType = Asn1SnmpTag.NotSnmpData;
     }
 }
Esempio n. 8
0
 public static ConstructData Find(ConstructType Name)
 {
     for (int i = 0; i < Directory.Count; i++)
     {
         if (Directory[i].isType == Name)
         {
             ConstructData temp = Directory[i].Clone();
             temp.ConstructContained = new Constructs(Directory[i].ConstructContained);
             temp.isType             = Name;
             conNum++;
             return(temp);
         }
     }
     return(null);
 }
Esempio n. 9
0
        /// <summary>
        /// 固定模板的抽象类构造函数
        /// </summary>
        /// <param name="consType">创建类别</param>
        public CodeManageBase(ConstructType consType)
        {
            IsStaticModel = false;
            ModelEntity   = null;
            Construct     = consType;
            StringBuilder result = new StringBuilder();

            using (StreamReader reader = new StreamReader(string.Format("{0}.sem", consType.ToString()).GetFileResource("Code")))
            {
                while (reader.Peek() != -1)
                {
                    string temp = reader.ReadLine();
                    temp = ModelContainer.Replace(temp);
                    result.AppendLine(temp);
                }
            }
            CodeContent = result.ToString();
        }
Esempio n. 10
0
        /// <summary>
        /// 活动模板的抽象类构造函数
        /// </summary>
        /// <param name="consType">创建类别</param>
        /// <param name="entity">活动模板的实体信息</param>
        public CodeManageBase(ConstructType consType, TemplateEntity entity)
        {
            IsStaticModel = true;
            ModelEntity   = entity;
            Construct     = consType;
            StringBuilder result = new StringBuilder();

            ModelContainer.Regist("$Data2Obj$", entity.Data2Obj, "实体的数据库名称");
            ModelContainer.Regist("$Entity$", entity.Entity, "实体的应用名称");
            using (StreamReader reader = new StreamReader(string.Format("{0}.slm", consType.ToString()).GetFileResource("Code")))
            {
                while (reader.Peek() != -1)
                {
                    string temp = reader.ReadLine();
                    temp = ModelContainer.Replace(temp);
                    result.AppendLine(temp);
                }
            }
            CodeContent = result.ToString();
        }
Esempio n. 11
0
        public void CreateBlueprint(ConstructType type)
        {
            ConstructStats constructStats = null;

            foreach (var construct in _objectsLibrary.ConstructStats)
            {
                if (construct.Type == type)
                {
                    constructStats = construct;
                }
            }

            if (constructStats == null)
            {
                Debug.Log($" construct of type {type} was not found in library");
                return;
            }

            _newConstruct = Instantiate(constructStats.prefab, this.transform.position, Quaternion.identity);
            _newConstruct.Init(constructStats);
            _newConstruct.OnConstructionFinished += ConstructionFinished;
        }
Esempio n. 12
0
 public CodeAppendManager(ConstructType consType, TemplateEntity entity)
     : base(consType, entity)
 {
     _consType = consType;
     _entity   = entity;
 }
Esempio n. 13
0
        /// <summary>
        /// 根据模型类别获取创建代码的路径
        /// </summary>
        /// <param name="modelType"></param>
        /// <param name="data2Obj"></param>
        /// <param name="overWrite">是否覆盖原有的文件</param>
        /// <returns></returns>
        public static string GetCodePath(ConstructType modelType, bool overWrite = true, TemplateEntity entity = null)
        {
            string path = string.Empty;
            string dir  = string.Empty;

            switch (modelType)
            {
            case ConstructType.Repository:
                dir = Path.Combine(ProjectContainer.Infrastructure.ToDirectory(), "Repository");
                if (Directory.Exists(dir) == false)
                {
                    Directory.CreateDirectory(dir);
                }
                path = Path.Combine(dir, entity.Data2Obj + "Repository.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.IRepository:
                dir = Path.Combine(ProjectContainer.DomainContext.ToDirectory(), entity.Data2Obj);
                if (Directory.Exists(dir) == false)
                {
                    Directory.CreateDirectory(dir);
                }
                path = Path.Combine(dir, "I" + entity.Data2Obj + "Repository.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.Application:
                path = Path.Combine(ProjectContainer.Application.ToDirectory(), entity.Data2Obj + "App.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.IApplication:
                path = Path.Combine(ProjectContainer.IApplication.ToDirectory(), "I" + entity.Data2Obj + "App.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.Data2Obj:
                path = Path.Combine(ProjectContainer.Data2Object.ToDirectory(), entity.Data2Obj + "DTO.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.Profile:
                dir = Path.Combine(ProjectContainer.Data2Object.ToDirectory(), "Profile");
                if (Directory.Exists(dir) == false)
                {
                    Directory.CreateDirectory(dir);
                }
                path = Path.Combine(dir, SolutionCommon.ProjectName + "Profile.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.Map:
                dir = Path.Combine(ProjectContainer.Infrastructure.ToDirectory(), "Map");
                if (Directory.Exists(dir) == false)
                {
                    Directory.CreateDirectory(dir);
                }
                path = Path.Combine(dir, entity.Entity + "Map.cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            case ConstructType.Entity:
                path = Path.Combine(ProjectContainer.DomainEntity.ToDirectory(), entity.Entity + ".cs");
                if (File.Exists(path) && overWrite)
                {
                    File.Delete(path);
                }
                break;

            default:
                break;
            }
            return(path);
        }
Esempio n. 14
0
 public CodeStaticManager(ConstructType consType)
     : base(consType)
 {
     _consType = consType;
 }
Esempio n. 15
0
 internal Construct(ConstructType setType)
 {
     Type   = setType;
     Config = ConstructConfig.QuadPiece;
 }
Esempio n. 16
0
        public void SelectConstruct(ConstructType type)
        {
            switch (type)
            {
            case ConstructType.ParallelLine:
                if (_selectedShapes.Count == 2)
                {
                    if (_selectedShapes[0] is LineLike && _selectedShapes[1] is Dot ||
                        _selectedShapes[0] is Dot && _selectedShapes[1] is LineLike)
                    {
                        var line = _selectedShapes[0] as LineLike ?? _selectedShapes[1] as LineLike;
                        var dot  = _selectedShapes[0] as Dot ?? _selectedShapes[1] as Dot;
                        _shapes.Add(Line.ParallelLine(line, dot));
                    }
                }
                break;

            case ConstructType.PerpendicularLine:
                if (_selectedShapes.Count == 2)
                {
                    if (_selectedShapes[0] is LineLike && _selectedShapes[1] is Dot ||
                        _selectedShapes[0] is Dot && _selectedShapes[1] is LineLike)
                    {
                        var line = _selectedShapes[0] as LineLike ?? _selectedShapes[1] as LineLike;
                        var dot  = _selectedShapes[0] as Dot ?? _selectedShapes[1] as Dot;
                        _shapes.Add(Line.PerpendicularLine(line, dot));
                    }
                }
                break;

            case ConstructType.Tangent:
                if (_selectedShapes.Count == 2)
                {
                    if (_selectedShapes[0] is Circle && _selectedShapes[1] is Dot ||
                        _selectedShapes[0] is Dot && _selectedShapes[1] is Circle)
                    {
                        var cir = _selectedShapes[0] as Circle ?? _selectedShapes[1] as Circle;
                        var dot = _selectedShapes[0] as Dot ?? _selectedShapes[1] as Dot;
                        _shapes.Add(Line.TangentLine(cir, dot));
                    }
                    else if (_selectedShapes[0] is Ellipse && _selectedShapes[1] is Dot ||
                             _selectedShapes[0] is Dot && _selectedShapes[1] is Ellipse)
                    {
                        var elp = _selectedShapes[0] as Ellipse ?? _selectedShapes[1] as Ellipse;
                        var dot = _selectedShapes[0] as Dot ?? _selectedShapes[1] as Dot;
                        _shapes.Add(Line.TangentLine(elp, dot));
                    }
                }
                break;

            case ConstructType.Reflection:    // 첫 선택이 대칭축, 두번째 선택이 대칭시킬 도형
                if (_selectedShapes.Count == 2)
                {
                    if (_selectedShapes[0] is LineLike)
                    {
                        var axis = _selectedShapes[0] as LineLike;

                        if (_selectedShapes[1] is Ellipse)
                        {
                            _shapes.Add(Ellipse.FromReflection(axis, _selectedShapes[1] as Ellipse));
                        }
                        else if (_selectedShapes[1] is Circle)
                        {
                            _shapes.Add(Circle.FromReflection(axis, _selectedShapes[1] as Circle));
                        }
                        else if (_selectedShapes[1] is Line)
                        {
                            _shapes.Add(Line.FromReflection(axis, _selectedShapes[1] as Line));
                        }
                        else if (_selectedShapes[1] is Vector)
                        {
                            _shapes.Add(Vector.FromReflection(axis, _selectedShapes[1] as Vector));
                        }
                        else if (_selectedShapes[1] is Segment)
                        {
                            _shapes.Add(Segment.FromReflection(axis, _selectedShapes[1] as Segment));
                        }
                        else
                        {
                            _shapes.Add(Dot.FromReflection(axis, _selectedShapes[1] as Dot));
                        }
                    }
                }
                break;

            case ConstructType.Ellipse:
            {
                if (_selectedShapes.Count == 3)
                {
                    var f1  = _selectedShapes[0] as Dot;
                    var f2  = _selectedShapes[1] as Dot;
                    var pin = _selectedShapes[2] as Dot;
                    if (f1 == null)
                    {
                        return;
                    }
                    if (f2 == null)
                    {
                        return;
                    }
                    if (pin == null)
                    {
                        return;
                    }
                    AddShape(Ellipse.FromThreeDots(f1, f2, pin));
                }
                break;
            }
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Binds an action to a specified <see cref="ConstructType"/>.
 /// </summary>
 /// <param name="type">The type of construct that allows for this action.</param>
 public BindToRegionAttribute(ConstructType type)
 {
     Region    = RegionType.Location;
     Location  = LocationType.Construct;
     Construct = type;
 }
 public Data2ObjCerateManager(ConstructType consType, TemplateEntity entity)
     : base(consType, entity)
 {
     _consType = consType;
     _entity   = entity;
 }
Esempio n. 19
0
        /// <summary>
        /// get text message template
        /// </summary>
        /// <param name="text">text</param>
        /// <param name="sender">sender id</param>
        /// <returns>json</returns>
        private async Task <List <JObject> > ConstructAndSendMessage(ConstructType type, CaseDetail caseDetailResult = null, JObject additionalMessage = null, string messageInfo = null)
        {
            // To-do: consider to convert to JSON
            List <JObject> messageList = new List <JObject>();

            if (additionalMessage != null)
            {
                messageList.Add(additionalMessage);
            }

            switch (type)
            {
            case ConstructType.Greeting:
                var greetingOption = new List <QuickReplyOption>
                {
                    new QuickReplyOption {
                        title = REQ_BOT_ASSIST, payload = REQ_BOT_ASSIST
                    },
                    new QuickReplyOption {
                        title = NO_BOT_ASSIST, payload = NO_BOT_ASSIST
                    },
                };

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"👋 Greeting { _senderInfo.first_name} { _senderInfo.last_name} 👋! {Environment.NewLine}We love having you with us." }
                }));

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Should I help you to work with your suppot cases? Here are some option(s). 🕵", quick_replies = greetingOption }
                }));

                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.None, Answered = true
                });


                break;

            case ConstructType.RequestBotAssistance:
                var assistanceOptions = new List <QuickReplyOption>
                {
                    new QuickReplyOption {
                        title = RAISE_TICKET, payload = RAISE_TICKET
                    },
                    new QuickReplyOption {
                        title = TICKET_STATUS, payload = TICKET_STATUS
                    }
                    //new QuickReplyOption { title = JUST_BROWSE, payload = JUST_BROWSE },
                };

                //check any notification pending, if yes user can cancel it too..
                var result = _jiraUserMgmtService.GetUser(_senderInfo.senderConversationId, _company.Id);
                if (result != null && _tickSysNotifService.GetByUser(result.Id) != null)
                {
                    assistanceOptions.Add(new QuickReplyOption {
                        title = CANCEL_NOTIF, payload = CANCEL_NOTIF
                    });
                }

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Greeting {_senderInfo.first_name} {_senderInfo.last_name}! I'm TicketBOT! 🤓" }
                }));

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"👨🏻‍🔧 How can I help you? Here are some option(s).", quick_replies = assistanceOptions }
                }));

                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.None, Answered = true
                });
                break;

            case ConstructType.RequestOperator:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Okay! Please submit your details here, our team will check and get back to you. " }
                }));

                Conversation conversation = new Conversation
                {
                    SenderPageId        = $"{_senderInfo.senderConversationId}~{_company.FbPageId}",
                    ConversationLogType = (int)ConvLogType.MuteLog,
                    ConversationData    = JsonConvert.SerializeObject(new List <ConversationData> {
                        new ConversationData {
                            LastQuestionAsked = (int)Question.None, Answered = true
                        }
                    }),
                };

                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");

                _conversationService.Create(conversation);
                break;

            case ConstructType.Ending:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Thank you! Have a nice day! :)" }
                }));

                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");
                break;

            case ConstructType.CreateTicket:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Okay got it!\nIn which application do you encounter the issue?" }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.IssueApplicationName, Answered = false
                });
                break;

            case ConstructType.TicketDescription:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Can you describe the issue?" }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.IssueDescription, Answered = false
                });
                break;

            case ConstructType.TicketCreationConfirmation:
                var createCaseConfirmationOption = new List <QuickReplyOption>
                {
                    new QuickReplyOption {
                        title = CASE_SUBMIT_YES, payload = CASE_SUBMIT_YES
                    },
                    new QuickReplyOption {
                        title = CASE_SUBMIT_NO, payload = CASE_SUBMIT_NO
                    },
                };
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Summary:\n\nSubject: {caseDetailResult.Subject} \n\nDescription: {caseDetailResult.Detail} \n\nAre you sure you want to submit?", quick_replies = createCaseConfirmationOption }
                }));;
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.IssueDescription, Answered = true
                });
                break;

            case ConstructType.TicketCreated:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"All done! Your case has been logged. Please quote {caseDetailResult.CaseKey} to follow up." }
                }));

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new
                    {
                        attachment = new
                        {
                            type    = "template",
                            payload = new
                            {
                                template_type = "one_time_notif_req",
                                title         = $"Do you want to get notified with {caseDetailResult.CaseKey} update?",
                                payload       = string.Format(FacebookCustomPayload.CASE_GET_NOTIFIED_PAYLOAD, caseDetailResult.CaseKey)
                            }
                        }
                    }
                }));

                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");
                break;

            case ConstructType.CheckTicket:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Sure! Please quote your ticket code." }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.TicketCode, Answered = false
                });
                break;

            case ConstructType.TicketFound:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"There you go! \n\nTicket Code: {caseDetailResult.CaseKey} \n\nStatus: {caseDetailResult.Status} \n\nCase Subject: {caseDetailResult.Subject} \n\nClick the link below for more. \n{caseDetailResult.WebURL}" }
                }));
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Thank you for using TicketBOT! Have a nice day! :)" }
                }));

                // One time notification integration here
                // Check user whether already subscribe
                if (caseDetailResult.Status != JiraServiceDeskStatus.Declined || caseDetailResult.Status != JiraServiceDeskStatus.Completed)
                {
                    messageList.Add(JObject.FromObject(new
                    {
                        recipient = new { id = _senderInfo.senderConversationId },
                        message   = new
                        {
                            attachment = new
                            {
                                type    = "template",
                                payload = new
                                {
                                    template_type = "one_time_notif_req",
                                    title         = $"Do you want to get notified with {caseDetailResult.CaseKey} updates?",
                                    payload       = string.Format(FacebookCustomPayload.CASE_GET_NOTIFIED_PAYLOAD, caseDetailResult.CaseKey)
                                }
                            }
                        }
                    }));
                }

                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");
                break;

            case ConstructType.SearchCompany:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"☝🏻 Before we get started, I wanna know one thing. Can you tell me your company name please? \nAs our cilent's privacy matters, we need you to enter full company name. \n😬 For testing enter 'ZTEST COMPANY' 😬" }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.CompanyName, Answered = false
                });
                break;

            case ConstructType.RequestVerificationCode:
                string testOTPInfo = string.Empty;
                if (!string.IsNullOrWhiteSpace(messageInfo))
                {
                    testOTPInfo = $"\n😬 For testing you can enter verification code as {messageInfo} 😬";
                }

                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Okay great! We've sent you a verification email which contains a verification code. Can you tell me your verification code please?{testOTPInfo}" }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.VerificationCode, Answered = false
                });
                break;

            case ConstructType.Retry:
                var retryOption = new List <QuickReplyOption>
                {
                    new QuickReplyOption {
                        title = RETRY_YES, payload = RETRY_YES
                    },
                    new QuickReplyOption {
                        title = RETRY_NO, payload = RETRY_NO
                    },
                };

                //messageList.Add(JObject.FromObject(new
                //{
                //    recipient = new { id = _senderInfo.senderConversationId },
                //    message = new { text = $"Sorry, I didn't quite catch that. It seems like invalid option/answer." }
                //}));
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Do you want to retry?", quick_replies = retryOption }
                }));
                _conversationService.UpsertActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}", new ConversationData {
                    LastQuestionAsked = (int)Question.Retry, Answered = true
                });
                break;

            case ConstructType.NotImplemented:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Im still learning, you can submit ideas to {_company.contactEmail}. 💡" }
                }));
                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");
                break;

            case ConstructType.Error:
                messageList.Add(JObject.FromObject(new
                {
                    recipient = new { id = _senderInfo.senderConversationId },
                    message   = new { text = $"Something went wrong, please try again :(" }
                }));
                _conversationService.RemoveActiveConversation($"{_senderInfo.senderConversationId}~{_company.FbPageId}");
                break;

            case ConstructType.None:
                break;
            }

            foreach (var message in messageList)
            {
                await _fbApiClientService.PostMessageAsync(Utility.ParseDInfo(_company.FbPageToken, _applicationSettings.General.SysInfo), message);
            }
            return(messageList);
        }
Esempio n. 20
0
 public void StartConstruction(ConstructType type)
 {
     State = InputState.Construction;
     _constructionManager.CreateBlueprint(type);
 }
Esempio n. 21
0
 public Asn1TypeAttribute(Asn1Tag asn1Tag, ConstructType constructType, Asn1Class asn1Class)
 {
     this.tagInfo = new Asn1TagInfo(asn1Tag, constructType, asn1Class);
 }
Esempio n. 22
0
 public Asn1TypeAttribute(Asn1SnmpTag asn1SnmpTag, ConstructType constructType)
 {
     this.tagInfo = new Asn1TagInfo(asn1SnmpTag, constructType);
 }
 public void StartPreview(ConstructType _strucType, GameObject _constructPrefab)
 {
     constructPrefab = _constructPrefab;
     currentType     = _strucType;
     preview         = true;
 }
Esempio n. 24
0
        private void CreateConstructsFromTo(byte startX, byte startY, byte endX, byte endY, byte owner, ConstructType type, List <Construct> constructs)
        {
            int dx = endX - startX;
            int dy = endY - startY;

            Construct ctr = null;

            // Shitty code to create roads
            if (dx < 0)
            {  // Road that goes to the left
                while (dx <= 0)
                {
                    ctr   = new Construct(type);
                    ctr.X = (byte)(startX - dx);
                    ctr.Y = (byte)startY;
                    constructs.Add(ctr);

                    dx++;
                }
            }
            else if (dx > 0)
            {  // Road that goes to the right
                while (dx >= 0)
                {
                    ctr   = new Construct(type);
                    ctr.X = (byte)(startX + dx);
                    ctr.Y = (byte)startY;
                    constructs.Add(ctr);

                    dx--;
                }
            }
            else if (dy < 0)
            {  // Road that goes to the top
                while (dy <= 0)
                {
                    ctr   = new Construct(type);
                    ctr.X = (byte)startX;
                    ctr.Y = (byte)(startY - dy);
                    constructs.Add(ctr);

                    dy++;
                }
            }
            else if (dy > 0)
            {  // Road that goes to the bottom
                while (dy >= 0)
                {
                    ctr   = new Construct(type);
                    ctr.X = startX;
                    ctr.Y = (byte)(startY + dy);
                    constructs.Add(ctr);

                    dy--;
                }
            }
        }
Esempio n. 25
0
 /// <summary>
 /// Encodes the type of the class construct.
 /// </summary>
 /// <param name="data">The data.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="asn1Class">The asn1 class.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="tag">The tag.</param>
 /// <returns>new offset value in int</returns>
 public static int EncodeClassConstructType(this byte[] data, int offset, Asn1Class asn1Class, ConstructType constructType, byte tag)
 {
     data[offset] = (byte)(((byte)asn1Class << 6) | ((byte)constructType << 5) | tag);
     return(offset + 1);
 }
Esempio n. 26
0
 public Asn1TypeAttribute(Asn1SnmpTag asn1SnmpTag, ConstructType constructType)
 {
     this.tagInfo = new Asn1TagInfo(asn1SnmpTag, constructType);
 }
Esempio n. 27
0
 /// <summary>
 /// Encodes the type of the class construct.
 /// </summary>
 /// <param name="data">The data.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="asn1Class">The asn1 class.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="tag">The tag.</param>
 /// <returns>new offset value in int</returns>
 public static int EncodeClassConstructType(this byte[] data, int offset, Asn1Class asn1Class, ConstructType constructType, byte tag)
 {
     data[offset] = (byte)(((byte)asn1Class << 6) | ((byte)constructType << 5) | tag);
     return offset + 1;
 }
Esempio n. 28
0
 public Asn1TypeAttribute(Asn1Tag asn1Tag, ConstructType constructType, Asn1Class asn1Class)
 {
     this.tagInfo = new Asn1TagInfo(asn1Tag, constructType, asn1Class);
 }
Esempio n. 29
0
 public override int GetHashCode()
 {
     return((base.GetHashCodeString() + ConstructType.ToString() + ParamInfo.ToString()).GetHashCode());
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Asn1TagInfo"/> struct.
 /// </summary>
 /// <param name="asn1Class">The asn1 class.</param>
 /// <param name="constructType">Type of the construct.</param>
 /// <param name="tagType">Type of the tag.</param>
 internal Asn1TagInfo(int asn1Class, int constructType, int tagType)
 {
     this.Asn1ClassType = (Asn1Class)asn1Class;
     this.Asn1ConstructType = (ConstructType)constructType;
     if (this.Asn1ClassType == Asn1Class.Application)
     {
         this.Asn1SnmpTagType = (Asn1SnmpTag)tagType;
         this.Asn1TagType = Asn1Tag.NotAsn1Data;
     }
     else
     {
         this.Asn1TagType = (Asn1Tag)tagType;
         this.Asn1SnmpTagType = Asn1SnmpTag.NotSnmpData;
     }
 }