コード例 #1
0
ファイル: MainWindowViewModel.cs プロジェクト: Jamiras/Core
        private static void CopyFile(FileBundle destBundle, FileBundle sourceBundle, string file)
        {
            using (Stream outputStream = destBundle.CreateFile(file))
            {
                destBundle.SetModified(file, sourceBundle.GetModified(file));

                using (Stream inputStream = sourceBundle.OpenFile(file, OpenFileMode.Read))
                {
                    byte[] buffer = new byte[8192];
                    do
                    {
                        int read = inputStream.Read(buffer, 0, buffer.Length);
                        if (read <= 0)
                        {
                            break;
                        }

                        outputStream.Write(buffer, 0, read);
                    } while (true);
                }
            }
        }
コード例 #2
0
ファイル: MainWindowViewModel.cs プロジェクト: Jamiras/Core
        private static void InjectFile(FileBundle bundle, string file, string fileName, DateTime lastWriteTime)
        {
            using (Stream outputStream = bundle.CreateFile(file))
            {
                bundle.SetModified(file, lastWriteTime);

                using (Stream inputStream = File.OpenRead(fileName))
                {
                    byte[] buffer = new byte[8192];
                    do
                    {
                        int read = inputStream.Read(buffer, 0, buffer.Length);
                        if (read <= 0)
                        {
                            break;
                        }

                        outputStream.Write(buffer, 0, read);
                    } while (true);
                }
            }
        }