블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
04-20 00:00


[Windows Path] Users\<user>\AppData\LocalLow\Unity\WebPlayer\Cache\<project_name>\


[Mac Path] ~/Library/Caches/Unity/



[출처] http://answers.unity3d.com/questions/956259/where-is-the-cache-folder-for-wwwloadfromcacheordo.html

반응형
Posted by blueasa
, |
반응형

'Programming > C#' 카테고리의 다른 글

C#으로 xml 처리하기  (0) 2011.10.25
현재 Process의 한영 정보 얻기  (0) 2011.10.10
C# XML 다루는 간단한 소스  (0) 2011.09.16
DLL 파일을 별도 폴더에서 관리하자  (0) 2011.09.14
[펌] 입력 문자 검사  (0) 2011.09.14
Posted by blueasa
, |

string str = @"E:\JAVA\Sample\X509Test\minMain.java.bak";

            System.Diagnostics.Debug.WriteLine("경로명:" + System.IO.Path.GetDirectoryName(str));
            System.Diagnostics.Debug.WriteLine("확장자:" + System.IO.Path.GetExtension(str));
            System.Diagnostics.Debug.WriteLine("파일명:" + System.IO.Path.GetFileName(str));

            System.Diagnostics.Debug.WriteLine("분리자:" + System.IO.Path.AltDirectorySeparatorChar);
            System.Diagnostics.Debug.WriteLine("확장자유무:" + System.IO.Path.HasExtension(str).ToString());
            System.Diagnostics.Debug.WriteLine("순파일명:" + System.IO.Path.GetFileNameWithoutExtension(str));
            System.Diagnostics.Debug.WriteLine("root:" + System.IO.Path.GetPathRoot(str));
            System.Diagnostics.Debug.WriteLine("랜덤파일명:" + System.IO.Path.GetRandomFileName());
            System.Diagnostics.Debug.WriteLine("임시파일:" + System.IO.Path.GetTempFileName());
            System.Diagnostics.Debug.WriteLine("임시경로:" + System.IO.Path.GetTempPath());

 

            //---------------------------------------------------------------------------
            int n= str.LastIndexOf(@"\");
            System.Diagnostics.Debug.WriteLine("파일명:" + str.Substring(0, n));
            System.Diagnostics.Debug.WriteLine("경로명:" + str.Substring(n + 1, str.Length - n - 1));

반응형
Posted by blueasa
, |

1. 파일과 디렉터리를 나타내는 클래스

 

 

  - 파일(File), 디렉터리(Directory) 관련 클래스들

    : FileSystemInfo _ 파일 시스템을 나타내는 기본 클래스

    : Directory, DirectoryInfo _ 디렉터리를 나타내는 기본 클래스

    : File, FileInfo _ 파일을 나타내는 기본 클래스

    : Path _ 경로를 조작하기 위한 기본 클래스

 

 

2. File 클래스

 

  - using System.IO;

 

  - File 클래스

    : public sealed class File

    : 파일 관련 함수 제공

    : 멤버 함수들이 public static으로 선언

    : 파일에 관련된 정보(파일의 존재여부, 파일의 생성시간, 최종 액세스시간, 최종 저장시간 등)을 알아낼 수 있다. 파일 삭제, 복사, 이동 등의 작업이 가능하다.

 

  - 파일 복사하기

    : File.Copy("FileTest.cs", "Output.txt", true);

 

  - 파일 존재 확인하기

    : bool exist = File.Exists("./Output.txt")

 

  - 파일 생성 시간 알아내기

    : DateTime dt = File.GetCreationTime("./Outout.txt");

 

 

3. File 클래스를 이용한 FileStream 생성

 

  - File 클래스의 역할 : FileStream의 객체 생성, 파일 관련 함수 제공

 

  - File을 이용해서 파일 스트림 생성

    : FileStrea fs = File.OpenRead("./herol.txt");

 

  - 문자 스트림 변환

    : StreamReader r = new StreamReader(fs, System.Text.Encoding.Default);

 

  - 커서의 위치를 첫부분에 위치시킨다.

    : r.BaseStreamSeek(0, SeekOrigin.Begin);

 

  - 데이터가 존재한다면 한줄 씩 읽어낸다.

    : while(r.Peek() > -1){

        Console.WriteLine(r.ReadLine());

      }

 

  - 스트리을 닫는다.

    : r.Close();

 

  - File 클래스의 함수들

    : AppendText() -> UTF-8로 인코딩된 텍스트를 추가하는 StreamWriter를 만든다.

    : Copy() -> 새 파일에 기존 파일을 복사

    : Create() -> 경로에 파일을 만든다.

    : CreateText() -> UTF-8로 인코딩된 텍스트를 쓰기 위해 새 파일을 만들거나 연다.

    : Delete() -> 파일을 삭제한다. 지정된 파일이 없어도 예외가 throw되지 않는다.

    : Exists() -> 파일이 있는지 여부를 확인

    : GetAttributes() -> 정규화된 경로에 있는 파일의 FileAttributes를 가져옴

    : GetCreationTime() -> 파일 또는 디렉터리의 만든 날자와 시간을 반환

    : GetLastAccessTime() -> 파일 또는 디렉터리를 마지막으로 액세스한 날짜와 시간을 반환

    : GetLastWriteTime() -> 파일 또는 디렉터리를 마지막으로 쓴 날짜와 시간을 반환

    : Move() -> 파일을 새 위치로 이동하고 파일의 이름을 새로 정할 수 있다.

    : Open() -> 지정된 경로에서 FileStream을 연다.

    : OpenRead() -> 읽기용으로 파일을 연다.

    : OpenText() -> UTF-8로 인코딩된 텍스트 파일을 읽기용으로 Open

    : OpenWrite() -> 쓰기용으로 기존 파일을 연다.

    : SetAttributes() -> 파일의 지정된 FileAttributes를 가져온다.

    : SetCreationTime() -> 파일이 만들어진 날짜와 시간을 설정

    : SetLastAccessTime() -> 파일을 마지막으로 액세스한 날짜와 시간을 설정

    : SetLastWriteTime() -> 파일에 마지막으로 쓴 날짜와 시간을 설정

 

 

4. Directory 클래스

 

  - 기능 : 디렉터리의 생성, 이동, 삭제 등의 기능을 이용할 수 있다.

 

  - Directory 클래스

    : public sealed class Directory

    : 디렉터리 생성 및 삭제

    : 디렉터리 관련 함수 제공

    : 멤버 함수들은 대부분 public static으로 선언되어 있다.

 

 

5. Path 클래스

 

  - Path 클래스

    : public sealed class Path

    : 파일이나 디렉터리의 경로의 확장 및 변경, 수정하는 클래스

    : 멤버들은 대부분 public static으로 선언되어 있다.


출처 : http://blog.naver.com/phoogu?Redirect=Log&logNo=110013802685

반응형
Posted by blueasa
, |

           string strFullPathName;
            string strDirectoryName;
            string strFileName;

 

            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "실행화일(exe)|*.exe";

 

            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                strFullPathName = openFileDialog.FileName;

                strDirectoryName = System.IO.Path.GetDirectoryName(strFullPathName);
                strFileName = System.IO.Path.GetFileName(strFullPathName);

 

                MessageBox.Show(strFullPathName);
                MessageBox.Show(strDirectoryName);
                MessageBox.Show(strFileName);

             }

 

화일작업을 하다보면 화일명 또는 디렉토리명만 가져오고 싶은 경우가 있다..

 

이런경우 어떻게 하면될까..?

 

예를들어, C:\Windows\System32\aa.exe  가 있다고 하면

 

Full Path == "C:\Windows\System32\aa.exe"

Directory Name  == > "C:\Windows\System32"

File Name ==> "aa,exe"

 

이런식이다..

 

 

C++에서는 "\"문자찾아서 잘라내기 했던 기억이 있다.

 

하지만, C#에서는 이를 위한 클래스가 있다.

Path.GetDirectoryName()과 Path.GetFileName()이 그것이다..

 

필요할때 쓰면될것 같다. ^^

 

 

 

 

 

또하나.. 시스템 폴더명을 알아보자..

 

시스템폴더는 OS에 따라 Windows\System32가 될수도 있고, Winnt\System32가 될수있다.

 

            string strSysDir = Environment.SystemDirectory.ToString();
            MessageBox.Show(strSysDir);

 

위와같이 Environment.systemDirectory()를 이용하면 된다. ^^


출처 : http://club.paran.com/club/home.do?clubid=eypgworld-bbsView.do?menuno=2509143-clubno=1078741-bbs_no=0PIGp

반응형

'Programming > C#' 카테고리의 다른 글

C# 종료버튼 클릭시 최소화 시키기  (0) 2010.07.20
@" 는 무슨 의미인가요?  (0) 2010.07.20
은양의 프로그래밍 세상  (0) 2010.07.19
이펙티브 C# - 요점 정리  (0) 2010.07.19
Form Show()/Hide()  (0) 2010.07.19
Posted by blueasa
, |