예제 #1
0
파일: Day.cs 프로젝트: shkumat/mgb_day
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    //	Запуск EXE-файла в том же каталоге, что и данная программа
    static bool    StartExeCopy(string SrcExeName, string Params)
    {
        if ((SrcExeName == null) || (Params == null))
        {
            return(false);
        }
        SrcExeName = SrcExeName.Trim();
        Params     = Params.Trim();
        if (SrcExeName == "")
        {
            return(false);
        }
        string Path    = CCommon.GetTaskDir() + "\\";
        string Mask    = SrcExeName.Substring(0, SrcExeName.Length - 3) + "*";
        string ExeName = Path + CCommon.GetFileName(SrcExeName);

        if (!CCommon.FileExists(ExeName))
        {
            foreach (string FileName in CCommon.GetFileList(Mask))
            {
                if (!CCommon.CopyFile(FileName, Path + CCommon.GetFileName(FileName)))
                {
                    return(false);
                }
            }
        }
        if (!CCommon.FileExists(ExeName))
        {
            return(false);
        }
        return(CCommon.Run(ExeName, Params));
    }