コード例 #1
0
ファイル: FileHandler.cs プロジェクト: infine8/unity3d-seva
        public override void WriteFile(string url, ResourceData resource)
        {
                #if COHERENT_UNITY_UNSUPPORTED_PLATFORM
            throw new ApplicationException("Coherent UI doesn't support the target platform!");
                #else
            IntPtr buffer = resource.GetBuffer();
            if (buffer == IntPtr.Zero)
            {
                resource.SignalFailure();
                return;
            }

            byte[] bytes = new byte[resource.GetSize()];
            Marshal.Copy(buffer, bytes, 0, bytes.Length);

            string cleanUrl = GetFilepath(url);

            try
            {
                File.WriteAllBytes(cleanUrl, bytes);
            }
            catch (IOException ex)
            {
                Console.Error.WriteLine(ex.Message);
                resource.SignalFailure();
                return;
            }

            resource.SignalSuccess();
                #endif
        }
コード例 #2
0
ファイル: FileHandler.cs プロジェクト: Charkova/MetaEden.a14
		public override void WriteFile(string url, ResourceData resource)
		{
			IntPtr buffer = resource.GetBuffer();
			if (buffer == IntPtr.Zero)
			{
				resource.SignalFailure();
				return;
			}

			byte[] bytes = new byte[resource.GetSize()];
			Marshal.Copy(buffer, bytes, 0, bytes.Length);

			string cleanUrl = GetFilepath(url);
			
			try
			{
				File.WriteAllBytes(cleanUrl, bytes);
			}
			catch (IOException ex)
			{
				Console.Error.WriteLine(ex.Message);
				resource.SignalFailure();
				return;
			}

			resource.SignalSuccess();
		}
コード例 #3
0
		public override void WriteFile(string url, ResourceData resource)
		{
		#if COHERENT_UNITY_UNSUPPORTED_PLATFORM
			throw new ApplicationException("Coherent UI doesn't support the target platform!");
		#else
			IntPtr buffer = resource.GetBuffer();
			if (buffer == IntPtr.Zero)
			{
				resource.SignalFailure();
				return;
			}

			byte[] bytes = new byte[resource.GetSize()];
			Marshal.Copy(buffer, bytes, 0, bytes.Length);

			string cleanUrl = GetFilepath(url);
			
			try
			{
				File.WriteAllBytes(cleanUrl, bytes);
			}
			catch (IOException ex)
			{
				Console.Error.WriteLine(ex.Message);
				resource.SignalFailure();
				return;
			}

			resource.SignalSuccess();
		#endif
		}