Exemplo n.º 1
0
  /**
   * Returns the Physical Path
   *
   * @param sMyWebServerRoot Web Server Root Directory
   * @param virtualDir Virtual Directory
   * @return Physical local Path
   * @throws IOException
   */
  @Override
  public String getLocalPath(String virtualDir) throws IOException {
    File vDirs = new File(ServerCore.ServerCongiguration.WebApplication.Root + "Data\\VDirs.dat");

    FileReader fileReader;
    BufferedReader reader;
    String line = "";
    String fileVirtualDir = "";
    String fileRealDir = "";
    int iStartPos = 0;

    virtualDir = virtualDir.trim();

    //		sMyWebServerRoot = sMyWebServerRoot.ToLower();

    //		virtualDir = virtualDir.ToLower();

    // sDirName = sDirName.Substring(1, sDirName.Length - 2);

    fileReader = new FileReader(vDirs);
    reader = new BufferedReader(fileReader);

    while (reader.ready()) {
      line = reader.readLine();
      line.trim();

      if (line.length() > 0) {
        iStartPos = line.indexOf(";");

        line = line.toLowerCase();

        fileVirtualDir = line.substring(0, iStartPos);
        fileRealDir = line.substring(iStartPos + 1);

        if (fileVirtualDir.equals(virtualDir)) {
          break;
        }
      }
    }

    ServerCore.print("Virtual Dir : " + fileVirtualDir);
    ServerCore.print("Directory   : " + virtualDir);
    ServerCore.print("Physical Dir: " + fileRealDir);

    if (fileVirtualDir.equals(virtualDir)) return fileRealDir;
    else return virtualDir;
  }
Exemplo n.º 2
0
  public ServerConnection getConnection() {
    for (ServerConnection connection : ServerCore.instance().connections.values()) {
      if (connection.user != null) {
        if (connection.user.username == username) {
          return connection;
        }
      }
    }

    return null;
  }
Exemplo n.º 3
0
  public User(String name, ArrayList<String> message) {
    username = name;
    messages = message;

    ServerCore.instance().cachedUsers.put(username, this);
  }