Beispiel #1
0
        public void save(Globals globals)
        {
            if (!changedSinceLoading)
            {
                return;
            }

            try
            {
                ParameterSerializer.storeParameter(globals, SERVER_COUNT, serverMap.Values.Count);

                int i = 1;
                foreach (JiraServer s in getAllServers())
                {
                    string var = SERVER_GUID + i;
                    ParameterSerializer.storeParameter(globals, var, s.GUID.ToString());
                    var = SERVER_NAME + s.GUID;
                    ParameterSerializer.storeParameter(globals, var, s.Name);
                    var = SERVER_URL + s.GUID;
                    ParameterSerializer.storeParameter(globals, var, s.Url);
                    CredentialsVault.Instance.saveCredentials(s);
                    ++i;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
        }
Beispiel #2
0
        public void save(Globals globals, string solutionName)
        {
            lock (this)
            {
                if (!changedSinceLoading)
                {
                    return;
                }

                solutionName = ParameterSerializer.getKeyFromSolutionName(solutionName);

                try
                {
                    ParameterSerializer.storeParameter(globals, RECENTLY_VIEWED_COUNT + solutionName, issues.Count);

                    int i = 1;
                    foreach (RecentlyViewedIssue issue in issues)
                    {
                        string var = RECENTLY_VIEWED_ISSUE_SERVER_GUID + solutionName + "_" + i;
                        ParameterSerializer.storeParameter(globals, var, issue.ServerGuid.ToString());
                        var = RECENTLY_VIEWED_ISSUE_KEY + solutionName + "_" + i;
                        ParameterSerializer.storeParameter(globals, var, issue.IssueKey);
                        ++i;
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
        }
        private static void storeProjects(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_COUNT), f.Projects.Count);
            int i = 0;

            foreach (JiraProject project in f.Projects)
            {
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_ID + i), project.Id);
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_KEY + i), project.Key);
                ++i;
            }
        }
        private static void storeIssueTypes(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int i = 0;

            ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_COUNT), f.IssueTypes.Count);
            foreach (JiraNamedEntity issueType in f.IssueTypes)
            {
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_ID + i), issueType.Id);
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_NAME + i), issueType.Name);
                ++i;
            }
        }
        private static void storeFixVersions(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int i = 0;

            ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_COUNT), f.FixForVersions.Count);
            foreach (JiraNamedEntity version in f.FixForVersions)
            {
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_ID + i), version.Id);
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_NAME + i), version.Name);
                ++i;
            }
        }
        private static void storeComponents(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int i = 0;

            ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_COUNT), f.Components.Count);
            foreach (JiraNamedEntity comp in f.Components)
            {
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_ID + i), comp.Id);
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_NAME + i), comp.Name);
                ++i;
            }
        }
        public static void save(Globals globals, string solutionName)
        {
            string solutionKey = ParameterSerializer.getKeyFromSolutionName(solutionName);

            ParameterSerializer.storeParameter(globals, solutionKey + FILTER_COUNT, FILTERS.Count);
            int i = 0;

            foreach (var filter in FILTERS)
            {
                ParameterSerializer.storeParameter(globals, solutionKey + FILTER_GUID + i, filter.Key.ToString());
                ParameterSerializer.storeParameter(globals, getParamKey(solutionKey, filter.Key, FILTER_SERVER_GUID + filter.Key), filter.Key.ToString());

                JiraCustomFilter f = filter.Value;

                storeProjects(globals, solutionKey, filter.Key, f);
                storeIssueTypes(globals, solutionKey, filter.Key, f);
                storeFixVersions(globals, solutionKey, filter.Key, f);
                storeAffectsVersions(globals, solutionKey, filter.Key, f);
                storeComponents(globals, solutionKey, filter.Key, f);

                ++i;
            }
        }