Пример #1
0
        public static Actor getActor(string filePlusFolder, int id)
        {
            Stream stream = new FileStream(filePlusFolder,
                                           FileMode.Open,
                                           FileAccess.Read,
                                           FileShare.Read);

            StreamReader reader = new StreamReader(stream);
            string       s      = reader.ReadToEnd();

            if (s != string.Empty)
            {
                try
                {
                    Actor a = Raw.DeserializeActor(s, id);
                    if (a != null)
                    {
                        if (a.GetType() == typeof(Actor))
                        {
                            return((Actor)a);
                        }
                    }
                }
                catch (Exception exc)
                {
                    Console.WriteLine(exc.Message);

                    Debug.Assert(true, exc.Message);
                    throw exc;
                }
            }
            reader.Close();
            return(null);
        }