当前位置: 首页>>代码示例>>C#>>正文


C# ResourceWriter.Close方法代码示例

本文整理汇总了C#中System.Resources.ResourceWriter.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceWriter.Close方法的具体用法?C# ResourceWriter.Close怎么用?C# ResourceWriter.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Resources.ResourceWriter的用法示例。


在下文中一共展示了ResourceWriter.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            ResourceWriter myResource = new ResourceWriter("Images.resources");
            myResource.AddResource("flash", new Bitmap("flashScreen.png"));
            Image simpleImage = new Image();
            simpleImage.Margin = new Thickness(0);

            BitmapImage bi = new BitmapImage();
            //BitmapImage.UriSource must be in a BeginInit/EndInit block
            bi.BeginInit();





            bi.UriSource = new Uri(@"pack://siteoforigin:,,,/alarm3.png");
            bi.EndInit();
            //set image source
            simpleImage.Source = bi;
            //        simpleImage.Stretch = Stretch.None;
            simpleImage.HorizontalAlignment = HorizontalAlignment.Center;
            simpleImage.Visibility = Visibility.Hidden;
            simpleImage.Name = "AlarmIndicator";
            simpleImage.Width = 13;


            myResource.AddResource("alarm", new Image("alarm3.png"));
            myResource.Close(); 


        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:31,代码来源:GenerateImageResources.cs

示例2: WriteChinaResource

 /// <summary>
 /// 写入 中文 资源文件.
 /// </summary>
 public void WriteChinaResource()
 {
     // 构造写入器.
     ResourceWriter rw = new ResourceWriter("China.resource");
     rw.AddResource("Hello", "你好");
     rw.Close();
 }
开发者ID:mahuidong,项目名称:my-csharp-sample,代码行数:10,代码来源:ResourceSample.cs

示例3: WriteEnglishResource

 /// <summary>
 /// 写入 英文 资源文件.
 /// </summary>
 public void WriteEnglishResource()
 {
     // 构造写入器.
     ResourceWriter rw = new ResourceWriter("English.resource");
     rw.AddResource("Hello", "Hello");
     rw.Close();
 }
开发者ID:mahuidong,项目名称:my-csharp-sample,代码行数:10,代码来源:ResourceSample.cs

示例4: SpecialResourceWriter

        public SpecialResourceWriter()
        {
            // Load all bunlde
            IList<IResourceBundle> allBundle = new List<IResourceBundle>(20);
            allBundle.Add(ResourceBundleFactory.CreateBundle("CanonMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("CasioMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("Commons", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("ExifInteropMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("ExifMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("FujiFilmMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("GpsMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("IptcMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("JpegMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("KodakMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("KyoceraMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("NikonTypeMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("OlympusMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("PanasonicMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("PentaxMarkernote", null, ResourceBundleFactory.USE_TXTFILE));
            allBundle.Add(ResourceBundleFactory.CreateBundle("SonyMarkernote", null, ResourceBundleFactory.USE_TXTFILE));

            foreach(IResourceBundle bdl in allBundle)
            {
                ResourceWriter rw = new ResourceWriter(bdl.Fullname+".resources");
                IDictionary<string,string> idic = bdl.Entries;
                IDictionaryEnumerator enumDic =  (IDictionaryEnumerator)idic.GetEnumerator();
                while (enumDic.MoveNext())
                {
                    rw.AddResource((string)enumDic.Key, (string)enumDic.Value);
                }
                rw.Close();
                rw.Dispose();

            }
        }
开发者ID:RobertCL,项目名称:MissionPlanner,代码行数:35,代码来源:SpecialResourceWriter.cs

示例5: AddFileAsStringResource

 public static void AddFileAsStringResource(string resourceFile, string resourceName, string inputFile)
 {
     ResourceWriter writer = new ResourceWriter(resourceFile);
     StreamReader reader = new StreamReader(inputFile);
     string s = reader.ReadToEnd();
     reader.Close();
     writer.AddResource(resourceName, s);
     writer.Close();
 }
开发者ID:pavelsavara,项目名称:nMars,代码行数:9,代码来源:ResourceUtil.cs

示例6: InsertEmployee

 public static void InsertEmployee(ResourceObj emp)
 {
     l.Add(emp);
     ResourceWriter rsxw = new ResourceWriter(path);
     for (int i = 0; i < l.Count; i++)
     {
         rsxw.AddResource("obj" + i.ToString(), l[i]);
     }
     rsxw.Close();
 }
开发者ID:nezlobin,项目名称:ASP,代码行数:10,代码来源:ResourceObj.cs

示例7: GenerationData

        void GenerationData(int countOfObj)
        {
            Random rand = new Random();
            ResourceWriter rsxw = new ResourceWriter(Server.MapPath("~/Resources/") + "res.resx");
            for (int i = 0; i < countOfObj; i++)
            {

                rsxw.AddResource("obj" + i.ToString(), new ResourceObj(rand));
            }
            rsxw.Close();
        }
开发者ID:nezlobin,项目名称:ASP,代码行数:11,代码来源:Home.aspx.cs

示例8: WriteImageResource

        /// <summary>
        /// Creates a resources file with an image
        /// </summary>
        /// <param name="imageSourcePath"></param>
        /// <param name="outputPath"></param>
        public static void WriteImageResource(string imageSourcePath, string outputPath) {
            Debug.Assert(imageSourcePath.EndsWith(".png"));
            Debug.Assert(outputPath.EndsWith(".resources"));

            FileInfo fileInfo = new FileInfo(imageSourcePath);
            FileStream fsSource = fileInfo.OpenRead();
            byte[] bytes = new byte[fileInfo.Length + 1];
            int bytesRead = fsSource.Read(bytes, 0, bytes.Length);
            Debug.Assert(bytesRead == fileInfo.Length);
            MemoryStream memoryStream = new MemoryStream(bytes, 0, bytesRead);
            ResourceWriter resw = new ResourceWriter(outputPath);
            resw.AddResource(imageSourcePath.ToLowerInvariant(), memoryStream);
            resw.Close();
        }
开发者ID:ajaishankar,项目名称:ravendb,代码行数:19,代码来源:SplashScreen.cs

示例9: WriteResource

 // Read all msgid/msgstr pairs (each string being NUL-terminated and
 // UTF-8 encoded) and write the .resources file to the given filename.
 WriteResource(String filename)
 {
     Stream input = new BufferedStream(Console.OpenStandardInput());
       reader = new StreamReader(input, new UTF8Encoding());
       if (filename.Equals("-")) {
     BufferedStream output = new BufferedStream(Console.OpenStandardOutput());
     // A temporary output stream is needed because ResourceWriter.Generate
     // expects to be able to seek in the Stream.
     MemoryStream tmpoutput = new MemoryStream();
     ResourceWriter rw = new ResourceWriter(tmpoutput);
     ReadAllInput(rw);
     #if __CSCC__
     // Use the ResourceReader to check against pnet-0.6.0 ResourceWriter
     // bug.
     try {
       ResourceReader rr = new ResourceReader(new MemoryStream(tmpoutput.ToArray()));
       foreach (System.Collections.DictionaryEntry entry in rr);
     } catch (IOException e) {
       throw new Exception("class ResourceWriter is buggy", e);
     }
     #endif
     tmpoutput.WriteTo(output);
     rw.Close();
     output.Close();
       } else {
     #if __CSCC__
     MemoryStream tmpoutput = new MemoryStream();
     ResourceWriter rw = new ResourceWriter(tmpoutput);
     ReadAllInput(rw);
     // Use the ResourceReader to check against pnet-0.6.0 ResourceWriter
     // bug.
     try {
       ResourceReader rr = new ResourceReader(new MemoryStream(tmpoutput.ToArray()));
       foreach (System.Collections.DictionaryEntry entry in rr);
     } catch (IOException e) {
       throw new Exception("class ResourceWriter is buggy", e);
     }
     BufferedStream output = new BufferedStream(new FileStream(filename, FileMode.Create, FileAccess.Write));
     tmpoutput.WriteTo(output);
     rw.Close();
     output.Close();
     #else
     ResourceWriter rw = new ResourceWriter(filename);
     ReadAllInput(rw);
     rw.Close();
     #endif
       }
 }
开发者ID:WalkOnCode,项目名称:android_real_web_server,代码行数:50,代码来源:msgfmt.cs

示例10: UpdateEmployee

        public static void UpdateEmployee(ASP_ex5.ResourceObj emp)
        {
            ResourceWriter rsxw = new ResourceWriter(path);
            for (int i = 0; i < l.Count; i++)
            {
                if (l[i].key == emp.key)
                {
                    l[i].comment = emp.comment;
                    l[i].key = emp.key;
                    l[i].value = emp.value;

                }
                rsxw.AddResource("obj" + i.ToString(), l[i]);
            }
            rsxw.Close();
        }
开发者ID:nezlobin,项目名称:ASP,代码行数:16,代码来源:ResourceObj.cs

示例11: Bug81759

		public void Bug81759 ()
		{
			MemoryStream ms = new MemoryStream ();
			using (ResourceReader xr = new ResourceReader (
				"Test/resources/bug81759.resources")) {
				ResourceWriter rw = new ResourceWriter (ms);
				foreach (DictionaryEntry de in xr)
					rw.AddResource ((string) de.Key, de.Value);
				rw.Close ();
			}
			ResourceReader rr = new ResourceReader (new MemoryStream (ms.ToArray ()));
			foreach (DictionaryEntry de in rr) {
				Assert.AreEqual ("imageList.ImageSize", de.Key as string, "#1");
				Assert.AreEqual ("Size", de.Value.GetType ().Name, "#2");
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:ResourceWriterTest.cs

示例12: Close

		public void Close ()
		{
			MemoryStream ms = new MemoryStream ();
			ResourceWriter writer = new ResourceWriter (ms);
			writer.AddResource ("Name", "Miguel");
			Assert.IsTrue (ms.CanWrite, "#A1");
			Assert.IsTrue (ms.GetBuffer ().Length == 0, "#A2");
			writer.Close ();
			Assert.IsFalse (ms.CanWrite, "#B1");
			Assert.IsFalse (ms.GetBuffer ().Length == 0, "#B2");
			writer.Close ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:ResourceWriterTest.cs

示例13: AddResource

		[Test] // AddResource (string, string)
		public void AddResource2_Value_Null ()
		{
			MemoryStream ms = new MemoryStream ();
			ResourceWriter writer = new ResourceWriter (ms);
			writer.AddResource ("Name", (string) null);
			writer.Generate ();

			ms.Position = 0;
			ResourceReader rr = new ResourceReader (ms);
			IDictionaryEnumerator enumerator = rr.GetEnumerator ();
			Assert.IsTrue (enumerator.MoveNext (), "#1");
			Assert.AreEqual ("Name", enumerator.Key, "#2");
			Assert.IsNull (enumerator.Value, "#3");
			Assert.IsFalse (enumerator.MoveNext (), "#4");

			writer.Close ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:18,代码来源:ResourceWriterTest.cs

示例14: AddResource_Name_Duplicate

		public void AddResource_Name_Duplicate ()
		{
			MemoryStream ms = new MemoryStream ();
			ResourceWriter writer = new ResourceWriter (ms);
			writer.AddResource ("FirstName", "Miguel");

			try {
				writer.AddResource ("FirstNaMe", "Chris");
				Assert.Fail ("#1");
			} catch (ArgumentException ex) {
				// Item has already been added. Key is dictionary:
				// 'FirstName'  Key being added: 'FirstNaMe'
				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsNull (ex.ParamName, "#5");
			}

			writer.AddResource ("Name", "Miguel");
			writer.Close ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:21,代码来源:ResourceWriterTest.cs

示例15: DeleteEmployee

        public static void DeleteEmployee(ASP_ex5.ResourceObj emp)
        {
            ResourceWriter rsxw = new ResourceWriter(path);
            for (int i = 0; i < l.Count; i++)
            {
                if (l[i].key != emp.key)
                {
                    rsxw.AddResource("obj" + i.ToString(), l[i]);
                }
            }
            rsxw.Close();

        }
开发者ID:nezlobin,项目名称:ASP,代码行数:13,代码来源:ResourceObj.cs


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