Beispiel #1
0
        public static bool TryLoad(Stream stream, out TaxonomyAddonManager tam)
        {
            tam = null;
            if (serializer == null)
            {
                serializer = new XmlSerializer(typeof(TaxonomyAddonManager));
            }

            if (serializer == null)
            {
                return(false);
            }

            try
            {
                tam = (TaxonomyAddonManager)TaxonomyAddonManager.serializer.Deserialize(stream);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.TargetSite.ToString() + ": " + ex.ToString());
                Debug.WriteLine(ex.TargetSite.ToString() + ": " + ex.ToString());
            }

            return(false);
        }
Beispiel #2
0
        public static bool TryAutoLoad(out TaxonomyAddonManager tam)
        {
            tam = null;
            string filePath = GetDefaultFilePath();

            TaxonomyAddonManager.TryLoadFile(filePath, out tam);

            return(!(tam == null));
        }
Beispiel #3
0
        public static bool TryLoadFile(string filePath, out TaxonomyAddonManager tam)
        {
            tam = null;
            if (!File.Exists(filePath))
            {
                return(false);
            }

            try
            {
                using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    return(TaxonomyAddonManager.TryLoad(fs, out tam));
                }
            }
            catch {}

            return(false);
        }
        public static bool TryLoadFile( string filePath, out TaxonomyAddonManager tam )
        {
            tam = null;
            if( !File.Exists( filePath ) )
                return false;

            try
            {
                using( FileStream fs = new FileStream( filePath, FileMode.Open, FileAccess.Read ) )
                {
                    return TaxonomyAddonManager.TryLoad( fs, out tam );
                }
            }
            catch{}

            return false;
        }
        public static bool TryLoad( Stream stream, out TaxonomyAddonManager tam )
        {
            tam = null;
            if( serializer == null )
                serializer = new XmlSerializer( typeof( TaxonomyAddonManager ) );

            if( serializer == null )
                return false;

            try
            {
                tam = (TaxonomyAddonManager)TaxonomyAddonManager.serializer.Deserialize( stream );
                return true;
            }
            catch( Exception ex )
            {
                Console.WriteLine( ex.TargetSite.ToString() + ": " + ex.ToString() );
                Debug.WriteLine( ex.TargetSite.ToString() + ": " + ex.ToString() );
            }

            return false;
        }
        public static bool TryAutoLoad( out TaxonomyAddonManager tam )
        {
            tam = null;
            string filePath = GetDefaultFilePath();
            TaxonomyAddonManager.TryLoadFile( filePath, out tam );

            return !( tam == null );
        }