예제 #1
0
        public static VAction ConvertLiveActionJson(string actID, string url, dynamic log, string eventName)
        {
            if (!String.IsNullOrEmpty(actID) &&
                !String.IsNullOrEmpty(url) &&
                !String.IsNullOrEmpty(eventName) &&
                log != null &&
                log.timeStamp != null &&
                log.tab != null &&
                log.userName != null &&
                log.logMsg != null)
            {
                XmlObject xml = new XmlObject(url, log);

                if (xml.isValid())
                {
                    string timeStamp = log.timeStamp.Value.ToString().Trim();
                    string username  = log.userName.Value.ToString().Trim();
                    eventName = eventName.Trim();
                    int tabID = Convert.ToInt32(log.tab);

                    Shape shape = xml.GetShape(eventName);
                    if (shape != null)
                    {
                        xml.SaveShapesLocally(tabID, shape);
                        return(new VAction(tabID, actID, shape, timeStamp, username, eventName));
                    }
                    return(null);
                }
                return(null);
            }
            return(null);
        }
예제 #2
0
        public static VAction ConvertHistoryActionJson(int tabID, dynamic item)
        {
            if (item.eventData != null &&
                item.eventName != null &&
                item.userName != null &&
                item.timeStamp != null &&
                item.id != null &&
                item.eventData.xml != null &&
                item.eventLog != null &&
                item.eventLog.toolName != null)
            {
                string url = item.eventData.xml;

                XmlObject xml = new XmlObject(url, item.eventLog);


                string eventName = item.eventName.Value.ToString().Trim();

                if (xml.isValid() && eventName == "elmadd")
                {
                    string actID     = item.id.ToString().Trim();
                    string timeStamp = item.timeStamp.Value.ToString().Trim();
                    string username  = item.userName.Value.ToString().Trim();


                    // TODO add log info (log.toolName and one more)

                    Shape shape = xml.GetShape(eventName);
                    if (shape != null)
                    {
                        xml.SaveShapesLocally(tabID, shape);
                        return(new VAction(tabID, actID, shape, timeStamp, username, eventName));
                    }
                    return(null);
                }
                return(null);
            }
            return(null);
        }