예제 #1
0
        //============================================================
        //<T>展现纹理图片<T>
        //============================================================
        private void MaterialImage(FCfgFolder fol)
        {
            FDrMaterialGroup material = fol.Tag as FDrMaterialGroup;
            ListViewGroup    group    = new ListViewGroup();
            int n = 1;

            material.Open();
            foreach (FDrModelMaterialTexture mat in material.Textures)
            {
                if (null != mat && mat.Texture != null)
                {
                    string path = mat.Texture.Directory + "\\icon\\" + mat.SourceType + ".jpg";
                    if (RFile.Exists(path))
                    {
                        Bitmap bit = new Bitmap(path);
                        imageList.Images.Add(bit);
                        int count = imageList.Images.Count;
                        imageList.Images.SetKeyName(count - 1, mat.SourceType + ".jpg");
                        n++;
                    }
                }
            }
            group.Tag  = material;
            group.Name = fol.Label + "-" + n.ToString();
            listView1.Groups.Add(group);
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (RFile.FileName != null)
            {
                var FName   = Path.GetFileName(RFile.FileName);
                var NewPath = Path.Combine(Hosting.WebRootPath, "Images", FName);
                RFile.CopyTo(new FileStream(NewPath, FileMode.Create));
                Item.ItemImage = FName;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Item).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemExists(Item.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
예제 #3
0
        //============================================================
        // <T>扫描资源。</T>
        //============================================================
        public override void Scan()
        {
            base.Scan();
            // 扫描所有文件
            _optionValid = true;
            FStrings fileNames = RDirectory.ListFiles(_directory);

            fileNames.Sort();
            foreach (string fileName in fileNames)
            {
                // 文件是否图片
                string name = fileName.Substring(fileName.LastIndexOf("\\") + 1);
                if (name.EndsWith(".png"))
                {
                    name = name.Substring(0, name.Length - 4);
                    // 是否符合命名标准
                    if (5 == name.Length)
                    {
                        int direction  = RInt.Parse(name.Substring(0, 1));
                        int frameIndex = RInt.Parse(name.Substring(1)) - 1;
                        // 同步剪辑
                        FRsResourceClip  clip  = SyncClip(direction);
                        FRsResourceFrame frame = new FRsResourceFrame();
                        frame.FileName = fileName;
                        clip.PushFrame(frame);
                        // 设置有效
                        _optionValid = true;
                    }
                    else
                    {
                        RMoCore.TrackConsole.Write(this, "Scan", "Invalid picture define. (file_name={0})", fileName);
                    }
                }
            }
            // 检查剪辑帧数相等
            FRsResourceClip firstClip = FristClip;

            if (null != firstClip)
            {
                foreach (FRsResourceClip clip in _clips)
                {
                    if (clip != null)
                    {
                        if (firstClip.FrameCount != clip.FrameCount)
                        {
                            RMoCore.TrackConsole.Write(this, "Scan", "Animation clip frame is differenty. (first_frames={0}, clip_frames={1})",
                                                       firstClip.FrameCount, clip.FrameCount);
                        }
                    }
                }
            }
            string _configName = _directory + "\\config.xml";

            if (RFile.Exists(_configName))
            {
                FXmlDocument xdoc = new FXmlDocument();
                xdoc.LoadFile(_configName);
                LoadConfig(xdoc.Root);
            }
        }
예제 #4
0
        //============================================================
        // <T>扫描工作路径,获得对象列表。</T>
        //============================================================
        public override void Scan()
        {
            base.Scan();
            // 设置目录
            _exportFileName = _directoryExprot + "\\tx_" + Code + ".swf";
            // 查询图片
            string resourceDirectory = RContent3dManager.TextureConsole.ResourceDirectory;

            foreach (string filename in RDirectory.ListFiles(_directory))
            {
                if (filename.EndsWith(".jpg"))
                {
                    FFileInfo        info   = new FFileInfo(filename);
                    FDrTextureBitmap bitmap = new FDrTextureBitmap();
                    bitmap.TypeCd   = EDrTexture.Diffuse;
                    bitmap.Source   = info.FullName.Substring(resourceDirectory.Length);
                    bitmap.FileName = info.FullName;
                    bitmap.Length   = info.Info.Length;
                    _bitmaps.Push(bitmap);
                }
            }
            // 加载设置文件
            if (RFile.Exists(_configFileName))
            {
                LoadConfigFile(_configFileName);
            }
        }
예제 #5
0
 //============================================================
 // <T>加载全部处理。</T>
 //============================================================
 public virtual void LoadAll()
 {
     // 清空集合
     if (_folders != null)
     {
         _folders.Clear();
     }
     if (_objects != null)
     {
         _objects.Clear();
     }
     // 加载所有子目录
     foreach (string path in RDirectory.ListDirectories(_directory))
     {
         // 跳过SVN目录
         if (path.IndexOf(".svn") != -1)
         {
             continue;
         }
         // 加载子目录
         OnLoadFolder(path);
     }
     if (_folders != null)
     {
         _folders.Sort();
     }
     // 加载配置
     if (RFile.Exists(ConfigFileName))
     {
         FXmlDocument xdoc = new FXmlDocument();
         xdoc.LoadFile(ConfigFileName);
         LoadConfig(xdoc.Root);
     }
 }
예제 #6
0
        //============================================================
        // <T>扫描工作路径,获得对象列表。</T>
        //============================================================
        public override void Scan()
        {
            base.Scan();
            // 检查文件集合
            FStrings fileNames = RDirectory.ListFiles(_directory);

            foreach (string fileName in fileNames)
            {
                if (fileName.EndsWith(".xml"))
                {
                    string name = RFile.GetFileName(fileName);
                    name = name.Substring(0, name.Length - 4);
                    if (name.StartsWith("import.") || name.StartsWith("temp."))
                    {
                        continue;
                    }
                    FDrScene scene = new FDrScene();
                    scene.Name            = _name;
                    scene.Label           = _label;
                    scene.TechniqueName   = name;
                    scene.Directory       = _directory;
                    scene.DirectoryExprot = _directoryExprot;
                    scene.Scan();
                    _scenes.Push(scene);
                }
            }
            // 设置目录
            _exportFileName = _directoryExprot + "\\sc_" + Code + ".swf";
            // 加载设置文件
            if (RFile.Exists(_configFileName))
            {
                //LoadConfig(new FXmlDocument(_directory + "\\config.xml").Root);
            }
        }
예제 #7
0
 //============================================================
 // <T>扫描工作路径,获得对象列表。</T>
 //============================================================
 public override void Scan()
 {
     base.Scan();
     _configFileName = _directory + "\\" + _techniqueName + ".xml";
     // 设置目录
     if (_techniqueName == "config")
     {
         _exportFileName = _directoryExprot + "\\sc_" + Code + ".swf";
     }
     else
     {
         _exportFileName = _directoryExprot + "\\sc_" + Code + "." + _techniqueName + ".swf";
     }
     // 加载设置文件
     if (RFile.Exists(_configFileName))
     {
         string fileName = _directory + "\\" + _techniqueName + ".xml";
         try {
             LoadConfig(new FXmlDocument(fileName).Root);
         } catch (Exception e) {
             RMoCore.TrackConsole.Write(this, "Scan", "Load config file failure. (file_name={0}, error={1})", fileName, e.Message);
             LoadConfig(new FXmlDocument(fileName).Root);
         }
     }
 }
예제 #8
0
        public async Task <RsFileStream> GetFileStream(Downloader downloader, RFile file)
        {
            var client = GetClient();
            //https://api.alldebrid.com/v4/magnet/status?agent=myAppName&apikey=someValidApikeyYouGenerate
            var streamTask = client.GetStreamAsync($"link/unlock?agent=myAppName&link={file.Path}&apikey={downloader.Token}");
            var result     = await JsonSerializer.DeserializeAsync <AllDebridResult <AllDebridLink> >(await streamTask, jsonOptions);

            var lien = result.data.Link;

            var clientStream             = _clientFactory.CreateClient();
            var getTask                  = client.GetAsync(lien, HttpCompletionOption.ResponseHeadersRead);
            HttpResponseMessage response = await getTask.ConfigureAwait(false);

            response.EnsureSuccessStatusCode();
            var lengthHeader = response.Content.Headers.TryGetValues("Content-Length", out var lengthStringArray);
            var lengthString = lengthStringArray?.FirstOrDefault();

            long.TryParse(lengthString, out var length);
            HttpContent c      = response.Content;
            var         stream = c != null ? await c.ReadAsStreamAsync().ConfigureAwait(false) :
                                 System.IO.Stream.Null;

            return(new RsFileStream()
            {
                Stream = stream, Length = length
            });
        }
예제 #9
0
 //============================================================
 // <T>加载所有目录。</T>
 //============================================================
 public virtual void LoadFolderAll()
 {
     // 加载所有子目录
     foreach (string path in RDirectory.ListDirectories(_directory))
     {
         // 跳过SVN目录
         if (path.IndexOf(".svn") != -1)
         {
             continue;
         }
         // 加载子目录
         OnLoadFolder(path);
     }
     if (_folders != null)
     {
         _folders.Sort();
     }
     // 加载配置
     if (RFile.Exists(ConfigFileName))
     {
         FXmlDocument xdoc = new FXmlDocument();
         try {
             xdoc.LoadFile(ConfigFileName);
         } catch (Exception e) {
             throw new FFatalException(e, "Open config file error. (file_name={0})", ConfigFileName);
         }
         LoadConfig(xdoc.Root);
     }
 }
예제 #10
0
 //============================================================
 // <T>保存设置信息。<T>
 //
 // @param xconfig 设置节点
 //============================================================
 public override void SaveConfig(FXmlNode xconfig)
 {
     base.SaveConfig(xconfig);
     // 设置文件长度
     xconfig.Set("length", _length);
     // 设置文件名称
     xconfig.Set("file_name", RFile.GetFileName(_fileName));
 }
예제 #11
0
파일: RSystem.cs 프로젝트: whztt07/MoCross
 //============================================================
 // <T>获得指定文件名称的路径。</T>
 //
 // @param fileName 文件名称
 // @return 路径
 //============================================================
 public static string Location(string fileName)
 {
     if ((null != fileName) && !fileName.Contains(RFile.DRIVER_SPLITER))
     {
         return(RFile.MakeFileName(Location(), fileName));
     }
     return(fileName);
 }
예제 #12
0
 //============================================================
 // <T>打开材质信息。</T>
 //============================================================
 public override void Scan()
 {
     base.Scan();
     // 加载设置文件
     _optionValid = RFile.Exists(_configFileName);
     if (_optionValid)
     {
         LoadConfigFile(_configFileName);
     }
 }
예제 #13
0
 //============================================================
 // <T>打开材质信息。</T>
 //============================================================
 public override void Scan()
 {
     base.Scan();
     _exportFileName     = RContent3dManager.TemplateConsole.ExportDirectory + "\\tp_" + Code + ".swf";
     _exportDataFileName = RContent3dManager.TemplateConsole.ExportDirectory + ".dt\\tp_" + Code + ".swf";
     // 加载设置文件
     if (RFile.Exists(_configFileName))
     {
         LoadConfigFile(_configFileName);
     }
 }
예제 #14
0
파일: FMbMap.cs 프로젝트: whztt07/MoCross
 //============================================================
 // <T>加载配置文件。</T>
 //============================================================
 public void LoadDirectory() {
    // 获得文件名称
    string fileName = _directory + @"\config.xml";
    if (!RFile.Exists(fileName)) {
       return;
    }
    // 加载设置
    using (FXmlDocument xmldoc = new FXmlDocument(fileName)) {
       LoadConfig(xmldoc.Root);
    }
 }
예제 #15
0
        //============================================================
        // <T>加载路径。</T>
        //
        // @param directory 路径
        //============================================================
        public static void LoadDirectory(string directory)
        {
            _directory = directory;
            // 加载应用信息
            string appFile = _directory + @"\Tools\Configuration\application.xml";

            if (RFile.Exists(appFile))
            {
                FXmlDocument xdoc = new FXmlDocument();
                // 加载文件
                xdoc.LoadFile(appFile);
                LoadConfig(xdoc.Root);
            }
        }
예제 #16
0
        public void Push(RFile Value)
        {
            TagNode Node = new TagNode(Value);

            if (RootNode == null)
            {
                RootNode = Node;
                _Size++;
            }
            else
            {
                _Size += RootNode.AddNode(Node);
            }
        }
예제 #17
0
 //============================================================
 // <T>打开资源。</T>
 //============================================================
 public override void Open()
 {
     if (!_statusOpen)
     {
         base.Open();
         // 打开图片资源
         _bitmap.LoadFile(_fileName);
         int length = (int)RFile.GetFileLength(_fileName);
         _size.Width  = _bitmap.Width;
         _size.Height = _bitmap.Height;
         // 测试有效区域
         RBitmap.TestValidRectangle(_bitmap.Native, _validRectangle, _qualityAlpha);
     }
 }
예제 #18
0
파일: FDrModel.cs 프로젝트: whztt07/MoCross
 //============================================================
 // <T>打开设置文件。</T>
 //============================================================
 public override void Scan()
 {
     base.Scan();
     // 设置文件名称
     _modelFileName      = _directory + "\\model.m3x";
     _meshFileName       = _directory + "\\model.msh";
     _exportFileName     = _directoryExprot + "\\md_" + Code + ".swf";
     _exportDataFileName = _directoryExprot + ".dt\\md_" + Code + ".swf";
     // 加载设置文件
     if (RFile.Exists(_configFileName))
     {
         LoadConfigFile(_configFileName);
     }
 }
예제 #19
0
 //============================================================
 // <T>保存设置信息。<T>
 //
 // @param xconfig 设置节点
 //============================================================
 public void SaveConfig(FXmlNode xconfig)
 {
     // 设置索引
     xconfig.Set("index", _index);
     // 设置延时
     xconfig.Set("delay", _delay);
     // 设置图片大小
     xconfig.Set("size", _size.ToString());
     // 设置有效大小
     xconfig.Set("valid_rectangle", _validRectangle.ToString());
     // 设置有效重心
     xconfig.Set("valid_barycenter", _validBarycenter.ToString());
     // 设置文件名称
     xconfig.Set("file_name", RFile.GetFileName(_fileName));
 }
예제 #20
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string dir = (string)parameters.Value;

            if (!RString.IsEmpty(dir))
            {
                string fulldir = RFile.CurrentFileName(dir);
                if (!Directory.Exists(fulldir))
                {
                    parameters.Description = _resource.FindDisplay(MSG_NOT_EXISTS, fulldir);
                    return(false);
                }
            }
            return(true);
        }
예제 #21
0
파일: FDrMap.cs 프로젝트: whztt07/MoCross
 //============================================================
 // <T>打开材质信息。</T>
 //============================================================
 public void Open()
 {
     if (!_initialized)
     {
         _configFileName = _path + "\\config.xml";
         _exportFileName = _exprotPath + "\\mp_" + _name + ".swf";
         // 加载设置文件
         if (RFile.Exists(_configFileName))
         {
             LoadConfigFile(_configFileName);
         }
         // 设置输出路径
         _exportFilePath = _exprotPath + "\\" + RInt.Pad(_id, 4);
         RDirectory.MakeDirectories(_exportFilePath);
         _initialized = true;
     }
 }
예제 #22
0
 //============================================================
 // <T>保存设置信息。<T>
 //
 // @param xconfig 设置节点
 // @author TYFNG 20120409
 //============================================================
 public override void SaveConfig(FXmlNode xconfig)
 {
     base.SaveConfig(xconfig);
     // 设置图片尺寸
     xconfig.Set("size", _size.ToString());
     // 设置文件属性
     xconfig.Set("option_alpha", _optionAlpha);
     // 设置支持空白
     xconfig.Set("option_padding", _optionPadding);
     // 设置品质类型
     xconfig.SetNvl("quality_cd", _qualityCd);
     // 设置品质调色板
     xconfig.Set("quality_palette", _qualityPalette);
     // 设置品质透明
     xconfig.Set("quality_alpha", _qualityAlpha);
     // 设置文件名称
     xconfig.Set("file_name", RFile.GetFileName(_fileName));
 }
예제 #23
0
        public IActionResult OnPost(int id)
        {
            if (RFile.FileName != null)
            {
                var FName   = Path.GetFileName(RFile.FileName);
                var NewPath = Path.Combine(Hosting.WebRootPath, "Images", FName);
                RFile.CopyTo(new FileStream(NewPath, FileMode.Create));
                Item.ImagePath = FName;
                //var OldImageName = mItem.Find(id).ImagePath;
                //var OldPath = Path.Combine(Hosting.WebRootPath, "Images", OldImageName);
                //System.IO.File.Delete(OldPath);
            }
            var groupId = Item.Groups.Id;
            var group   = g_Method.Find(groupId);

            Item.Groups = group;
            mItem.Edit(Item, id);
            return(RedirectToPage("/Items/ShowItems"));
        }
예제 #24
0
        protected void LoadConfig(string name)
        {
            Assembly  assembly = Assembly.GetEntryAssembly();
            FFileInfo info     = new FFileInfo(assembly.Location);

            _path = info.DirectoryName;
            // Make file name
            string file = null;

            if (name != null && name.IndexOf(':') != -1)
            {
                file = name;
            }
            else
            {
                AssemblyName aname = assembly.GetName();
                if (name == null)
                {
                    file = RFile.MakeFileName(_path, aname.Name);
                }
                else
                {
                    file = RFile.MakeFileName(_path, name);
                }
                if (!file.EndsWith(TYPE_XML))
                {
                    file += TYPE_XML;
                }
            }
            // Load config
            FXmlDocument xdoc = new FXmlDocument();

            //xdoc.Formater.Formater = this;
            _exists = File.Exists(file);
            if (_exists)
            {
                _exists = true;
                xdoc.LoadFile(file);
            }
            // Set config
            _config = xdoc.Root;
            BuildConfigMap(_config);
        }
예제 #25
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (RFile.FileName != null)
            {
                var FName   = Path.GetFileName(RFile.FileName);
                var NewPath = Path.Combine(Hosting.WebRootPath, "Images", FName);
                RFile.CopyTo(new FileStream(NewPath, FileMode.Create));
                Item.ItemImage = FName;
            }
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Items.Add(Item);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
예제 #26
0
        //============================================================
        // <T>导入设置信息。</T>
        //============================================================
        public void ImportConfig()
        {
            Dispose();
            // 加载设置文件
            string fileName = _directory + "\\import." + _techniqueName + ".xml";

            if (RFile.Exists(fileName))
            {
                LoadOrignConfig(new FXmlDocument(fileName).Root);
            }
            // 压缩文件
            FCompressFile file = new FCompressFile();

            Serialize(file);
            file.Compress(_exportFileName);
            _logger.Debug(this, "Export", "Export scene success. (file_name={0})", _exportFileName);
            // 存储信息
            Store();
            _logger.Debug(this, "Import", "Import scene success. (file_name={0})", fileName);
        }
예제 #27
0
        //============================================================
        // <T>从文件中加载所有信息。</T>
        //============================================================
        public void RestoreFiles()
        {
            // 保存属性
            string    configName = RFile.MakeFileName(_storagePath, "applications.ser");
            FByteFile file       = new FByteFile(configName);
            // 写入个数
            int count = file.ReadInt32();

            // 保存所有程序信息
            for (int n = 0; n < count; n++)
            {
                FApplicationInfo info = new FApplicationInfo();
                info.Name = file.ReadString();
                // 保存程序信息
                string fileName = RFile.MakeFileName(_storagePath, info.Name + ".ser");
                info.LoadFile(fileName);
                _infos.Push(info);
                _activeInfo = info;
            }
        }
예제 #28
0
        //============================================================
        // <T>存储所有信息到文件中。</T>
        //============================================================
        public void StoreFiles()
        {
            // 保存属性
            FByteFile file = new FByteFile();
            // 写入个数
            int count = _infos.Count;

            file.WriteInt32(count);
            // 保存所有程序信息
            for (int n = 0; n < count; n++)
            {
                FApplicationInfo info = _infos.Get(n);
                file.WriteString(info.Name);
                // 保存程序信息
                string fileName = RFile.MakeFileName(_storagePath, info.Name + ".ser");
                info.SaveFile(fileName);
            }
            // 保存文件
            string configName = RFile.MakeFileName(_storagePath, "applications.ser");

            file.SaveFile(configName);
        }
예제 #29
0
        public RFile Pop()
        {
            RFile ret = null;

            if (_Size > 0)
            {
                TagNode TempNode = RootNode;
                ret = new RFile(TempNode.Value);
                if (RootNode.CenterChild != null)
                {
                    RootNode             = TempNode.CenterChild;
                    TempNode.CenterChild = null;
                    RootNode.AddNode(TempNode.LeftChild);
                    TempNode.LeftChild = null;
                    RootNode.AddNode(TempNode.RightChild);
                    TempNode.RightChild = null;
                }
                else if (RootNode.LeftChild != null)
                {
                    RootNode           = TempNode.LeftChild;
                    TempNode.LeftChild = null;
                    RootNode.AddNode(TempNode.RightChild);
                    TempNode.RightChild = null;
                }
                else if (RootNode.RightChild != null)
                {
                    RootNode            = TempNode.RightChild;
                    TempNode.RightChild = null;
                }
                else
                {
                    RootNode = null;
                }
                _Size--;
            }
            return(ret);
        }
예제 #30
0
 //============================================================
 // <T>打开处理。</T>
 //============================================================
 public void Open()
 {
     if (!RFile.Exists(_configFileName))
     {
         return;
     }
     if (_opened)
     {
         return;
     }
     using (FXmlDocument xdocument = new FXmlDocument(_configFileName)){
         FXmlNode xconfig = xdocument.Root;
         foreach (FXmlNode xnode in xconfig.Nodes)
         {
             if (xnode.IsName("Constant"))
             {
                 FTplConstant constant = new FTplConstant();
                 constant.LoadConfig(xnode);
                 _constants.Push(constant);
             }
         }
     }
     _opened = true;
 }