public void LoadXML(string sFileName)
        {
            XmlDocument docXML = new XmlDocument();
            bool bFirst = true;
            docXML.Load(sFileName);

            _stFiles.Clear();
            foreach (XmlNode node in docXML.SelectNodes("QVCSLog/Files/File"))
            {
                stFile newTable = new stFile();
                newTable.sFileName  = node.SelectSingleNode("Name").InnerText;
                newTable.sPath  = node.SelectSingleNode("Path").InnerText;
                newTable.stHistorys=new List<stHistory>() ;
                newTable.stLabels =new List<stLabel>() ;

                foreach (XmlNode fieldnode in node.SelectNodes("Historys/History"))
                {
                    stHistory newHistory = new stHistory();
                    newHistory.sLabel = fieldnode.SelectSingleNode("Label").InnerText;
                    newHistory.sRevision = fieldnode.SelectSingleNode("Revision").InnerText;
                    newHistory.sDescription = fieldnode.SelectSingleNode("Description").InnerText;
                    newHistory.sCheckedInBy = fieldnode.SelectSingleNode("CheckedInBy").InnerText;
                    newTable.stHistorys.Add(newHistory);
                }

                foreach (XmlNode labelnode in node.SelectNodes("Labels/Label"))
                {
                    stLabel newLabel = new stLabel();
                    newLabel.sLabel = labelnode.SelectSingleNode("Name").InnerText;
                    newLabel.sRevision = labelnode.SelectSingleNode("Revision").InnerText;
                    newTable.stLabels.Add(newLabel);
                }
                if (bFirst == true)
                {
                    _stLabels = newTable.stLabels;
                    bFirst = false;
                }

                _stFiles.Add(newTable);
            }
        }
Example #2
0
        private stRegistry MappOfficeWorksData(string strPath, string strFileToUpload)
        {
            stRegistry RegistryST = new stRegistry();

            RegistryST.Book = new stBook();
            //ArrayList oDynamicFields = new ArrayList(); // ArrayList Aux
            RegistryST.Classification = new stClassification();
            RegistryST.Entity         = new stEntity();
            RegistryST.User           = new stUser();
            RegistryST.DocumentType   = new stDocumentType();

            //Set Book ID
            RegistryST.Book.BookID = Convert.ToInt64(drpBooks.SelectedValue.ToString());

            //Set User login
            RegistryST.User.UserLogin = strUserName;

            //Create a new File struct
            stFile oFile = new stFile();

            //Convert File to byte Array
            oFile.FileArray = FileToArray(strPath + @"\" + strFileToUpload);
            //Get File Path
            oFile.FilePath = strPath + @"\" + strFileToUpload;
            //Get File Name
            oFile.FileName = strFileToUpload;
            //Attach the file
            RegistryST.Files    = new stFile[1];
            RegistryST.Files[0] = oFile;

            //Estado
            //stDynamicField NewDynamic = new stDynamicField();
            //NewDynamic.DynamicFieldID = Convert.ToInt64(oMapp.FieldIdentifier);
            //NewDynamic.DynamicFieldName = oMapp.FieldName;
            //NewDynamic.DynamicFieldValue = oMData.Data;
            //oDynamicFields.Add(NewDynamic);

            RegistryST.Subject = strSubject;

            return(RegistryST);
        }
Example #3
0
        /// <summary>
        /// Add a File to collection
        /// </summary>
        /// <param name="FilePath"></param>
        public void AddFile(string FilePath)
        {
            //Test if File Exists
            if (!File.Exists(FilePath))
            {
                throw new OWOfficeException(OWOfficeException.enumExceptionsID.FileNotFOUND, FilePath);
            }

            //Create a new File struct
            stFile oFile = new stFile();

            //Convert File to byte Array
            oFile.FileArray = FileToArray(FilePath);

            //Get File Path
            oFile.FilePath = FilePath;
            //Get File Name
            string[] Aux = FilePath.Split('\\');
            oFile.FileName = Aux[Aux.Length - 1];

            //Add File struct To Global Array List
            this.List.Add(oFile);
        }
        private void ReadLog(string sPath , string sFileName, bool bAddToLabels)
        {
            List<stHistory> stHistorys = new List<stHistory>();
            List<stLabel> stLabels = new List<stLabel>();
            bool bProcessingLabels = false;
            bool bProcessingRevision = false;
            bool bProcessingDescription = false;

            string sError;
            string sResponse;
            sResponse = CommandLineHelper.Run(@"C:\QVCSBin\qlog ","\""+ sFileName +"\"" , out sError, sPath);
            if (sError.Length > 0 || (sResponse.Length < 50 && sResponse.Contains( " not found!")==false))
            {
                //sResponse = sResponse;
            }

            string sCurrentRevision = "";
            string sCurrentDescription = "";
            string sCheckedInBy = "";
            string lastLabel = "";

            /*
             *           Labels:
            Revision 1.47 labeled by *Name* as 'Utilinet_S00237-05.05.E22'
            Revision 1.50 labeled by *Name* as 'S00244-05.05.D62'
            Revision 1.50 labeled by *Name* as 'U14 init version'
            Revision 1.47 labeled by *Name* as 'Utilinet_S00237-
             *
             * -------------------------------------------
            Revision 1.50: created by *Name*
               Last file edit: 4/04/2013 3:08:40 PM

            Revision inserted: 4/04/2013 3:10:42 PM

             Compressed from: 169376 to 48983
              Description:
            Removed LoadProf.c from U1300 and added  DynamicLP.c */
            foreach (string sLine in sResponse.Split('\n'))
            {
                if (sLine.Trim().StartsWith("Labels:"))
                {
                    bProcessingLabels = true;
                }

                if (sLine.Trim().StartsWith("Description:"))
                {
                    bProcessingLabels = false;
                }

                if (sLine.Trim().StartsWith("-------------------------------------------"))
                {
                    if (bProcessingDescription == true)
                    {

                        stHistory newHistory = new stHistory();
                        newHistory.sDescription = sCurrentDescription;
                        newHistory.sRevision = sCurrentRevision;
                        newHistory.sCheckedInBy = sCheckedInBy;
                        newHistory.sLabel = "";
                        foreach (stLabel stlab in stLabels)
                        {
                            if (stlab.sRevision == newHistory.sRevision)
                            {
                                newHistory.sLabel = stlab.sLabel;
                                lastLabel = stlab.sLabel;
                            }
                        }
                        if (newHistory.sLabel=="")
                        { newHistory.sLabel = lastLabel; }
                        sCurrentRevision = "";
                        stHistorys.Add(newHistory);
                    }
                    bProcessingRevision = true;
                    bProcessingDescription = false;
                }

                if (bProcessingLabels == true && sLine.Trim().Length > "Revision ".Length)
                {
                    int iRevisionEnd = sLine.Trim().IndexOf(' ', "Revision ".Length);
                    int iLabelEnd = sLine.Trim().LastIndexOf('\'');
                    int iLabelStart = sLine.Trim().LastIndexOf('\'', iLabelEnd - 1);
                    int i = 0;
                    bool bFound = false;
                    stLabel newLabel = new stLabel();
                    newLabel.sLabel = sLine.Trim().Substring(iLabelStart + 1, iLabelEnd - iLabelStart - 1);
                    newLabel.sRevision = sLine.Trim().Substring("Revision ".Length, iRevisionEnd - "Revision ".Length);
                    foreach (stLabel stlab in _stLabels)
                    {
                        if (newLabel.sLabel.Trim().CompareTo (stlab.sLabel.Trim())>0)
                        {
                            i++;
                        }

                        if (stlab.sLabel.Trim() == newLabel.sLabel.Trim())
                        {
                            bFound = true;
                        }
                    }

                    if (bFound == false)
                    {
                        if (bAddToLabels == true)
                        {
                            _stLabels.Add(newLabel);
                            _lastFileName = sPath + sFileName;
                        }
                    }
                    stLabels.Add(newLabel);
                }

                if (bProcessingDescription == true)
                {
                    sCurrentDescription += sLine + "\r\n";
                }

                if (bProcessingRevision == true)
                {
                    bProcessingLabels = false;
                    if (sLine.Trim().StartsWith("Revision ") && sLine.StartsWith("Revision inserted:") == false)
                    {
                        int iRevisionEnd = sLine.Trim().IndexOf(' ', "Revision ".Length);
                        int iCheckedInStart = sLine.Trim().IndexOf ("created by ");
                        sCurrentRevision = sLine.Trim().Substring("Revision ".Length, iRevisionEnd - "Revision ".Length - 1);
                        sCheckedInBy = sLine.Trim().Substring(iCheckedInStart + "created by ".Length);
                    }
                    if (sLine.Trim().StartsWith("Description:"))
                    {
                        sCurrentDescription = "";
                        bProcessingDescription = true;
                    }
                }
            }

            if (bProcessingDescription == true)
            {

                stHistory newHistory = new stHistory();
                newHistory.sDescription = sCurrentDescription;
                newHistory.sRevision = sCurrentRevision;
                newHistory.sCheckedInBy = sCheckedInBy;
                newHistory.sLabel = "";
                foreach (stLabel stlab in stLabels)
                {
                    if (stlab.sRevision == newHistory.sRevision)
                    {
                        newHistory.sLabel = stlab.sLabel;
                    }
                }
                sCurrentRevision = "";
                stHistorys.Add(newHistory);
            }
            bProcessingRevision = true;
            bProcessingDescription = false;

            stFile newFile=new stFile();
            newFile.sFileName = sFileName;
            newFile.sPath = sPath;
            newFile.stHistorys = stHistorys;
            newFile.stLabels = stLabels;
            _stFiles.Add(newFile);
        }