コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }