// Path: src/main/java/de/doridian/steammobile/auth/Credentials.java
// public class Credentials {
// 	public String username;
// 	public String password;
// 	public String steamguard_token;
// 
// 	public Credentials(String username, String password, String steamguard_token) {
// 		this.username = username;
// 		this.password = password;
// 		this.steamguard_token = steamguard_token;
// 	}
// 
// 	public Credentials() {
// 		this(null, null, null);
// 	}
// }


import de.doridian.steammobile.auth.Credentials;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
package de.doridian.steammobile.auth.base;



public abstract class ReaderWriterAuthStorage implements AuthStorage {
	protected void writeCredentialsTo(Credentials credentials, Writer writer) {
		try {
			PrintWriter pwriter = new PrintWriter(writer);
			pwriter.println(credentials.username);
			pwriter.println(credentials.password);
			pwriter.println(credentials.steamguard_token);
			pwriter.close();
		} catch(Exception e) {
			System.out.println("Writing authentication file failed because:");
			e.printStackTrace();
		}
	}

	protected Credentials readCredentialsFrom(Reader reader) {
		try {
			BufferedReader breader = new BufferedReader(reader);
			String user = breader.readLine();
			String password = breader.readLine();
			String token = breader.readLine();
			breader.close();
			return new Credentials(user, password, token);
		} catch(FileNotFoundException e) {
			//We don't care!
		} catch(Exception e) {
			System.out.println("Reading authentication file failed because:");
			e.printStackTrace();
		}
// Path: src/main/java/de/doridian/steammobile/auth/Credentials.java
// public class Credentials {
// 	public String username;
// 	public String password;
// 	public String steamguard_token;
// 
// 	public Credentials(String username, String password, String steamguard_token) {
// 		this.username = username;
// 		this.password = password;
// 		this.steamguard_token = steamguard_token;
// 	}
// 
// 	public Credentials() {
// 		this(null, null, null);
// 	}
// }


// Path: src/main/java/de/doridian/steammobile/auth/base/ReaderWriterAuthStorage.java
import de.doridian.steammobile.auth.Credentials;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;

package de.doridian.steammobile.auth.base;



public abstract class ReaderWriterAuthStorage implements AuthStorage {
	protected void writeCredentialsTo(Credentials credentials, Writer writer) {
		try {
			PrintWriter pwriter = new PrintWriter(writer);
			pwriter.println(credentials.username);
			pwriter.println(credentials.password);
			pwriter.println(credentials.steamguard_token);
			pwriter.close();
		} catch(Exception e) {
			System.out.println("Writing authentication file failed because:");
			e.printStackTrace();
		}
	}

	protected Credentials readCredentialsFrom(Reader reader) {
		try {
			BufferedReader breader = new BufferedReader(reader);
			String user = breader.readLine();
			String password = breader.readLine();
			String token = breader.readLine();
			breader.close();
			return new Credentials(user, password, token);
		} catch(FileNotFoundException e) {
			//We don't care!
		} catch(Exception e) {
			System.out.println("Reading authentication file failed because:");
			e.printStackTrace();
		}
		return null;