Exemple #1
0
        /// <summary>
        /// Initializes the Device Driver System.
        /// </summary>
        public static void Initialize()
        {
            // Create Resource Manager
            resourceManager = new ResourceManager();

            // Create Device Manager
            deviceManager = new DeviceManager();

            // Create the Device Driver Manager
            deviceDriverRegistry = new DeviceDriverRegistry(PlatformArchitecture.X86);

            // Create the PCI Controller Manager
            pciControllerManager = new PCIControllerManager(deviceManager);

            partitionManager = new PartitionManager(deviceManager);

            // Setup hardware abstraction interface
            var hardwareAbstraction = new Mosa.CoolWorld.x86.HAL.HardwareAbstraction();

            // Set device driver system to the hardware HAL
            Mosa.DeviceSystem.HAL.SetHardwareAbstraction(hardwareAbstraction);

            // Set the interrupt handler
            Mosa.DeviceSystem.HAL.SetInterruptHandler(ResourceManager.InterruptManager.ProcessInterrupt);
        }
        public ScrollableContainer(string uniqueName, Size size, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Size = size;

            if (RenderTargetCache.Targets.Contains(uniqueName))
                //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later.
                uniqueName = uniqueName + Guid.NewGuid();

            clippingRI = new RenderImage(uniqueName, Size.Width, Size.Height, ImageBufferFormats.BufferRGB888A8);
            scrollbarH = new Scrollbar(true, _resourceManager);
            scrollbarV = new Scrollbar(false, _resourceManager);
            scrollbarV.size = Size.Height;

            scrollbarH.Update(0);
            scrollbarV.Update(0);

            clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha;
            clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha;

            clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha;
            clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha;

            Update(0);
        }
Exemple #3
0
        public GameModeScene(IGameScreenManager manager)
            : base(manager)
        {
            services = (SCSServices)manager.Game.Services.GetService(typeof(SCSServices));

            resourceManager = (IResourceManager)manager.Game.Services.GetService(typeof(IResourceManager));
        }
 public AnalyticsScriptInjectingFilter(
     ISiteService siteService,
     IResourceManager resourceManager)
 {
     _siteService = siteService;
     _resourceManager = resourceManager;
 }
 public AppConfig(IResourceManager appSettings)
 {
     this.Env = appSettings.Get("Env", Env.Local);
     this.EnableCdn = appSettings.Get("EnableCdn", false);
     this.CdnPrefix = appSettings.Get("CdnPrefix", "");
     this.AdminUserNames = appSettings.Get("AdminUserNames", new List<string>());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HardwareResources"/> class.
 /// </summary>
 /// <param name="resourceManager">The resource manager.</param>
 /// <param name="ioPortRegions">The io port regions.</param>
 /// <param name="memoryRegions">The memory regions.</param>
 /// <param name="interruptHandler">The interrupt handler.</param>
 public HardwareResources(IResourceManager resourceManager, IIOPortRegion[] ioPortRegions, IMemoryRegion[] memoryRegions, IInterruptHandler interruptHandler)
 {
     this.resourceManager = resourceManager;
     this.ioPortRegions = ioPortRegions;
     this.memoryRegions = memoryRegions;
     this.interruptHandler = interruptHandler;
 }
        public BlueprintButton(string c1, string c1N, string c2, string c2N, string res, string resname,
                               IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Compo1 = c1;
            Compo1Name = c1N;

            Compo2 = c2;
            Compo2Name = c2N;

            Result = res;
            ResultName = resname;

            _icon = _resourceManager.GetSprite("blueprint");

            Label = new TextSprite("blueprinttext", "", _resourceManager.GetFont("CALIBRI"))
                        {
                            Color = Color.GhostWhite,
                            ShadowColor = Color.DimGray,
                            ShadowOffset = new Vector2(1, 1),
                            Shadowed = true
                        };

            Update(0);
        }
Exemple #8
0
        public Chatbox(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager,
                       IKeyBindingManager keyBindingManager)
        {
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;
            _keyBindingManager = keyBindingManager;

            Position = new Point((int)CluwneLib.CurrentClippingViewport.Width - (int)Size.X - 10, 10);

            ClientArea = new Rectangle(Position.X, Position.Y, (int) Size.X, (int) Size.Y);

            _textInputLabel = new Label("", "CALIBRI", _resourceManager)
                                  {
                                      Text =
                                          {
                                              Size = new Size(ClientArea.Width - 10, 12),
                                              Color = Color.Green
                                          }
                                  };

            _chatColors = new Dictionary<ChatChannel, Color>
                              {
                                  {ChatChannel.Default, Color.Gray},
                                  {ChatChannel.Damage, Color.Red},
                                  {ChatChannel.Radio, Color.DarkGreen},
                                  {ChatChannel.Server, Color.Blue},
                                  {ChatChannel.Player, Color.Green},
                                  {ChatChannel.Lobby, Color.White},
                                  {ChatChannel.Ingame, Color.Green},
                                  {ChatChannel.OOC, Color.White},
                                  {ChatChannel.Emote, Color.Cyan},
                                  {ChatChannel.Visual, Color.Yellow},
                              };
        }
 public DeltaScriptInclusionFilter(
     IEnumerable<IDeltaInstanceProvider> deltaInstanceProviders,
     IResourceManager resourceManager
     ) {
         _deltaInstanceProviders = deltaInstanceProviders;
         _resourceManager = resourceManager;
 }
        public ScrollableContainer(string uniqueName, Vector2i size, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Size = size;

            //if (RenderTargetCache.Targets.Contains(uniqueName))
            //    //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later.
            //    uniqueName = uniqueName + Guid.NewGuid();

            clippingRI = new RenderImage(uniqueName,(uint)Size.X,(uint) Size.Y);

            //clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha;
            //clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha;
            //clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha;
            //clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha;
            clippingRI.BlendSettings.ColorSrcFactor = BlendMode.Factor.SrcAlpha;
            clippingRI.BlendSettings.ColorDstFactor = BlendMode.Factor.OneMinusSrcAlpha;
            clippingRI.BlendSettings.AlphaSrcFactor = BlendMode.Factor.SrcAlpha;
            clippingRI.BlendSettings.AlphaDstFactor = BlendMode.Factor.OneMinusSrcAlpha;

            scrollbarH = new Scrollbar(true, _resourceManager);
            scrollbarV = new Scrollbar(false, _resourceManager);
            scrollbarV.size = Size.Y;

            scrollbarH.Update(0);
            scrollbarV.Update(0);

            Update(0);
        }
 public FacebookAuthProvider(IResourceManager appSettings)
     : base(appSettings, Realm, Name, "AppId", "AppSecret")
 {
     this.AppId = appSettings.GetString("oauth.facebook.AppId");
     this.AppSecret = appSettings.GetString("oauth.facebook.AppSecret");
     this.Permissions = appSettings.Get("oauth.facebook.Permissions", new string[0]);
 }
 public SceneNodeFactory(IShapeFactory shapeFactory, IResourceManager resourceManager)
 {
   if (shapeFactory == null) throw new ArgumentNullException("shapeFactory");
   if (resourceManager == null) throw new ArgumentNullException("resourceManager");
   _shapeFactory = shapeFactory;
   _resourceManager = resourceManager;
 }
Exemple #13
0
        public static IResourceManager GetResources()
        {
            if (m_instance == null)
                m_instance = ResourceManagerFactory.CreateResourceManager();

            return m_instance;            
        }
Exemple #14
0
 public CraftSlotUi(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager)
 {
     _resourceManager = resourceManager;
     _userInterfaceManager = userInterfaceManager;
     _sprite = _resourceManager.GetSprite("slot");
     _color = Color.White;
 }
 public TargetingDummyElement(string spriteName, BodyPart part, IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
     BodyPart = part;
     _elementSprite = _resourceManager.GetSprite(spriteName);
     Update(0);
 }
Exemple #16
0
 public HotbarSlot(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
     _buttonSprite = _resourceManager.GetSprite("hotbar_slot");
     Color = Color.White;
     Update(0);
 }
        public SiteConfig(IResourceManager resources)
        {
            OAuthURL = resources.GetString("OAuthURL");
            if (OAuthURL == null)
            {
                ThrowConfigException("OAuthURL");
            }

            AppID = resources.GetString("AppID");
            if (AppID == null)
            {
                ThrowConfigException("AppID");
            }
            SodaHost = resources.GetString("SodaHost");
            if (AppID == null)
            {
                ThrowConfigException("SodaHost");
            }

            SodaDataSet = resources.GetString("SodaDataSet");
            if (AppID == null)
            {
                ThrowConfigException("SodaDataSet");
            }

            ServiceRequestDataSet = resources.GetString("ServiceRequestDataSet");
            if (AppID == null)
            {
                ThrowConfigException("ServiceRequestDataSet");
            }
        }
Exemple #18
0
 public Checkbox(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
     checkbox = _resourceManager.GetSprite("checkbox0");
     checkboxCheck = _resourceManager.GetSprite("checkbox1");
     Update(0);
 }
Exemple #19
0
		public AnimSkin(IResourceManager resourceManager, ManagedList<AnimBone> b)
		{
			this.bones = b;
			this.resourceManager = resourceManager;
			this.skeleton = new ResourceReference(AnimSkel.TypeHash, resourceManager, this);
			this.skeletonModel = new ResourceReference(Model.TypeHash, resourceManager, this);
		}
        public TargetingDummy(IPlayerManager playerManager, INetworkManager networkManager,
                              IResourceManager resourceManager)
        {
            _networkManager = networkManager;
            _playerManager = playerManager;
            _resourceManager = resourceManager;

            var head = new TargetingDummyElement("dummy_head", BodyPart.Head, _resourceManager);
            var torso = new TargetingDummyElement("dummy_torso", BodyPart.Torso, _resourceManager);
            var groin = new TargetingDummyElement("dummy_groin", BodyPart.Groin, _resourceManager);
            var armL = new TargetingDummyElement("dummy_arm_l", BodyPart.Left_Arm, _resourceManager);
            var armR = new TargetingDummyElement("dummy_arm_r", BodyPart.Right_Arm, _resourceManager);
            var legL = new TargetingDummyElement("dummy_leg_l", BodyPart.Left_Leg, _resourceManager);
            var legR = new TargetingDummyElement("dummy_leg_r", BodyPart.Right_Leg, _resourceManager);

            _elements.Add(head);
            _elements.Add(torso);
            _elements.Add(groin);
            _elements.Add(armL);
            _elements.Add(armR);
            _elements.Add(legL);
            _elements.Add(legR);
            head.Clicked += Selected;
            torso.Clicked += Selected;
            groin.Clicked += Selected;
            armL.Clicked += Selected;
            armR.Clicked += Selected;
            legL.Clicked += Selected;
            legR.Clicked += Selected;
            Update(0);
            UpdateHealthIcon();
        }
Exemple #21
0
        public TileSpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Tile Spawn Panel", size, resourceManager)
        {
            _resourceManager = resourceManager;
            _placementManager = placementManager;

            _tileList = new ScrollableContainer("tilespawnlist", new Size(200, 400), _resourceManager)
                            {Position = new Point(5, 5)};
            components.Add(_tileList);

            var searchLabel = new Label("Tile Search:", "CALIBRI", _resourceManager) {Position = new Point(210, 0)};
            components.Add(searchLabel);

            _tileSearchTextbox = new Textbox(125, _resourceManager) {Position = new Point(210, 20)};
            _tileSearchTextbox.OnSubmit += tileSearchTextbox_OnSubmit;
            components.Add(_tileSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
                              {
                                  DrawBackground = true,
                                  DrawBorder = true,
                                  Position = new Point(210, 55)
                              };

            _clearLabel.Clicked += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            BuildTileList();

            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
        public RequestDelegate BuildBranch(IApplicationBuilder app, IEnumerable<IResourceStartup> resourceStartups, IEnumerable<IResource> resources, IResourceManager resourceManager)
        {
            var branchApp = app.New();
            branchApp.Map($"/{_serverOptions.BasePath}", glimpseApp =>
            {
                // REGISTER: resource startups
                foreach (var resourceStartup in resourceStartups)
                {
                    var startupApp = glimpseApp.New();

                    var resourceBuilderStartup = new ResourceBuilder(startupApp, resourceManager);
                    resourceStartup.Configure(resourceBuilderStartup);

                    glimpseApp.Use(next =>
                    {
                        startupApp.Run(next);

                        var startupBranch = startupApp.Build();

                        return context =>
                        {
                            if (CanExecute(context, resourceStartup.Type))
                            {
                                return startupBranch(context);
                            }

                            return next(context);
                        };
                    });
                }

                // REGISTER: resources
                var resourceBuilder = new ResourceBuilder(glimpseApp, resourceManager);
                foreach (var resource in resources)
                {
                    resourceBuilder.Run(resource.Name, resource.Parameters?.GenerateUriTemplate(), resource.Type, resource.Invoke);
                }

                glimpseApp.Run(async context =>
                {
                    // RUN: resources
                    var result = resourceManager.Match(context);
                    if (result != null)
                    {
                        if (CanExecute(context, result.Type))
                        {
                            await result.Resource(context, result.Paramaters);
                        }
                        else
                        {
                            // TODO: Review, do we want a 401, 404 or continue users pipeline 
                            context.Response.StatusCode = 401;
                        }
                    }
                });
            });
            branchApp.Use(subNext => { return async ctx => await _next(ctx); });

            return branchApp.Build();
        }
        public BlueprintButton(string c1, string c1N, string c2, string c2N, string res, string resname,
                               IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Compo1 = c1;
            Compo1Name = c1N;

            Compo2 = c2;
            Compo2Name = c2N;

            Result = res;
            ResultName = resname;

            _icon = _resourceManager.GetSprite("blueprint");

            Label = new TextSprite("blueprinttext", "", _resourceManager.GetFont("CALIBRI"))
                        {
                            Color = new SFML.Graphics.Color(248, 248, 255),
                            ShadowColor = new SFML.Graphics.Color(105, 105, 105),
                            ShadowOffset = new Vector2f(1, 1),
                            Shadowed = true
                        };

            Update(0);
        }
Exemple #24
0
 public Hotbar(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
     hotbarBG = resourceManager.GetSprite("main_hotbar");
     createSlots();
     Update(0);
 }
Exemple #25
0
		public EditorEnvironment(
			MainEditorWindow mainEditorWindow, IResourceManager resourceManager, IComponentContext context)
		{
			this.mainEditorWindow = mainEditorWindow;
			this.resourceManager = resourceManager;
			this.context = context;
		}
		public BinaryResourceFormat(
			IResourceManager resourceManager, IComponentContext context, IResourceErrorHandler errorHandler)
		{
			this.resourceManager = resourceManager;
			this.context = context;
			this.errorHandler = errorHandler;
		}
Exemple #27
0
 public MediaController(IResourceManager resourceManager,
     IImageHelper imageHelper,
     IRepository<ThumbnailSize> thumbRepository) {
     _resourceManager = resourceManager;
     _imageHelper = imageHelper;
     _thumbRepository = thumbRepository;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="YammerAuthProvider"/> class.
 /// </summary>
 /// <param name="appSettings">
 /// The application settings (in web.config).
 /// </param>
 public YammerAuthProvider(IResourceManager appSettings)
     : base(appSettings, appSettings.GetString("oauth.yammer.Realm"), Name, "ClientId", "AppSecret")
 {
     this.ClientId = appSettings.GetString("oauth.yammer.ClientId");
     this.ClientSecret = appSettings.GetString("oauth.yammer.ClientSecret");
     this.PreAuthUrl = appSettings.GetString("oauth.yammer.PreAuthUrl");
 }
        public HealthScannerWindow(Entity assignedEnt, Vector2D mousePos, UserInterfaceManager uiMgr,
                                   IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            assigned = assignedEnt;
            _uiMgr = uiMgr;

            _overallHealth = new TextSprite("hpscan" + assignedEnt.Uid.ToString(), "",
                                            _resourceManager.GetFont("CALIBRI"));
            _overallHealth.Color = Color.ForestGreen;

            _background = _resourceManager.GetSprite("healthscan_bg");

            _head = _resourceManager.GetSprite("healthscan_head");
            _chest = _resourceManager.GetSprite("healthscan_chest");
            _arml = _resourceManager.GetSprite("healthscan_arml");
            _armr = _resourceManager.GetSprite("healthscan_armr");
            _groin = _resourceManager.GetSprite("healthscan_groin");
            _legl = _resourceManager.GetSprite("healthscan_legl");
            _legr = _resourceManager.GetSprite("healthscan_legr");

            Position = new Point((int) mousePos.X, (int) mousePos.Y);

            Setup();
            Update(0);
        }
Exemple #30
0
    public void Load(IDataNode dataNode, IResourceManager resourceManager)
    {
      _shaderName = dataNode.ReadParameter("key");
      _vertexShader = dataNode.ReadParameter("vertex");
      _fragmentShader = dataNode.ReadParameter("fragment");

      if (dataNode.HasParameter("numbers"))
      {
        var floats = dataNode.ReadParameterList("numbers");
        foreach (var f in floats)
        {
          _numericParameters.Add(f, default(float));
        }
      }

      if (dataNode.HasParameter("vectors"))
      {
        var vectors = dataNode.ReadParameterList("vectors");
        foreach (var v in vectors)
        {
          _vectorParameters.Add(v, default(Vector3));
        }
      }


      if (dataNode.HasParameter("textures"))
      {
        var textures = dataNode.ReadParameterList("textures");
        foreach (var t in textures)
        {
          _textureParameters.Add(t, null);
        }
      }

    }
 public void SetResourceManager(IResourceManager resourceManager)
 {
     m_ResourceMgr = resourceManager;
 }
Exemple #32
0
 /// <summary>
 ///     Releases the resource manager given.
 /// </summary>
 /// <param name="resourceManager">The resource manager.</param>
 /// <param name="styleManager">The style manager that was used to get the resource manager. Can be null.</param>
 public static void ReleaseResourceManager(ref IResourceManager resourceManager, StyleManager styleManager)
 {
     GetCache <IResourceManager, StyleManager>()
     .Release(Interlocked.Exchange(ref resourceManager, null), styleManager);
 }
Exemple #33
0
 internal TestExecutionData(ITestCase testCase, IEnumerable <ITestCase> prereqCases, IResourceManager resourceManager, string testGroupName)
 {
     TestCase        = testCase;
     PrereqCases     = prereqCases;
     ResourceManager = resourceManager;
     TestGroupName   = testGroupName;
 }
Exemple #34
0
 public ScriptTagHelper(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
 }
Exemple #35
0
 public ImageButton()
 {
     _resourceManager = IoCManager.Resolve <IResourceManager>();
     Color            = Color.White;
     Update(0);
 }
Exemple #36
0
        public void ImportModelMdb(IFeatureClass fc, string mdbFile, int groupId)
        {
            try
            {
                //2、获取基本信息
                FileInfo fInfo       = new FileInfo(mdbFile);
                string   strFilePath = fInfo.DirectoryName;

                Gvitech.CityMaker.Resource.IResourceFactory rf = new Gvitech.CityMaker.Resource.ResourceFactory();
                IResourceManager rm = fc.FeatureDataSet as IResourceManager;
                Dictionary <string, IEnvelope> cacheModeInfos = new Dictionary <string, IEnvelope>();
                List <string> cacheImageNames = new List <string>();

                IGeometryFactory geoFactory = new GeometryFactory();
                IResourceFactory symbolFac  = new ResourceFactory();

                IRowBufferCollection fcRows = new RowBufferCollection();
                IRowBuffer           fcRow  = null;

                //4、解析mdb
                string strConn    = _ConnStr + mdbFile + "\'";
                int    index      = 0;
                int    totalCount = 0;
                using (OleDbConnection oleConn = new OleDbConnection(strConn))
                {
                    oleConn.Open();
                    string          strSql      = "select count(*)  from Attribute_Table_CityManager";
                    OleDbCommand    countCmd    = new OleDbCommand(strSql, oleConn);
                    OleDbDataReader countReader = countCmd.ExecuteReader();
                    countReader.Read();
                    totalCount = countReader.GetInt32(0);
                    countReader.Close();

                    OleDbCommand    command   = new OleDbCommand(_QueryModelStr, oleConn);
                    OleDbDataReader reader    = command.ExecuteReader();
                    IModelPoint     modePoint = null;
                    while (reader.Read())
                    {
                        int    percent = ++index * 100 / totalCount;
                        string toolTip = string.Format("已完成{0}条/总共{1}条 {2}%", index, totalCount, percent);
                        CommonEntity.FormEntity.Text = toolTip;

                        double dScaleX = 0.0;
                        double dScaleY = 0.0;
                        double dScaleZ = 0.0;

                        double.TryParse(reader.GetString(9), out dScaleX);
                        double.TryParse(reader.GetString(10), out dScaleY);
                        double.TryParse(reader.GetString(11), out dScaleZ);

                        //if (dScaleX < 0 || dScaleY < 0 || dScaleZ < 0)
                        //    continue;

                        //fc
                        fcRow = fc.CreateRowBuffer();
                        int nPose = fcRow.FieldIndex("name");
                        if (nPose == -1)
                        {
                            continue;
                        }
                        string modelName = reader.GetString(0);
                        fcRow.SetValue(nPose, modelName);

                        nPose = fcRow.FieldIndex("groupId");
                        if (nPose == -1)
                        {
                            continue;
                        }
                        fcRow.SetValue(nPose, groupId);

                        modePoint = (IModelPoint)geoFactory.CreateGeometry(
                            gviGeometryType.gviGeometryModelPoint,
                            gviVertexAttribute.gviVertexAttributeZ);
                        modePoint.ModelName = modelName;

                        double dModePointX = double.Parse(reader.GetString(2)) + 0;  // CoorX = 0
                        double dModePointY = double.Parse(reader.GetString(3)) + 0;  // CoorY = 0
                        double dModePointZ = double.Parse(reader.GetString(4)) + 0;  // CoorZ = 0

                        double dRotationAngle = double.Parse(reader.GetString(5));
                        double dAxisX         = double.Parse(reader.GetString(6));
                        double dAxisY         = double.Parse(reader.GetString(7));
                        double dAxisZ         = double.Parse(reader.GetString(8));

                        double dUTransAngel = double.Parse(reader.GetString(12));
                        double dUTransX     = double.Parse(reader.GetString(13));
                        double dUTransY     = double.Parse(reader.GetString(14));
                        double dUTransZ     = double.Parse(reader.GetString(15));

                        modePoint.X = dModePointX;
                        modePoint.Y = dModePointY;
                        modePoint.Z = dModePointZ;

                        IMatrix matrix = new Matrix();

                        IVector3 pointVec = new Vector3();
                        pointVec.X = dModePointX;
                        pointVec.Y = dModePointY;
                        pointVec.Z = dModePointZ;

                        IVector3 Scale = new Vector3();
                        Scale.X = dScaleX;
                        Scale.Y = dScaleY;
                        Scale.Z = dScaleZ;

                        IVector3 Rotation = new Vector3();
                        Rotation.X = dAxisX;
                        Rotation.Y = dAxisY;
                        Rotation.Z = dAxisZ;

                        IVector3 Shear = new Vector3();
                        Shear.X = dUTransX;
                        Shear.Y = dUTransY;
                        Shear.Z = dUTransZ;

                        matrix.Compose2(pointVec, Scale, dRotationAngle, Rotation, dUTransAngel, Shear);
                        modePoint.FromMatrix(matrix);

                        //mc
                        IPropertySet Images = null;

                        //如果内存中不包含
                        if (!cacheModeInfos.Keys.Contains(modelName))
                        {
                            //数据库中包含
                            if (rm.ModelExist(modelName))
                            {
                                //重名即跳过
                                IEnvelope ev = rm.GetModel(modelName).Envelope;
                                modePoint.ModelEnvelope = ev;
                            }
                            else
                            {
                                IModel  simpleModel = null;
                                string  osgFilePath = strFilePath + "\\" + modelName + ".osg";
                                IModel  fineModel   = null;
                                IMatrix m           = null;
                                symbolFac.CreateModelAndImageFromFileEx(osgFilePath,
                                                                        out Images, out simpleModel, out fineModel, out m);
                                if (fineModel == null || fineModel.GroupCount == 0)
                                {
                                    continue;
                                }

                                cacheModeInfos[modelName] = modePoint.ModelEnvelope = Clone(fineModel.Envelope);

                                rm.AddModel(modelName, fineModel, simpleModel);
                            }
                        }
                        else
                        {
                            modePoint.ModelEnvelope = cacheModeInfos[modelName];
                        }

                        nPose = fcRow.FieldIndex("Geometry");
                        fcRow.SetValue(nPose, modePoint);
                        fcRows.Add(fcRow);

                        //tc
                        if (Images != null)
                        {
                            int nCount = Images.Count;
                            if (nCount > 0)
                            {
                                Hashtable htImages = Images.AsHashtable();
                                foreach (DictionaryEntry item in htImages)
                                {
                                    string imgName = item.Key.ToString();
                                    IImage img     = item.Value as IImage;
                                    if (img == null)
                                    {
                                        continue;
                                    }
                                    if (string.IsNullOrEmpty(imgName))
                                    {
                                        continue;
                                    }

                                    //如果内存中不包含
                                    if (!cacheImageNames.Contains(imgName))
                                    {
                                        //数据库中包含
                                        if (rm.ImageExist(imgName))
                                        {
                                            //重名即跳过
                                        }
                                    }

                                    //如果内存中不包含,数据库中也不包含
                                    if (!rm.ImageExist(imgName) &&
                                        !cacheImageNames.Contains(imgName))
                                    {
                                        cacheImageNames.Add(imgName);
                                        rm.AddImage(imgName, img);
                                    }
                                }
                            }
                        }
                        //end

                        if (fcRows.Count >= 10)
                        {
                            InsertFeatures(fc as IObjectClass, fcRows);
                            fcRows.Clear();
                        }
                    }
                    reader.Close();
                    oleConn.Close();
                }

                if (fcRows.Count > 0)
                {
                    InsertFeatures(fc as IObjectClass, fcRows);
                    fcRows.Clear();
                }
            }
            catch (System.Exception ex)
            {
                if (ex.GetType().Name.Equals("UnauthorizedAccessException"))
                {
                    MessageBox.Show("需要标准runtime授权");
                }
                else
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 protected ScriptRegister(IViewDataContainer container, IResourceManager resourceManager) : base(container, resourceManager, "script")
 {
 }
Exemple #38
0
 public MainViewModel(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
 }
Exemple #39
0
 public string Get(IResourceManager instance)
 => content;
 public CheckOutCommandHandler(IResourceManager resourceManager,
                               IOrderCommandRepository orderCommandRepository) : base(resourceManager)
 {
     _orderCommandRepository = orderCommandRepository;
 }
 public StructureUpgradeHelper(StructureRepository structureRepository, GridStructure grid, IPlacementManager placementManager, IResourceManager resourceManager)
     : base(structureRepository, grid, placementManager, resourceManager)
 {
 }
Exemple #42
0
 public MetaTagHelper(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
 }
Exemple #43
0
 public JSONToResource(ResourceName resourceName, string FolderPath)
 {
     this._manager        = ServiceLocator.Current.GetInstance <IResourceManager>();
     this._ResourceName   = resourceName;
     this._JSONFolderPath = FolderPath;
 }
Exemple #44
0
        public EntitySpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Entity Spawn Panel", size, resourceManager)
        {
            _resourceManager  = resourceManager;
            _placementManager = placementManager;

            _entityList = new ScrollableContainer("entspawnlist", new Size(200, 400), _resourceManager)
            {
                Position = new Point(5, 5)
            };
            components.Add(_entityList);

            var searchLabel = new Label("Entity Search:", "CALIBRI", _resourceManager)
            {
                Position = new Point(210, 0)
            };

            components.Add(searchLabel);

            _entSearchTextbox = new Textbox(125, _resourceManager)
            {
                Position = new Point(210, 20)
            };
            _entSearchTextbox.OnSubmit += entSearchTextbox_OnSubmit;
            components.Add(_entSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
            {
                DrawBackground = true,
                DrawBorder     = true,
                Position       = new Point(210, 55)
            };

            _overLabel = new Label("Override Placement:", "CALIBRI", _resourceManager)
            {
                Position = _clearLabel.Position + new Size(0, _clearLabel.ClientArea.Height + 15)
            };

            components.Add(_overLabel);

            var initOpts = new List <string>();

            initOpts.AddRange(new[]
            {
                "None",
                "AlignNone",
                "AlignFree",
                "AlignSimilar",
                "AlignTileAny",
                "AlignTileEmpty",
                "AlignTileNonSolid",
                "AlignTileSolid",
                "AlignWall",
                "AlignWallTops"
            });

            _lstOverride = new Listbox(150, 125, resourceManager, initOpts);
            _lstOverride.SelectItem("None");
            _lstOverride.ItemSelected += _lstOverride_ItemSelected;
            _lstOverride.Position      = _overLabel.Position + new Size(0, _overLabel.ClientArea.Height);
            components.Add(_lstOverride);

            _clearLabel.Clicked        += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            _eraserButton = new ImageButton
            {
                ImageNormal = "erasericon",
                Position    =
                    new Point(_clearLabel.Position.X + _clearLabel.ClientArea.Width + 5,
                              _clearLabel.Position.Y)
            };

            //eraserButton.Position = new Point(clearLabel.ClientArea.Right + 5, clearLabel.ClientArea.Top); Clientarea not updating properly. FIX THIS
            _eraserButton.Clicked += EraserButtonClicked;
            components.Add(_eraserButton);

            BuildEntityList();

            Position = new Point((int)(CluwneLib.CurrentRenderTarget.Size.X / 2f) - (int)(ClientArea.Width / 2f),
                                 (int)(CluwneLib.CurrentRenderTarget.Size.Y / 2f) - (int)(ClientArea.Height / 2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Exemple #45
0
 public ClipBoardSideBarPanelFilter(ILayoutAccessor layoutAccessor, IShapeFactory shapeFactory, IResourceManager resourceManager)
 {
     _layoutAccessor  = layoutAccessor;
     _shapeFactory    = shapeFactory;
     _resourceManager = resourceManager;
 }
        private void MaintainContainment(IResourceManager resMan)
        {
            var antimatterResource = part.Resources[resourceName];

            if (antimatterResource == null)
            {
                return;
            }

            if (chargeStatus > 0 && antimatterResource.amount > _minimumAntimatterAmount)
            {
                // chargeStatus is in seconds
                chargeStatus -= vessel.packed ? 0.05f : resMan.FixedDeltaTime();
            }

            if (!_shouldCharge && antimatterResource.amount <= _minimumAntimatterAmount)
            {
                return;
            }

            var powerModifier = canExplodeFromGeeForce
                ? (resourceRatio * (currentGeeForce / 10) * 0.8) + ((part.temperature / 1000) * 0.2)
                : Math.Pow(resourceRatio, 2);

            effectivePowerNeeded = chargeNeeded * powerModifier;

            if (effectivePowerNeeded <= 0.0)
            {
                _effectiveMaxGeeforce      = 0;
                _temperatureExplodeCounter = 0;
                _geeforceExplodeCounter    = 0;
                _powerExplodeCounter       = 0;
                return;
            }


            double powerRequest = (chargeStatus >= maxCharge ? 1.0 : 2.0) *
                                  effectivePowerNeeded;
            // TODO, not sure about this change.
            double chargeToAdd = resMan.Consume(ResourceName.ElectricCharge, powerRequest) / effectivePowerNeeded;

            chargeStatus += chargeToAdd;

            if (chargeToAdd >= resMan.FixedDeltaTime())
            {
                _charging = true;
            }
            else
            {
                _charging = false;
                if (TimeWarp.CurrentRateIndex > 3 && (antimatterResource.amount > _minimumAntimatterAmount))
                {
                    TimeWarp.SetRate(3, true);
                    ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg7", TimeWarp.CurrentRate, antimatterResource.resourceName), 1, ScreenMessageStyle.UPPER_CENTER);//"Cannot Time Warp faster than " +  + "x while " +  + " Tank is Unpowered"
                }
            }


            if (_startupTimeout > 0)
            {
                _startupTimeout--;
            }

            if (_startupTimeout == 0 && antimatterResource.amount > _minimumAntimatterAmount)
            {
                //verify temperature
                if (!CheatOptions.IgnoreMaxTemperature && canExplodeFromHeat && part.temperature > (double)(decimal)maxTemperature)
                {
                    _temperatureExplodeCounter++;
                    if (_temperatureExplodeCounter > 20)
                    {
                        DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg8"));//"Antimatter container exploded due to reaching critical temperature"
                    }
                }
                else
                {
                    _temperatureExplodeCounter = 0;
                }

                //verify geeforce
                _effectiveMaxGeeforce = resourceRatio > 0 ? Math.Min(10, maxGeeforce / resourceRatio) : 10;
                if (!CheatOptions.UnbreakableJoints && canExplodeFromGeeForce)
                {
                    if (vessel.missionTime > 0)
                    {
                        if (currentGeeForce > _effectiveMaxGeeforce)
                        {
                            ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg9"), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: geeforce at critical!"
                            _geeforceExplodeCounter++;
                            if (_geeforceExplodeCounter > 30)
                            {
                                DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg10"));//"Antimatter container exploded due to reaching critical geeforce"
                            }
                        }
                        else if (TimeWarp.CurrentRateIndex > maximumTimewarpWithGeeforceWarning && currentGeeForce > _effectiveMaxGeeforce - 0.02)
                        {
                            TimeWarp.SetRate(maximumTimewarpWithGeeforceWarning, true);
                            ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg11", TimeWarp.CurrentRate), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: Cannot Time Warp faster than " +  + "x while geeforce near maximum tolerance!"
                        }
                        else if (currentGeeForce > _effectiveMaxGeeforce - 0.04)
                        {
                            ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg12", (currentGeeForce / _effectiveMaxGeeforce * 100).ToString("F2")), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: geeforce at " +  + "%  tolerance!"
                        }
                        else
                        {
                            _geeforceExplodeCounter = 0;
                        }
                    }
                    else if (currentGeeForce > _effectiveMaxGeeforce)
                    {
                        ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg13"), 1, ScreenMessageStyle.UPPER_CENTER);//"Warning: geeforce tolerance exceeded but sustanable while the mission timer has not started"
                    }
                }
                else
                {
                    _geeforceExplodeCounter = 0;
                }

                //verify power
                if (chargeStatus <= 0)
                {
                    chargeStatus = 0;
                    if (!CheatOptions.InfiniteElectricity && antimatterResource.amount > 0.00001 * antimatterResource.maxAmount)
                    {
                        _powerExplodeCounter++;
                        if (_powerExplodeCounter > 20)
                        {
                            DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg14"));//"Antimatter container exploded due to running out of power"
                        }
                    }
                }
                else
                {
                    _powerExplodeCounter = 0;
                }
            }


            if (chargeStatus > maxCharge)
            {
                chargeStatus = maxCharge;
            }
        }
        private void btnAnalyse_Click(object sender, EventArgs e)
        {
            try
            {
                this._dt.Rows.Clear();
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null || !app.Current3DMapControl.Terrain.IsRegistered)
                {
                    return;
                }
                foreach (Guid g in this._listRender)
                {
                    app.Current3DMapControl.ObjectManager.DeleteObject(g);
                }
                this._listRender.Clear();

                WaitForm.Start("正在分析...", "请稍后");

                if (this._drawTool == null)
                {
                    return;
                }
                IGeometry geo = this._drawTool.GetGeo();
                if (geo == null || geo.GeometryType != gviGeometryType.gviGeometryPolygon)
                {
                    return;
                }
                IPolygon polygon = geo as IPolygon;
                IPoint   pt      = polygon.ExteriorRing.Midpoint;
                double   height  = double.Parse(this.seLimitHeight.Value.ToString());

                List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName(new string[] { "Building", "Structure" });
                if (list != null && list.Count != 0)
                {
                    foreach (DF3DFeatureClass dffc in list)
                    {
                        IFeatureClass fc  = dffc.GetFeatureClass();
                        IFeatureLayer fl  = dffc.GetFeatureLayer();
                        FacilityClass fac = dffc.GetFacilityClass();
                        if (fl != null)
                        {
                            if (fl.VisibleMask == gviViewportMask.gviViewNone)
                            {
                                continue;
                            }
                        }
                        if (fc != null)
                        {
                            IFieldInfoCollection fiCol = fc.GetFields();
                            int indexGeo = fiCol.IndexOf("Geometry");
                            if (indexGeo == -1)
                            {
                                continue;
                            }
                            int indexFid = fiCol.IndexOf(fc.FidFieldName);
                            if (indexFid == -1)
                            {
                                continue;
                            }
                            int indexName    = -1;
                            int indexAddress = -1;
                            int indexContact = -1;
                            if (fac != null)
                            {
                                indexName    = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Name"));
                                indexAddress = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Address"));
                                indexContact = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Contact"));
                            }

                            IResourceManager resManager = fc.FeatureDataSet as IResourceManager;
                            if (resManager == null)
                            {
                                continue;
                            }

                            IRowBuffer row    = null;
                            IFdeCursor cursor = null;
                            try
                            {
                                ISpatialFilter filter = new SpatialFilter();
                                filter.Geometry      = geo;
                                filter.GeometryField = "Geometry";
                                filter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                                cursor = fc.Search(filter, true);
                                while ((row = cursor.NextRow()) != null)
                                {
                                    IGeometry geoRow = row.GetValue(indexGeo) as IGeometry;
                                    if (geoRow != null && geoRow.GeometryType == gviGeometryType.gviGeometryModelPoint)
                                    {
                                        IModelPoint mp = geoRow as IModelPoint;
                                        IVector3    v3 = mp.AsMatrix().GetScale();
                                        //string name = mp.ModelName;
                                        //IModel m = resManager.GetModel(name);
                                        IEnvelope env           = mp.ModelEnvelope;
                                        double    terrainHeight = 0.0;
                                        if (app.Current3DMapControl.Terrain.IsRegistered)
                                        {
                                            terrainHeight = app.Current3DMapControl.Terrain.GetElevation(mp.X, mp.Y, gviGetElevationType.gviGetElevationFromDatabase);
                                        }
                                        double mpHeigth = env.Depth * v3.Z;
                                        if (mpHeigth > height)
                                        {
                                            DataRow dr = this._dt.NewRow();
                                            if (indexName != -1)
                                            {
                                                dr["Name"] = row.GetValue(indexName);
                                            }
                                            dr["fcName"] = string.IsNullOrEmpty(fc.AliasName) ? fc.Name : fc.AliasName;
                                            dr["fid"]    = row.GetValue(indexFid);
                                            dr["Geo"]    = row.GetValue(indexGeo);
                                            if (indexAddress != -1)
                                            {
                                                dr["Address"] = row.GetValue(indexAddress);
                                            }
                                            if (indexContact != -1)
                                            {
                                                dr["Contact"] = row.GetValue(indexContact);
                                            }
                                            dr["TerrainHeight"] = terrainHeight.ToString("0.00");
                                            dr["Height"]        = env.MaxZ.ToString("0.00");
                                            dr["OverHeight"]    = (mpHeigth - height).ToString("0.00");
                                            dr["fc"]            = fc;
                                            this._dt.Rows.Add(dr);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                            finally
                            {
                                if (row != null)
                                {
                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                                    row = null;
                                }
                                if (cursor != null)
                                {
                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                                    cursor = null;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { }
            finally
            {
                WaitForm.Stop();
            }
        }
Exemple #48
0
 public WebViewScriptRegister(WebPageBase viewPage, IViewDataContainer container, IResourceManager resourceManager)
     : base(container, resourceManager)
 {
     _viewPage = viewPage;
 }
Exemple #49
0
 public static void SetResourceManager(HttpContextBase viewBage, IResourceManager resourceManager)
 {
     viewBage.Items["IResourceManager"] = resourceManager;
 }
Exemple #50
0
        private void AddRecord()
        {
            try
            {
                this.beforeRowBufferMap.Clear();
                SelectCollection.Instance().Clear();
                if (reg == null || tc == null)
                {
                    return;
                }
                FacStyleClass style = this.cmbStyle.EditValue as FacStyleClass;
                if (style == null)
                {
                    return;
                }
                SubClass sc = this.cmbClassify.EditValue as SubClass;

                DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer;
                if (featureClassInfo == null)
                {
                    return;
                }
                IFeatureClass fc = featureClassInfo.GetFeatureClass();
                if (fc == null)
                {
                    return;
                }
                IResourceManager manager = fc.FeatureDataSet as IResourceManager;
                if (manager == null)
                {
                    return;
                }
                IFeatureLayer fl = featureClassInfo.GetFeatureLayer();
                if (fl == null)
                {
                    return;
                }
                IFieldInfoCollection fields = fc.GetFields();
                int indexOid = fields.IndexOf(fc.FidFieldName);
                if (indexOid == -1)
                {
                    return;
                }
                int mpindex = fields.IndexOf(fl.GeometryFieldName);
                if (mpindex == -1)
                {
                    return;
                }
                int indexShape = fields.IndexOf("Shape");
                if (indexShape == -1)
                {
                    return;
                }
                int indexFootPrint = fields.IndexOf("FootPrint");
                if (indexFootPrint == -1)
                {
                    return;
                }
                int indexStyleId = fields.IndexOf("StyleId");
                if (indexStyleId == -1)
                {
                    return;
                }
                int indexFacilityId = fields.IndexOf("FacilityId");
                if (indexFacilityId == -1)
                {
                    return;
                }

                IFieldInfo fiShape = fields.Get(indexShape);
                if (fiShape == null || fiShape.GeometryDef == null)
                {
                    return;
                }

                IGeometry geo = this._drawTool.GetGeo();
                if (geo.GeometryType != gviGeometryType.gviGeometryPolyline)
                {
                    return;
                }
                IPolyline line   = geo as IPolyline;
                IPolyline geoOut = this._geoFact.CreateGeometry(gviGeometryType.gviGeometryPolyline, fiShape.GeometryDef.VertexAttribute) as IPolyline;
                for (int i = 0; i < line.PointCount; i++)
                {
                    IPoint ptGet  = line.GetPoint(i);
                    IPoint pttemp = ptGet.Clone2(fiShape.GeometryDef.VertexAttribute) as IPoint;
                    if (fiShape.GeometryDef.HasZ)
                    {
                        pttemp.SetCoords(ptGet.X, ptGet.Y, ptGet.Z, 0, 0);
                    }
                    else
                    {
                        pttemp.SetCoords(ptGet.X, ptGet.Y, 0, 0, 0);
                    }
                    geoOut.AppendPoint(pttemp);
                }

                IQueryFilter filter = new QueryFilter();
                filter.WhereClause      = "1=1";
                filter.ResultBeginIndex = 0;
                filter.ResultLimit      = 1;
                filter.PostfixClause    = "ORDER BY " + fc.FidFieldName + " desc";
                IFdeCursor cursor = null;
                cursor = fc.Search(filter, false);
                IRowBuffer rowtemp = cursor.NextRow();
                int        oid     = 0;
                if (rowtemp != null)
                {
                    oid = int.Parse(rowtemp.GetValue(indexOid).ToString());
                }
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }

                IRowBufferFactory fac = new RowBufferFactory();
                IRowBuffer        row = fac.CreateRowBuffer(fields);
                row.SetValue(indexOid, oid + 1);
                row.SetValue(indexShape, geoOut);
                row.SetValue(indexFootPrint, geoOut.Clone2(gviVertexAttribute.gviVertexAttributeNone));
                row.SetValue(indexStyleId, style.ObjectId);
                row.SetValue(indexFacilityId, BitConverter.ToString(ObjectIdGenerator.Generate()).Replace("-", string.Empty).ToLowerInvariant());
                if (sc != null)
                {
                    int indexClassify = fields.IndexOf(this._classifyName);
                    int indexGroupId  = fields.IndexOf("GroupId");
                    if (indexClassify != -1 && indexGroupId != -1)
                    {
                        row.SetValue(indexClassify, sc.Name);
                        row.SetValue(indexGroupId, sc.GroupId);
                    }
                }
                foreach (DataRow dr in this._dt.Rows)
                {
                    IFieldInfo fi = dr["F"] as IFieldInfo;
                    if (fi == null)
                    {
                        continue;
                    }
                    string fn    = fi.Name;
                    int    index = fields.IndexOf(fn);
                    if (index != -1)
                    {
                        if (dr["FV"] == null)
                        {
                            row.SetNull(index);
                        }
                        else
                        {
                            string strobj = dr["FV"].ToString();
                            bool   bRes   = false;
                            switch (fi.FieldType)
                            {
                            case gviFieldType.gviFieldBlob:
                            case gviFieldType.gviFieldGeometry:
                            case gviFieldType.gviFieldUnknown:
                                break;

                            case gviFieldType.gviFieldFloat:
                                float f;
                                bRes = float.TryParse(strobj, out f);
                                if (bRes)
                                {
                                    row.SetValue(index, f);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            case gviFieldType.gviFieldDouble:
                                double d;
                                bRes = double.TryParse(strobj, out d);
                                if (bRes)
                                {
                                    row.SetValue(index, d);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            case gviFieldType.gviFieldFID:
                            case gviFieldType.gviFieldUUID:
                            case gviFieldType.gviFieldInt16:
                                Int16 i16;
                                bRes = Int16.TryParse(strobj, out i16);
                                if (bRes)
                                {
                                    row.SetValue(index, i16);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            case gviFieldType.gviFieldInt32:
                                Int32 i32;
                                bRes = Int32.TryParse(strobj, out i32);
                                if (bRes)
                                {
                                    row.SetValue(index, i32);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            case gviFieldType.gviFieldInt64:
                                Int64 i64;
                                bRes = Int64.TryParse(strobj, out i64);
                                if (bRes)
                                {
                                    row.SetValue(index, i64);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            case gviFieldType.gviFieldString:
                                row.SetValue(index, strobj);
                                break;

                            case gviFieldType.gviFieldDate:
                                DateTime dt;
                                bRes = DateTime.TryParse(strobj, out dt);
                                if (bRes)
                                {
                                    row.SetValue(index, dt);
                                }
                                else
                                {
                                    row.SetNull(index);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }

                Fac plf = new PipeLineFac(reg, style, row, tc, false, false);

                IModelPoint mp          = null;
                IModel      finemodel   = null;
                IModel      simplemodel = null;
                string      name        = "";
                if (UCAuto3DCreate.RebuildModel(plf, style, out mp, out finemodel, out simplemodel, out name))
                {
                    if (finemodel == null || mp == null)
                    {
                        return;
                    }
                    mp.ModelEnvelope = finemodel.Envelope;
                    row.SetValue(mpindex, mp);
                    //if (mc != null)
                    //{
                    //    if (indexClassify != -1 && indexGroupid != -1)
                    //    {

                    //    }
                    //}
                    bool bRes = false;
                    if (!string.IsNullOrEmpty(mp.ModelName))
                    {
                        if (!manager.ModelExist(mp.ModelName))
                        {
                            if (manager.AddModel(mp.ModelName, finemodel, simplemodel))
                            {
                                bRes = true;
                            }
                        }
                        else
                        {
                            if (manager.UpdateModel(mp.ModelName, finemodel) && manager.UpdateSimplifiedModel(mp.ModelName, simplemodel))
                            {
                                bRes = true;
                            }
                        }
                    }
                    if (!bRes)
                    {
                        return;
                    }
                    IRowBufferCollection rowCol = new RowBufferCollection();
                    rowCol.Add(row);
                    beforeRowBufferMap[featureClassInfo] = rowCol;
                    UpdateDatabase();
                    app.Current3DMapControl.FeatureManager.RefreshFeatureClass(fc);
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #51
0
 public ManageController(IResourceManager resourceManager, IHostingEnvironment hostingEnvironment, UserManager <User> userManager)
 {
     this.userManager        = userManager;
     this.hostingEnvironment = hostingEnvironment;
     this.resourceManager    = resourceManager;
 }
        public void CanCRUDLocks()
        {
            using (var context = FluentMockContext.Start(GetType().FullName))
            {
                IAuthorizationManager authorizationManager = TestHelper.CreateAuthorizationManager();
                IComputeManager computeManager = TestHelper.CreateComputeManager();
                IResourceManager managerResources = computeManager.ResourceManager;
                INetworkManager networkManager = TestHelper.CreateNetworkManager();
                IStorageManager storageManager = TestHelper.CreateStorageManager();

                // Prepare a VM
                string password = SdkContext.RandomResourceName("P@s", 14);
                string rgName = SdkContext.RandomResourceName("rg", 15);
                string vmName = SdkContext.RandomResourceName("vm", 15);
                string storageName = SdkContext.RandomResourceName("st", 15);
                string diskName = SdkContext.RandomResourceName("dsk", 15);
                string netName = SdkContext.RandomResourceName("net", 15);
                Region region = Region.USEast;

                IResourceGroup resourceGroup = null;
                IManagementLock lockGroup = null,
                        lockVM = null,
                        lockStorage = null,
                        lockDiskRO = null,
                        lockDiskDel = null,
                        lockSubnet = null;

                try
                {
                    resourceGroup = managerResources.ResourceGroups.Define(rgName)
                            .WithRegion(region)
                            .Create();
                    Assert.NotNull(resourceGroup);

                    ICreatable<INetwork> netDefinition = networkManager.Networks.Define(netName)
                            .WithRegion(region)
                            .WithExistingResourceGroup(resourceGroup)
                            .WithAddressSpace("10.0.0.0/28");

                    // Define a VM for testing VM locks
                    ICreatable<IVirtualMachine> vmDefinition = computeManager.VirtualMachines.Define(vmName)
                            .WithRegion(region)
                            .WithExistingResourceGroup(resourceGroup)
                            .WithNewPrimaryNetwork(netDefinition)
                            .WithPrimaryPrivateIPAddressDynamic()
                            .WithoutPrimaryPublicIPAddress()
                            .WithPopularWindowsImage(KnownWindowsVirtualMachineImage.WindowsServer2012R2Datacenter)
                            .WithAdminUsername("tester")
                            .WithAdminPassword(password)
                            .WithSize(VirtualMachineSizeTypes.Parse("Standard_D2a_v4"));

                    // Define a managed disk for testing locks on that
                    ICreatable<IDisk> diskDefinition = computeManager.Disks.Define(diskName)
                            .WithRegion(region)
                            .WithExistingResourceGroup(resourceGroup)
                            .WithData()
                            .WithSizeInGB(100);

                    // Define a storage account for testing locks on that
                    ICreatable<IStorageAccount> storageDefinition = storageManager.StorageAccounts.Define(storageName)
                            .WithRegion(region)
                            .WithExistingResourceGroup(resourceGroup);

                    // Create resources in parallel to save time and money
                    Extensions.Synchronize(() => Task.WhenAll(
                        storageDefinition.CreateAsync(),
                        vmDefinition.CreateAsync(),
                        diskDefinition.CreateAsync()));

                    IVirtualMachine vm = (IVirtualMachine)vmDefinition;
                    IStorageAccount storage = (IStorageAccount)storageDefinition;
                    IDisk disk = (IDisk)diskDefinition;
                    INetwork network = vm.GetPrimaryNetworkInterface().PrimaryIPConfiguration.GetNetwork();
                    ISubnet subnet = network.Subnets.Values.FirstOrDefault();

                    // Lock subnet
                    ICreatable<IManagementLock> lockSubnetDef = authorizationManager.ManagementLocks.Define("subnetLock")
                            .WithLockedResource(subnet.Inner.Id)
                            .WithLevel(LockLevel.ReadOnly);

                    // Lock VM
                    ICreatable<IManagementLock> lockVMDef = authorizationManager.ManagementLocks.Define("vmlock")
                            .WithLockedResource(vm)
                            .WithLevel(LockLevel.ReadOnly)
                            .WithNotes("vm readonly lock");

                    // Lock resource group
                    ICreatable<IManagementLock> lockGroupDef = authorizationManager.ManagementLocks.Define("rglock")
                            .WithLockedResource(resourceGroup.Id)
                            .WithLevel(LockLevel.CanNotDelete);

                    // Lock storage
                    ICreatable<IManagementLock> lockStorageDef = authorizationManager.ManagementLocks.Define("stLock")
                            .WithLockedResource(storage)
                            .WithLevel(LockLevel.CanNotDelete);

                    // Create locks in parallel
                    ICreatedResources<IManagementLock> created = authorizationManager.ManagementLocks.Create(lockVMDef, lockGroupDef, lockStorageDef, lockSubnetDef);

                    lockVM = created.FirstOrDefault(o => o.Key.Equals(lockVMDef.Key));
                    lockStorage = created.FirstOrDefault(o => o.Key.Equals(lockStorageDef.Key));
                    lockGroup = created.FirstOrDefault(o => o.Key.Equals(lockGroupDef.Key));
                    lockSubnet = created.FirstOrDefault(o => o.Key.Equals(lockSubnetDef.Key));

                    // Lock disk synchronously
                    lockDiskRO = authorizationManager.ManagementLocks.Define("diskLockRO")
                            .WithLockedResource(disk)
                            .WithLevel(LockLevel.ReadOnly)
                            .Create();

                    lockDiskDel = authorizationManager.ManagementLocks.Define("diskLockDel")
                            .WithLockedResource(disk)
                            .WithLevel(LockLevel.CanNotDelete)
                            .Create();

                    // Verify VM lock
                    Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(vm.Id).Count());

                    Assert.NotNull(lockVM);
                    lockVM = authorizationManager.ManagementLocks.GetById(lockVM.Id);
                    Assert.NotNull(lockVM);
                    Assert.Equal(LockLevel.ReadOnly, lockVM.Level);
                    Assert.Equal(vm.Id, lockVM.LockedResourceId, true);

                    // Verify resource group lock
                    Assert.NotNull(lockGroup);
                    lockGroup = authorizationManager.ManagementLocks.GetByResourceGroup(resourceGroup.Name, "rglock");
                    Assert.NotNull(lockGroup);
                    Assert.Equal(LockLevel.CanNotDelete, lockGroup.Level);
                    Assert.Equal(resourceGroup.Id, lockGroup.LockedResourceId, true);

                    // Verify storage account lock
                    Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(storage.Id).Count());

                    Assert.NotNull(lockStorage);
                    lockStorage = authorizationManager.ManagementLocks.GetById(lockStorage.Id);
                    Assert.NotNull(lockStorage);
                    Assert.Equal(LockLevel.CanNotDelete, lockStorage.Level);
                    Assert.Equal(storage.Id, lockStorage.LockedResourceId, true);

                    // Verify disk lock
                    Assert.Equal(3, authorizationManager.ManagementLocks.ListForResource(disk.Id).Count());

                    Assert.NotNull(lockDiskRO);
                    lockDiskRO = authorizationManager.ManagementLocks.GetById(lockDiskRO.Id);
                    Assert.NotNull(lockDiskRO);
                    Assert.Equal(LockLevel.ReadOnly, lockDiskRO.Level);
                    Assert.Equal(disk.Id, lockDiskRO.LockedResourceId, true);

                    Assert.NotNull(lockDiskDel);
                    lockDiskDel = authorizationManager.ManagementLocks.GetById(lockDiskDel.Id);
                    Assert.NotNull(lockDiskDel);
                    Assert.Equal(LockLevel.CanNotDelete, lockDiskDel.Level);
                    Assert.Equal(disk.Id, lockDiskDel.LockedResourceId, true);

                    // Verify subnet lock
                    Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(network.Id).Count());

                    lockSubnet = authorizationManager.ManagementLocks.GetById(lockSubnet.Id);
                    Assert.NotNull(lockSubnet);
                    Assert.Equal(LockLevel.ReadOnly, lockSubnet.Level);
                    Assert.Equal(subnet.Inner.Id, lockSubnet.LockedResourceId, true);

                    // Verify lock collection
                    var locksSubscription = authorizationManager.ManagementLocks.List();
                    var locksGroup = authorizationManager.ManagementLocks.ListByResourceGroup(vm.ResourceGroupName);
                    Assert.NotNull(locksSubscription);
                    Assert.NotNull(locksGroup);

                    int locksAllCount = locksSubscription.Count();
                    Assert.True(6 <= locksAllCount);

                    int locksGroupCount = locksGroup.Count();
                    Assert.Equal(6, locksGroup.Count());
                }
                finally
                {
                    try
                    {
                        if (resourceGroup != null)
                        {
                            if (lockGroup != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockGroup.Id);
                            }
                            if (lockVM != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockVM.Id);
                            }
                            if (lockDiskRO != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockDiskRO.Id);
                            }
                            if (lockDiskDel != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockDiskDel.Id);
                            }
                            if (lockStorage != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockStorage.Id);
                            }
                            if (lockSubnet != null)
                            {
                                authorizationManager.ManagementLocks.DeleteById(lockSubnet.Id);
                            }

                            managerResources.ResourceGroups.BeginDeleteByName(rgName);
                        }
                    }
                    catch { }
                }
            }
        }
 public CloudAvatarProvider()
 {
     UseCache        = true;
     resourceManager = new CloudResourceManager(connection);
 }
Exemple #54
0
        void Init(IntPtr pParam)
        {
            IEngineSubSystem p_sub_sys = null;

            IResourceManager p_res_man = null;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys);
            p_res_man = (IResourceManager)p_sub_sys;

            IRender p_render = null;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys);
            p_render = (IRender)p_sub_sys;
            p_render.GetRender2D(out pRender2D);

            IEngineBaseObject p_obj = null;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out p_sub_sys);
            pInput = (IInput)p_sub_sys;
            pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR);

            p_res_man.GetDefaultResource(E_ENGINE_OBJECT_TYPE.EOT_BITMAP_FONT, out p_obj);
            pFont = (IBitmapFont)p_obj;


            // Background clear color setup.
            TColor4 tc = new TColor4(38, 38, 55, 255);

            p_render.SetClearColor(ref tc);

            // This example adapted only for 800X600 resolution, if even resolution will be higher it won't effect it.
            pRender2D.SetResolutionCorrection(GAME_VP_WIDTH, GAME_VP_HEIGHT, true);



            p_res_man.Load(RESOURCE_PATH + "sounds\\owl.wav", out p_obj, 0);
            pSndOwl = (ISoundSample)p_obj;

            p_res_man.Load(RESOURCE_PATH + "sounds\\forest_ambient.wav", out p_obj, 0);
            pForestAmbient = (ISoundSample)p_obj;
            pForestAmbient.PlayEx(out pChannelAmbientLoop, E_SOUND_SAMPLE_PARAMS.SSP_LOOPED);

            p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_forest_background.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pBg = (ITexture)p_obj;
            p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_cloudy_night_sky.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pSky = (ITexture)p_obj;
            p_res_man.Load(RESOURCE_PATH + "sprites\\smoke.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pFog = (ITexture)p_obj;
            p_res_man.Load(RESOURCE_PATH + "sprites\\light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pLightRound = (ITexture)p_obj;

            p_res_man.Load(RESOURCE_PATH + "sprites\\vox.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pVox = (ITexture)p_obj;
            pVox.SetFrameSize(149, 149);

            p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_owl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pOwl = (ITexture)p_obj;
            pOwl.SetFrameSize(48, 128);

            p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_anime_girl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pTexGirl = (ITexture)p_obj;
            pTexGirl.SetFrameSize(55, 117);

            p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_mistery_light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
            pLight = (ITexture)p_obj;
            pLight.SetFrameSize(64, 128);
        }
Exemple #55
0
 public LinkTagHelper(IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
 }
Exemple #56
0
 public HomeController(CommandDispatcher commandDispatcher, QueryDispatcher queryDispatcher, IResourceManager resourceManager, ILogger <HomeController> logger) : base(commandDispatcher, queryDispatcher, resourceManager)
 {
     _logger = logger;
 }
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            m_EditorResourceMode = baseComponent.EditorResourceMode;
            m_ResourceManager    = m_EditorResourceMode ? baseComponent.EditorResourceHelper : GameFrameworkEntry.GetModule <IResourceManager>();
            if (m_ResourceManager == null)
            {
                Log.Fatal("Resource manager is invalid.");
                return;
            }

            m_ResourceManager.ResourceUpdateStart   += OnResourceUpdateStart;
            m_ResourceManager.ResourceUpdateChanged += OnResourceUpdateChanged;
            m_ResourceManager.ResourceUpdateSuccess += OnResourceUpdateSuccess;
            m_ResourceManager.ResourceUpdateFailure += OnResourceUpdateFailure;

            m_ResourceManager.SetReadOnlyPath(Application.streamingAssetsPath);
            if (m_ReadWritePathType == ReadWritePathType.TemporaryCache)
            {
                m_ResourceManager.SetReadWritePath(Application.temporaryCachePath);
            }
            else
            {
                if (m_ReadWritePathType == ReadWritePathType.Unspecified)
                {
                    m_ReadWritePathType = ReadWritePathType.PersistentData;
                }

                m_ResourceManager.SetReadWritePath(Application.persistentDataPath);
            }

            if (m_EditorResourceMode)
            {
                return;
            }

            SetResourceMode(m_ResourceMode);
            m_ResourceManager.SetDownloadManager(GameFrameworkEntry.GetModule <IDownloadManager>());
            m_ResourceManager.SetObjectPoolManager(GameFrameworkEntry.GetModule <IObjectPoolManager>());
            m_ResourceManager.AssetAutoReleaseInterval    = m_AssetAutoReleaseInterval;
            m_ResourceManager.AssetCapacity               = m_AssetCapacity;
            m_ResourceManager.AssetExpireTime             = m_AssetExpireTime;
            m_ResourceManager.AssetPriority               = m_AssetPriority;
            m_ResourceManager.ResourceAutoReleaseInterval = m_ResourceAutoReleaseInterval;
            m_ResourceManager.ResourceCapacity            = m_ResourceCapacity;
            m_ResourceManager.ResourceExpireTime          = m_ResourceExpireTime;
            m_ResourceManager.ResourcePriority            = m_ResourcePriority;
            if (m_ResourceMode == ResourceMode.Updatable)
            {
                m_ResourceManager.UpdatePrefixUri  = m_UpdatePrefixUri;
                m_ResourceManager.UpdateRetryCount = m_UpdateRetryCount;
            }

            m_ResourceHelper = Helper.CreateHelper(m_ResourceHelperTypeName, m_CustomResourceHelper);
            if (m_ResourceHelper == null)
            {
                Log.Error("Can not create resource helper.");
                return;
            }

            m_ResourceHelper.name = "Resource Helper";
            Transform transform = m_ResourceHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_ResourceManager.SetResourceHelper(m_ResourceHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Load Resource Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_LoadResourceAgentHelperCount; i++)
            {
                AddLoadResourceAgentHelper(i);
            }
        }
Exemple #58
0
 public ViewPageScriptRegister(HtmlTextWriter context, IViewDataContainer container, IResourceManager resourceManager)
     : base(container, resourceManager)
 {
     _context = context;
 }
Exemple #59
0
 public AddMasterCommandHandler(IResourceManager resourceManager, IMasterCommandRepository masterCommandRepository) : base(resourceManager)
 {
     _masterCommandRepository = masterCommandRepository;
 }
 public OAuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider)
     : this(appSettings, authRealm, oAuthProvider, "ConsumerKey", "ConsumerSecret")
 {
 }