Пример #1
0
        private void ImportAutoRename(
            string sObjectName,
            IImportOverwriteInfo oOverwriteInfo)
        {
            const string IMPORTED_SUFFIX = "_Imported";

            string sNewName;

            int nImportedSuffixIndex = sObjectName.LastIndexOf(IMPORTED_SUFFIX);

            if (nImportedSuffixIndex >= 0)
            {
                string sBaseName = sObjectName.Substring(0, nImportedSuffixIndex);

                string sImportNum =
                    sObjectName.Substring(nImportedSuffixIndex + IMPORTED_SUFFIX.Length);

                int nImportNum = 1;

                if (sImportNum.Length > 0)
                {
                    try
                    {
                        nImportNum = int.Parse(sImportNum) + 1;
                    }
                    catch
                    {
                    }
                }

                sNewName = String.Format("{0}{1}{2}", sBaseName, IMPORTED_SUFFIX, nImportNum);
            }
            else
            {
                sNewName = sObjectName + IMPORTED_SUFFIX;
            }

            oOverwriteInfo.NewObjectName = sNewName;
            oOverwriteInfo.Overwrite     = true;
        }
Пример #2
0
        private void oCopySession_OnObjectExists(
            string sObjectName,
            string sObjectType,
            IImportOverwriteInfo oOverwriteInfo)
        {
            if (OnObjectExists != null)
            {
                OnObjectExists(
                    sObjectName,
                    sObjectType,
                    oOverwriteInfo);
            }
            else
            {
                // TEMP

                ImportAutoRename(
                    sObjectName,
                    oOverwriteInfo);
            }

            //			TEMPORARY CLOSED, ALWAYS PERFORM AutoRename IF COLLISION OCCURED DURING IMPORT

            //			if (Rare.ObjectExistsNotifier != null)
            //			{
            //				Rare.ObjectExistsNotifier.Notify (
            //					sObjectName,
            //					sObjectType,
            //					oOverwriteInfo);
            //			}

            //			if (!StringUtil.CompareIgnoreCase (sObjectName, oOverwriteInfo.NewObjectName))
            //			{
            //				Rare.RenamedNodeMap.Add (sObjectName, oOverwriteInfo.NewObjectName);
            //			}
        }