public static string GetPhysicalPathForId(string siteId, bool isTemplate, string relativePath, out FaultContract Fault)
        {
            Fault = null;
            string physicalPath = null;

            if (isTemplate)
            {
                Template template = TemplateConfiguration.FindTemplateById(siteId);
                if (template == null)
                {
                    Fault           = new FaultContract();
                    Fault.FaultType = "Error";
                    Fault.Message   = "Unable to find template with ID = " + siteId;
                    return(null);
                }
                else
                {
                    physicalPath = ServerUtility.MapPath(TemplateFolderPath) + "\\" + template.ID;
                    if (!string.IsNullOrEmpty(relativePath))
                    {
                        physicalPath += "\\" + relativePath.Replace("/", "\\");
                    }
                }
            }
            else
            {
                Site site = SiteConfiguration.FindExistingSiteByID(siteId);
                if (site == null)
                {
                    Fault           = new FaultContract();
                    Fault.FaultType = "Error";
                    Fault.Message   = "Unable to find Site with ID = " + siteId;
                    return(null);
                }
                else
                {
                    physicalPath = site.PhysicalPath;
                    if (!string.IsNullOrEmpty(relativePath))
                    {
                        physicalPath += "\\" + relativePath.Replace("/", "\\");
                    }
                }
            }
            return(physicalPath);
        }
 public static void SavePreviewImageForSite(string siteId, byte[] imageBytes)
 {
     if (imageBytes == null || string.IsNullOrEmpty(siteId))
     {
         return;
     }
     try
     {
         using (System.IO.Stream stream = new System.IO.FileStream(ServerUtility.MapPath(APP_THUMBNAILSFOLDERPATH + "/" + siteId + ".png"), System.IO.FileMode.Create, System.IO.FileAccess.Write))
         {
             stream.Write(imageBytes, 0, imageBytes.Length);
             stream.Close();
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Write(ex.ToString());
     }
 }
        protected override void SaveSettingsFile(string xml, string path)
        {
            path = ServerUtility.MapPath(path);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            if (File.Exists(path))
            {
                lock (lockObject)
                {
                    using (System.IO.StreamWriter file = new System.IO.StreamWriter(path))
                    {
                        file.Write(xml);
                        file.Flush();
                    }
                }
            }
        }
Beispiel #4
0
 protected override string GetSettingsXml()
 {
     return(ConfigurationStoreManager.GetFileContents(ServerUtility.MapPath(SETTINGSCONFIGPATH)));
 }