Exemplo n.º 1
0
        public bool IsAffectedByLight(CModel model)
        {
            BoundingSphere lightSphere = new BoundingSphere(Transform.Position, Range);
            BoundingBox    meshBox     = new BoundingBox(model.AABoxMin, model.AABoxMin);

            return(lightSphere.Intersects(meshBox));
        }
Exemplo n.º 2
0
        public SimulationManager(GraphicsDevice device, ContentManager content)
        {
            if (Instance != null)
            {
                throw new InvalidOperationException("Cannot create more than once instance of the simulation manager.");
            }
            Instance = this;

            _sb       = new SpriteBatch(device);
            _blankTex = new Texture2D(device, 1, 1);
            _blankTex.SetData(new Color[] { Color.White });

            _device    = device;
            _world     = new WorldModel(device, (int)Constants.WorldSize.X / 10);
            _uavModel  = new CModel(device, content.Load <Model>("UAV"));
            _tankModel = new CModel(device, content.Load <Model>("tank"));
            _missModel = new CModel(device, content.Load <Model>("sphere_missile"));
            _cone      = new ConeModel(device);
            _ring      = new RingModel(device, Constants.TankFiringRange / 10, 1);

            _font  = content.Load <SpriteFont>("debugfont");
            _lRect = new Rectangle(0, 0, 130, 70);

            Simulation = new Simulation();

            _entityFollow = new EntityFollowBehavior();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询一行记录
        /// </summary>
        /// <param name="filter">过滤器</param>
        /// <returns>返回单条数据</returns>
        public CModel GetModel(ModelFilter filter)
        {
            string sql = filter.ExecuteSql.ToString();

            CModel model = null;

            try
            {
                SqlDataReader reader = SqlRequest.GetReader(sql, filter.GetParams());

                while (reader.Read())
                {
                    model = new CModel(filter.TableName);

                    foreach (var field in filter.Fields)
                    {
                        model[field] = reader[field];
                    }
                }


                reader.Close();

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates new chase  camera with default target model
 /// </summary>
 /// <param name="graphicsDevice"></param>
 /// <param name="model"></param>
 public ChaseCamera(GraphicsDevice graphicsDevice, CModel model) : base(graphicsDevice)
 {
     Model                  = model;
     PositionOffset         = new Vector3(model.Position.X, model.Position.Y, Model.Position.Z + 1500);
     TargetOffset           = new Vector3(Model.Position.X, Model.Position.Y + 200, Model.Position.Z);
     RelativeCameraRotation = Vector3.Zero;
 }
Exemplo n.º 5
0
        public bool TriggerTrap(int[] explorerPosition)
        {
            if (Position[0] != explorerPosition[0] || Position[1] != explorerPosition[1])
            {
                return(false);
            }

            if (PlayScene.Random.Next(1, 3) == 1)
            {
#if DEBUG
                Main.InsertLog("Explorer: Agrrrr!!!");
#endif
                SoundController.PlaySound(PlayContentHolder.Instance.SoundRock);
                rock   = new CModel(PlayContentHolder.Instance.ModelRock, new Vector3(Position[1] * 10 + 5, 36, Position[0] * 10 + 5));
                _state = TrapState.Rock;
                _parent.Explorer.Shock();
                timeline = 90;
            }
            else
            {
#if DEBUG
                Main.InsertLog("Explorer: Aaaaa....");
#endif
                SoundController.PlaySound(PlayContentHolder.Instance.SoundPit);
                _state = TrapState.Hole;
                _parent.Floor.HideMesh(Position[0] * _parent.MazeSize + Position[1]);
                _parent.Explorer.Fall();
            }

            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 根据主键获取一行记录
        /// </summary>
        /// <param name="table"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public CModel GetModelByKey(string table, object key)
        {
            CModel m_table = new CModel(table);

            string sql = SqlSplice.GetSelect(m_table, key);

            CModel model = null;

            try
            {
                SqlDataReader reader = SqlRequest.GetReader(sql, SqlSplice.SqlParams.ToArray());

                while (reader.Read())
                {
                    model = new CModel(table);

                    foreach (var field in model.Fields)
                    {
                        model[field] = reader[field];
                    }
                }



                return(model);
            }
            catch (Exception ex)
            {
                throw new Exception("根据主键查询一行记录出错了", ex);
            }
        }
    public static void Main(String[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("Need one argument, copasi file");
            Environment.Exit(1);
        }

        CDataModel dataModel = CRootContainer.addDatamodel();

        if (!dataModel.loadModel(args[0]))
        {
            Console.WriteLine("Could not open file");
            Console.WriteLine(CCopasiMessage.getAllMessageText());
            Environment.Exit(1);
        }

        CModel model = dataModel.getModel();
        ModelParameterSetVectorN sets = model.getModelParameterSets();

        // if we don't have one, create one
        if (sets.size() == 0)
        {
            CModelParameterSet newSet = new CModelParameterSet("Current State", model);
            newSet.createFromModel();
            printParameterSet(newSet);
            sets.add(newSet);
        }

        // interrogate the exiting parameter sets
        printExistingParametersets(model.getModelParameterSets());
    }
Exemplo n.º 8
0
        public Trap(int[] position, PlayScene parent)
        {
            _parent = parent;
            trap    = new CModel(PlayContentHolder.Instance.ModelTrap, new Vector3(position[1] * 10 + 5, 0.02f, position[0] * 10 + 5));

            Position = position;
        }
Exemplo n.º 9
0
 public CModelRenderNode(object outer, CModel model) : base(outer)
 {
     m_model         = model;
     m_bounds.center = m_model.AABoxCenter;
     m_bounds.extent = (m_model.AABoxMax - m_model.AABoxMin) / 2;
     IsFullyLoaded   = true;
 }
Exemplo n.º 10
0
        /// <summary>
        /// 删除多行记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="models"></param>
        public void DeleteModels <T>(List <T> models)
        {
            if (models.Count <= 0)
            {
                return;
            }


            List <CModel> cmodels = new List <CModel>();

            foreach (var model in models)
            {
                CModel cmodel = null;

                cmodel = JsonConverter.ModelToCModel <T>(model);

                if (cmodel == null)
                {
                    throw new Exception("实体对象为空");
                }

                cmodels.Add(cmodel);
            }

            if (cmodels.Count <= 0)
            {
                return;
            }


            DeleteModels(cmodels);
        }
Exemplo n.º 11
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // Load the models
            _uavModel  = new CModel(GraphicsDevice, Content.Load <Model>("UAV"));
            _tankModel = new CModel(GraphicsDevice, Content.Load <Model>("tank"));
        }
Exemplo n.º 12
0
 public void SetInit()
 {
     skinnedModel.Position.Y = -15;
     tile = new CModel(
         PlayContentHolder.Instance.ModelTile[parent.IsDarkness ? 2 : (position[0] * parent.MazeSize + position[1]) % 2],
         skinnedModel.Position
         );
 }
Exemplo n.º 13
0
        public M8ViewModel(CModel cModel, IEventAggregator ea)
        {
            MyCModel = cModel;
            _ea      = ea;
            _ea.GetEvent <LanguageChangeEvent>().Subscribe(ChangedLang);

            //TabItemのHeaderになる言葉を多言語設定の為Resoucesから取り出す
            Title = CModel.GetLocalizedValue <string>("TITLEM8");
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取Sql参数
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static SqlParameter[] GetSqlParams(CModel model)
        {
            foreach (var field in model.Fields)
            {
                SqlParams.Add(new SqlParameter($"@{field}", model[field]));
            }

            return(SqlParams.ToArray());
        }
Exemplo n.º 15
0
 public Setups(object sender)
 {
     InitializeComponent();
     Model = (CModel)sender;
     List<string> temp=new List<string>();
     foreach (string str in Model.gridsToLook)
         temp.Add(str);
     textBox1.Lines = temp.ToArray();
 }
Exemplo n.º 16
0
        public SoundModel(CModel _commondata, IEventAggregator _ea)
        {
            ea         = _ea;
            commondata = _commondata;

            InitPlotModelRT();
            InitPlotModelFFT();
            InitPlotModelSpectrogram();
        }
    public static void Main(String[] args)
    {
        // create a new datamodel
        CDataModel dataModel = CRootContainer.addDatamodel();

        if (args.Length != 1)
        {
            Console.WriteLine("Need one argument: SBML | CPS filename.");
            Environment.Exit(1);
        }

        String filename = args[0];

        try
        {
            String ext = System.IO.Path.GetExtension(filename);
            if (ext.Trim().ToLowerInvariant().EndsWith("xml"))
            {
                // load the model without progress report
                dataModel.importSBML(filename);
            }
            else
            {
                // load the model without progress report
                dataModel.loadModel(filename);
            }
        }
        catch
        {
            Console.WriteLine("Error while loading the model from file named \"" + filename + "\".");
            Environment.Exit(1);
        }
        try
        {
            CModel model          = dataModel.getModel();
            int    numAnnotations = model.getNumUnsupportedAnnotations();
            Console.WriteLine("The model has: " + numAnnotations + " unsupported annotations.");

            if (numAnnotations == 0)
            {
                Console.WriteLine("adding custom annotation");
                // we don't have an annotation, so lets add one
                if (!model.addUnsupportedAnnotation("http://myannotation.org", "<test xmlns='http://myannotation.org' value='blaaaahaaa'/>"))
                {
                    Console.WriteLine("couldn't set annotation: ");
                    Console.WriteLine(CCopasiMessage.getAllMessageText());
                }
            }
            Console.WriteLine("The name of the first is: " + model.getUnsupportedAnnotationName(0));
            Console.WriteLine("The raw xml of the first is: " + model.getUnsupportedAnnotation(0));
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
        }
    }
Exemplo n.º 18
0
        public MAViewModel(CModel commonModel, IEventAggregator ea, IRegionManager regionManager)
        {
            MyCModel = commonModel;
            _ea      = ea;
            _ea.GetEvent <LanguageChangeEvent>().Subscribe(ChangedLang);

            //TabItemのHeaderになる言葉を多言語設定の為Resoucesから取り出す
            Title          = CModel.GetLocalizedValue <string>("TITLEMA");
            _regionManager = regionManager;
        }
Exemplo n.º 19
0
        /// <summary>
        /// 实体转CModel
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public static CModel ModelToCModel <T>(T t)
        {
            CModel model = null;

            string str_json = ObjectToJson <T>(t);

            model = JsonToCModel <T>(str_json);

            return(model);
        }
Exemplo n.º 20
0
 private void ReadTextureMapBlock(EndianBinaryReader reader, CModel currentModel)
 {
     currentModel.TextureMapCount = reader.ReadInt32();
     for (int i = 0; i < currentModel.TextureMapCount; i++)
     {
         float tU = reader.ReadSingle();
         float tV = reader.ReadSingle();
         _models._vertexTextureMap.Add(new Vector2(tU, tV));
     }
 }
Exemplo n.º 21
0
        private void ReadFaceMaterialsBlock(EndianBinaryReader reader, CModel currentModel)
        {
            int nbrFaceMaterials = reader.ReadInt32();
            int bytesPerEntry    = reader.ReadInt32();

            for (int i = 0; i < nbrFaceMaterials; i++)
            {
                int matIndex = reader.ReadInt16() - 1;   //-1 because it is 1-based
                currentModel.Polygons[i].MaterialIndex = matIndex;
            }
        }
Exemplo n.º 22
0
        private void ReadVertexBlock(EndianBinaryReader reader, CModel currentModel)
        {
            currentModel.VertexBaseIndex = _models._vertexPositions.Count;
            currentModel.VertexCount     = reader.ReadInt32();

            for (int i = 0; i < currentModel.VertexCount; i++)
            {
                Vector3 vertex = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
                _models._vertexPositions.Add(vertex);
            }
        }
Exemplo n.º 23
0
        private void ReadMaterialsBlock(EndianBinaryReader reader, CModel currentModel)
        {
            currentModel.MaterialNames = new List <string>();
            int nbrMaterials = reader.ReadInt32();

            for (int i = 0; i < nbrMaterials; i++)
            {
                string material = ReadNullTerminatedString(reader);
                currentModel.MaterialNames.Add(material);
            }
        }
Exemplo n.º 24
0
 public void RiseUpDone()
 {
     tile = null;
     if (PlayScene.Random.Next(1, 3) == 1)
     {
         Dance();
     }
     else
     {
         Spin();
     }
 }
Exemplo n.º 25
0
 public void UpdateClient(CModel model)
 {
     try
     {
         SqlDataAccess sql = new SqlDataAccess();
         sql.SaveData("dbo.spClientsUpdate", model, "WMData");
     }
     catch (Exception ex)
     {
         throw new InvalidDataException($"UpdateClient(CPostModel model) coundn't update data.(model.PhoneNumber = {model.PhoneNumber})", ex);
     }
 }
Exemplo n.º 26
0
        public MainWindowViewModel(CModel commondata, IEventAggregator ea)
        {
            _ea          = ea;
            MyCommonData = commondata;

            LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
            LocalizeDictionary.Instance.Culture = new CultureInfo(System.Globalization.CultureInfo.CurrentCulture.Name);
            //LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("ja-JP");
            Title = CModel.GetLocalizedValue <string>("TITLE");

            _ea.GetEvent <LanguageChangeEvent>().Subscribe(ChangedLang);
            _ea.GetEvent <MessageSentEvent>().Subscribe(SetMessage);
            //Trace.WriteLine("main");
        }
Exemplo n.º 27
0
 public Export(object sender, object model)
 {
     MF = (Main_Form)sender;
     Model = (CModel)model;
     InitializeComponent();
     foreach (CModel.DProperty prop in Model.Props)
     {
         DataGridViewRow row = new DataGridViewRow();
         row.CreateCells(dataGridView1);
         row.Cells[0].Value = prop.Name;
         row.Cells[1].Value = prop.Name + "_out.txt";
         dataGridView1.Rows.Add(row);
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// 实体集合转CModel集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="objs"></param>
        /// <returns></returns>
        public static List <CModel> ModelToCModels <T>(List <T> objs)
        {
            List <CModel> cmodels = null;


            foreach (var obj in objs)
            {
                CModel cmodel = ModelToCModel <T>(obj);
                cmodels.Add(cmodel);
            }


            return(cmodels);
        }
Exemplo n.º 29
0
        /// <summary>
        /// CModel转实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public static T CModelToModel <T>(CModel model)
        {
            string json = JsonSerializer(model.FieldsValue);

            //object m_obj = JsonConverter.JsonDeserialize(json);

            json = json.Replace(",\"Value\"", string.Empty);
            json = json.Replace("\"Key\":", string.Empty);
            json = json.Replace("{", string.Empty);
            json = json.Replace("}", string.Empty);
            json = json.Replace("[", "{");
            json = json.Replace("]", "}");

            return(JsonDeserialize <T>(json));
        }
Exemplo n.º 30
0
        /// <summary>
        /// 查询多行记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filter">过滤器</param>
        /// <returns></returns>
        public List <T> GetModels <T>(ModelFilter filter)
        {
            Type type = typeof(T);

            string sql = filter.ExecuteSql.ToString();

            List <CModel> models = new List <CModel>();

            try
            {
                SqlDataReader reader = SqlRequest.GetReader(sql, filter.Params.ToArray());

                while (reader.Read())
                {
                    CModel model = new CModel(type);

                    foreach (var field in model.Fields)
                    {
                        model[field] = reader[field];
                    }

                    models.Add(model);
                }

                reader.Close();


                List <T> m_objs = new List <T>();

                if (models.Count <= 0)
                {
                    return(m_objs);
                }

                foreach (var model in models)
                {
                    T m_obj = JsonConverter.CModelToModel <T>(model);

                    m_objs.Add(m_obj);
                }

                return(m_objs);
            }
            catch (Exception ex)
            {
                throw new Exception("查询多行记录出错了", ex);
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// 返回删除语句
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public static string GetDelete(CModel model)
        {
            SqlParamsClear();

            StringBuilder sql = new StringBuilder();

            sql.Append($" DELETE  FROM  {model.TableName}  ");

            sql.Append($" WHERE {model.KeyName}=@{model.KeyName}");

            SqlParams.Add(new SqlParameter($"@{model.KeyName}", model.KeyValue));

            InitSql = sql.ToString();

            return(sql.ToString());
        }
Exemplo n.º 32
0
        private void init_View_YK(CModel tpl)
        {
            int iPos   = 0;
            int iCount = 0;

            foreach (var t in tpl.lst_Table_YK.Values)
            {
                dgv_YK.RowCount += 1;
                iPos             = 0;
                dgv_YK.Rows[iCount].Cells[iPos++].Value = t.Id;
                dgv_YK.Rows[iCount].Cells[iPos++].Value = t.GroupName;
                dgv_YK.Rows[iCount].Cells[iPos++].Value = t.ItemName;
                dgv_YK.Rows[iCount].Cells[iPos++].Value = t.DataType;
                dgv_YK.Rows[iCount].Cells[iPos++].Value = getHex(t.Addr);
                iCount += 1;
            }
        }
Exemplo n.º 33
0
        /// <summary>
        /// Gets the SBML identifier.
        /// </summary>
        /// <returns>
        /// The SBML identifier.
        /// </returns>
        /// <param name='model'>
        /// Model.
        /// </param>
        /// <param name='channel'>
        /// Channel.
        /// </param>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='name'>
        /// Name.
        /// </param>
        static string GetSBMLId(CModel model, CPlotDataChannelSpec channel, out VariableType type, out string name)
        {
            var path = channel.getString();
            var last = path.Substring(path.LastIndexOf(",", StringComparison.Ordinal) + 1);
            var first = path.Substring(0, path.LastIndexOf(",", StringComparison.Ordinal));

            type = VariableType.Unknown;
            name = "unknown";

            if (last.EndsWith("Rate") || last.EndsWith("ParticleNumber"))
                return null;

            if (model.getCN().getString() == first)
            {
                type = VariableType.Time;
                name = "Time";
                return "time";
            }

            for (int i = 0; i < model.getMetabolites().size(); i++)
            {
                var current = model.getMetabolite((uint)i);
                if (current.getCN().getString() == first)
                {
                    type = VariableType.Species;
                    name = current.getObjectDisplayName();
                    return current.getSBMLId();
                }
            }

            for (int i = 0; i < model.getCompartments().size(); i++)
            {
                var current = model.getCompartment((uint)i);
                if (current.getCN().getString() == first)
                {
                    type = VariableType.Compartment;
                    name = current.getObjectDisplayName();
                    return current.getSBMLId();
                }
            }

            for (int i = 0; i < model.getModelValues().size(); i++)
            {
                var current = model.getModelValue((uint)i);
                if (current.getCN().getString() == first)
                {
                    type = VariableType.Parameter;
                    name = current.getObjectDisplayName();
                    return current.getSBMLId();
                }
            }

            for (int i = 0; i < model.getReactions().size(); i++)
            {
                var current = model.getReaction((uint)i);
                if (current.getCN().getString() == first)
                {
                    type = VariableType.Reaction;
                    name = current.getObjectDisplayName();
                    return current.getSBMLId();
                }
            }

            return null;
        }
Exemplo n.º 34
0
        private void ReadVertexBlock(EndianBinaryReader reader, CModel currentModel)
        {
            currentModel.VertexBaseIndex = _models._vertexPositions.Count;
            currentModel.VertexCount = reader.ReadInt32();

            for (int i = 0; i < currentModel.VertexCount; i++)
            {
                Vector3 vertex = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
                _models._vertexPositions.Add(vertex);
            }
        }
Exemplo n.º 35
0
 private void ReadMaterialsBlock(EndianBinaryReader reader, CModel currentModel)
 {
     currentModel.MaterialNames = new List<string>();
     int nbrMaterials = reader.ReadInt32();
     for (int i = 0; i < nbrMaterials; i++)
     {
         string material = ReadNullTerminatedString(reader);
         currentModel.MaterialNames.Add(material);
     }
 }
Exemplo n.º 36
0
        private void ReadFaceMaterialsBlock(EndianBinaryReader reader, CModel currentModel)
        {
            int nbrFaceMaterials = reader.ReadInt32();
            int bytesPerEntry = reader.ReadInt32();

            for (int i = 0; i < nbrFaceMaterials; i++)
            {
                int matIndex = reader.ReadInt16() - 1;   //-1 because it is 1-based
                currentModel.Polygons[i].MaterialIndex = matIndex;
            }
        }
Exemplo n.º 37
0
        private void ReadPolygonBlock(EndianBinaryReader reader, CModel model)
        {
            model.Polygons = new List<Polygon>();

            int polygonCount = reader.ReadInt32();

            for (int i = 0; i < polygonCount; i++)
            {
                UInt16 v1 = reader.ReadUInt16();
                UInt16 v2 = reader.ReadUInt16();
                UInt16 v3 = reader.ReadUInt16();

                byte unk1 = reader.ReadByte();
                byte unk2 = reader.ReadByte();
                byte unk3 = reader.ReadByte();

                Polygon polygon = new Polygon(v1, v2, v3);
                polygon.CalculateNormal(_models._vertexPositions, model.VertexBaseIndex);
                model.Polygons.Add(polygon);
            }
        }
Exemplo n.º 38
0
 private void ReadTextureMapBlock(EndianBinaryReader reader, CModel currentModel)
 {
     currentModel.TextureMapCount = reader.ReadInt32();
     for (int i = 0; i < currentModel.TextureMapCount; i++)
     {
         float tU = reader.ReadSingle();
         float tV = reader.ReadSingle();
         _models._vertexTextureMap.Add(new Vector2(tU, tV));
     }
 }
Exemplo n.º 39
0
        public DatFile(string filename, bool deformMainModel)
        {
            if (filename.EndsWith(".ACT", StringComparison.InvariantCultureIgnoreCase))
                filename = filename.ToUpper().Replace(".ACT", ".DAT"); //fix up some 3rd party vehicle weirdness

            CModel currentModel = null;

            Stream file = OpenDataFile(filename);
            if (!Exists)
                return;

            EndianBinaryReader reader = new EndianBinaryReader(EndianBitConverter.Big, file);

            while (true)
            {
                int type = reader.ReadInt32();
                int size = 0;
                if (type != (int)BlockType.Null)
                    size = reader.ReadInt32();

                switch (type)
                {
                    case (int)BlockType.Null:
                        break;

                    case (int)BlockType.ModelName:
                        reader.Seek(2, SeekOrigin.Current);
                        string name = ReadNullTerminatedString(reader);

                        if (deformMainModel && Path.GetFileNameWithoutExtension(name).Equals(Path.GetFileNameWithoutExtension(filename), StringComparison.InvariantCultureIgnoreCase))
                            currentModel = new CDeformableModel();
                        else
                            currentModel = new CModel();

                        currentModel.Name = name;
                        _models.Add(currentModel);

                        break;

                    case (int)BlockType.Vertices:
                        ReadVertexBlock(reader, currentModel);
                        break;

                    case (int)BlockType.Faces:
                        ReadPolygonBlock(reader, currentModel);
                        break;

                    case (int)BlockType.TextureCoords:
                        ReadTextureMapBlock(reader, currentModel);
                        break;

                    case (int)BlockType.Materials:
                        ReadMaterialsBlock(reader, currentModel);
                        break;

                    case (int)BlockType.FaceMaterials:
                        ReadFaceMaterialsBlock(reader, currentModel);
                        break;

                    default:
                        Debug.WriteLine("Unknown section: " + type);
                        reader.Seek(size, SeekOrigin.Current);
                        break;
                }

                if (reader.BaseStream.Position == reader.BaseStream.Length)
                    break;
            }

            reader.Close();
            if (filename == "FAUST.DAT")
            {
            }
            _models.Resolve(true);
        }
Exemplo n.º 40
0
        public void device_set_discount_curve(double[] df_i, CModel model)
        {
            host_d_set_discount_curve(df_i);
            CArray.alloc(ref _device_ir_yi, _host_d_ir_yi.Length, EType.float_t, EMemorySpace.device, model, "device_ir_yi");

            if (df_i != null)
            {
                CArray.alloc(ref _device_df_i, host_d_df_i.Length, EType.float_t, EMemorySpace.device, model, "device_df_i");
                float[] fdf_i = new float[host_d_df_i.Length];
                for (int i = 0; i < host_d_df_i.Length; i++)
                {
                    fdf_i[i] = (float)host_d_df_i[i];
                }
                CArray.copy(ref _device_df_i, fdf_i);
            }
        }
Exemplo n.º 41
0
        private void OkButton(object sender, RoutedEventArgs e)
        {
            long age = -1;
            long salary = -1;

            if (!String.IsNullOrWhiteSpace(nameBox.Text) && Int64.TryParse(ageBox.Text, out age)
                && Int64.TryParse(salaryBox.Text, out salary) && !String.IsNullOrWhiteSpace(phoneBox.Text))
            {
                CModel user = new CModel { Name = nameBox.Text, Age = age, Salary = salary, Phone = phoneBox.Text };
                App.dataBase.Insert(user);

                if (Frame.CanGoBack)
                    Frame.GoBack();
            }
        }