コード例 #1
0
        protected virtual bool AnalyseContent()
        {
            var serializer = new DataContractJsonSerializer(typeof(AdditionalMessageContainer));
            var mStream    = new MemoryStream(Encoding.UTF8.GetBytes(result));

            try
            {
                result_Analysed = (AdditionalMessageContainer)serializer.ReadObject(mStream);
            }
            catch (Exception e)
            {
                Debug.WriteLine("exception!");
                Debug.WriteLine(e.Message);
                return(false);
            }
            return(true);
        }
コード例 #2
0
        public virtual async Task <bool> Run(string Uname)
        {
            result_Analysed = new AdditionalMessageContainer()
            {
                Content = "", Title = "Fail", url = null
            };
            if (Uname != null && Uname == "")
            {
                return(false);
            }
            bool Hresult = await GetMessage(Uname);

            if (Hresult)
            {
                Hresult = AnalyseContent();
            }
            if (Hresult && CheckUser(Uname))
            {
                SendMessage();
            }
            return(Hresult && CheckUser(Uname));
        }