예제 #1
0
 private void LoadSettings()
 {
     if (settings == null)
     {
         settings = GetSettings();
     }
 }
예제 #2
0
        public void SaveSettings()
        {
            VersionControlServer vcs     = GetVersionControlServer();
            string    settingsServerPath = GetSettingsFilePath(Hierarchy.ProjectName, SettingsFileName);
            string    localPath;
            Workspace ws = GetWorkspaceForSettings(vcs, settingsServerPath, out localPath);

            if (!vcs.ServerItemExists(settingsServerPath, ItemType.File))
            {
                CreateDirectoryIfNotExist(localPath);
                Serializer.Serialize(localPath, settings);
                ws.PendAdd(localPath);
            }
            else
            {
                ws.Get(new GetRequest(new ItemSpec(settingsServerPath, RecursionType.None), VersionSpec.Latest),
                       GetOptions.GetAll | GetOptions.Overwrite);
                ws.PendEdit(localPath, RecursionType.OneLevel);
                Serializer.Serialize(localPath, settings);
            }
            var pendingschanges = ws.GetPendingChanges(settingsServerPath);

            if (pendingschanges.Length > 0)
            {
                ws.CheckIn(pendingschanges, CheckinComment, null, null, new PolicyOverrideInfo(CheckinComment, null));
                if (ws.Name == TemporaryWorkspaceName)
                {
                    ws.Delete();
                }
            }
            settings = null;
        }