Пример #1
0
        public static void OpenImageFile(HashFile file, ImageFile imageFile, bool openOnTerminal)
        {
            var imageContent = imageFile.ImageContent;

            if (file.Status == FileStatus.Encrypted)
            {
                ShowEncryptedFileMessage();
            }

            if (openOnTerminal)
            {
                TerminalUtil.ShowImage(imageContent);
            }
            else
            {
                string title = FileSystem.GetWindowTitleForFile(file);
                ImageWindowComponent imageWindow = WindowUtil.CreateImageWindow(imageContent, title);

                if (file.Status == FileStatus.Encrypted)
                {
                    var materialPrefab = DataHolder.GUIReferences.EncryptedImageMaterial;

                    var material = new Material(materialPrefab);
                    material.CopyPropertiesFromMaterial(materialPrefab);

                    imageWindow.ImageHolder.material      = material;
                    imageWindow.UpdateImageBlendFactor    = true;
                    imageWindow.EncryptedImageBlendFactor = 1f;
                }
            }
        }
Пример #2
0
        public static void OpenTextFile(HashFile file, TextFile textFile, bool openOnTerminal)
        {
            string textContent;

            if (file.Status == FileStatus.Encrypted)
            {
                ShowEncryptedFileMessage();

                textContent = textFile.EncryptedTextContent;
            }
            else
            {
                textContent = FileSystem.GetTextFileContent(textFile);
            }

            if (openOnTerminal)
            {
                TerminalUtil.ShowText(textContent);
            }
            else
            {
                string title = FileSystem.GetWindowTitleForFile(file);
                WindowUtil.CreateTextWindow(textContent, title);
            }
        }