Esempio n. 1
0
        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 SAWSOperationResultSet();
            var     MergeParam         = new SAWSDiffMergeParam();

            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);
            }
        }
Esempio n. 2
0
        public bool CheckOutFiles(string strLocalPath, string strRemotePath)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            bool   Cancelled;
            string ResultDescription;
            var    CheckoutFileSet    = new SAWSCheckoutFileSet();
            var    CheckoutFile       = new SAWSCheckoutFile();
            var    OperationResultSet = new SAWSOperationResultSet();
            var    MergeParam         = new SAWSDiffMergeParam();

            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);
            }
        }
Esempio n. 3
0
        public bool UndoCheckoutFiles(string strRemoteFile)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }

            bool   Cancelled;
            string ResultDescription;
            var    undoCheckoutFileSet = new SAWSUndoCheckoutFileSet();
            var    undoCheckoutFile    = new SAWSUndoCheckoutFile();
            var    OperationResultSet  = new SAWSOperationResultSet();

            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);
            }
        }
Esempio n. 4
0
        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 SAWSOperationResultSet();
            var     MergeParam         = new SAWSDiffMergeParam();

            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 (SAWSOperationResult result in OperationResultSet)
                {
                    if (result.OperationResult != 0)
                    {
                        bSucceed = false;
                        break;
                    }
                }

                return(bSucceed && !Cancelled);
            }
        }
Esempio n. 5
0
        public bool DeleteFile(string strRemotePath)
        {
            Boolean Cancelled;
            string  ResultDescription;
            var     OperationResultSet = new SAWSOperationResultSet();
            var     fileset            = new SAWSDeleteFileSet();

            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 (SAWSOperationResult result in OperationResultSet)
                {
                    if (result.OperationResult != 0)
                    {
                        bSucceed = false;
                        break;
                    }
                }

                return(bSucceed && !Cancelled);
            }
        }
Esempio n. 6
0
        public bool AddFile(string strLocalPath, string strRemotePath, string Comment)
        {
            if (!(this.bConnected && this.bLogin))
            {
                return(false);
            }
            var     AddFileSet = new SAWSAddFileSet();
            Boolean Cancelled;
            string  ResultDescription;
            var     OperationResultSet = new SAWSOperationResultSet();

            var file = new SAWSAddFile();

            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 (SAWSOperationResult 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);
        }
Esempio n. 7
0
        public bool CheckInFiles(string strLocalPath, string strRemotePath, string Comment)
        {
            bool   Cancelled;
            string ResultDescription;
            var    CheckinFileSet     = new SAWSCheckinFileSet();
            var    CheckinFile        = new SAWSCheckinFile();
            var    OperationResultSet = new SAWSOperationResultSet();
            var    MergeParam         = new SAWSDiffMergeParam();

            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);
            }
        }