コード例 #1
0
ファイル: Settings.cs プロジェクト: roboter/FlashAutorun
        /// <summary>
        /// Load settings from disk
        /// </summary>
        /// <returns></returns>
        public static Settings LoadSettings( )
        {
            Settings ss1 = new Settings( );
            try
            {

                if ( File.Exists( InternalRes.FlashAutorunSettingsFileName ) )
                {
                    XmlSerializer serializer = new XmlSerializer( typeof( Settings ) );

                    FileStream fs = new FileStream( InternalRes.FlashAutorunSettingsFileName , FileMode.Open );
                    ss1 = ( Settings ) serializer.Deserialize( fs );
                    Debug.WriteLine( ss1.ApplicationName );
                    fs.Close( );
                }

            }
            catch ( Exception ex )
            {
                Debug.WriteLine( ex.ToString( ) );
            }
            if ( !Directory.Exists( fullsetupspath ) ) Directory.CreateDirectory( fullsetupspath );
            if ( !Directory.Exists( fulliconspath ) ) Directory.CreateDirectory( fulliconspath );
            return ss1;
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: roboter/FlashAutorun
        // private static Boolean isSettingsWritble = true;
        /// <summary>
        /// Check if possable to write changes to data and settings
        /// </summary>
        /// <summary>
        ///  Save settings to disk
        /// </summary>
        /// <param name="tosave"></param>
        public static void SaveSettings( Settings tosave )
        {
            if ( Utils.ifFileWriteble( InternalRes.FlashAutorunSettingsFileName ) )
            {
                XmlSerializer serializer = new XmlSerializer( typeof( Settings ) );

                TextWriter writer = new StreamWriter( InternalRes.FlashAutorunSettingsFileName );
                serializer.Serialize( writer , tosave );
                writer.Close( );
            }
            else
            {
                Debug.WriteLine( FlashAutorun.CreateFileError + InternalRes.FlashAutorunSettingsFileName );
            }
        }
コード例 #3
0
ファイル: Settings.cs プロジェクト: roboter/FlashAutorun
 /// <summary>
 ///  If no Settings File found Load Defaults
 /// </summary>
 /// <returns>Default Settings</returns>
 public static Settings LoadDefaults( )
 {
     Settings s1 = new Settings( );
     s1.aplicationName = InternalRes.FlashAutorunApplicationName + " " + Application.ProductVersion + " " + System.Threading.Thread.CurrentThread.CurrentUICulture;
     return s1;
 }
コード例 #4
0
ファイル: Main.cs プロジェクト: roboter/FlashAutorun
        private void SettingsGet( )
        {
            try
            {
                mysettings = new Settings( );
                mysettings = Settings.LoadSettings( );
                if ( mysettings.aplicationName == null )
                {
                    mysettings = Settings.LoadDefaults( );
                    Settings.SaveSettings( mysettings );
                }

            }
            catch ( Exception ex )
            {
                Debug.WriteLine( "LoadSettings()" + ex.Message );
            }
        }