예제 #1
0
        public void RenameFileManagerItem(string oldText, string newText, string href)
        {
            var hrefQueryString = System.Web.HttpUtility.ParseQueryString(href);

            var hrefFile     = hrefQueryString["file"];
            var hrefCurrPath = hrefQueryString["currpath"];

            if (!string.IsNullOrEmpty(hrefFile))
            {
                var oldFileInfo = new FileInfo(URIHelper.BasePath + hrefFile);

                var newHref = oldFileInfo.Directory.FullName + "\\" + newText;

                var newFileInfo = new FileInfo(newHref);

                if (oldFileInfo.Exists && !newFileInfo.Exists)
                {
                    File.Move(oldFileInfo.FullName, newFileInfo.FullName);
                }
            }
            else if (!string.IsNullOrEmpty(hrefCurrPath))
            {
                var absPath          = URIHelper.ConvertToAbsPath(hrefCurrPath);
                var oldDirectoryInfo = new DirectoryInfo(absPath);

                var newHref = oldDirectoryInfo.Parent.FullName + "\\" + newText;

                var newDirInfo = new DirectoryInfo(newHref);

                if (oldDirectoryInfo.Exists && !newDirInfo.Exists)
                {
                    Directory.Move(oldDirectoryInfo.FullName, newDirInfo.FullName);
                }
            }
        }
예제 #2
0
    IEnumerator Start()
    {
        GLTFSceneImporter sceneImporter = null;
        ILoader           loader        = null;

        if (UseStream)
        {
            // Path.Combine treats paths that start with the separator character
            // as absolute paths, ignoring the first path passed in. This removes
            // that character to properly handle a filename written with it.
            GLTFUri = GLTFUri.TrimStart(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });
            string fullPath      = Path.Combine(Application.streamingAssetsPath, GLTFUri);
            string directoryPath = URIHelper.GetDirectoryName(fullPath);
            loader        = new FileLoader(directoryPath);
            sceneImporter = new GLTFSceneImporter(
                Path.GetFileName(GLTFUri),
                loader
                );
        }
        else
        {
            string directoryPath = URIHelper.GetDirectoryName(GLTFUri);
            loader        = new WebRequestLoader(directoryPath);
            sceneImporter = new GLTFSceneImporter(
                URIHelper.GetFileFromUri(new Uri(GLTFUri)),
                loader
                );
        }

        sceneImporter.SceneParent = gameObject.transform;
        sceneImporter.Collider    = Colliders;
        sceneImporter.MaximumLod  = MaximumLod;
        yield return(sceneImporter.LoadScene(-1, Multithreaded, HandleAction));
    }
예제 #3
0
        private bool CanSetSelectedImage(string value)
        {
            if (value == null)
            {
                return(false);
            }

            value = URIHelper.ConvertAbsUrlToTilda(value.ToLower());

            if (value.EndsWith(".jpeg") || value.EndsWith(".jpg") || value.EndsWith(".png") || value.EndsWith(".gif") || value.EndsWith(".svg"))
            {
                if (File.Exists(URIHelper.ConvertToAbsPath(value)))
                {
                    SelectedImage.Visible = true;
                    return(true);
                }
                else
                {
                    SelectedImage.Visible = false;
                }
            }
            else
            {
                SelectedImage.Visible = false;
            }

            return(false);
        }
        ParseResult ILinkParserStrategy.GetLinks(string page, string sourceUrl)
        {
            if (string.IsNullOrWhiteSpace(page))
            {
                return(new ParseResult(new string[0], new string[0]));
            }

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(page);

            var links = doc.DocumentNode
                        .SelectNodes("//a")
                        .Select(p => p.GetAttributeValue("href", "not found"))
                        .Distinct()
                        .Select(x => URIHelper.GetAbsoluteLink(x, sourceUrl))
                        .Where(x => x != null)
                        .ToArray();

            var linksToProceed = links
                                 .Where(link => URIHelper.IsLinkLocalForDomain(link, sourceUrl))
                                 .ToArray();

            return(new ParseResult(links, linksToProceed));
        }
예제 #5
0
        public void ProcessRequest(HttpContext context)
        {
            this.context = context;

            var templateBaseUrl = URIHelper.ConvertToAbsUrl(context.Request.QueryString["templateBaseUrl"]);

            var method = "loadfile";
            var path   = context.Request.QueryString["path"];

            if (!string.IsNullOrEmpty(context.Request["method"]))
            {
                method = context.Request["method"].ToLower();
            }

            if (string.IsNullOrEmpty(path))
            {
                path = context.Request.FilePath;
            }

            switch (method)
            {
            case "loadfile":
                LoadFile(path, templateBaseUrl);
                break;

                /*case "loadjsincludes":
                 *  LoadJsIncludes(context.Request.QueryString["pageId"], templateBaseUrl);
                 *  break;
                 *
                 * case "loadcssincludes":
                 *  LoadCssIncludes(context.Request.QueryString["pageId"], templateBaseUrl);
                 *  break;*/
            }
        }
예제 #6
0
        protected void LanguageToggleLinks_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.DataItem == null)
            {
                return;
            }

            var language     = (FrameworkLibrary.Language)e.Item.DataItem;
            var languageLink = (HyperLink)e.Item.FindControl("LanguageLink");

            languageLink.Text = language.Name;

            if (BasePage.CurrentMediaDetail.Language.CultureCode == language.CultureCode)
            {
                languageLink.CssClass = "current";
            }

            var item = MediaDetailsMapper.GetByMedia(BasePage.CurrentMedia, language);

            if (item == null)
            {
                e.Item.Visible = false;
                return;
            }

            languageLink.NavigateUrl = URIHelper.ConvertToAbsUrl(item.AutoCalculatedVirtualPath);
        }
예제 #7
0
    public static async Task Load(GameObject gameObjectLoader, string url, Action callback, Action <GameObject> onInitializeGltfObject)
    {
        ImporterFactory Factory       = null;
        bool            UseStream     = true;
        string          GLTFUri       = url;
        bool            Multithreaded = true;
        int             MaximumLod    = 300;
        int             Timeout       = 8;

        var importOptions = new ImportOptions
        {
            AsyncCoroutineHelper = gameObjectLoader.GetComponent <AsyncCoroutineHelper>() ?? gameObjectLoader.AddComponent <AsyncCoroutineHelper>()
        };

        GLTFSceneImporter sceneImporter = null;
        var cancelToken = new CancellationTokenSource();

        try
        {
            Factory = Factory ?? ScriptableObject.CreateInstance <DefaultImporterFactory>();
            if (UseStream)
            {
                var    fullPath      = GLTFUri;
                string directoryPath = URIHelper.GetDirectoryName(fullPath);
                importOptions.DataLoader = new FileLoader(directoryPath);
                sceneImporter            = Factory.CreateSceneImporter(Path.GetFileName(GLTFUri), importOptions);
            }
            else
            {
                string directoryPath = URIHelper.GetDirectoryName(GLTFUri);
                importOptions.DataLoader = new WebRequestLoader(directoryPath);
                sceneImporter            = Factory.CreateSceneImporter(URIHelper.GetFileFromUri(new Uri(GLTFUri)), importOptions);
            }
            sceneImporter.SceneParent            = gameObjectLoader.transform;
            sceneImporter.MaximumLod             = MaximumLod;
            sceneImporter.Timeout                = Timeout;
            sceneImporter.IsMultithreaded        = Multithreaded;
            sceneImporter.OnInitializeGltfObject = onInitializeGltfObject;
            mTasks.Add(cancelToken);
            await sceneImporter.LoadSceneAsync(-1, true, null, cancelToken.Token);
        }
        finally
        {
            if (importOptions.DataLoader != null)
            {
                if (sceneImporter != null)
                {
                    mCreatedScenes.Add(sceneImporter.CreatedObject);
                    if (cancelToken.IsCancellationRequested)
                    {
                        sceneImporter.CreatedObject.DestroySelf();
                    }
                    sceneImporter.Dispose();
                    sceneImporter = null;
                }
                importOptions.DataLoader = null;
            }
            callback.InvokeGracefully();
        }
    }
예제 #8
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            var currentUser = this.CurrentUser;

            if (currentUser == null)
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
                CurrentUser = null;

                return;
            }

            if (!currentUser.HasPermission(PermissionsEnum.AccessCMS))
            {
                Response.Redirect("~/");
            }

            if (this.MasterPageFile != null)
            {
                var masterFilePath = GetMasterPageFilePath();

                if (File.Exists(URIHelper.ConvertToAbsPath(masterFilePath)))
                {
                    MasterPageFile = masterFilePath;
                }
            }
        }
예제 #9
0
        public void SetItem(IMediaDetail mediaDetail)
        {
            if (mediaDetail == null)
            {
                return;
            }

            Link.NavigateUrl = URIHelper.ConvertToAbsUrl(mediaDetail.AutoCalculatedVirtualPath);

            var title            = mediaDetail.SectionTitle;
            var shortDescription = mediaDetail.ShortDescription;

            var maxCharsTitle            = 40;
            var maxCharsShortDescription = 116;

            if (title.Length > maxCharsTitle)
            {
                title = title.Substring(0, maxCharsTitle);
            }

            if (shortDescription.Length > maxCharsShortDescription)
            {
                shortDescription = shortDescription.Substring(0, maxCharsShortDescription) + " ...";
            }

            Link.Attributes["title"] = "<span class='toolTipTitle'>" + title + "</span><br />" + shortDescription;
        }
예제 #10
0
        public void UpdateFieldsFromObject()
        {
            IMediaDetail item = (IMediaDetail)SelectedItem;

            if ((item.ID == 0) && (item.LinkTitle == null || item.LinkTitle == ""))
            {
                var mediaType    = MediaTypesMapper.GetByID(item.MediaTypeID);
                var createdItems = mediaType.MediaDetails.Where(i => !i.IsHistory && i.Media.ParentMediaID == item.Media.ParentMediaID && i.LanguageID == AdminBasePage.CurrentLanguage.ID).Select(i => i);

                var newIndex = createdItems.Count() + 1;

                item.LinkTitle = AdminBasePage.CurrentLanguage.DisplayName + " - " + mediaType.Name + " " + newIndex;
            }

            LinkTitle.Text = item.LinkTitle;

            var virtualPath = item.AutoCalculatedVirtualPath;

            /*if (LanguagesMapper.GetAllActive().Count() > 1)
             *  virtualPath = URIHelper.ConvertAbsUrlToTilda(URIHelper.ConvertToAbsUrl(virtualPath).Replace(URIHelper.BaseUrl, URIHelper.BaseUrlWithLanguage));*/

            VirtualPath.Text        = virtualPath;
            VirtualPath.NavigateUrl = URIHelper.ConvertToAbsUrl(virtualPath) + "?version=" + item.HistoryVersionNumber;

            UpdateTags();

            UpdateTabsFieldsFromObject();

            UpdateMediaFieldsFromObject();

            //SEOSettingsTab.UpdateFieldsFromObject();
            //PublishSettingsTab.UpdateFieldsFromObject();
        }
예제 #11
0
        public ParseResult GetLinks(string page, string sourceUrl)
        {
            if (string.IsNullOrWhiteSpace(page))
            {
                return(new ParseResult(new string[0], new string[0]));
            }

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(page);

            var links = doc.DocumentNode
                        .SelectNodes("//a")
                        .Select(p => p.GetAttributeValue("href", "not found"))
                        .Distinct()
                        .Select(x => URIHelper.GetAbsoluteLink(x, sourceUrl))
                        .Where(x => x != null && !x.Contains(_excludedValue, StringComparison.InvariantCultureIgnoreCase))
                        .ToArray();

            var linksToProceed = links
                                 .Where(link => URIHelper.IsLinkLocalForDomain(link, sourceUrl))
                                 .ToArray();

            return(new ParseResult(links, linksToProceed));
        }
예제 #12
0
        public static void Load(string path, Action <GameObject> onLoad)
        {
            //GLTF Component Settings
            int               MaximumLod     = 300;
            bool              Multithreaded  = true;
            ILoader           loader         = null;
            Shader            shaderOverride = null;
            GLTFSceneImporter sceneImporter  = null;

            string directoryPath = URIHelper.GetDirectoryName(path);

            loader = new WebRequestLoader(directoryPath);

            sceneImporter = new GLTFSceneImporter(
                Path.GetFileName(path),
                loader
                );

            sceneImporter.Collider         = GLTFSceneImporter.ColliderType.None;
            sceneImporter.MaximumLod       = MaximumLod;
            sceneImporter.CustomShaderName = shaderOverride ? shaderOverride.name : null;

            Action <GameObject> newOnLoad = (go) =>
            {
                onLoad(go);
            };

            // Call coroutine to load AR object
            ThreadHelper.Instance.StartCoroutine(LoadScene(sceneImporter, Multithreaded, newOnLoad));
        }
        protected void UploadFilesNow_Click(object sender, EventArgs e)
        {
            try
            {
                var field = GetField();

                if (IsPostBack && Request.Files.Count > 0 && !hasRun)
                {
                    hasRun = true;

                    var index = 0;
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        var file = Request.Files[i];

                        if (string.IsNullOrEmpty(file.FileName))
                        {
                            continue;
                        }

                        var fileInfo = (new System.IO.FileInfo(GetFolderPath() + file.FileName));

                        if (!fileInfo.Directory.Exists)
                        {
                            fileInfo.Directory.Create();
                        }

                        if (fileInfo.Directory.Exists)
                        {
                            file.SaveAs(fileInfo.FullName);

                            var filePath = URIHelper.ConvertAbsUrlToTilda(URIHelper.ConvertAbsPathToAbsUrl(fileInfo.FullName)).Replace("~", "");

                            if (!field.FieldAssociations.Any(j => j.MediaDetail.PathToFile == filePath))
                            {
                                var fieldAssociation = new FieldAssociation();
                                fieldAssociation.MediaDetail                   = (MediaDetail)PagesMapper.CreateObject(MediaTypeID, MediasMapper.CreateObject(), AdminBasePage.SelectedMedia);
                                fieldAssociation.MediaDetail.LinkTitle         = fieldAssociation.MediaDetail.SectionTitle = fieldAssociation.MediaDetail.ShortDescription = fieldAssociation.MediaDetail.MainContent = fileInfo.Name;
                                fieldAssociation.MediaDetail.PathToFile        = filePath;
                                fieldAssociation.MediaDetail.PublishDate       = DateTime.Now;
                                fieldAssociation.MediaDetail.CreatedByUser     = fieldAssociation.MediaDetail.LastUpdatedByUser = FrameworkSettings.CurrentUser;
                                fieldAssociation.MediaDetail.CachedVirtualPath = fieldAssociation.MediaDetail.CalculatedVirtualPath();
                                fieldAssociation.MediaDetail.LanguageID        = SettingsMapper.GetSettings().DefaultLanguage.ID;

                                field.FieldAssociations.Add(fieldAssociation);

                                index++;

                                var returnObj = BaseMapper.SaveDataModel();
                            }
                        }
                    }
                }
                SetValue(GetValue());
            }
            catch (Exception ex)
            {
            }
        }
예제 #14
0
        private void AttemptToLoadFromCache()
        {
            if (AppSettings.ForceSSL && !URIHelper.IsSSL())
            {
                URIHelper.ForceSSL();
            }

            if (FrameworkSettings.CurrentUser == null && Request.QueryString.Count == 0)
            {
                if (Request.HttpMethod == "GET" && (!(bool)BaseMapper.CanConnectToDB || AppSettings.EnableOutputCaching))
                {
                    var userSelectedVersion = RenderVersion.HTML;

                    if (BasePage.IsMobile)
                    {
                        userSelectedVersion = RenderVersion.Mobile;
                    }

                    var cacheKey = (userSelectedVersion.ToString() + Request.Url.PathAndQuery).ToLower();

                    if (AppSettings.EnableLevel1MemoryCaching)
                    {
                        var cacheData = (string)ContextHelper.GetFromCache(cacheKey);

                        if (!string.IsNullOrEmpty(cacheData))
                        {
                            BaseService.WriteHtml(cacheData + "<!-- Loaded from level 1 - Memory Cache -->");
                        }
                    }

                    if (AppSettings.EnableLevel2FileCaching)
                    {
                        var cache = FileCacheHelper.GetFromCache(cacheKey);

                        if (!cache.IsError)
                        {
                            var cacheData = cache.GetRawData <string>();

                            if (!string.IsNullOrEmpty(cacheData))
                            {
                                BaseService.WriteHtml($"{cacheData} <!-- Loaded from level 2 - File Cache -->");
                            }
                        }
                    }

                    if (AppSettings.EnableLevel3RedisCaching)
                    {
                        var cacheData = RedisCacheHelper.GetFromCache(cacheKey);

                        if (!string.IsNullOrEmpty(cacheData))
                        {
                            BaseService.WriteHtml(cacheData + "<!-- Loaded from level 3 - Redis Cache -->");
                        }
                    }
                }

                AttemptDBConnection();
            }
        }
예제 #15
0
        private void Application_BeginRequest(Object source, EventArgs e)
        {
            var installerPath    = "~/Installer/";
            var absInstallerUrl  = URIHelper.ConvertToAbsUrl(installerPath);
            var absInstallerPath = URIHelper.ConvertToAbsPath(installerPath);

            if (Request.CurrentExecutionFilePathExtension == "" && !Request.Url.AbsoluteUri.StartsWith(absInstallerUrl))
            {
                if (Directory.Exists(absInstallerPath) && AppSettings.EnableInstaller)
                {
                    Response.Redirect(installerPath);
                }
            }


            if (AppSettings.IsRunningOnProd && AppSettings.ForceWWWRedirect)
            {
                var isSubDomain = (Request.Url.AbsoluteUri.Split('.').Length > 2);
                var isLocalHost = Request.Url.Host.StartsWith("localhost");

                if (!Request.Url.Host.StartsWith("www.") && !isLocalHost && !isSubDomain)
                {
                    Response.RedirectPermanent(Request.Url.AbsoluteUri.Replace("://", "://www."));
                }
            }


            BaseService.AddResponseHeaders();

            var virtualPathRequest = HttpContext.Current.Request.Path.EndsWith("/");

            if (virtualPathRequest)
            {
                Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
                Response.Cache.SetNoStore();
            }

            if (isFirstApplicationRequest)
            {
                ContextHelper.ClearAllMemoryCache();
                FrameworkBaseMedia.InitConnectionSettings(AppSettings.GetConnectionSettings());
                isFirstApplicationRequest = false;
            }

            if (Request.Url.AbsolutePath.Contains("robots.txt"))
            {
                var absPath = URIHelper.ConvertToAbsPath(Request.Url.AbsolutePath);

                if (File.Exists(absPath))
                {
                    var fileContent = File.ReadAllText(absPath);

                    var parsedContent = ParserHelper.ParseData(fileContent, BasePage.GetDefaultTemplateVars(""));

                    BaseService.WriteText(parsedContent);
                }
            }
        }
예제 #16
0
        public IEnumerable <Tag> GetTags()
        {
            var items = new List <Tag>();
            IEnumerable <string> values = TagValues.Value.Trim().Split(',').Distinct();

            var count = 0;

            foreach (string value in values)
            {
                var tagName = value.Trim();

                var lowerCaseTagName = tagName.ToLower();

                if ((tagName == "") || (items.Any(i => i.Name.ToLower() == lowerCaseTagName)))
                {
                    continue;
                }

                long id;
                long.TryParse(tagName, out id);
                Tag item = null;

                if (id != 0)
                {
                    item = TagsMapper.GetByID(long.Parse(tagName));
                }

                if (item == null)
                {
                    item = TagsMapper.GetByName(tagName);
                }

                if (item != null)
                {
                    item = BaseMapper.GetObjectFromContext <Tag>(item);
                }

                if ((item == null) || (item.ID == 0))
                {
                    item             = TagsMapper.CreateObject();
                    item.Name        = tagName;
                    item.Description = tagName;
                    item.OrderIndex  = count;
                    item.SefTitle    = URIHelper.PrepairUri(tagName);
                    item.DateCreated = item.DateLastModified = DateTime.Now;
                }

                if (item != null)
                {
                    items.Add(item);
                }

                count++;
            }

            return(items);
        }
예제 #17
0
        public AdminBasePage()
        {
            if (AppSettings.ForceSSL)
            {
                URIHelper.ForceSSL();
            }

            this.masterFilesDirPath = "~/Admin/Views/MasterPages/";
        }
예제 #18
0
 public AssetPromise_GLTF(ContentProvider provider, string url, string hash = null)
 {
     this.provider = provider;
     this.url      = url.Substring(url.LastIndexOf('/') + 1);
     this.id       = hash ?? url;
     // We separate the directory path of the GLB and its file name, to be able to use the directory path when
     // fetching relative assets like textures in the ParseGLTFWebRequestedFile() event call
     assetDirectoryPath = URIHelper.GetDirectoryName(url);
 }
        void Start()
        {
            Debug.Log("Hit spacebar to change the scene.");
            _asyncCoroutineHelper = gameObject.AddComponent <AsyncCoroutineHelper>();
            Uri uri           = new Uri(Url);
            var directoryPath = URIHelper.AbsoluteUriPath(uri);

            _loader   = new WebRequestLoader(directoryPath);
            _fileName = URIHelper.GetFileFromUri(uri);

            LoadScene(SceneIndex);
        }
예제 #20
0
        void Start()
        {
            Debug.Log("Hit spacebar to change the scene.");

            Uri uri           = new Uri(Url);
            var directoryPath = URIHelper.AbsoluteUriPath(uri);

            _loader   = new WebRequestLoader(directoryPath);
            _fileName = URIHelper.GetFileFromUri(uri);

            StartCoroutine(LoadScene(SceneIndex));
        }
예제 #21
0
        IEnumerator Start()
        {
            ILoader loader        = new WebRequestLoader(URIHelper.GetDirectoryName(Url));
            var     sceneImporter = new GLTFSceneImporter(
                URIHelper.GetFileFromUri(new Uri(Url)),
                loader
                );

            sceneImporter.SceneParent = gameObject.transform;
            yield return(sceneImporter.LoadScene(-1, Multithreaded));

            IntegrationTest.Pass();
        }
        private void LoadFile()
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            if (this.ValidatePath(relPathToFile))
            {
                var fileContent = File.ReadAllText(absPathToFile);
                Editor.Text = fileContent;

                DisplaySuccessMessage($@"Successfully loaded file ( {absPathToFile} )");
            }
        }
예제 #23
0
파일: LogApp.cs 프로젝트: ranchg/PIMS
        //写日志 By 阮创 2017/11/30
        public static void Write(Result result)
        {
            T_User_Log t_User_Log = new T_User_Log();

            t_User_Log.F_User_Id     = ManageProvider.Provider.Current().User.F_Id;
            t_User_Log.F_Account     = ManageProvider.Provider.Current().User.F_Account;
            t_User_Log.F_IPAddress   = URIHelper.GetUserIP();
            t_User_Log.F_Menu        = AuthApp.CurrentMenu;
            t_User_Log.F_Action      = AuthApp.CurrentAction;
            t_User_Log.F_Result_Mark = (int)result;
            t_User_Log.F_Enable_Mark = 1;
            t_User_Log.F_Delete_Mark = 0;
            userLogBusiness.Write(t_User_Log);
        }
예제 #24
0
        private void LoadFile()
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            if (File.Exists(absPathToFile))
            {
                var fileContent = File.ReadAllText(absPathToFile);
                Editor.Text = fileContent;

                DisplaySuccessMessage($@"Successfully loaded file ( {absPathToFile} ) ");
            }
            else
            {
                DisplayErrorMessage($"File does not exist ( {absPathToFile} ) ");
            }
        }
예제 #25
0
        public void Page_Init(object sender, EventArgs e)
        {
            AddCommonIncludes();

            var currentVirtualPath = URIHelper.GetCurrentVirtualPath();

            if (URIHelper.IsSame(FormsAuthentication.LoginUrl, currentVirtualPath))
            {
                return;
            }

            if (FrameworkSettings.Current.CurrentMediaDetail == null)
            {
                Response.Redirect("~/");
            }

            /*if (!IsPostBack)
             * {
             *  if ((!URIHelper.IsSpecialRequest(currentVirtualPath)) && !CurrentMediaDetail.IsCacheDataStale(UserSelectedVersion) && CurrentMediaDetail.EnableCaching && AppSettings.EnableOutputCaching && !CurrentMediaDetail.VirtualPath.Contains("/admin/") && !CurrentMediaDetail.VirtualPath.Contains("/login/") && !CurrentMediaDetail.VirtualPath.Contains("/search/"))
             *  {
             *      switch (UserSelectedVersion)
             *      {
             *          case RenderVersion.Mobile:
             *              {
             *                  BaseService.WriteRaw(CurrentMediaDetail.MobileCacheData + "<!--Loaded From Cache-->");
             *                  break;
             *              }
             *          case RenderVersion.HTML:
             *              {
             *                  BaseService.WriteRaw(CurrentMediaDetail.HtmlCacheData + "<!--Loaded From Cache-->");
             *                  break;
             *              }
             *      }
             *  }
             * }*/

            string id = CurrentMediaDetail.VirtualPath.Trim().Replace("~/", "").Replace("/", "-");

            if (id.EndsWith("-"))
            {
                id = id.Substring(0, id.Length - 1);
            }

            this.TemplateVars["BodyClass"] = id;
        }
예제 #26
0
        protected void Save_Click(object sender, EventArgs e)
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            try
            {
                File.WriteAllText(absPathToFile, Editor.Text);

                DisplaySuccessMessage($@"Successfully saved ( {absPathToFile} )");
            }
            catch (Exception ex)
            {
                ErrorHelper.LogException(ex);

                DisplayErrorMessage("Error saving", ErrorHelper.CreateError(ex));
            }
        }
예제 #27
0
        protected void Create_OnClick(object sender, EventArgs e)
        {
            var newUser = UsersMapper.CreateObject();

            newUser.UserName           = EmailAddress.Text;
            newUser.EmailAddress       = EmailAddress.Text;
            newUser.Password           = Password.Text;
            newUser.AuthenticationType = AuthType.Forms.ToString();
            newUser.IsActive           = true;

            /*var role = RoleEnum.FrontEndUser;
             * RoleEnum.TryParse(Category.Text, out role);
             *
             * newUser.Roles.Add(BaseMapper.GetObjectFromContext(RolesMapper.GetByEnum(role)));*/

            var returnObj  = newUser.Validate();
            var userExists = UsersMapper.GetByEmailAddress(newUser.EmailAddress);

            if (userExists != null)
            {
                returnObj.Error = ErrorHelper.CreateError("Validation Error", "An account with the same email address already exists, <a href=" + URIHelper.BaseUrl + "login>Click Here</a> to login or retrieve your password");
            }

            if (!returnObj.IsError)
            {
                returnObj = UsersMapper.Insert(newUser);
            }

            if (returnObj.IsError)
            {
                Message.Text = returnObj.Error.Exception.Message;

                if ((returnObj.Error.Exception.InnerException.Message != null) && (returnObj.Error.Exception.InnerException.Message != ""))
                {
                    Message.Text = returnObj.Error.Exception.InnerException.Message;
                }
            }
            else
            {
                var returnObjAutoResponder = SendAutoResponderEmail(newUser);
                var returnObjNotification  = SendNotificationEmails(newUser);
                Response.Redirect(URIHelper.GetCurrentVirtualPath() + "thank-you/");
            }
        }
예제 #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToIndexValuesContainingSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToIndexValuesContainingSpaces()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long startNodeId = helper.createNode();
            long startNodeId = _helper.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long endNodeId = helper.createNode();
            long         endNodeId        = _helper.createNode();
            const string relationshiptype = "tested-together";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long relationshipId = helper.createRelationship(relationshiptype, startNodeId, endNodeId);
            long         relationshipId = _helper.createRelationship(relationshiptype, startNodeId, endNodeId);
            const string key            = "key";
            const string value          = "value with   spaces  in it";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String indexName = indexes.newInstance();
            string indexName = _indexes.newInstance();

            _helper.createRelationshipIndex(indexName);
            JaxRsResponse response = HttpPostIndexRelationshipNameKeyValue(indexName, relationshipId, key, value);

            assertEquals(Status.CREATED.StatusCode, response.Status);
            URI location = response.Location;

            response.Close();
            response = HttpGetIndexRelationshipNameKeyValue(indexName, key, URIHelper.encode(value));
            assertEquals(Status.OK.StatusCode, response.Status);
            string responseEntity = response.Entity;
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<?> hits = (java.util.Collection<?>) org.neo4j.server.rest.domain.JsonHelper.readJson(responseEntity);
            ICollection <object> hits = (ICollection <object>)JsonHelper.readJson(responseEntity);

            assertEquals(1, hits.Count);
            response.Close();
            CLIENT.resource(location).delete();
            response = HttpGetIndexRelationshipNameKeyValue(indexName, key, URIHelper.encode(value));
            assertEquals(200, response.Status);
            responseEntity = response.Entity;
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: hits = (java.util.Collection<?>) org.neo4j.server.rest.domain.JsonHelper.readJson(responseEntity);
            hits = (ICollection <object>)JsonHelper.readJson(responseEntity);
            assertEquals(0, hits.Count);
            response.Close();
        }
예제 #29
0
        public static void RenderRss(IEnumerable <RssItem> rssItems = null, string rssTitle = "", string rssDescription = "", string rssLink = "")
        {
            if (rssItems == null)
            {
                rssItems = MediaDetailsMapper.GetRssItems(MediaDetailsMapper.GetAllChildMediaDetails(FrameworkSettings.Current.CurrentMedia.ID, FrameworkSettings.Current.CurrentLanguage.ID).Where(i => i.CanRender && i.MediaType.ShowInSiteTree).OrderByDescending(i => i.PublishDate));
            }

            if (rssLink == "")
            {
                if (FrameworkSettings.Current.CurrentMediaDetail != null)
                {
                    rssLink = URIHelper.ConvertToAbsUrl(FrameworkSettings.Current.CurrentMediaDetail.VirtualPath);
                }
                else
                {
                    rssLink = URIHelper.ConvertToAbsUrl(URIHelper.GetCurrentVirtualPath());
                }
            }

            if (rssTitle == "")
            {
                rssTitle = FrameworkSettings.Current.CurrentMediaDetail.Title;
            }

            if (rssDescription == "")
            {
                rssDescription = FrameworkSettings.Current.CurrentMediaDetail.GetMetaDescription();
            }

            Rss rss = new Rss(rssTitle, rssLink, rssDescription);

            rss.Items = rssItems;

            var Response = HttpContext.Current.Response;

            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType     = "text/xml";

            RssHelper.WriteRss(rss, Response.OutputStream);

            Response.Flush();
            Response.End();
        }
예제 #30
0
        public static void FixGltfRootInvalidUriCharacters(GLTFRoot gltfRoot)
        {
            if (gltfRoot == null)
            {
                Debug.LogError("FixGltfRootInvalidUriCharacters >>> gltfRoot is null!");
                return;
            }

            GLTFRoot root = gltfRoot;

            if (root.Images != null)
            {
                foreach (GLTFImage image in root.Images)
                {
                    if (!string.IsNullOrEmpty(image.Uri))
                    {
                        bool isBase64 = URIHelper.IsBase64Uri(image.Uri);

                        if (!isBase64)
                        {
                            image.Uri = image.Uri.Replace('/', Path.DirectorySeparatorChar);
                        }
                    }
                }
            }

            if (root.Buffers != null)
            {
                foreach (GLTFBuffer buffer in root.Buffers)
                {
                    if (!string.IsNullOrEmpty(buffer.Uri))
                    {
                        bool isBase64 = URIHelper.IsBase64Uri(buffer.Uri);

                        if (!isBase64)
                        {
                            buffer.Uri = buffer.Uri.Replace('/', Path.DirectorySeparatorChar);
                        }
                    }
                }
            }
        }