示例#1
0
        public static PluginData BuildFromDictionary(IDictionary <string, object> dict)
        {
            PluginDataProject proj = SoftwareCoUtil.ConvertObjectToProject(dict);
            PluginData        pd   = new PluginData(proj.name, proj.directory);

            pd.end         = SoftwareCoUtil.ConvertObjectToLong(dict, "end");
            pd.start       = SoftwareCoUtil.ConvertObjectToLong(dict, "start");
            pd.local_end   = SoftwareCoUtil.ConvertObjectToLong(dict, "local_end");
            pd.local_start = SoftwareCoUtil.ConvertObjectToLong(dict, "local_start");
            pd.keystrokes  = SoftwareCoUtil.ConvertObjectToLong(dict, "keystrokes");
            pd.cumulative_editor_seconds = SoftwareCoUtil.ConvertObjectToLong(dict, "cumulative_editor_seconds");
            pd.os       = SoftwareCoUtil.ConvertObjectToString(dict, "os");
            pd.offset   = SoftwareCoUtil.ConvertObjectToDouble(dict, "offset");
            pd.version  = SoftwareCoUtil.ConvertObjectToString(dict, "version");
            pd.timezone = SoftwareCoUtil.ConvertObjectToString(dict, "timezone");
            pd.cumulative_session_seconds = SoftwareCoUtil.ConvertObjectToLong(dict, "cumulative_session_seconds");
            pd.pluginId           = SoftwareCoUtil.ConvertObjectToInt(dict, "pluginId");
            pd.elapsed_seconds    = SoftwareCoUtil.ConvertObjectToLong(dict, "elapsed_seconds");
            pd.workspace_name     = SoftwareCoUtil.ConvertObjectToString(dict, "workspace_name");
            pd.hostname           = SoftwareCoUtil.ConvertObjectToString(dict, "hostname");
            pd.project_null_error = SoftwareCoUtil.ConvertObjectToString(dict, "project_null_error");
            pd.project            = proj;
            IDictionary <string, object> sourceDict = SoftwareCoUtil.ConvertObjectToSource(dict);

            if (sourceDict != null && sourceDict.Count > 0)
            {
                foreach (KeyValuePair <string, object> entry in sourceDict)
                {
                    IDictionary <string, object> fileInfoDict = new Dictionary <string, object>();
                    try
                    {
                        PluginDataFileInfo fileInfo = PluginDataFileInfo.GetPluginDataFromDict((JsonObject)entry.Value);
                        pd.source.Add(fileInfo);
                    }
                    catch (Exception e)
                    {
                        //
                    }
                }
            }
            return(pd);
        }