// Path: app/src/main/java/com/batsw/anonimitychat/tor/listener/TorBundleListenerManager.java
// public class TorBundleListenerManager {
// 
//     private List<ITorBundleStatusListener> mTorListenersList = null;
// 
//     public TorBundleListenerManager() {
//         mTorListenersList = new ArrayList<>();
//     }
// 
//     public void addTorBundleListener(ITorBundleStatusListener iTorBundleStatusListener) {
//         mTorListenersList.add(iTorBundleStatusListener);
//     }
// 
//     public void statusMessageReceived(String torLogMessage) {
//         for (ITorBundleStatusListener torStatusListener : mTorListenersList) {
//             torStatusListener.tellStatusMessage(torLogMessage);
//         }
//     }
// 
//     public void removeTorBundleListener(ITorBundleStatusListener iTorBundleStatusListener) {
//         if (mTorListenersList.contains(iTorBundleStatusListener)) {
//             mTorListenersList.remove(mTorListenersList);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/tor/listener/TorBundleStatusListenerImpl.java
// public class TorBundleStatusListenerImpl implements ITorBundleStatusListener {
// 
//     private String mStatusMessage = "";
// 
//     @Override
//     public void tellStatusMessage(String torLogMessage) {
//         mStatusMessage = torLogMessage;
//     }
// 
//     public String getStatusMessage() {
//         return mStatusMessage;
//     }
// }


import android.content.res.AssetManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;
import com.batsw.anonimitychat.R;
import com.batsw.anonimitychat.tor.listener.TorBundleListenerManager;
import com.batsw.anonimitychat.tor.listener.TorBundleStatusListenerImpl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
    private String mTorHostnamee;
    private boolean mTorBundleStarted = false;


    public TorProcessManager(AppCompatActivity mainActivity, TextView torStatusTextView) {

        mMainActivity = mainActivity;
        mAssetManager = mMainActivity.getAssets();

        mTorBundleListenerManager = new TorBundleListenerManager();

        mTorStatusTextView = torStatusTextView;
        mTorStatusTextView.setText(TorConstants.TOR_BUNDLE_STOPPED);

        init();
    }

    private void init() {
        Log.i(TOR_PROCESS_MANAGER_TAG, "ENTER -> init");

        mTorStartCommand = createTorProcessStartingPrerequisites();

        mTorProcessCommander = new TorProcess(mTorStartCommand, mTorBundleListenerManager);

        Log.i(TOR_PROCESS_MANAGER_TAG, "LEAVE -> init");
    }

    public void startTorBundle() {
        Log.i(TOR_PROCESS_MANAGER_TAG, "ENTER -> startTorBundle");

// Path: app/src/main/java/com/batsw/anonimitychat/tor/listener/TorBundleListenerManager.java
// public class TorBundleListenerManager {
// 
//     private List<ITorBundleStatusListener> mTorListenersList = null;
// 
//     public TorBundleListenerManager() {
//         mTorListenersList = new ArrayList<>();
//     }
// 
//     public void addTorBundleListener(ITorBundleStatusListener iTorBundleStatusListener) {
//         mTorListenersList.add(iTorBundleStatusListener);
//     }
// 
//     public void statusMessageReceived(String torLogMessage) {
//         for (ITorBundleStatusListener torStatusListener : mTorListenersList) {
//             torStatusListener.tellStatusMessage(torLogMessage);
//         }
//     }
// 
//     public void removeTorBundleListener(ITorBundleStatusListener iTorBundleStatusListener) {
//         if (mTorListenersList.contains(iTorBundleStatusListener)) {
//             mTorListenersList.remove(mTorListenersList);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/tor/listener/TorBundleStatusListenerImpl.java
// public class TorBundleStatusListenerImpl implements ITorBundleStatusListener {
// 
//     private String mStatusMessage = "";
// 
//     @Override
//     public void tellStatusMessage(String torLogMessage) {
//         mStatusMessage = torLogMessage;
//     }
// 
//     public String getStatusMessage() {
//         return mStatusMessage;
//     }
// }


// Path: app/src/main/java/com/batsw/anonimitychat/tor/bundle/TorProcessManager.java
import android.content.res.AssetManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;
import com.batsw.anonimitychat.R;
import com.batsw.anonimitychat.tor.listener.TorBundleListenerManager;
import com.batsw.anonimitychat.tor.listener.TorBundleStatusListenerImpl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

    private String mTorHostnamee;
    private boolean mTorBundleStarted = false;


    public TorProcessManager(AppCompatActivity mainActivity, TextView torStatusTextView) {

        mMainActivity = mainActivity;
        mAssetManager = mMainActivity.getAssets();

        mTorBundleListenerManager = new TorBundleListenerManager();

        mTorStatusTextView = torStatusTextView;
        mTorStatusTextView.setText(TorConstants.TOR_BUNDLE_STOPPED);

        init();
    }

    private void init() {
        Log.i(TOR_PROCESS_MANAGER_TAG, "ENTER -> init");

        mTorStartCommand = createTorProcessStartingPrerequisites();

        mTorProcessCommander = new TorProcess(mTorStartCommand, mTorBundleListenerManager);

        Log.i(TOR_PROCESS_MANAGER_TAG, "LEAVE -> init");
    }

    public void startTorBundle() {
        Log.i(TOR_PROCESS_MANAGER_TAG, "ENTER -> startTorBundle");

        mTorBundleStatusListener = new TorBundleStatusListenerImpl();