블로그 이미지
프로그램을 가장 훌륭하게 작성하는 방법은 상태가 변경되는 오브젝트들과 수학적인 값을 나타내는 오브젝트들의 조합으로 표현하는 것이다. -Kent Beck 초초초보

카테고리

Programming (184)
ASP.NET (9)
Silverlight (2)
Javascript (20)
C# (8)
java (25)
SQL (14)
Oracle (3)
MyBatis (3)
기타 (52)
개발방법론 (1)
trouble shooting (2)
Linux (5)
스칼라 (5)
html (2)
grails & gradle (3)
Spring (2)
rabbitmq (1)
(3)
spark (0)
docker (3)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

Posted by 초초초보
, |
Posted by 초초초보
, |

참조 : http://msdn.microsoft.com/ko-kr/library/z5s1e2wh.aspx

.msi 파일을 만들 때
빌드는 문제없이 잘되지만 빌드 후 나온 msi 파일을 설치시
ActiveX 같은 경우는 문제가 없는데, 시스템 파일 같은 경우 오류가발생 하는 경우가 있다.




설치 도중 오류 발생 함.

등록할 파일의 속성 중
Regster - vsdrpDoNotRegister 선택 하면 레지스트리에등록 하지 않음.
regsvr32 명령어가 필요한 dll은 vsdrfCOMSeflReg 선택 하면 됨.





끝.



Posted by 초초초보
, |

참조 : http://sandeep-aparajit.blogspot.com/2008/04/how-to-execute-command-in-c.html
         http://msdn.microsoft.com/ko-kr/library/e78byta0(VS.80).aspx
         http://www.uvm.edu/~jgm/wordpress/?p=121


System.Diagnostics.ProcessStartInfo  를 이용하여 실행

인증서 등록하기 예제
인증서등록 도구인  certmgr.exe 와 인증서 hanjin.cer 필요 함.   

class Program

    {

        static void Main(string[] args)

        {

            System.Diagnostics.ProcessStartInfo ps =

                new System.Diagnostics.ProcessStartInfo("cmd",

                "/c certmgr.exe -add hanjin.cer -c -s -r localMachine Root");

            ps.RedirectStandardOutput = true;

            ps.UseShellExecute = false;

            ps.CreateNoWindow = true;

            System.Diagnostics.Process p =

                new System.Diagnostics.Process();

            p.StartInfo = ps;

            p.Start();

 

            string result = p.StandardOutput.ReadToEnd();

            Console.WriteLine(result);

        }


인증서는 보안상. 업로드 불가.



끝.
Posted by 초초초보
, |

-- 파일 첨부 --
Posted by 초초초보
, |

폴더 감시 후 해당 폴더에서 변경(생성, 삭제, 이동 등)이 일어 났을 경우

해당 이벤트를 발생시킴


--  예제 소스  --
 static void Main(string[] args)
        {
            System.IO.FileSystemWatcher fsw = new System.IO.FileSystemWatcher();
            fsw.Path = "C:/test";
            fsw.EnableRaisingEvents = true;

            fsw.Created += new  System.IO.FileSystemEventHandler(fsw_Created);

            Console.ReadKey();
        }

        static void fsw_Created(object sender, System.IO.FileSystemEventArgs e)
        {
            Console.WriteLine("파일 경로 : " + e.FullPath);
            Console.WriteLine("만든 파일 : " + e.Name);
        }

Posted by 초초초보
, |

A() -> B() ->C() 함수를 호출 했다고 가정 했을 때

C() 함수에서 A() 함수명을 구할 수 있다.

        private void Defender4()
        {
            int count = new StackTrace().FrameCount; //현재의 호출스택 카운트
            StackTrace stacktrace = new StackTrace();
            MethodBase method = null;
            for (int i = 0; i <count ; i++)
            {
               method= stacktrace.GetFrame(i).GetMethod(); //i 번째에 해당하는 호출스택 메소드 반환
               Console.WriteLine("{0}번 째 호출스택 : {1}",i,method.Name);
            }
          
            Console.WriteLine();
        }


로그 작성에서 사용 하면 좋을 듯 함..








Posted by 초초초보
, |

참조 사이트 : http://msdn.microsoft.com/ko-kr/library/system.environment(VS.80).aspx


보통 환경 변수를 가져올 때
 string str = Environment.GetEnvironmentVariable("환경변수명");
 Console.WriteLine(str);

이런 식으로 가져오게 된다.

문장 속에 환경 변수가 들어 있다면 해당 값으로 치환해 주는 메소드가 있다.
String query = "%SystemDrive%";
str = Environment.ExpandEnvironmentVariables(query); //환경변수 여러개도 됨.

출력 값 : C:

파일의 경로를 저장 할 때 객체.Save("c:/파일명.확장자");
      --> 환경 변수를 구해서 객체.Save(str +  "/파일명.확장자");

Posted by 초초초보
, |