private static string EnlistmentPathTranslation(IVsSccEnlistmentPathTranslation vsSccEnlistmentPathTranslation, string filePath)
 {
     if (vsSccEnlistmentPathTranslation != null)
     {
         try
         {
             string text;
             string text2;
             if (vsSccEnlistmentPathTranslation.TranslateProjectPathToEnlistmentPath(filePath, out text, out text2) >= 0)
             {
                 filePath = text.ToUpperInvariant();
             }
         }
         catch (Exception)
         {
         }
     }
     return filePath;
 }
 private string WalkProject(IVsSccEnlistmentPathTranslation vsSccEnlistmentPathTranslation, IVsProject vsProject, string projectTypeString, string zipFileRoot, string zipLocalPath, ProjectItems projItems, XmlDocument xmlDoc, XmlNode xmlProjectContentsNode, List<string> accumulatedFiles, bool bIsWebProj, string frameworkVersion, string visualStudioVersion)
 {
     var xmlGenerationResult = "OK";
     if (projItems != null)
     {
         foreach (ProjectItem projectItem in projItems)
         {
             string text = Path.Combine(zipFileRoot, zipLocalPath);
             string text2 = projectItem.get_FileNames(1);
             string name = projectItem.Name;
             if (!bIsWebProj || string.Compare(name, "Generated___Files", StringComparison.OrdinalIgnoreCase) != 0)
             {
                 string zipSafeName = this.GetZipSafeName(name, text);
                 if (Directory.Exists(text2))
                 {
                     XmlNode xmlNode = xmlDoc.CreateElement("Folder");
                     xmlProjectContentsNode.AppendChild(xmlNode);
                     XmlAttribute xmlAttribute = xmlDoc.CreateAttribute("Name");
                     xmlAttribute.Value = zipSafeName;
                     xmlNode.Attributes.Append(xmlAttribute);
                     XmlAttribute xmlAttribute2 = xmlDoc.CreateAttribute("TargetFolderName");
                     xmlAttribute2.Value = name;
                     xmlNode.Attributes.Append(xmlAttribute2);
                     string text3 = Path.Combine(zipLocalPath, zipSafeName);
                     Directory.CreateDirectory(Path.Combine(zipFileRoot, text3));
                     xmlGenerationResult = this.WalkProject(vsSccEnlistmentPathTranslation, vsProject, projectTypeString, zipFileRoot, text3, projectItem.ProjectItems, xmlDoc, xmlNode, accumulatedFiles, bIsWebProj, frameworkVersion, visualStudioVersion);
                     if (xmlGenerationResult != "OK")
                     {
                         break;
                     }
                 }
                 else
                 {
                     if (IsFileALink(vsSccEnlistmentPathTranslation, vsProject, projectItem))
                     {
                         xmlGenerationResult = this.WalkProject(vsSccEnlistmentPathTranslation, vsProject, projectTypeString, zipFileRoot, zipLocalPath, projectItem.ProjectItems, xmlDoc, xmlProjectContentsNode, accumulatedFiles, bIsWebProj, frameworkVersion, visualStudioVersion);
                         if (xmlGenerationResult != "OK")
                         {
                             break;
                         }
                     }
                     else
                     {
                         string text4 = Path.GetDirectoryName(projectItem.get_FileNames(1)).ToUpperInvariant();
                         string text5 = Path.GetDirectoryName(projectItem.ContainingProject.FullName).ToUpperInvariant();
                         if (!text4.Equals(text5) && text4.StartsWith(text5) && projectTypeString.Equals("VC"))
                         {
                             zipLocalPath = text4.Substring(text5.Length + 1);
                             text = Path.Combine(zipFileRoot, zipLocalPath);
                             if (!Directory.Exists(text))
                             {
                                 Directory.CreateDirectory(text);
                             }
                             zipSafeName = this.GetZipSafeName(name, text);
                         }
                         if (!IsInRestrictedList(name))
                         {
                             XmlNode xmlNode2 = xmlDoc.CreateElement("ProjectItem");
                             xmlProjectContentsNode.AppendChild(xmlNode2);
                             bool fDoReplacements = ValidMimeType(text2) && !projectTypeString.Equals("VC");
                             XmlAttribute xmlAttribute3 = xmlDoc.CreateAttribute("ReplaceParameters");
                             xmlAttribute3.Value = fDoReplacements.ToString().ToLowerInvariant();
                             xmlNode2.Attributes.Append(xmlAttribute3);
                             XmlAttribute xmlAttribute4 = xmlDoc.CreateAttribute("TargetFileName");
                             xmlAttribute4.Value = GetTargetItemName(name, projectTypeString);
                             xmlNode2.Attributes.Append(xmlAttribute4);
                             if (projectTypeString.Equals("VC"))
                             {
                                 xmlNode2.InnerText = Path.Combine(zipLocalPath, zipSafeName);
                             }
                             else
                             {
                                 xmlNode2.InnerText = zipSafeName;
                             }
                             accumulatedFiles.Add(Path.Combine(zipLocalPath, zipSafeName));
                             string rootNamespace = "";
                             try
                             {
                                 rootNamespace = (string)projectItem.ContainingProject.Properties.Item("RootNamespace").Value;
                             }
                             catch
                             {
                             }
                             xmlGenerationResult = this.MakeReplacements(false, true, fDoReplacements, rootNamespace, text2, Path.Combine(text, zipSafeName), frameworkVersion, visualStudioVersion);
                             if (xmlGenerationResult != "OK")
                             {
                                 break;
                             }
                             xmlGenerationResult = this.WalkProject(vsSccEnlistmentPathTranslation, vsProject, projectTypeString, zipFileRoot, zipLocalPath, projectItem.ProjectItems, xmlDoc, xmlProjectContentsNode, accumulatedFiles, bIsWebProj, frameworkVersion, visualStudioVersion);
                             if (xmlGenerationResult != "OK")
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     return xmlGenerationResult;
 }
 internal static bool IsFileALink(IVsSccEnlistmentPathTranslation vsSccEnlistmentPathTranslation, IVsProject vsProject, ProjectItem projItem)
 {
     string text = Path.GetDirectoryName(projItem.get_FileNames(1)).ToUpperInvariant();
     string text2 = Path.GetDirectoryName(projItem.ContainingProject.FullName).ToUpperInvariant();
     if (text.StartsWith(text2, StringComparison.InvariantCultureIgnoreCase))
     {
         return false;
     }
     if (text2.StartsWith("http:", StringComparison.OrdinalIgnoreCase) || text2.StartsWith("https:", StringComparison.OrdinalIgnoreCase) || text2.StartsWith("ftp:", StringComparison.OrdinalIgnoreCase))
     {
         string value = projItem.ContainingProject.FullName.ToUpperInvariant();
         try
         {
             if (vsProject is IVsSccProjectProviderBinding)
             {
                 IVsSccProjectProviderBinding vsSccProjectProviderBinding = (IVsSccProjectProviderBinding)vsProject;
                 int num = 0;
                 string text3;
                 if (vsSccProjectProviderBinding.TranslateEnlistmentPath(EnlistmentPathTranslation(vsSccEnlistmentPathTranslation, text), out num, out text3) >= 0)
                 {
                     text3 = text3.ToUpperInvariant();
                     if (text3.StartsWith(value, StringComparison.InvariantCultureIgnoreCase))
                     {
                         return false;
                     }
                 }
             }
         }
         catch (Exception)
         {
         }
         return true;
     }
     return true;
 }