public static void Save(string fileName, HexFileCollectionInfo hexFileCollectionInfo)
		{
			var dataContractSerializer = new DataContractSerializer(typeof(HexFileCollectionInfo));
			using (var fileStream = new FileStream(fileName, FileMode.Create))
			{
				dataContractSerializer.WriteObject(fileStream, hexFileCollectionInfo);
			}
		}
Exemple #2
0
		void CopyProperties(HexFileCollectionInfo hexFileCollectionInfo)
		{
			SelectedDriver = hexFileCollectionInfo.DriverType;
			Name = hexFileCollectionInfo.Name;
			MinorVersion = hexFileCollectionInfo.MinorVersion;
			MajorVersion = hexFileCollectionInfo.MajorVersion;
			AutorName = hexFileCollectionInfo.AutorName;

			Files = new ObservableRangeCollection<FileViewModel>();
			foreach (var fileInfo in hexFileCollectionInfo.FileInfos)
			{
				var fileViewModel = new FileViewModel(fileInfo, false);
				Files.Add(fileViewModel);
				SelectedFile = Files.FirstOrDefault();
			}
		}
Exemple #3
0
		void OnSaveFile()
		{
			var saveDialog = new SaveFileDialog()
			{
				Filter = "Пакет обновления (*.FSCS)|*.FSCS",
				DefaultExt = "Пакет обновления (*.FSCS)|*.FSCS"
			};
			if (saveDialog.ShowDialog().Value)
			{
				if (File.Exists(saveDialog.FileName))
					File.Delete(saveDialog.FileName);

				var hexFileCollectionInfo = new HexFileCollectionInfo()
				{
					DriverType = SelectedDriver,
					Name = Name,
					MinorVersion = MinorVersion,
					MajorVersion = MajorVersion,
					AutorName = AutorName
				};
				foreach (var file in Files)
				{
					var hexFileInfo = new HEXFileInfo()
					{
						HexMemoryType = file.SelectedHexMemoryType,
						FileName = file.FileName
					};
					foreach (var lineViewModel in file.Lines)
					{
						hexFileInfo.Lines.Add(lineViewModel.OriginalContent);
					}
					hexFileCollectionInfo.FileInfos.Add(hexFileInfo);
				}
				HXCFileInfoHelper.Save(saveDialog.FileName, hexFileCollectionInfo);
			}
		}
Exemple #4
0
		void OnCreateNew()
		{
			var hexFileCollectionInfo = new HexFileCollectionInfo();
			CopyProperties(hexFileCollectionInfo);
		}