コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Return))
     {
         inputField.gameObject.SetActive(false);
         if (inputField.text != "")
         {
             text.text = "";
             replyPanel.SetActive(true);
             //判定
             feel = Feel.Get(inputField.text);
             faceChanger.faceChange(feel);
             if (feel == 2)
             {
                 RenderSettings.skybox = sunny;
                 FileStr.InputStr(inputField.text);
             }
             else if (feel == 1)
             {
                 RenderSettings.skybox                     = rain;
                 rain2D.RainScript.RainIntensity           = 0.5f;
                 rain2D.RainScript.WindSoundVolumeModifier = 0.5f;
             }
             StartCoroutine(Chat());
             inputField.text = "";
         }
         topreturn.gameObject.SetActive(true);
     }
 }
コード例 #2
0
        private void bt_open_Click(object sender, RoutedEventArgs e)
        {
            if (this.tb_file.Text != string.Empty)
            {
                f = new FileStr();

                bt_convert.IsEnabled = true;
            }
        }
コード例 #3
0
 private void save_Click(object sender, EventArgs e)
 {
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileStr.WriteStr(StudentsToString(Arr2ToStudents(DataGridViewUtils.GridToArray2 <string>(Output))), saveFileDialog.FileName);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "ошибка");
         }
     }
 }
コード例 #4
0
 private void save_Click(object sender, EventArgs e)
 {
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileStr file = new FileStr(saveFileDialog.FileName);
             file.WriteStr(Output.Text);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "ошибка");
         }
     }
 }
コード例 #5
0
 private void Open_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             string[,] Arr2 = StudentsToArr2(StrToStudents(FileStr.ReadStr(openFileDialog.FileName)));
             DataGridViewUtils.Array2ToGrid(Input, Arr2);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "ошибка");
         }
     }
 }
コード例 #6
0
    public void showMessage()
    {
        fukidashi.SetActive(true);
        msgtxt.text = "そいつぁあ大変やったなあ\n";
        List <string> sArr = Shuffle(FileStr.getStringArr());
        int           i    = 0;

        foreach (var a in sArr)
        {
            i++;
            msgtxt.text += "・" + a + "\n";
            if (i == 3)
            {
                break;
            }
        }
        msgtxt.text += "元気だしてや";
    }
コード例 #7
0
    /// <summary>
    /// Log出力用メソッド
    /// 入力値を取得してLogに出力し、初期化
    /// </summary>


    public void InputLogger()
    {
        string inputValue = inputField.text;

        if (inputValue.Length >= 2)
        {
            int pn = Feel.Get(inputValue);
            //if(pn==2)FileStr.InputStr(inputValue + "@" + pn);
            //Only Positive & Sentence
            if (pn == 2)
            {
                FileStr.InputStr(inputValue);
            }
        }
        //  Debug.Log(inputValue);


        InitInputField();
    }
コード例 #8
0
ファイル: Logger.cs プロジェクト: jajanuj/GitTest
        /// <summary>判斷Log檔案是否超過保存日期</summary>
        /// <param name="path">指定要檢查資料夾檔案的完整路徑</param>
        private static void JudgeDirectorySaveDate(string path)
        {
            string   FileStr;
            DateTime tempDateTime;

            try
            {
                string[] tempPaths = Directory.GetFiles(path, "*." + m_FileExp);

                // 判斷存放Log檔案是否超過保存日期
                for (int i = 0; i < tempPaths.Length; i++)
                {
                    string compareString = string.Format("LOG\\{0}_", m_FileName);
                    if (tempPaths[i].Contains(compareString))
                    {
                        int index = tempPaths[i].LastIndexOf(compareString) + compareString.Length;
                        FileStr = tempPaths[i].Substring(index, tempPaths[i].Length - index);
                        // 這邊可以再修改======================================================================================
                        int yy = 2010, mm = 1, dd = 1;
                        yy           = int.Parse(FileStr.Substring(0, 4));
                        mm           = int.Parse(FileStr.Substring(4, 2));
                        dd           = int.Parse(FileStr.Substring(6, 2));
                        tempDateTime = DateTime.Parse(mm.ToString() + "/" + dd.ToString() + "/" + yy.ToString() + " 00:00:00");
                        // ====================================================================================================

                        // 判斷Log檔案是否超過保存日期
                        if (tempDateTime.AddDays(m_ReserveDay) < DateTime.Now)
                        {
                            string filePath = string.Format(@"{0}\{1}_{2}", path, m_FileName, FileStr);
                            if (File.Exists(filePath))
                            {
                                File.Delete(filePath);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
コード例 #9
0
    public static string getMessage()
    {
        string str;

        str = "でも、こんないいこともありましたよね!\n";
        List <string> sArr = Shuffle(FileStr.getStringArr());
        int           i    = 0;

        foreach (var a in sArr)
        {
            i++;
            //ここでランダム3つ表示。
            str += "・" + a + "\n";
            if (i == 1)
            {
                break;
            }
        }

        return(str);
    }
コード例 #10
0
ファイル: clsFtp.cs プロジェクト: siszoey/geosufan
        /// <summary>
        /// 获得指定的路径下的文件夹,Path根目录下路径
        /// </summary>
        /// <returns></returns>
        public string[] GetFloder(string Path, out string error)
        {
            string[]      FileDetial;
            string[]      Floder = null;//用于返回
            bool          Isnull = false;
            StringBuilder result = new StringBuilder();

            try
            {
                error = "";
                if ("" == Path || null == Path)
                {
                    FileDetial = GetFileList("ftp://" + ftpServerIP + "/", WebRequestMethods.Ftp.ListDirectoryDetails, out error);
                }
                else
                {
                    FileDetial = GetFileList("ftp://" + ftpServerIP + "/" + Path + "/", WebRequestMethods.Ftp.ListDirectoryDetails, out error);
                }
                if (null != FileDetial || 0 > FileDetial.Length)
                {
                    foreach (string FileStr in FileDetial)
                    {
                        string File        = FileStr.Trim();
                        string newfileinfo = File.Substring(0, 3);
                        if ("drw" == newfileinfo)
                        {
                            int    strl   = File.Length;
                            int    indexm = File.LastIndexOf(':');
                            int    start  = indexm + 4;
                            int    end    = strl - start;
                            string floder = File.Substring(start, end);
                            if ("." == floder || ".." == floder)
                            {
                                continue;
                            }
                            else
                            {
                                result.Append(floder);
                                result.Append("\n");
                                Isnull = true;
                            }
                        }
                    }

                    if (Isnull)
                    {
                        result.Remove(result.ToString().LastIndexOf('\n'), 1);
                        Floder = result.ToString().Split('\n');
                    }
                }
                error = "Succeed";
            }

            catch (Exception ex)
            {
                error  = ex.Message;
                Isnull = false;
            }

            if (true == Isnull)
            {
                return(Floder);
            }
            else
            {
                return(null);
            }
        }
コード例 #11
0
 static void FileWrite(string str, string Path)
 {
     FileStr.WriteStr(str, Path);
 }
コード例 #12
0
 static string FileRead(string Path)
 {
     return(FileStr.ReadStr(Path));
 }
コード例 #13
0
        // *----------------------------------------------------------------------------------
        // *开 发 者:陈亚飞
        // *开发时间:20110616
        // *功能函数:获得FTP的指定文件夹下面的所有目录以及子目录
        // *参    数:指定的文件夹目录,true(是否查找指定文件夹目录下的文件夹),异常
        // *------------------------------------------------------------------------------------
        public List <string> GetSubDirectory(string path, bool beGetSubDir, out Exception pError)
        {
            pError = null;
            string[]      FileDetial;
            string        error  = "";
            List <string> LstDir = new List <string>();

            try
            {
                error = "";
                if (beGetSubDir)
                {
                    if ("" == path || null == path)
                    {
                        FileDetial = GetFileList("ftp://" + ftpServerIP + "/", WebRequestMethods.Ftp.ListDirectoryDetails, out error);
                    }
                    else
                    {
                        FileDetial = GetFileList("ftp://" + ftpServerIP + "/" + path + "/", WebRequestMethods.Ftp.ListDirectoryDetails, out error);
                    }
                    if (error != "Succeed")
                    {
                        pError = new Exception("获取文件目录列表失败");
                        return(null);
                    }
                    if (null != FileDetial || 0 > FileDetial.Length)
                    {
                        foreach (string FileStr in FileDetial)
                        {
                            string File        = FileStr.Trim();
                            string newfileinfo = File.Substring(0, 3);
                            if ("drw" == newfileinfo)
                            {
                                int    strl   = File.Length;
                                int    indexm = File.LastIndexOf(':');
                                int    start  = indexm + 4;
                                int    end    = strl - start;
                                string floder = File.Substring(start, end);
                                if ("." == floder || ".." == floder)
                                {
                                    continue;
                                }
                                else
                                {
                                    if (path != "")
                                    {
                                        if (!LstDir.Contains(path + "/" + floder))
                                        {
                                            LstDir.Add(path + "/" + floder);
                                        }
                                    }
                                    else
                                    {
                                        if (!LstDir.Contains(floder))
                                        {
                                            LstDir.Add(floder);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (LstDir != null)
                {
                    if (LstDir.Count == 0)
                    {
                        beGetSubDir = false;
                    }
                    else
                    {
                        beGetSubDir = true;
                        int pCount = LstDir.Count;
                        for (int j = 0; j < pCount; j++)
                        {
                            string        pSubDir       = LstDir[j];
                            List <string> tempSubDirLst = new List <string>();
                            tempSubDirLst = GetSubDirectory(pSubDir, beGetSubDir, out pError);
                            if (pError != null)
                            {
                                pError = new Exception("获取文件目录列表失败");
                                return(null);
                            }
                            if (tempSubDirLst != null)
                            {
                                if (tempSubDirLst.Count > 0)
                                {
                                    LstDir.AddRange(tempSubDirLst);
                                }
                            }
                        }
                    }
                }

                return(LstDir);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(null);
            }
        }