Esempio n. 1
0
        public override void LoadConfig(FXmlNode config)
        {
            FXmlNodes nodes = config.Nodes;

            if (nodes != null)
            {
                foreach (FXmlNode node in nodes)
                {
                    string flag = node[PTY_FLAG];
                    if (!RString.IsEmpty(flag))
                    {
                        if ("0".EndsWith(flag))
                        {
                            //_object0 = CreateObject(node);
                        }
                        else if ("1".EndsWith(flag))
                        {
                            //_object1 = CreateObject(node);
                        }
                        else
                        {
                            throw new FFatalException("Unknown flag. {0}", config.Dump());
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        //============================================================
        private void QDsTemplateEditorForm_Load(object sender, System.EventArgs e)
        {
            // 创建设备
            _device = RDxCore.Adapter.CreateDevice(pnlViewport.Handle, pnlViewport.Width, pnlViewport.Height);
            // 创建舞台
            FDxStage stage = new FDxStage();

            RDxCore.StageConsole.ActiveStage = stage;
            // 创建场景
            _scene        = new FDxDesignScene();
            _scene.Device = _device;
            _scene.Setup();
            _scene.Region.BackgroundColor.Set(0, 0, 0, 1);
            _scene.Region.BackgroundColor.Set(0.5f, 0.5f, 0.5f, 1.0f);
            _scene.Region.Camera.Viewport.width  = pnlSpace.Width;
            _scene.Region.Camera.Viewport.height = pnlSpace.Height;
            _scene.Region.Camera.Viewport.Update();
            _scene.Region.Camera.Position.Set(0, 200, -500);
            _scene.Region.Camera.LookAt(0, 200, 0);
            _scene.Region.LightDirectional.Position.Set(1000, 1000, 0);
            _scene.Region.LightDirectional.Camera.Position.Set(1000, 1000, 0);
            _scene.Region.LightDirectional.Camera.LookAt(0, 200, 0);
            // 加载模型
            if (!RString.IsEmpty(_templateName))
            {
                LoadTemplate(_templateName);
            }
            // 加载场景
            // qdsDeviceProperty.LoadDevice(_device);
            // qdsSceneTree.LoadScene(_scene);
            // 开始时钟
            timRefresh.Enabled = true;
            CenterToScreen();
        }
Esempio n. 3
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string mail = (string)parameters.Value;

            if (!RString.IsEmpty(mail))
            {
                string[] lines = RString.TrimLines(mail.Split('\n'), false);
                if (_maxCount > 0)
                {
                    if (lines.Length > _maxCount)
                    {
                        parameters.Description = _resource.FindDisplay(MSG_MAX_COUNT, _maxCount);
                        return(false);
                    }
                }
                foreach (string line in lines)
                {
                    if (!CheckMail(parameters, line))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 4
0
        public override void LoadConfig(FXmlNode config)
        {
            base.LoadConfig(config);
            // Load type
            string type = config[PTY_TYPE];

            if (!RString.IsEmpty(type))
            {
                _dataType = REnum.ToValue <EAopParameterType>(type);
            }
            // Load component
            if (config.HasNode())
            {
                FXmlNode node = config.Nodes[0];
                if (node.IsName(XAopComponent.TAG))
                {
                    _dataType = EAopParameterType.Component;
                }
            }
            // Load value
            if (_dataType == EAopParameterType.String)
            {
                _dataValue = config.Text;
            }
        }
Esempio n. 5
0
        //============================================================
        // <T>解析字符串内容。</T>
        //
        // @param value 字符串内容
        //============================================================
        public bool Parse(string value, bool alpha = true)
        {
            // 重置内容
            Reset();
            // 判断为空
            if (RString.IsEmpty(value))
            {
                return(false);
            }
            // 去除前置符号#
            if (value.StartsWith("#"))
            {
                value = value.Substring(1);
            }
            // 去除前置符号0x
            if (value.StartsWith("0x"))
            {
                value = value.Substring(2);
            }
            // 解析内容
            int result = Convert.ToInt32(value, 16);

            Parse(result, alpha);
            return(true);
        }
Esempio n. 6
0
        //============================================================
        // <T>解析颜色字符串为数字。</T>
        //
        // @param source 字符串
        // @return 整数
        //============================================================
        public static int ParseHex(string source)
        {
            // 解析内容
            if (RString.IsEmpty(source))
            {
                return(0);
            }
            if (!RInt.IsHex(source))
            {
                return(0);
            }
            string value = source.Trim();

            if (value.Length == 0)
            {
                return(0);
            }
            // 去除前缀
            if (value.StartsWith("#"))
            {
                value = value.Substring(1);
            }
            if (value.StartsWith("0x"))
            {
                value = value.Substring(2);
            }
            // 转换为数字
            int result = Convert.ToInt32(value, 16);

            if (value.Length <= 6)
            {
                result |= 0xFF << 24;
            }
            return(result);
        }
Esempio n. 7
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string value = RString.Nvl(parameters.Value);

            if (!RString.IsEmpty(value))
            {
                string[] items = value.Split('.');
                if (items.Length != 4)
                {
                    parameters.Description = _resource.FindDisplay(MSG_INVALID, _description);
                    return(false);
                }
                foreach (string item in items)
                {
                    int result = 0;
                    if (!Int32.TryParse(item, out result))
                    {
                        parameters.Description = _resource.FindDisplay(MSG_INVALID, _description);
                        return(false);
                    }
                    if (result < 0 || result > 255)
                    {
                        parameters.Description = _resource.FindDisplay(MSG_INVALID, _description);
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 8
0
 public bool CheckMail(FValidatorParameters parameters, string mail)
 {
     if (!RString.IsEmpty(mail))
     {
         mail = mail.Trim();
         // Check @
         int at = mail.IndexOf('@');
         if (at == -1)
         {
             parameters.Result      = false;
             parameters.Description = _resource.FindDisplay(MSG_NOT_FIND_AT, mail);
             return(false);
         }
         // Check .
         int dot = mail.IndexOf('.', at + 1);
         if (dot == -1)
         {
             parameters.Result      = false;
             parameters.Description = _resource.FindDisplay(MSG_NOT_FIND_DOT, mail);
             return(false);
         }
         // Check space
         string[] items = mail.Split('@', '.');
         foreach (string item in items)
         {
             if (RString.IsEmpty(item))
             {
                 parameters.Result      = false;
                 parameters.Description = _resource.FindDisplay(MSG_INVALID, mail);
                 return(false);
             }
         }
     }
     return(true);
 }
Esempio n. 9
0
 public override string GetDetailInfo()
 {
     if (RString.IsEmpty(_fileName))
     {
         return(null);
     }
     return(_resource.FindDisplay(RES_DETAIL_FILE, _fileName));
 }
Esempio n. 10
0
 public override void Push(FFunctionInfo item)
 {
     if (!RString.IsEmpty(item.Name))
     {
         _names[item.Name] = item;
     }
     base.Push(item);
 }
Esempio n. 11
0
 //============================================================
 // <T>获得显示内容。</T>
 //============================================================
 public string FormatDisplay()
 {
     if (!RString.IsEmpty(_text))
     {
         return(_text);
     }
     return(_label);
 }
Esempio n. 12
0
        //============================================================
        // <T>打开文件夹处理。</T>
        //
        // @param sender 发送者
        // @param e 事件
        //============================================================
        private void tsbFolder_Click(object sender, EventArgs e)
        {
            string directory = _resourcePicture.Directory;

            if (!RString.IsEmpty(directory))
            {
                System.Diagnostics.Process.Start(directory);
            }
        }
Esempio n. 13
0
        //============================================================
        // <T>打开内容处理。</T>
        //
        // @param sender 发送者
        // @param e 事件
        //============================================================
        private void tsbOpen_Click(object sender, EventArgs e)
        {
            string fileName = _resourcePicture.FileName;

            if (!RString.IsEmpty(fileName))
            {
                System.Diagnostics.Process.Start(fileName);
            }
        }
Esempio n. 14
0
        //============================================================
        // <T>加载配置信息。</T>
        //
        // @param xconfig 配置信息
        //============================================================
        public void LoadConfig(FXmlNode xconfig)
        {
            // 读取属性
            _name  = xconfig.Nvl("name");
            _label = String.Empty;
            // 读取设置
            LoadConfigInfo(xconfig);
            // 读取高度
            FXmlNode xheight = xconfig.Find("Height");

            if (null != xheight)
            {
                //_optionHeight = xconfig.GetInteger("option_height", _optionHeight);
                _heightDepth = xheight.GetFloat("depth");
            }
            // 读取表面
            FXmlNode xsurface = xconfig.Find("Surface");

            if (null != xsurface)
            {
                _surfaceRate        = xsurface.GetFloat("rate");
                _surfaceReflect     = xsurface.GetFloat("reflect");
                _surfaceBright      = xsurface.GetFloat("bright");
                _surfaceBrightLevel = xsurface.GetFloat("bright_level");
                _surfaceCoarse      = xsurface.GetFloat("coarse");
                _surfaceCoarseLevel = xsurface.GetFloat("coarse_level");
                _surfaceMerge       = xsurface.GetFloat("merge");
                _surfacePower       = xsurface.GetFloat("power");
            }
            if (!RString.IsEmpty(_name))
            {
                _material = RContent3dManager.MaterialConsole.FindDefault(_scene.ThemeName, _name);
                if (null == _material)
                {
                    RMoCore.TrackConsole.Write(this, "LoadConfig", "Scene material is not exists. (scene={0}, material={1})", _scene.Code, Code);
                }
                else
                {
                    _label               = _material.Group.Label;
                    _transformName       = _material.TransformName;
                    _optionLight         = _material.OptionLight;
                    _optionMerge         = _material.OptionMerge;
                    _optionSort          = _material.OptionSort;
                    _sortLevel           = _material.SortLevel;
                    _optionAlpha         = _material.OptionAlpha;
                    _optionDepth         = _material.OptionDepth;
                    _optionCompare       = _material.OptionCompare;
                    _optionDouble        = _material.OptionDouble;
                    _optionShadow        = _material.OptionShadow;
                    _optionShadowSelf    = _material.OptionShadowSelf;
                    _optionDynamic       = _material.OptionDynamic;
                    _optionTransmittance = _material.OptionTransmittance;
                    _optionOpacity       = _material.OptionOpacity;
                }
            }
        }
Esempio n. 15
0
 //============================================================
 // <T>根据属性名称,设置非空属性内容。</T>
 //
 // @param name 属性名称
 // @param value 属性内容
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public void SetNvl(string name, string value, string defaultValue = null)
 {
     if (!RString.IsEmpty(value))
     {
         if (value != defaultValue)
         {
             Attributes.Set(name, value);
         }
     }
 }
Esempio n. 16
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string value = (string)parameters.Value;

            if (RString.IsEmpty(value))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 17
0
        //============================================================
        // <T>生成标志集合。</T>
        //
        // @return 标志集合
        //============================================================
        public override int MakeSerializeFlags()
        {
            int flags = base.MakeSerializeFlags();

            // 设置信息
            if (!RString.IsEmpty(_dataName))
            {
                flags |= (int)ERcFlag.Data;
            }
            return(flags);
        }
Esempio n. 18
0
        public override void LoadConfig(FXmlNode config)
        {
            // Id
            _id = config[PTY_ID];
            // Face
            _faceName = config[PTY_FACE];
            // Type
            _typeName = config[PTY_TYPE];
            // Scope
            string scope = config[PTY_SCOPE];

            if (!RString.IsEmpty(scope))
            {
                _scope = REnum.ToValue <EScope>(scope);
            }
            // Load config
            if (config.HasNode())
            {
                foreach (FXmlNode node in config.Nodes)
                {
                    if (node.IsName(XAopConstructor.TAG))
                    {
                        // Constructor
                        if (_constructor != null)
                        {
                            throw new FFatalException("Constructor can't be duplicate.\n{1}", config.Dump());
                        }
                        _constructor = new XAopConstructor();
                        _constructor.LoadConfig(node);
                    }
                    else if (node.IsName(XAopProperty.TAG))
                    {
                        // Properties
                        XAopProperty property = new XAopProperty();
                        property.LoadConfig(node);
                        _properties.Push(property);
                    }
                    else if (node.IsName(XAopInitialize.TAG))
                    {
                        // Initializes
                        XAopInitialize method = new XAopInitialize();
                        method.LoadConfig(node);
                        _initializes.Push(method);
                    }
                    else if (node.IsName(XAopRelease.TAG))
                    {
                        // Releases
                        XAopRelease method = new XAopRelease();
                        method.LoadConfig(node);
                        _releases.Push(method);
                    }
                }
            }
        }
Esempio n. 19
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string value = RString.Nvl(parameters.Value);

            if (RString.IsEmpty(value))
            {
                parameters.Description = _resource.FindDisplay(MSG_IS_EMPTY, _description);
                return(false);
            }
            return(true);
        }
Esempio n. 20
0
 //============================================================
 // <T>根据属性名称,获得整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public float GetFloat(string name, float defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RFloat.Parse(value));
         }
     }
     return(defaultValue);
 }
Esempio n. 21
0
 //============================================================
 // <T>根据属性名称,获得长整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public long GetLong(string name, long defaultValue)
 {
     if (_attributes != null)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RLong.Parse(value));
         }
     }
     return(defaultValue);
 }
Esempio n. 22
0
 //============================================================
 // <T>根据属性名称,获得整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public bool GetBoolean(string name, bool defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RBool.IsTrue(value));
         }
     }
     return(defaultValue);
 }
Esempio n. 23
0
 //============================================================
 // <T>根据属性名称,获得属性内容。</T>
 //
 // @param name 属性名称
 // @return 属性内容
 //============================================================
 public string Get(string name, string defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(value);
         }
     }
     return(defaultValue);
 }
Esempio n. 24
0
 public void Push(IAopNode config)
 {
     if (!_duplicate && _ids.Contains(config.Id))
     {
         throw new FFatalException("Has contains node(id={0})", config.Id);
     }
     base.Push((T)config);
     if (!RString.IsEmpty(config.Id))
     {
         _ids[config.Id] = (T)config;
     }
 }
Esempio n. 25
0
 //============================================================
 // <T>发件。</T>
 //============================================================
 public void Send(FMail mail)
 {
     //_nativeSmtp.EnableSsl = true;
     _nativeSmtp.Timeout = 9999;
     _nativeSmtp.UseDefaultCredentials = false;
     if (!RString.IsEmpty(_loginId) && !RString.IsEmpty(_loginPw))
     {
         _nativeSmtp.Credentials = new NetworkCredential(_loginId, _loginPw);
     }
     _nativeSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
     _nativeSmtp.Send(mail._nativeMail);
 }
Esempio n. 26
0
 //============================================================
 // <T>根据属性名称,获得整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public int GetInteger(string name, int defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RInt.Parse(value));
         }
     }
     return(defaultValue);
 }
Esempio n. 27
0
        public override bool DoCheck(FValidatorParameters parameters)
        {
            string value = RString.Nvl(parameters.Value);

            if (!RString.IsEmpty(value))
            {
                if (!RString.CheckPattern(value, _partternChars))
                {
                    parameters.Description = _resource.FindDisplay(MSG_INVALID_PARTTERN, _description);
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 28
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public virtual bool Parse(string value)
 {
     if (!RString.IsEmpty(value))
     {
         string[] data = value.Split(',');
         if (data.Length == 2)
         {
             Width  = RInt.Parse(data[0]);
             Height = RInt.Parse(data[1]);
             return(true);
         }
     }
     return(false);
 }
Esempio n. 29
0
 public override void LoadConfig(FXmlNode config)
 {
     base.LoadConfig(config);
     _description = config[PTY_DESCRIPTION];
     _parttern    = config[PTY_PARTTERN];
     if ("{filename}".EndsWith(_parttern, StringComparison.CurrentCultureIgnoreCase))
     {
         _parttern = PTN_FILENAME;
     }
     if (!RString.IsEmpty(_parttern))
     {
         _partternChars = RString.MakePattern(_parttern);
     }
 }
Esempio n. 30
0
 public override void LoadConfig(FXmlNode config)
 {
     base.LoadConfig(config);
     // Face
     if (!RString.IsEmpty(_faceName))
     {
         _linkFace = _console.FindType(_faceName);
     }
     // Type
     if (!RString.IsEmpty(_typeName))
     {
         _linkType = _console.FindType(_typeName);
         _descriptor.Parse(_linkType);
     }
 }