C# (CSharp) System.Xml.Serialization XmlSerializer примеры использования

C# (CSharp) System.Xml.Serialization XmlSerializer - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для System.Xml.Serialization.XmlSerializer, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
 public void ExistingFeatureInModelIsNotDuplicated()
 {
     var simpleScript =
         @"// Fills in details for download packages automatically.
         // This instance created AUTOMATICALLY during a previous run.
         function AutomatePackages()
         {
             SetElement(""FlavorName1"", ""NAME"");
             SetElement(""FlavorUrl1"", ""URL"");
             NextStage();
             NextStage();
         }";
     var configuration = new ConfigurationModel();
     configuration.Flavors = new List<ConfigurationModel.FlavorOptions> { new ConfigurationModel.FlavorOptions { FlavorName = "NAME"}};
     var scriptFile = Path.Combine(TestFolder, "test.js");
     var installerFile = Path.Combine(TestFolder, "installer.xml");
     File.WriteAllText(scriptFile, simpleScript);
     configuration.FileLocation = installerFile;
     configuration.Save();
     JavaScriptConverter.ConvertJsToXml(scriptFile, installerFile);
     var serializer = new XmlSerializer(typeof(ConfigurationModel));
     using (var textReader = new StreamReader(installerFile))
     {
         var model = (ConfigurationModel)serializer.Deserialize(textReader);
         Assert.That(model.Flavors, Is.Not.Null);
         Assert.That(model.Flavors.Count, Is.EqualTo(1));
         Assert.That(model.Flavors.First().FlavorName, Is.EqualTo("NAME"));
         Assert.That(model.Flavors.First().DownloadURL, Is.EqualTo("URL"));
     }
 }
Пример #2
0
        public static void SendFileInfo()
        {

            // Получаем тип и расширение файла
            fileDet.FILETYPE = fs.Name.Substring((int)fs.Name.Length - 3, 3);

            // Получаем длину файла
            fileDet.FILESIZE = fs.Length;

            XmlSerializer fileSerializer = new XmlSerializer(typeof(FileDetails));
            MemoryStream stream = new MemoryStream();

            // Сериализуем объект
            fileSerializer.Serialize(stream, fileDet);

            // Считываем поток в байты
            stream.Position = 0;
            Byte[] bytes = new Byte[stream.Length];
            stream.Read(bytes, 0, Convert.ToInt32(stream.Length));

            Console.WriteLine("Отправка деталей файла...");

            // Отправляем информацию о файле
            sender.Send(bytes, bytes.Length, endPoint);
            stream.Close();

        }
Пример #3
0
        public static BackgroundTrackItem DeserializeObjectAudioTrack(this string s)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(BackgroundTrackItem));
            StringReader textReader = new StringReader(s);

            return xmlSerializer.Deserialize(textReader) as BackgroundTrackItem;
        }
        public static MachineCollection LoadSettings(string path)
        {
            MachineCollection machineCollection;

            if (File.Exists(path))
            {
                XmlSerializer deserializer = new XmlSerializer(typeof(MachineCollection));
                using (TextReader textReader = new StreamReader(path))
                {
                    try
                    {
                        machineCollection = (MachineCollection)deserializer.Deserialize(textReader);
                        machineCollection.Initialize();
                    }
                    catch (System.Exception ex)
                    {
                        machineCollection = new MachineCollection();
                        Log.LogError("", ex);
                    }
                }
            }
            else
            {
                machineCollection = new MachineCollection();
            }
            return machineCollection;
        }
Пример #5
0
 public static string Serialize(MaterialList mats)
 {
     StringWriter sw = new StringWriter();
     XmlSerializer ser = new XmlSerializer(typeof(MaterialList));
     ser.Serialize(sw, mats);
     return sw.ToString();
 }
        public void Convert(string inputFileName, string outputFileName)
        {
            var deser = new XmlSerializer(typeof(Song));
            Song zigSong;
            using (FileStream stream = new FileStream(inputFileName, FileMode.Open))
            {
                zigSong = (Song)deser.Deserialize(stream);
            }

            var guitarTrack = GetTrack(zigSong);
            if (guitarTrack == null)
            {
                throw new Exception("Couldn't find a guitar track");
            }

            var rsSong = new RsSong();
            AddSongMetadata(rsSong, zigSong);
            AddEbeats(rsSong, zigSong);
            AddNotes(rsSong, zigSong);

            deser = new XmlSerializer(typeof(RsSong));
            using (FileStream stream = new FileStream(outputFileName, FileMode.Create))
            {
                deser.Serialize(stream, rsSong);
            }
        }
        private IEnumerable<ICompletionData> GetData(string highlightingName)
        {
            try
            {

            var result = new List<ICompletionData>();
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Intellisense", "Keywords", "options.xml");
            using (var sr = new StreamReader(path))
            {
                var ser = new XmlSerializer(typeof(List<KeywordsFileOption>));
                var ops = (List<KeywordsFileOption>)ser.Deserialize(sr);

                var filePath = Path.Combine(Application.StartupPath, "Intellisense", "Keywords",
                    ops
                    .Where(x => string.Compare(x.HighlightingName, highlightingName) == 0)
                    .Select(x => x.Filename)
                    .FirstOrDefault() ?? string.Empty);
                if (File.Exists(filePath))
                {
                    var w = GetWords(filePath);
                    result.AddRange(w);
                }
            }
            return result;
            }
            catch (Exception)
            {
                // TODO: приделать логирование
                return new List<ICompletionData>();
            }
        }
        public static PersistentVM LoadStateFromFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new ArgumentException(Resources.MissingPersistentVMFile, "filePath");
            }

            XmlAttributeOverrides overrides = new XmlAttributeOverrides();
            XmlAttributes ignoreAttrib = new XmlAttributes();
            ignoreAttrib.XmlIgnore = true;
            overrides.Add(typeof(DataVirtualHardDisk), "MediaLink", ignoreAttrib);
            overrides.Add(typeof(DataVirtualHardDisk), "SourceMediaLink", ignoreAttrib);
            overrides.Add(typeof(OSVirtualHardDisk), "MediaLink", ignoreAttrib);
            overrides.Add(typeof(OSVirtualHardDisk), "SourceImageName", ignoreAttrib);

            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(PersistentVM), overrides, new Type[] { typeof(NetworkConfigurationSet) }, null, null);

            PersistentVM role = null;
            
            using (var stream = new FileStream(filePath, FileMode.Open))
            {
                role = serializer.Deserialize(stream) as PersistentVM;
            }

            return role;
        }
		public LoadResourceXml ()
		{
			#region How to load an XML file embedded resource
			var assembly = typeof(LoadResourceText).GetTypeInfo().Assembly;
			Stream stream = assembly.GetManifestResourceStream("WorkingWithFiles.PCLXmlResource.xml");

			List<Monkey> monkeys;
			using (var reader = new System.IO.StreamReader (stream)) {
				var serializer = new XmlSerializer(typeof(List<Monkey>));
				monkeys = (List<Monkey>)serializer.Deserialize(reader);
			}
			#endregion

			var listView = new ListView ();
			listView.ItemsSource = monkeys;


			Content = new StackLayout {
				Padding = new Thickness (0, 20, 0, 0),
				VerticalOptions = LayoutOptions.StartAndExpand,
				Children = {
					new Label { Text = "Embedded Resource XML File (PCL)", 
						FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
						FontAttributes = FontAttributes.Bold
					}, listView
				}
			};

			// NOTE: use for debugging, not in released app code!
			//foreach (var res in assembly.GetManifestResourceNames()) 
			//	System.Diagnostics.Debug.WriteLine("found resource: " + res);
		}
        public override void SaveToDataStore(BlogEngine.Core.DataStore.ExtensionType exType, string exId, object settings)
        {
            XmlSerializer xs = new XmlSerializer(settings.GetType());
            string objectXML = string.Empty;
            using (StringWriter sw = new StringWriter())
            {
                xs.Serialize(sw, settings);
                objectXML = sw.ToString();
            }

            using (var mongo = new MongoDbWr())
            {
                var coll = mongo.BlogDB.GetCollection("DataStoreSettings");

                Document spec = new Document();
                spec["ExtensionType"] = exType;
                spec["ExtensionId"] = exId;

                var res = new Document();
                res["Settings"] = objectXML;
                res["ExtensionType"] = exType;
                res["ExtensionId"] = exId;

                coll.Update(res, spec, UpdateFlags.Upsert);
            }
        }
        public When_reading_from_example_file_namespaces()
        {
            var readAllText = File.OpenRead(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\ExamplesFiles\\namespaces.xml"));

            var xmlSerializer = new XmlSerializer(typeof(root));
            root = (root)xmlSerializer.Deserialize(readAllText);
        }
        public bool Save()
        {
            IAmazonResponse amazonResponse = amazonFactory.GetResponse();

            XmlSerializer serializer;
            TextWriter writer;

            try
            {
                if (amazonResponse.Errors.Count != 0)
                {
                    serializer = new XmlSerializer(typeof (List<string>));
                    writer = new StreamWriter(fileParameters.ErrorFileNameAndPath);
                    serializer.Serialize(writer, amazonResponse.Errors);
                    writer.Close();
                }

                serializer = new XmlSerializer(typeof (List<Review>));
                writer = new StreamWriter(fileParameters.ReviewFileNameAndPath);
                serializer.Serialize(writer, amazonResponse.Reviews);
                writer.Close();

                serializer = new XmlSerializer(typeof (List<Product>));
                writer = new StreamWriter(fileParameters.ProductFileNameAndPath);
                serializer.Serialize(writer, amazonResponse.Products);
                writer.Close();
            }
            catch
            {
                return false;
            }
            return true;
        }
        public void Convert(string inputFileName, string outputFileName)
        {
            var deser = new XmlSerializer(typeof(ZpeSong));
            ZpeSong zigSong;
            using (FileStream stream = new FileStream(inputFileName, FileMode.Open))
            {
                zigSong = (ZpeSong)deser.Deserialize(stream);
            }

            if (zigSong.PueVersion != 46)
                throw new Exception("Incompatable version of Ziggy Pro Editor XML");
            
            var guitarTrack = GetTrack(zigSong);
            if (guitarTrack == null)
            {
                throw new Exception("Couldn't find a guitar track");
            }

            var rsSong = new Song();
            AddSongMetadata(rsSong, zigSong);
            AddEbeats(rsSong, zigSong);
            AddNotes(rsSong, zigSong);

            using (FileStream stream = new FileStream(outputFileName, FileMode.Create))
            {
                rsSong.Serialize(stream, true);
            }
        }
Пример #14
0
        public void Deserialize(string settingsPath)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Settings));
            TextReader reader = null;
            Settings settings = null;
            try
            {
                reader = new StreamReader(settingsPath + "\\" + FILE_NAME);
                settings = (Settings)serializer.Deserialize(reader);
            }
            catch {;}
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }                
            }            

            if (settings != null)
            {
                this.DeviceLogging = settings.DeviceLogging;
                this.DesktopLogging = settings.DesktopLogging;
                this.CommLogging = settings.CommLogging;
            }            
        }
Пример #15
0
	/// <summary>
	/// Reads in a file containing a map of saved discovery documents populating the Documents and References properties, 
	/// with discovery documents, XML Schema Definition (XSD) schemas, and service descriptions referenced in the file.
	/// </summary>
	/// <param name="topLevelFilename">Name of file to read in, containing the map of saved discovery documents.</param>
	/// <returns>
	/// A DiscoveryClientResultCollection containing the results found in the file with the map of saved discovery documents. 
	/// The file format is a DiscoveryClientProtocol.DiscoveryClientResultsFile class serialized into XML; however, one would 
	/// typically create the file using only the WriteAll method or Disco.exe.
	/// </returns>
	public DiscoveryClientResultCollection ReadAllUseBasePath(string topLevelFilename)
	{
		string basePath = (new FileInfo(topLevelFilename)).Directory.FullName;
		var sr = new StreamReader (topLevelFilename);
		var ser = new XmlSerializer (typeof (DiscoveryClientResultsFile));
		var resfile = (DiscoveryClientResultsFile) ser.Deserialize (sr);
		sr.Close ();
		
		foreach (DiscoveryClientResult dcr in resfile.Results)
		{
			// Done this cause Type.GetType(dcr.ReferenceTypeName) returned null
			Type type;
			switch (dcr.ReferenceTypeName)
			{
				case "System.Web.Services.Discovery.ContractReference":
					type = typeof(ContractReference);
					break;
				case "System.Web.Services.Discovery.DiscoveryDocumentReference":
					type = typeof(DiscoveryDocumentReference);
					break;
				default:
					continue;
			}
			
			var dr = (DiscoveryReference) Activator.CreateInstance(type);
			dr.Url = dcr.Url;
			var fs = new FileStream (Path.Combine(basePath, dcr.Filename), FileMode.Open, FileAccess.Read);
			Documents.Add (dr.Url, dr.ReadDocument (fs));
			fs.Close ();
			References.Add (dr.Url, dr);
		}
		return resfile.Results;	
	}
Пример #16
0
        public Dictionary<int, float> GetItemPriceById(IEnumerable<int> eveId,bool sell=false)
        {
            var res = new Dictionary<int,float>();
            //http://api.eve-central.com/api/marketstat?typeid=34&typeid=35&regionlimit=10000002
            var url = new StringBuilder("http://api.eve-central.com/api/marketstat?");
            foreach (var id in eveId)
            {
                url.Append("typeid=").Append(id).Append("&");
            }
            url.Append("regionlimit=10000002");

            using (var cli = new WebClient())
            {
                var rdr = cli.OpenRead(url.ToString());
                var ser = new XmlSerializer(typeof (evec_api));
                if (rdr != null)
                {
                    var objectRes = (evec_api)ser.Deserialize(rdr);
                    foreach (var type in objectRes.marketstat)
                    {
                        res[type.id] = sell? type.sell.avg :type.buy.avg;
                    }
                }
            }

            return res;
        }
        public override bool Execute()
        {
            Log.LogMessage( MessageImportance.Low, "Packing M-Files Application." );

            // Make sure the collections are never null.
            References = References ?? new ITaskItem[ 0 ];
            SourceFiles = SourceFiles ?? new ITaskItem[ 0 ];
            DefaultEnvironments = DefaultEnvironments ?? new string[ 0 ];

            // Create the application package contents.
            var references = References.Select( item => new Reference( item ) ).ToList();
            var files = SourceFiles.Select( item => new PackageFile( item ) ).ToList();

            var appDef = CreateApplicationDefinition( references, files );
            var outputZip = CreatePackage( references, files );

            // Serialize the application definition file.
            var stream = new MemoryStream();
            var serializer = new XmlSerializer( typeof( ApplicationDefinition ) );
            serializer.Serialize( stream, appDef );
            stream.Flush();
            stream.Position = 0;
            outputZip.AddEntry( "appdef.xml", stream );

            // Save the zip.
            outputZip.Save();

            return true;
        }
Пример #18
0
 public void SerializeObject(string path, SerializableObject objToSerialize)
 {
     FileStream fstream = File.Open(path, FileMode.Create);
     XmlSerializer formatter = new XmlSerializer(typeof(SerializableObject));
     formatter.Serialize(fstream, objToSerialize);
     fstream.Close();
 }
Пример #19
0
        internal static Config LoadConfig()
        {
            string userAppDaraPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string appName = AppDomain.CurrentDomain.FriendlyName;
            while (appName.Contains("."))
            {
                appName = Path.GetFileNameWithoutExtension(appName);
            }
            appName += "." + s_configExtension;
            string path = Path.Combine(userAppDaraPath, appName);

            // search in local folder
            if (!File.Exists(path))
                return new Config();

            using (var fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read))
            {
                try
                {
                    var configObj = new XmlSerializer(typeof(Config)).Deserialize(fs);
                    var config = configObj as Config;
                    if (config != null)
                        m_lastConfig = config.Copy();
                    return config;
                }
                catch (Exception)
                {
                    return new Config();
                }
            }
        }
Пример #20
0
        public static Graph LoadXML(FileStream stream)
        {
            // Convert the object to XML data and put it in the stream.
             XmlSerializer serializer = new XmlSerializer(typeof(Graph));

             return (Graph)serializer.Deserialize(stream);
        }
Пример #21
0
 public void Load()
 {
     var exeLoc = System.Reflection.Assembly.GetExecutingAssembly().Location;
     var exePath = Path.GetDirectoryName(exeLoc);
     var offsetFile = Path.Combine(exePath, "offsets.xml");
     if (File.Exists(offsetFile))
     {
         // Load the offset data from file
         try
         {
             using (FileStream inFile = new FileStream(offsetFile, FileMode.Open))
             {
                 XmlSerializer x = new XmlSerializer(typeof(OffsetFile));
                 offsetFileData = (OffsetFile)x.Deserialize(inFile);
             }
             Loaded = true;
         }
         catch
         {
             Loaded = false;
         }
     }
     else
     {
         Loaded = false;
     }
 }
Пример #22
0
        public static void load()
        {
            if (!File.Exists(Misc.getServerPath() + @"\data\npcDrops.xml"))
            {
                Console.WriteLine(@"Missing data\npcDrops.xml");
                return;
            }
            try
            {
                //Deserialize text file to a new object.
                StreamReader objStreamReader = new StreamReader(Misc.getServerPath() + @"\data\npcDrops.xml");
                XmlSerializer serializer = new XmlSerializer(typeof(List<NpcDrop>));
                List<NpcDrop> list = (List<NpcDrop>)serializer.Deserialize(objStreamReader);

                int p = 0;
                foreach (NpcDrop drop in list)
                {
                    for (int i = 0; i < drop.npcs.Length; i++)
                        NpcData.forId(drop.npcs[i]).setDrop(drop);
                    p++;
                }
                Console.WriteLine("Loaded " + p + " npc drops.");
            }
            catch (Exception e)
            {
                Misc.WriteError((e.InnerException == null ? e.ToString() : e.InnerException.ToString()));
            }
        }
Пример #23
0
        private async Task<Device> GetXml(Dictionary<string, string> headers)
        {
            if (headers.ContainsKey("location"))
            {
                WebRequest request = WebRequest.Create(new Uri(headers["location"]));

                var r = (HttpWebResponse) await request.GetResponseAsync();
                if (r.StatusCode == HttpStatusCode.OK)
                {
                    try
                    {
                        var ser = new XmlSerializer(typeof (Device));
                        return (Device) ser.Deserialize(r.GetResponseStream());
                    }
                    catch (InvalidOperationException ex)
                    {
                        Debug.WriteLine(ex.Message);
                        return null;
                    }
                }

                throw new Exception("Cannot connect to service");
            }

            throw new Exception("No service Uri defined");
        }
 public List<Status> DeserializeStatusList(Stream stream)
 {
     XmlSerializer serializer = new XmlSerializer(
         typeof(List<Status>), 
         new XmlRootAttribute("statuses"));
     return (List<Status>)serializer.Deserialize(stream);
 }
Пример #25
0
        public static void Serialization1(Human human)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Human));
            StringBuilder sb = new StringBuilder();

            /* SERIALIZATION */
            using (StringWriter writer = new StringWriter(sb))
            {
                serializer.Serialize(writer, human);
            }
            // XML file
            //Console.WriteLine("SB: " +sb.ToString());
            /* END SERIALIZATION */



            /* DESERIALIZATION */
            Human newMartin = new Human();
            using (StringReader reader = new StringReader(sb.ToString()))
            {
                newMartin = serializer.Deserialize(reader) as Human;
            }
            Console.WriteLine(newMartin.ToString() + Environment.NewLine);
            /* END DESERIALIZATION */
        }
Пример #26
0
        /// <summary>
        /// Analyzes website and creates XML document
        /// </summary>
        /// <param name="config">Website's config</param>
        /// <returns>
        /// Updated website's config
        /// </returns>
        public WebsiteModel AnalyzeWebsite(WebsiteModel config)
        {
            CrawlerHelper crawlHelper = new CrawlerHelper();
            OrganizerHelper orgHelper = new OrganizerHelper();

            config.OrganizerConfig = new OrganizerModel();
            config.ExportConfig = new ExportModel();
            config.ExportConfig.Xml = string.Empty;

            var crawler = crawlHelper.ConfigureCrawler(config.CrawlerConfig);
            var list = crawler.Crawl();

            var analyzer = new WebsiteAnalyzer(config.AnalyzerConfig);
            var analyticsRunner = new AnalyticsRunner(crawler, analyzer);

            var site = analyticsRunner.Run(list);

            site.Name = config.Name;

            using (var sw = new StringWriter())
            {
                var serializer = new XmlSerializer(typeof(Site));
                serializer.Serialize(sw, site);

                config.ExportConfig.Xml = sw.ToString();
            }
                
            config.OrganizerConfig.Pages = orgHelper.AddChildren(site.Root, site);

            return config;
        }
Пример #27
0
        public email()
        {
            Data rx=null;
            XmlSerializer reader = new XmlSerializer(typeof(Data));
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            using (FileStream input = File.OpenRead(appPath+@"\data.xml"))
            {
                if(input.Length !=0)
                   rx = reader.Deserialize(input) as  Data;
            }

            if (rx != null)
            {
                try
                {
                    emaila = rx.userName;
                    passwd = UnprotectPassword(rx.passwd);
                    loginInfo = new NetworkCredential(emaila, passwd);
                    msg = new MailMessage();
                    smtpClient = new SmtpClient(rx.outGoing, rx.port);
                    smtpClient.EnableSsl = rx.ssl;
                    smtpClient.UseDefaultCredentials = false;
                    smtpClient.Credentials = loginInfo;
                    this.createMessage();
                    Environment.Exit(0);
                }
                catch (SmtpException sysex)
                {

                    MessageBox.Show("Taxi Notification App Has Encountered a Problem " +sysex.Message + " Please Check Your Configuration Settings", "Taxi Notification Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
                }
            }
            else Environment.Exit(0);
        }
Пример #28
0
 public string ContributionsXML(int startRow, int pageSize)
 {
     var xs = new XmlSerializer(typeof(ContributionElements));
     var sw = new StringWriter();
     PopulateTotals();
     var cc = contributions.OrderByDescending(m => m.ContributionDate).Skip(startRow).Take(pageSize);
     var a = new ContributionElements
     {
         NumberOfPages = (int) Math.Ceiling((model.Count ?? 0)/100.0),
         NumberOfItems = model.Count ?? 0,
         TotalAmount = model.Total ?? 0,
         List = (from c in cc
                 let bd = c.BundleDetails.FirstOrDefault()
                 select new APIContribution.Contribution
                 {
                     ContributionId = c.ContributionId,
                     PeopleId = c.PeopleId ?? 0,
                     Name = c.Person.Name,
                     Date = c.ContributionDate.FormatDate(),
                     Amount = c.ContributionAmount ?? 0,
                     Fund = c.ContributionFund.FundName,
                     Description = c.ContributionDesc,
                     CheckNo = c.CheckNo
                 }).ToArray()
     };
     xs.Serialize(sw, a);
     return sw.ToString();
 }
Пример #29
0
        public static object DeserializeAudioTracks(string tracksString)
        {
            XmlSerializer xmlDeSerializer = new XmlSerializer(typeof(List<BackgroundTrackItem>));
            StringReader textReader = new StringReader(tracksString);

            return xmlDeSerializer.Deserialize(textReader) as List<BackgroundTrackItem>;
        }
Пример #30
0
        public IEnumerable<Task> LoadTasks()
        {
            XmlSerializer xmlSerializer = new XmlSerializer (typeof(DataSet));
            DataSet ds;
            var tasks = new List<Task> ();

            try {
                FileStream readStream = new FileStream (path, FileMode.Open);
                ds = (DataSet)xmlSerializer.Deserialize (readStream);
                readStream.Close ();
            } catch (IOException) {
                return tasks;
            }

            foreach (var row in ds.Tables [0].AsEnumerable ()) {
                var task = new Task {
                    CreateDate = DateTime.Parse (row ["Task_CreateDate"].ToString ()),
                    Description = row ["Task_Description"].ToString (),
                    Title = row ["Task_Title"].ToString (),
                    IsDone = Boolean.Parse (row ["Task_IsDone"].ToString ()),
                    Priority = (Priority) Int32.Parse (row ["Task_Priority"].ToString ())
                };
                if (row ["Task_Deadline"] is DBNull) {
                    task.Deadline = null;
                } else {
                    task.Deadline = DateTime.Parse(row ["Task_Deadline"].ToString ());
                }
                tasks.Add (task);
            }

            return tasks;
        }