• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Resource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Resource的典型用法代码示例。如果您正苦于以下问题:C# Resource类的具体用法?C# Resource怎么用?C# Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Resource类属于命名空间,在下文中一共展示了Resource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Car

        private IEnumerable<Event> Car(string name, Environment env, Resource gasStation, Container fuelPump)
        {
            /*
               * A car arrives at the gas station for refueling.
               *
               * It requests one of the gas station's fuel pumps and tries to get the
               * desired amount of gas from it. If the stations reservoir is
               * depleted, the car has to wait for the tank truck to arrive.
               */
              var fuelTankLevel = env.RandUniform(MinFuelTankLevel, MaxFuelTankLevel + 1);
              env.Log("{0} arriving at gas station at {1}", name, env.Now);
              using (var req = gasStation.Request()) {
            var start = env.Now;
            // Request one of the gas pumps
            yield return req;

            // Get the required amount of fuel
            var litersRequired = FuelTankSize - fuelTankLevel;
            yield return fuelPump.Get(litersRequired);

            // The "actual" refueling process takes some time
            yield return env.Timeout(TimeSpan.FromSeconds(litersRequired / RefuelingSpeed));

            env.Log("{0} finished refueling in {1} seconds.", name, (env.Now - start).TotalSeconds);
              }
        }
开发者ID:hsz-develop,项目名称:abeham--SimSharp,代码行数:26,代码来源:GasStationRefueling.cs


示例2: NeedsExecutionFor

        public override bool NeedsExecutionFor(Resource resource)
        {
            var rpfName = GetRpfNameFor(resource);

            if (!File.Exists(rpfName))
            {
                return true;
            }

            // if not, test modification times
            var requiredFiles = GetRequiredFilesFor(resource).Select(a => Path.Combine(resource.Path, a));
            requiredFiles = requiredFiles.Concat(resource.ExternalFiles.Select(a => a.Value.FullName));

            var modDate = requiredFiles.Select(a => File.GetLastWriteTime(a)).OrderByDescending(a => a).First();
            var rpfModDate = File.GetLastWriteTime(rpfName);

            if (modDate > rpfModDate)
            {
                return true;
            }

            // and get the hash of the client package to store for ourselves (yes, we do this on every load; screw big RPF files, we're reading them anyway)
            var hash = Utils.GetFileSHA1String(rpfName);

            resource.ClientPackageHash = hash;

            return false;
        }
开发者ID:Preto0203,项目名称:Server_One,代码行数:28,代码来源:UpdatePackageFileTask.cs


示例3: Tile

 public Tile(Resource r, Vector3 gl, Vector2 p, int chitValue)
 {
     resource = r;
     geoLocation = gl;
     position = p;
     this.chitValue = chitValue;
 }
开发者ID:Gabino3,项目名称:socAI,代码行数:7,代码来源:Tile.cs


示例4: DynamicFetch

        public void DynamicFetch()
        {
            using (ISession s = OpenSession())
            using (ITransaction tx = s.BeginTransaction())
            {
                DateTime now = DateTime.Now;
                User me = new User("me");
                User you = new User("you");
                Resource yourClock = new Resource("clock", you);
                Task task = new Task(me, "clean", yourClock, now); // :)
                s.Save(me);
                s.Save(you);
                s.Save(yourClock);
                s.Save(task);
                tx.Commit();
            }

            using (IStatelessSession ss = sessions.OpenStatelessSession())
            using (ITransaction tx = ss.BeginTransaction())
            {
                ss.BeginTransaction();
                Task taskRef =
                    (Task)ss.CreateQuery("from Task t join fetch t.Resource join fetch t.User").UniqueResult();
                Assert.True(taskRef != null);
                Assert.True(NHibernateUtil.IsInitialized(taskRef));
                Assert.True(NHibernateUtil.IsInitialized(taskRef.User));
                Assert.True(NHibernateUtil.IsInitialized(taskRef.Resource));
                Assert.False(NHibernateUtil.IsInitialized(taskRef.Resource.Owner));
                tx.Commit();
            }

            cleanup();
        }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:33,代码来源:StatelessSessionFetchingTest.cs


示例5: ShouldMatchResourceOnKeyAndValue

        public void ShouldMatchResourceOnKeyAndValue()
        {
            var filter = new ResourceFilter { KeyRegex = new Regex(@"Kiwi"), ValueRegex = new Regex(@"amazing kiwi") };
            var resource = new Resource("This_is_my_Kiwi_resource", "What an amazing kiwi");

            filter.IsMatch(resource).ShouldBeTrue();
        }
开发者ID:tygerbytes,项目名称:ResourceFitness,代码行数:7,代码来源:ResourceFilterTests.cs


示例6: run

        public override Statistics run()
        {
            Environment env = new Environment();

            //dist
            List<double> valueList = new List<double>() { 1, 2, 3, 4, 5 };
            List<double> distribution = new List<double>() { 0.5, 0.6, 0.7, 0.8, 1.0 };
            Discrete d = new Discrete(valueList, distribution);
            //dist1
            Uniform n = new Uniform(1, 3);
            Distribution dist = new Distribution(d);
            Distribution dist1 = new Distribution(n);

            Create c = new Create(env, 0, 20, dist);

            Dispose di = new Dispose(env, 1);

            Queue q = new Queue(env, 3);
            q.Capacity = 1;
            Resource r = new Resource(env, 2, 1, dist1, q);

            c.Next_AID.Add("First", 2);
            r.Next_AID.Add("First", 1);

            env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0);
            env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0);
            env.Setup_Simulation();
            return env.Simulate();
        }
开发者ID:aidint,项目名称:SimExpert,代码行数:29,代码来源:SimpleSimulation.cs


示例7: Label

 /// <summary>
 /// Initializes a new instance of the <see cref="Textbox"/> class.
 /// </summary>
 public Label()
 {
     this.Text = "";
     this.font = AlmiranteEngine.Resources.LoadSync<BitmapFont>("Fonts\\Pixel16");
     this.Color = Color.White;
     this.Alignment = FontAlignment.Left;
 }
开发者ID:WoLfulus,项目名称:Almirante,代码行数:10,代码来源:Label.cs


示例8: OnInitialize

        /// <summary>
        /// Scene initialization
        /// </summary>
        protected override void OnInitialize()
        {
            var device = AlmiranteEngine.Device;
            this.background = new Texture2D(device, 1, 1);
            this.background.SetData(new Color[] { Color.FromNonPremultiplied(0, 0, 0, 255) });
            this.map = AlmiranteEngine.Resources.LoadSync<Texture2D>("Objects\\Back");

            this.text = new Textbox()
            {
                Size = new Vector2(620, 30),
                Position = new Vector2(10, 720 - 40),
                MaxLength = 60
            };
            this.text.KeyDown += OnKeyDown;
            this.text.Enter += OnFocus;
            this.text.Leave += OnUnfocus;

            this.Interface.Controls.Add(this.text);

            this.chat = new Chat()
            {
                Size = new Vector2(620, 620),
                Position = new Vector2(10, 720 - 40 - 10 - 620),
                MaxEntries = 50
            };
            this.Interface.Controls.Add(this.chat);

            Player.Instance.Protocol.Subscribe<PlayerMessage>(this.OnMessage);
        }
开发者ID:WoLfulus,项目名称:Almirante,代码行数:32,代码来源:Play.cs


示例9: recieveResource

 public void recieveResource(Resource resource)
 {
     for (int i = 0; i < spawnAmount; i++)
     {
         mobQueue.Enqueue(resource);
     }
 }
开发者ID:joeygoode,项目名称:cauldron-command,代码行数:7,代码来源:SacrificialAltar.cs


示例10: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     // Browser detection and redirecting to error page
     if (Request.Browser.Browser.ToLower() == "ie" && Convert.ToDouble(Request.Browser.Version) < 7)
     {
         SPUtility.TransferToErrorPage("To view this report use later versions of IE 6.0");
     }
     else
     {
         try
         {
             string siteurl = MyUtilities.ProjectServerInstanceURL(SPContext.Current);
             var Resource_Svc = new Resource()
                                    {
                                        AllowAutoRedirect = true,
                                        Url = siteurl + "/_vti_bin/psi/resource.asmx",
                                        UseDefaultCredentials = true
                                    };
             var result = MyUtilities.GetGovernanceReport(siteurl, Resource_Svc.GetCurrentUserUid());
             //Repeater1.DataSource = result;
             //Repeater1.DataBind();
             JSONData.Text = result.Rows.Count > 0 ? MyUtilities.Serialize(result) : "";
         }
         catch (Exception ex)
         {
             MyUtilities.ErrorLog(ex.Message, EventLogEntryType.Error);
         }
     }
 }
开发者ID:Santhoshonet,项目名称:ProjectGovernanceReport,代码行数:29,代码来源:ITXPGReportV2.aspx.cs


示例11: CloneFrom

 public void CloneFrom(ResourceCollection other)
 {
     int e = 0, o = 0;
     while (e < Resources.Count || o < other.Resources.Count) {
         int oid = o;
         if (e < Resources.Count) {
             for (; oid < other.Resources.Count; ++oid) if (other.Resources[oid].Name == Resources[e].Name) break;
         } else oid = other.Resources.Count;
         if (e == Resources.Count || oid < other.Resources.Count) {
             for (; o < oid; ++o) {
                 var otherEntity = other.Resources[o];
                 var myEntity = new Resource() { Name = otherEntity.Name };
                 myEntity.Amount = otherEntity.Amount;
                 Resources.Insert(e++, myEntity);
             }
         }
         if (e < Resources.Count) {
             if (oid < other.Resources.Count) {
                 if (oid != o) Debug.LogError("Id missmatch");
                 Resources[e++].Amount = other.Resources[o++].Amount;
             } else {
                 Resources.RemoveAt(e);
             }
         }
     }
 }
开发者ID:JordanAupetit,项目名称:ProjectDungeon,代码行数:26,代码来源:Resource.cs


示例12: WindowsAzureAddOn

        /// <summary>
        /// Creates new instance from AddOn
        /// </summary>
        /// <param name="resource">The add on details</param>
        /// <param name="geoRegion">The add on region</param>
        public WindowsAzureAddOn(Resource resource, string geoRegion, string cloudService)
        {
            Type = resource.Namespace == DataSetType ? DataType : AppServiceType;

            AddOn = resource.Type;

            Name = resource.Name;

            Plan = resource.Plan;

            SchemaVersion = resource.SchemaVersion;

            ETag = resource.ETag;

            State = resource.State;

            UsageMeters = resource.UsageLimits.ToList();

            OutputItems = (Type == AppServiceType) ? new Dictionary<string, string>(resource.OutputItems) :
                new Dictionary<string, string>();

            LastOperationStatus = resource.Status;

            Location = geoRegion;

            CloudService = cloudService;
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:32,代码来源:WindowsAzureAddOn.cs


示例13: Handle_ShouldReturnContentResultWithLastModified_WhenDataIsResource

 public void Handle_ShouldReturnContentResultWithLastModified_WhenDataIsResource()
 {
     var handler = new ResourceRouteHandler();
     var resource = new Resource(Resources.ResourceManager, Resources.StringResources.test);
     var result = handler.Handle(null, new RouteData { Data = resource });
     Assert.AreEqual(resource.LastModified, (result as ContentResult).LastModified);
 }
开发者ID:ducas,项目名称:MicroWebServer,代码行数:7,代码来源:ResourceRouteHandlerTests.cs


示例14: SetResource

 // Initialization
 public void SetResource(Resource newResource)
 {
     resource = newResource;
     // Update models
     resourceModel.sprite = resource.MapIcon;
     resourceModel.color = resource.MapIconColor;
 }
开发者ID:Juan73908,项目名称:ETCorps,代码行数:8,代码来源:Tile.cs


示例15: Process

        public ProcessingResult Process(Resource resource)
        {
            var eventRecorder = new EventRecorder();
            this.Target = new StubTarget();

            var concordionBuilder = new ConcordionBuilder()
                .withEvaluatorFactory(this.EvaluatorFactory)
                .withIOUtil(new IOUtil())
                .withSource(this.Source)
                .withTarget(this.Target)
                .withAssertEqualsListener(eventRecorder)
                .withThrowableListener(eventRecorder);

            if (this.Fixture != null)
            {
                new ExtensionLoader(this.Configuration).AddExtensions(this.Fixture, concordionBuilder);
            }

            if (this.Extension != null)
            {
                this.Extension.addTo(concordionBuilder);
            }

            var concordion = concordionBuilder.build();

            ResultSummary resultSummary = concordion.process(resource, this.Fixture);
            string xml = this.Target.GetWrittenString(resource);
            return new ProcessingResult(resultSummary, eventRecorder, xml);
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:29,代码来源:TestRig.cs


示例16: Test_If_Paths_Point_To_File_And_Are_Identical_Can_Calculate_Relative_Path

        public void Test_If_Paths_Point_To_File_And_Are_Identical_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\spec\x.html");
            var to = new Resource(@"\spec\x.html");

            Assert.AreEqual("x.html", from.getRelativePath(to));
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:7,代码来源:Resource_Fixture.cs


示例17: HandleObjectCommand

    protected override void HandleObjectCommand(CommandType command, GameObject targetObject)
    {
        if (isSelected)
        {
            switch (command)
            {
                case CommandType.Attack:
                    {
                        currentTarget = targetObject.GetComponent<Commandable>();
                        currentCommand = command;
                        UpdatePath();
                    }
                    break;
                case CommandType.Follow:
                    {

                    }
                    break;
                case CommandType.Patrol:
                    {

                    }
                    break;
                case CommandType.Mine:
                    {
                        currentResourceTarget = targetObject.GetComponent<Resource>();
                        currentCommand = command;
                        UpdatePath();
                    }
                    break;
                default:
                    break;
            }
        }
    }
开发者ID:CosmicRey,项目名称:VGP230,代码行数:35,代码来源:Worker.cs


示例18: Test_If_Paths_Are_Not_Identical_Can_Calculate_Relative_Path

        public void Test_If_Paths_Are_Not_Identical_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\spec\");
            var to = new Resource(@"\spec\blah");

            Assert.AreEqual(@"blah", from.getRelativePath(to));
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:7,代码来源:Resource_Fixture.cs


示例19: ShouldMatchResourceOnKey

        public void ShouldMatchResourceOnKey()
        {
            var filter = new ResourceFilter { KeyRegex = new Regex(@"Kiwi") };
            var resource = new Resource("This_is_my_Kiwi_resource");

            filter.IsMatch(resource).ShouldBeTrue();
        }
开发者ID:tygerbytes,项目名称:ResourceFitness,代码行数:7,代码来源:ResourceFilterTests.cs


示例20: Test_If_Paths_Are_Weird_And_End_In_Slashes_Can_Calculate_Relative_Path

        public void Test_If_Paths_Are_Weird_And_End_In_Slashes_Can_Calculate_Relative_Path()
        {
            var from = new Resource(@"\x\b\c\");
            var to = new Resource(@"\a\b\x\");

            Assert.AreEqual(@"../../../a/b/x/", from.getRelativePath(to));
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:7,代码来源:Resource_Fixture.cs



注:本文中的Resource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ResourceAttributes类代码示例发布时间:2022-05-24
下一篇:
C# Resolver类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap