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


C# Serializer.DeSerializeObject方法代码示例

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


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

示例1: loadList

        public void loadList()
        {
            // Get history
            downloadedTrailers = new List<string>();
            trailerDBobject = new ObjectToSerialize();
            Serializer serializer = new Serializer();
            trailerDBobject = serializer.DeSerializeObject(Application.StartupPath + "\\trailerDB.txt");
            downloadedTrailers = trailerDBobject.DownloadedTrailers;

            historyListBox.DataSource = downloadedTrailers;
        }
开发者ID:tmar89,项目名称:tmar89snapstreamdev,代码行数:11,代码来源:dBEditor.cs

示例2: LoadRule

        public void LoadRule()
        {
            // Configure open file dialog box
            var dlg = new OpenFileDialog { FileName = "Prize Bond Manager",
                DefaultExt = ".pbm", Filter = @"Prize Bond Manager Files (.pbm)|*.pbm" };

            // Show open file dialog box
            var result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == DialogResult.OK)
            {
                // Open document
                var filename = dlg.FileName;
                var serializer = new Serializer();
                var deSerializeObject = serializer.DeSerializeObject(filename);
                var bonds = deSerializeObject.Bonds;
                var dal = new DAL();
                foreach (var bond in bonds)
                {
                    dal.AddBond(bond);
                }
            }
        }
开发者ID:munnaonc,项目名称:PrizeBondManager,代码行数:24,代码来源:BackUpManager.cs

示例3: runwork

        // Thread to scan
        private void runwork()
        {
            // Log in again
            if (!login())
            {
                SetStatus(statusWindow, "Will try to log on again in 10 seconds");
                hourTimer.Change(10000, 1000 * 60 * 60 * 4);
                scanner.Abort();
            }

            try
            {
                // List to save movies to db file
                List<string> downloadedTrailers = new List<string>();
                ObjectToSerialize trailerDBobject = new ObjectToSerialize();
                trailerDBobject.DownloadedTrailers = downloadedTrailers;

                // Scan for trailers
                SetStatus(statusWindow, "Scanning for new Trailers");
                string URL = "http://www.trailerfreaks.com/";
                HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(URL));
                HttpWebResponse webres = (HttpWebResponse)webreq.GetResponse();
                Stream resStream = webres.GetResponseStream();
                string response = new StreamReader(resStream).ReadToEnd();
                // Find trailer
                string trailerStart = "a href =\"trai"; string toFind; string trailerName; string trailerDescription;
                string trailerDate; string trailerActors; string trailerNameClean; string trailerDetailsURL;
                int startindex, endindex;
                //int numToGet = 10000;
                //if (!numTrailersToGet.Equals("All"))
                //    numToGet = int.Parse(numTrailersToGet);
                //int count = 0;
                //while ((startindex = response.IndexOf(trailerStart)) > -1 && count < numToGet)
                while ((startindex = response.IndexOf(trailerStart)) > -1)
                {
                    bool skip = false;

                    if (startindex > -1)
                    {
                        response = response.Substring(startindex);
                    }
                    else
                    {
                        SetStatus(statusWindow, "Error Finding Trailer Page Links");
                        SetStatus(statusWindow, "Scanning aborted.");
                        enableControls(true);
                        scanner.Abort();
                    }
                    toFind = "title=\"";
                    startindex = response.IndexOf(toFind);
                    if (startindex > -1)
                    {
                        startindex += toFind.Length; // Move to starting position of new Trailer
                    }
                    else
                    {
                        SetStatus(statusWindow, "Error parsing for Trailer Name");
                        continue;
                    }
                    endindex = response.IndexOf("\"", startindex);
                    trailerName = response.Substring(startindex, endindex - startindex).Trim();
                    // Remove Year
                    trailerName = trailerName.Remove(trailerName.LastIndexOf(" "));
                    trailerNameClean = replaceSpecials(trailerName);
                    trailerNameClean = trailerNameClean.Remove(trailerNameClean.LastIndexOf(" "));
                    SetStatus(statusWindow, "Found Trailer: " + trailerName);
                    response = response.Substring(endindex);

                    // Check if it exists already in flat file
                    string trailerDB = Application.StartupPath + "\\trailerDB.txt";
                    if (!File.Exists(trailerDB))
                    {
                        if (verbose)
                            SetStatus(statusWindow, "New DB Created and will add Trailer after successfull download");
                    }
                    else
                    {
                        Serializer serializer = new Serializer();
                        trailerDBobject = serializer.DeSerializeObject(Application.StartupPath + "\\trailerDB.txt");
                        downloadedTrailers = trailerDBobject.DownloadedTrailers;
                        if (downloadedTrailers.Contains(trailerName + GetText(formatBox)))
                        {
                            SetStatus(statusWindow, "Already Downloaded, Skipping Trailer");
                            skip = true;
                        }
                        else
                        {
                            if (verbose)
                                SetStatus(statusWindow, "Not in DB will add Trailer after successfull download");
                        }
                    }

                    if (!skip)
                    {
                        // Get description
                        toFind = "<a href=\"";
                        startindex = response.IndexOf(toFind);
                        if (startindex > -1)
                        {
//.........这里部分代码省略.........
开发者ID:tmar89,项目名称:tmar89snapstreamdev,代码行数:101,代码来源:GUI.cs

示例4: FromFile

 public static TerrainScreen FromFile()
 {
     Serializer serializer = new Serializer();
     TerrainScreen obj = serializer.DeSerializeObject<TerrainScreen>("save.txt");
     return obj;
 }
开发者ID:Andrusza,项目名称:PiratesArr,代码行数:6,代码来源:Setup.cs


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