public string GetFileComment(string path)
        {
            Boolean Cancelled;
            string  ResultDescription;
            Boolean IsMergeable;
            int     RemoteVersionLow;
            int     RemoteVersionHigh;

            System.DateTime LatestModified;
            int             RemoteSizeLow;
            int             RemoteSizeHigh;
            string          Comment;

            path = SAWCommon.ConvertPath(path);

            if (0 != sdkObject.GetFileGeneralInfo(SAWCommon.ConvertPath(path), out IsMergeable, out RemoteVersionLow,
                                                  out RemoteVersionHigh, out LatestModified, out RemoteSizeLow, out RemoteSizeHigh, out Comment,
                                                  out Cancelled, out ResultDescription))
            {
                return("");
            }
            else
            {
                return(Comment);
            }
        }
        public bool GetFile(int version, string strLocalPath, string strRemotePath)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }
            Boolean Cancelled;
            string  ResultDescription;
            string  FileNameOnServer = SAWCommon.ConvertPath(strRemotePath);
            int     VersionNumberLow = version;
            string  LocalFileName    = strLocalPath;
            var     MergeParam       = new SAWHDiffMergeParam();

            if (0 != sdkObject.GetOldVersionFile(FileNameOnServer, VersionNumberLow, 0, LocalFileName, false,
                                                 Enum_ModifiedFileHandling.Enum_ReplaceModifiedFile, Enum_EOL.Enum_EOLNative,
                                                 Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent,
                                                 MergeParam, out Cancelled, out ResultDescription))
            {
                return(false);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public bool CheckInProject(string strLocalPath, string strRemotePath, string Comment)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            Boolean Cancelled;
            String  ResultDescription;
            String  ProjectToCheckin   = SAWCommon.ConvertPath(strRemotePath);
            String  LocalDirectory     = strLocalPath;
            var     OperationResultSet = new SAWHOperationResultSet();
            var     MergeParam         = new SAWHDiffMergeParam();

            if (0 != sdkObject.CheckInProject(ProjectToCheckin, LocalDirectory, false, false, false, false,
                                              Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_EOL.Enum_EOLNative, false, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent,
                                              Enum_CheckinUnchangedFileHandling.Enum_AskCheckinUnchangedFile, Comment, MergeParam, out Cancelled, out ResultDescription, out OperationResultSet))
            {
                return(false);
            }
            else
            {
                bool bSucceed = true;
                foreach (SAWHOperationResult result in OperationResultSet)
                {
                    if (result.OperationResult != 0)
                    {
                        bSucceed = false;
                        break;
                    }
                }

                return(bSucceed && !Cancelled);
            }
        }
        public bool CheckOutFiles(string strLocalPath, string strRemotePath)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            bool   Cancelled;
            string ResultDescription;
            var    CheckoutFileSet    = new SAWHCheckoutFileSet();
            var    CheckoutFile       = new SAWHCheckoutFile();
            var    OperationResultSet = new SAWHOperationResultSet();
            var    MergeParam         = new SAWHDiffMergeParam();

            CheckoutFile.FileToCheckout = SAWCommon.ConvertPath(strRemotePath);
            CheckoutFile.LocalFileName  = strLocalPath;
            CheckoutFileSet.Add(CheckoutFile);

            if (0 != sdkObject.CheckoutFiles(CheckoutFileSet, true, "lock", true, Enum_ModifiedFileHandling.Enum_ReplaceModifiedFile, Enum_EOL.Enum_EOLNative,
                                             Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent, MergeParam, out Cancelled, out ResultDescription, out OperationResultSet))
            {
                return(false);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public Int64 GetFileSize(string path)
        {
            Boolean Cancelled;
            string  ResultDescription;
            Boolean IsMergeable;
            int     RemoteVersionLow;
            int     RemoteVersionHigh;

            System.DateTime LatestModified;
            int             RemoteSizeLow;
            int             RemoteSizeHigh;
            string          Comment;

            path = SAWCommon.ConvertPath(path);

            if (0 != sdkObject.GetFileGeneralInfo(path, out IsMergeable, out RemoteVersionLow,
                                                  out RemoteVersionHigh, out LatestModified, out RemoteSizeLow, out RemoteSizeHigh, out Comment,
                                                  out Cancelled, out ResultDescription))
            {
                return(0);
            }
            else
            {
                Int64 ret = 0;
                ret  = RemoteSizeLow;
                ret += RemoteSizeHigh * (1 << sizeof(long) * 8);
                return(ret);
            }
        }
        public bool DeleteFile(string strRemotePath)
        {
            if (!this.bLogin)
            {
                return(false);
            }
            List <string> toDelete = new List <string>();

            toDelete.Add(SAWCommon.ConvertPath(strRemotePath));
            StringObject error = new StringObject();
            List <SDKItemOperatorResult> results = new List <SDKItemOperatorResult>();

            if (0 != sdkObject.DeleteFiles(strRepositoryName, toDelete, false, ref results, error))  //DestoryPermanently is set as false
            {
                return(false);
            }
            else
            {
                if (OperatorResultsHaveError(results))  //File is already deleted but not Purged.
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
        public bool CheckOutProject(string strLocalPath, string strRemotePath, string Comment)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            Boolean Cancelled;
            String  ResultDescription;
            String  ProjectToCheckout  = SAWCommon.ConvertPath(strRemotePath);
            String  LocalDirectory     = strLocalPath;
            var     OperationResultSet = new SAWHOperationResultSet();
            var     MergeParam         = new SAWHDiffMergeParam();

            if (0 != sdkObject.CheckoutProject(ProjectToCheckout, LocalDirectory, Comment, false, false, false,
                                               Enum_ModifiedFileHandling.Enum_AskModifiedFile, Enum_EOL.Enum_EOLNative, Enum_CompareFileBy.Enum_CompareFileByChecksum,
                                               Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent, MergeParam, out Cancelled, out ResultDescription, out OperationResultSet))
            {
                return(false);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public bool DeleteFile(string strRemotePath)
        {
            Boolean Cancelled;
            string  ResultDescription;
            var     OperationResultSet = new SAWHOperationResultSet();
            var     fileset            = new SAWHDeleteFileSet();

            fileset.Add(SAWCommon.ConvertPath(strRemotePath));
            if (0 != sdkObject.DeleteFiles(fileset, false, out Cancelled, out ResultDescription, out OperationResultSet))
            {/*
              * if(ResultDescription.Contains("already"))
              *     return true;
              * else*/
                return(false);
            }
            else
            {
                bool bSucceed = true;
                foreach (SAWHOperationResult result in OperationResultSet)
                {
                    if (result.OperationResult != 0)
                    {
                        bSucceed = false;
                        break;
                    }
                }

                return(bSucceed && !Cancelled);
            }
        }
        public bool GetFile(int version, string strLocalPath, string strRemotePath)
        {
            string strFileServerFullNameToGet = SAWCommon.ConvertPath(strRemotePath);
            long   lVersionNumber             = version;
            string strLocalFileFullName       = strLocalPath;
            bool   bMakeWritable             = true;
            int    iEnumEOL                  = EnumEOL.enumEOLNative;
            int    iEnumSetLocalFileTime     = EnumSetLocalFileTime.enumCurrentFileTime;
            int    iEnumModifiedFileHandling = EnumModifiedFileHandling.enumReplaceModifiedFile;
            SDKDiffMergeParameter        stDiffMergeParameter   = new SDKDiffMergeParameter();
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            StringObject strobjError = new StringObject();

            if (0 != sdkObject.GetOldVersionFile(strRepositoryName, strFileServerFullNameToGet, lVersionNumber, strLocalFileFullName, bMakeWritable, iEnumEOL, iEnumModifiedFileHandling, iEnumSetLocalFileTime, stDiffMergeParameter, ref listItemOperateResults, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public bool UndoCheckoutFiles(string strRemoteFile)
        {
            List <string> listFileFullNameToUndoCheckout      = new List <string>();
            int           enumUndoCheckOutChangedFileHandling = EnumUndoCheckOutChangedFileHandling.enumUndoCheckOutAndDeleteLocalCopy;
            int           enumEOL         = EnumEOL.enumEOLNative;
            int           enumSetFileTime = EnumSetLocalFileTime.enumCurrentFileTime;
            bool          bReadOnly       = false;
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            StringObject strobjError = new StringObject();

            strRemoteFile = SAWCommon.ConvertPath(strRemoteFile);
            listFileFullNameToUndoCheckout.Add(strRemoteFile);
            if (0 != sdkObject.UndoCheckoutFiles(strRepositoryName, listFileFullNameToUndoCheckout, enumUndoCheckOutChangedFileHandling, enumEOL, enumSetFileTime, bReadOnly, ref listItemOperateResults, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public List <SAWItemInfo> EnumItems(string path, int ver)
        {
            if (false == GetFileInfo(path, -1).isdir)
            {
                return(null);
            }
            List <SAWItemInfo> result = new List <SAWItemInfo>();

            path = SAWCommon.ConvertPath(path);
            List <string> listSubFileNames       = new List <string>();
            StringObject  strobjError            = new StringObject();
            bool          bRecursive             = false;
            List <string> listSubFolderFullNames = new List <string>();

            if ((0 != sdkObject.GetSubFolderFromParentFolder(strRepositoryName, path, bRecursive, ref listSubFolderFullNames, strobjError)) ||
                (0 != sdkObject.GetFileListFromParentProject(strRepositoryName, path, ref listSubFileNames, strobjError)))
            {
                return(null);
            }
            foreach (string strSubFolder in listSubFolderFullNames)
            {
                result.Add(GetFileInfo(strSubFolder, -1));
            }
            foreach (string strSubFile in listSubFileNames)
            {
                result.Add(GetFileInfo(strSubFile, -1));
            }
            return(result);
        }
        public bool CheckInFiles(string strLocalPath, string strRemotePath, string Comment)
        {
            List <string> listFilesFullNameToCheckIn = new List <string>();
            bool          bKeepCheckout    = false;
            bool          bRemoveLocalCopy = true;
            string        strComment       = Comment;
            List <long>   listIssueID      = new List <long>();
            bool          bUseReadOnly     = false;
            int           iEnumCheckInUnChangedFileHandling     = EnumCheckinUnchangedFileHandling.enumUndoCheckinUnchangedFile;
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            BoolObject   bConflictExists = new BoolObject();
            StringObject strobjError     = new StringObject();

            strRemotePath = SAWCommon.ConvertPath(strRemotePath);
            listFilesFullNameToCheckIn.Add(strRemotePath);
            if (0 != sdkObject.CheckInFiles(strRepositoryName, listFilesFullNameToCheckIn, bKeepCheckout, bRemoveLocalCopy, strComment, listIssueID, bUseReadOnly, iEnumCheckInUnChangedFileHandling, ref listItemOperateResults, bConflictExists, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public bool UndoCheckoutFiles(string strRemoteFile)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            bool   Cancelled;
            string ResultDescription;
            var    undoCheckoutFileSet = new SAWHUndoCheckoutFileSet();
            var    undoCheckoutFile    = new SAWHUndoCheckoutFile();
            var    OperationResultSet  = new SAWHOperationResultSet();

            undoCheckoutFile.FileToUndo    = SAWCommon.ConvertPath(strRemoteFile);
            undoCheckoutFile.LocalFileName = "";
            undoCheckoutFileSet.Add(undoCheckoutFile);

            if (0 != sdkObject.UndoCheckoutFiles(undoCheckoutFileSet, Enum_LocalFileHandling.Enum_LeaveLocalFile, Enum_UndoCheckOutChangedFileHandling.Enum_UndoCheckOutChangeFile,
                                                 Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_EOL.Enum_EOLNative, true, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent,
                                                 out Cancelled, out ResultDescription, out OperationResultSet))
            {
                return(false);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public bool AddFile(string strLocalPath, string strRemotePath, string Comment)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }
            var     AddFileSet = new SAWHAddFileSet();
            Boolean Cancelled;
            string  ResultDescription;
            var     OperationResultSet = new SAWHOperationResultSet();

            var file = new SAWHAddFile();

            file.FileType       = Enum_FileType.Enum_Autodetect;
            file.LocalFileName  = strLocalPath;
            file.RemoteFileName = SAWCommon.ConvertPath(strRemotePath);
            AddFileSet.Add(file);

            bool bAddSucceed = true;

            if (0 != sdkObject.AddFiles(AddFileSet, true, Comment, Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent,
                                        false, out Cancelled, out ResultDescription, out OperationResultSet))
            {
                bAddSucceed = false;
            }
            else
            {
                bAddSucceed = !Cancelled;
            }

            foreach (SAWHOperationResult result in OperationResultSet)
            {
                if (result.OperationResult != 0)
                {
                    bAddSucceed = false;
                    break;
                }
            }

            if (!bAddSucceed)
            {
                if (CheckOutFiles(strLocalPath, strRemotePath))
                {
                    bool ret = CheckInFiles(strLocalPath, strRemotePath, Comment);
                    if (!ret)
                    {
                        UndoCheckoutFiles(strRemotePath);
                    }
                    return(ret);
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }
        public SAWItemInfo GetFileInfo(string file, int ver)
        {
            SAWItemInfo  ItemInfo = new SAWItemInfo();
            LongObject   version  = new LongObject();
            DateTime     time     = new DateTime();
            LongObject   size     = new LongObject();
            StringObject comment  = new StringObject();
            StringObject error    = new StringObject();

            file = SAWCommon.ConvertPath(file);
            if (0 != sdkObject.GetFileGeneralInfo(strRepositoryName, file, version, ref time, size, comment, error))
            {
                string errorIfFolder = "File \"" + file + "\" not found.";
                if (errorIfFolder == error.GetValue())
                {
                    IntObject iobjSubFoldersNotDeletedCount = new IntObject();
                    IntObject iobjSubFoldersDeletedCount    = new IntObject();
                    IntObject iobjFileNotDeletedCount       = new IntObject();
                    IntObject iobjFilesDeletedCount         = new IntObject();
                    List <SDKDeletedItemGeneralInfo> listDeletedItemGeneralInfo = new List <SDKDeletedItemGeneralInfo>();
                    IntObject iobjRight = new IntObject();
                    if (0 == sdkObject.GetFolderGeneralInfo(strRepositoryName, file, iobjSubFoldersNotDeletedCount, iobjSubFoldersDeletedCount, iobjFileNotDeletedCount, iobjFilesDeletedCount, version, ref time, comment, ref listDeletedItemGeneralInfo, iobjRight, error))
                    {
                        ItemInfo.comment = comment.GetValue();
                        ItemInfo.name    = file;
                        ItemInfo.size    = 0;
                        ItemInfo.version = (int)version.GetValue();
                        ItemInfo.date    = time;
                        ItemInfo.isdir   = true;
                        ItemInfo.type    = EnumActionType.Enum_ActionTypeNull;
                        ItemInfo.user    = "";
                        return(ItemInfo);
                    }
                }
                return(null);
            }
            else
            {
                ItemInfo.comment = comment.GetValue();
                ItemInfo.name    = file;
                ItemInfo.size    = (int)size.GetValue();
                ItemInfo.version = (int)version.GetValue();
                ItemInfo.date    = time;
                ItemInfo.isdir   = false;
                ItemInfo.type    = EnumActionType.Enum_ActionTypeNull;
                ItemInfo.user    = "";
                return(ItemInfo);
            }
        }
        public List <SAWItemInfo> GetFileHistory(string path)
        {
            List <SDKHistory> history = new List <SDKHistory>();
            StringObject      error   = new StringObject();

            path = SAWCommon.ConvertPath(path);
            List <string> listUsers = new List <string>();
            List <SHistorySortOrderBy> listFilterHistorySortOrderBy = new List <SHistorySortOrderBy>();

            //SHistorySortOrderBy HistorySortOrderBy = new SHistorySortOrderBy();
            //listFilterHistorySortOrderBy.Add(HistorySortOrderBy);
            if (0 != sdkObject.GetFileHistory(strRepositoryName, path, listUsers, int.MaxValue, false, "", listFilterHistorySortOrderBy, ref history, true, error))
            {
                if (error.GetValue().Contains("The operation can not be performed on folder"))
                {
                    List <string> listFileExtensions = new List <string>();
                    List <string> listFileSubStrings = new List <string>();
                    if (0 != sdkObject.GetFolderHistoryByItem(strRepositoryName, path, false, listUsers, listFileExtensions, listFileSubStrings, int.MaxValue, false, "", listFilterHistorySortOrderBy, new System.DateTime(), System.DateTime.Now, ref history, error))
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }

            List <SAWItemInfo> ItemHistoryInfoset = new List <SAWItemInfo>();

            foreach (SDKHistory ItemHistory in history)
            {
                SAWItemInfo ItemInfo = new SAWItemInfo();
                ItemInfo.comment = ItemHistory.m_strComment;
                ItemInfo.name    = ItemHistory.m_strItemFullName;
                ItemInfo.size    = (int)ItemHistory.m_lFileSize;
                ItemInfo.version = (int)ItemHistory.m_lChangeSetID; //GetLastestVersionNum(ItemHistory.m_strItemFullName);
                ItemInfo.date    = ItemHistory.m_dtCheckin;
                ItemInfo.isdir   = IsItemAFolder(ItemHistory.m_enumItemType);
                ItemInfo.type    = ConvertActionType(ItemHistory.m_enumActionType);
                ItemInfo.user    = ItemHistory.m_strUserName;
                ItemHistoryInfoset.Add(ItemInfo);
            }
            return(ItemHistoryInfoset);
        }
Exemplo n.º 17
0
        public int GetLastestVersionNum(string strPath)
        {
            Boolean Cancelled;
            string  ResultDescription;

            strPath = SAWCommon.ConvertPath(strPath);
            ulong           ItemID = 0;
            ulong           VersionNumber = 0;
            bool            Project, Mergable, Deleted;
            DateTime        CheckinTime, ModificationTime;
            long            FileSize;
            Enum_ItemStatus ItemStatus;
            string          CheckedOutUser;

            int iResult = sdkObject.GetItemInfo(strPath, ref ItemID, ref VersionNumber, out Project, out Mergable, out Deleted, out CheckinTime,
                                                out ModificationTime, out FileSize, out ItemStatus, out CheckedOutUser, out Cancelled, out ResultDescription);

            return((ItemID == 0) ? -1 : (int)VersionNumber);
        }
        public int GetLastestVersionNum(string strPath)
        {
            Boolean Cancelled;
            string  ResultDescription;

            strPath = SAWCommon.ConvertPath(strPath);
            ulong           ItemID = 0;
            ulong           VersionNumber = 0;
            bool            Project, Mergable, Deleted;
            DateTime        CheckinTime, ModificationTime;
            long            FileSize;
            Enum_ItemStatus ItemStatus;
            string          CheckedOutUser;

            int iResult = sdkObject.GetItemInfo(strPath, ref ItemID, ref VersionNumber, out Project, out Mergable, out Deleted, out CheckinTime,
                                                out ModificationTime, out FileSize, out ItemStatus, out CheckedOutUser, out Cancelled, out ResultDescription);

            return((ItemID == 0) ? -1 : (int)VersionNumber);

            #region used before v4.0
            //int VersionLow;
            //int VersionHight;
            //Boolean Cancelled;
            //string ResultDescription;
            //strPath = SAWCommon.ConvertPath(strPath);
            //if (0 != sdkObject.GetFileLatestVersionNumber(strPath, out VersionLow, out VersionHight, out Cancelled, out ResultDescription))
            //{
            //    if (0 != sdkObject.GetProjectLatestVersionNumber(strPath, out VersionLow, out VersionHight, out Cancelled, out ResultDescription))
            //    {
            //        return -1;
            //    }
            //    else
            //    {
            //        return VersionLow;
            //    }
            //}
            //else
            //{
            //    return VersionLow;
            //}
            #endregion
        }
        public bool GetFileModifiedDate(string path, out System.DateTime date)
        {
            bool   Cancelled;
            string ResultDescription;
            bool   IsMergeable;
            int    versionLow;
            int    versionHigh;
            int    sizeLow;
            int    sizeHigh;
            string Comment = "";

            if (0 != sdkObject.GetFileGeneralInfo(SAWCommon.ConvertPath(path), out IsMergeable, out versionLow, out versionHigh, out date, out sizeLow, out sizeHigh, out Comment, out Cancelled, out ResultDescription))
            {
                return(true);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public List <string> EnumFolders(string strFolder)
        {
            SAWHProjectListSet ProjectListSet = new SAWHProjectListSet();
            Boolean            Cancelled;
            string             ResultDescription;

            strFolder = SAWCommon.ConvertPath(strFolder);
            if (0 != sdkObject.GetProjectListFromProject(strFolder, out ProjectListSet, out Cancelled, out ResultDescription))
            {
                return(null);
            }
            else
            {
                List <string> res = new List <string>();
                for (int i = 0; i < ProjectListSet.Count; i++)
                {
                    res.Add(ProjectListSet.Item(i));
                }
                return(res);
            }
        }
        public bool AddFile(string strLocalPath, string strRemotePath, string Comment)
        {
            if (!this.bLogin)
            {
                return(false);
            }
            List <string> Local = new List <string>();

            Local.Add(strLocalPath);
            List <string> Remote = new List <string>();

            Remote.Add(SAWCommon.ConvertPath(strRemotePath));
            List <SDKItemOperatorResult> results = new List <SDKItemOperatorResult>();
            StringObject error = new StringObject();

            if (0 != sdkObject.AddFiles(strRepositoryName, Remote, Local, false, Comment, ref results, error))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(results))
                {
                    return(true);
                }
                else
                {
                    if (CheckOutFiles(strLocalPath, strRemotePath))
                    {
                        bool ret = CheckInFiles(strLocalPath, strRemotePath, Comment);
                        if (!ret)
                        {
                            UndoCheckoutFiles(strRemotePath);
                        }
                        return(ret);
                    }
                    return(false);
                }
            }
        }
        public List <SAWItemInfo> GetFileHistory(string path)
        {
            bool   Cancelled;
            string ResultDescription;
            var    FileHistoryParam = new SAWHFileHistoryParam();
            bool   IsPinned;
            var    HistorySet = new SAWHHistorySet();
            bool   bDir       = false;

            if (0 != sdkObject.GetFileHistory(SAWCommon.ConvertPath(path), FileHistoryParam, out IsPinned, out HistorySet, out Cancelled, out ResultDescription))
            {
                var FolderHistoryParam = new SAWHProjectHistoryParam();
                if (0 != sdkObject.GetProjectHistory(SAWCommon.ConvertPath(path), FolderHistoryParam, out HistorySet, out Cancelled, out ResultDescription))
                {
                    return(null);
                }
                bDir = true;
            }

            var set = new List <SAWItemInfo>();

            for (int i = 0; i < HistorySet.Count; i++)
            {
                SAWHHistory w   = HistorySet.Item(i) as SAWHHistory;
                var         his = new SAWItemInfo();
                his.comment = w.Comment == null ? "" : w.Comment;
                his.date    = w.ActionDateTime;
                his.name    = w.ItemName;
                his.size    = w.FileSizeLow;
                his.user    = w.UserName;
                his.version = w.VersionNumberLow;
                his.type    = (EnumActionType)w.ActionType;
                his.isdir   = bDir;
                set.Add(his);
            }
            return(set);
        }
        public bool CheckOutFiles(string strLocalPath, string strRemotePath)
        {
            if (!this.bLogin)
            {
                return(false);
            }
            List <string>                listCheckoutServerFileFullName = new List <string>();
            List <string>                listCheckoutLocalFileFullName  = new List <string>();
            string                       strComment             = "lock";
            bool                         bDoNotGetLocalCopy     = true;
            int                          iEnumExclusiveCheckout = EnumCheckoutLockType.enumExclusiveLock;
            int                          iEnumEOL = EnumEOL.enumEOLNative;
            int                          iEnumSetLocalFileTime     = EnumSetLocalFileTime.enumCurrentFileTime;
            int                          iEnumModifiedFileHandling = EnumModifiedFileHandling.enumReplaceModifiedFile;
            SDKDiffMergeParameter        stDiffMergeParameter      = new SDKDiffMergeParameter();
            List <SDKItemOperatorResult> listItemOperateResults    = new List <SDKItemOperatorResult>();
            StringObject                 strobjError = new StringObject();

            strRemotePath = SAWCommon.ConvertPath(strRemotePath);
            listCheckoutServerFileFullName.Add(strRemotePath);
            listCheckoutLocalFileFullName.Add(strLocalPath);
            if (0 != sdkObject.CheckoutFiles(strRepositoryName, listCheckoutServerFileFullName, listCheckoutLocalFileFullName, strComment, bDoNotGetLocalCopy, iEnumExclusiveCheckout, iEnumEOL, iEnumSetLocalFileTime, iEnumModifiedFileHandling, stDiffMergeParameter, ref listItemOperateResults, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public bool CheckInFiles(string strLocalPath, string strRemotePath, string Comment)
        {
            bool   Cancelled;
            string ResultDescription;
            var    CheckinFileSet     = new SAWHCheckinFileSet();
            var    CheckinFile        = new SAWHCheckinFile();
            var    OperationResultSet = new SAWHOperationResultSet();
            var    MergeParam         = new SAWHDiffMergeParam();

            CheckinFile.FileToCheckin = SAWCommon.ConvertPath(strRemotePath);
            CheckinFile.LocalFileName = strLocalPath;
            CheckinFileSet.Add(CheckinFile);

            if (0 != sdkObject.CheckInFiles(CheckinFileSet, false, false, Enum_CompareFileBy.Enum_CompareFileByChecksum,
                                            Enum_EOL.Enum_EOLNative, false, true, Enum_SetLocalFileTime.Enum_SetLocalFileTimeCurrent, Enum_CheckinUnchangedFileHandling.Enum_CheckinUnchangedFile,
                                            Comment, MergeParam, out Cancelled, out ResultDescription, out OperationResultSet))
            {
                return(false);
            }
            else
            {
                return(!Cancelled);
            }
        }
        public List <SAWItemInfo> EnumItems(string strFolder, int version)
        {
            if (version == -1)
            {
                version = GetLastestVersionNum(strFolder);
            }

            // Lookup cache.

            /*foreach(SAWItemCache v in this.itemCache)
             * {
             *  if(strFolder == v.strPath && version == v.version)
             *  {
             *      return v.result;
             *  }
             * }*/

            List <SAWItemInfo> result     = new List <SAWItemInfo>();
            SAWHHistorySet     subProject = new SAWHHistorySet();
            SAWHHistorySet     subFile    = new SAWHHistorySet();
            Boolean            Cancelled;
            string             ResultDescription;

            if (0 != sdkObject.GetProjectTreeByVersion(SAWCommon.ConvertPath(strFolder), version, out subProject, out subFile, out Cancelled, out ResultDescription))
            {
                return(null);
            }
            foreach (SAWHHistory v in subProject)
            {
                SAWItemInfo his = new SAWItemInfo();
                his.comment = v.Comment;
                his.name    = v.ItemName;
                his.size    = v.FileSizeLow;
                his.user    = v.UserName;
                his.version = v.VersionNumberLow;
                his.date    = v.ModificationDateTime;
                his.date    = System.DateTime.Now;
                his.isdir   = true;
                result.Add(his);
            }

            foreach (SAWHHistory v in subFile)
            {
                SAWItemInfo his = new SAWItemInfo();
                his.comment = v.Comment;
                his.name    = v.ItemName;
                his.size    = v.FileSizeLow;
                his.user    = v.UserName;
                his.version = v.VersionNumberLow;
                his.date    = v.ModificationDateTime;
                his.isdir   = false;
                result.Add(his);
            }

            /*
             * SAWItemCache c = new SAWItemCache();
             * c.strPath = strFolder;
             * c.version = version;
             * c.result = result;
             * itemCache.Add(c);*/
            return(result);
        }