コード例 #1
0
        private void buttonRunToFile_Click(object sender, EventArgs e)
        {
            completedWork = 0;

            saveFileStruct = new SaveFileStruct();

            saveFileStruct.DBDescription =
                GetConnectionStringFromCheckedBoxListDataBase();
            new SaveFile(
                (string pathToDir,
                 bool isHeader,
                 string separator,
                 string type) =>
            {
                saveFileStruct.pathToDir       = pathToDir;
                saveFileStruct.isHeader        = isHeader;
                saveFileStruct.separator       = separator;
                saveFileStruct.type            = type;
                saveFileStruct.query           = richTextBoxQuery.Text;
                saveFileStruct.connectionCount = GetConnectionCount();
                UtilityFile.CreateDir(pathToDir);
                var query = saveFileStruct.query + " LIMIT " + getByOneRequest;
                Run(query, SetResultsToFiles, saveFileStruct.DBDescription);
                var strPathToLog = saveFileStruct.pathToDir + @"\log.txt";
                console          = new Utility.Console(strPathToLog);
                console.Show();
            }).Show();
        }
コード例 #2
0
        private void SaveAllFiles(
            string pathToDir,
            bool isHeader,
            string separator,
            string type)
        {
            int pagesCount = tabControlResult.TabPages.Count;

            UtilityFile.CreateDir(pathToDir);
            for (int i = 0; i < pagesCount; i++)
            {
                var currentPage =
                    tabControlResult.
                    TabPages[i];
                var currentFileName =
                    currentPage.Name;
                DataTable dt =
                    (DataTable)
                    ((DataGridView)currentPage.
                     Controls[0]).
                    DataSource;
                SaveAllFiles(
                    dt,
                    currentFileName,
                    pathToDir,
                    isHeader,
                    separator,
                    type);
            }
        }
コード例 #3
0
    public ModifyFileInfo[] ReadFileArray(string _packerPath, string _filePath)
    {
        List <ModifyFileInfo> tempModifyFileList = new List <ModifyFileInfo>();

        modifyFileLib.AddModifyFileList(File.ReadAllText(_filePath));
        ModifyFileInfo[] tempModifyFileArray = modifyFileLib.GetModifyFileArray();
        List <FileInfo>  tempList            = UtilityFile.GetDirectoryAllFile(_packerPath);

        for (int i = 0; i < tempList.Count; i++)
        {
            FileInfo tempFileInfo = tempList[i];
            string   tempFullName = tempFileInfo.FullName;
            if (tempFullName.Contains(".txt") || tempFullName.Contains(".meta") || tempFullName.Contains(".manifest"))
            {
                continue;
            }

            ModifyFileInfo tempInfo = modifyFileLib.GetTargetModifyFile(tempFullName);
            if (tempInfo != null)
            {
                if (tempFullName == tempInfo.FilePath && CalculateFileMd5(tempFullName) != tempInfo.FileDate)
                {
                    tempModifyFileList.Add(tempInfo);
                }
            }
            else
            {
                tempModifyFileList.Add(new ModifyFileInfo(tempFullName + "#" + CalculateFileMd5(tempFullName)));
            }
        }

        return(tempModifyFileList.ToArray());
    }
コード例 #4
0
        public FormState formStateNow; //画面当前状态

        /// <summary>
        /// 打开xml文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpenXml_Click(object sender, EventArgs e)
        {
            try
            {
                string filePath = UtilityFile.ChooseOneFile("xml文件|*.xml");
                if (string.IsNullOrEmpty(filePath))
                {
                    return;
                }
                textBoxFileName.Text = filePath;
                treeView1.Nodes.Clear();
                //创建一个XML对象
                XmlDocument myxml = new XmlDocument();
                //读取已经有的xml
                myxml.Load(filePath);
                //声明一个节点存储根节点
                XmlNode root = myxml.DocumentElement;
                textBoxInnerText.Text = root.InnerText;

                TreeNode node = createNode(root);
                treeView1.Nodes.Add(node);
            }
            catch (Exception ex)
            {
                Log.ShowErrorBox(ex);
            }
        }
コード例 #5
0
ファイル: OptionManager.cs プロジェクト: testdoron/pansoft
        public FileInfo Backup(string file)
        {
            FileStream fs = null;

            try
            {
                fs = File.Create(file);
            }
            catch (DirectoryNotFoundException)
            {
                UtilityFile.CreateDirectory(Path.GetDirectoryName(file));
                this.Backup(file);
            }
            catch (IOException)
            {
                FileAttributes fileAtts = FileAttributes.Normal;
                //先获取此文件的属性
                fileAtts = System.IO.File.GetAttributes(file);
                //讲文件属性设置为普通(即没有只读和隐藏等)
                System.IO.File.SetAttributes(file, FileAttributes.Normal);
                System.IO.File.Delete(file);
                this.Backup(file);
            }
            this.OptionDocument.Save(fs);
            return(new FileInfo(file));
        }
コード例 #6
0
        public void SetResultsToFiles(
            DataTable dataTable,
            string log,
            string dbName,
            string status = "Current")
        {
            try
            {
                if (dataTable.Rows.Count == 0)
                {
                    saveFileStruct.DBDescription.
                    RemoveAll(item => item.Item1 == dbName);
                    saveFileStruct.connectionCount--;
                    DataBaseThreading.ResetQueryDone(saveFileStruct.connectionCount);
                    console.Add($"\n\n\n\n\n\n***\nThe {dbName} has been completed work\n***\n\n\n\n\n\n");
                }

                if (saveFileStruct.DBDescription.Count == 0 && !keyCompleted)
                {
                    keyCompleted = true;
                    console.Add("\n\n\n\n\n\n***\nFiles were saved\n***\n\n\n\n\n\n");
                    MessageBox.Show("Files were saved", "Success!");
                    return;
                }

                dbName = UtilityFile.RemoveInvalidChars(dbName);

                SaveAllFiles(
                    dataTable,
                    dbName,
                    saveFileStruct.pathToDir,
                    saveFileStruct.isHeader,
                    saveFileStruct.separator,
                    saveFileStruct.type);

                completedWork++;
                if (saveFileStruct.connectionCount == completedWork)
                {
                    saveFileStruct.isHeader = false;
                    requestCount++;
                    var limit = $"SELECT SKIP {getByOneRequest * requestCount} " +
                                $"FIRST {getByOneRequest} ";

                    var regex = new Regex(Regex.Escape("SELECT "), RegexOptions.IgnoreCase);
                    var query = regex.Replace(saveFileStruct.query, limit, 1);

                    Run(query, SetResultsToFiles, saveFileStruct.DBDescription);

                    completedWork = 0;
                }
                console.Add($"+++\ndbName = {dbName}\ngetByOneRequest = {getByOneRequest}\nrequestCount = {requestCount}\n");
            }
            catch (Exception e)
            {
                console.Add($"\n\n\n ERROR!\n{e.Message} \n\n\n");
            }
        }
コード例 #7
0
    /// <summary>
    /// 压缩文件
    /// </summary>
    public void PackerAssets()
    {
        // 打包资源文件成 UPK 压缩文件
        string tempPath = BuildConst.PackerPath;

        UtilityFile.CreateDirectory(tempPath);
        UtilityPacker.PackFolder(tempPath, BuildConst.PackerFilePath);

        AssetDatabase.Refresh();
    }
コード例 #8
0
ファイル: DynamicTree.cs プロジェクト: Loong-Lee/VSDT
        private void btnBrowser_Click(object sender, EventArgs e)
        {
            string strFile = UtilityFile.ChooseOneFile("*.xml|XML文件|*.*|所有文件");

            if (string.IsNullOrEmpty(strFile.Trim()))
            {
                return;
            }
            txtXmlPath.Text             = strFile;
            XmlTreeNode.localConfigPath = this.txtXmlPath.Text;
        }
コード例 #9
0
    public CreateManager(string _dirPath)
    {
        libList.Clear();

        List <FileInfo> tempFileList = UtilityFile.GetDirectoryAllFile(_dirPath, "xlsx");

        for (int i = 0; i < tempFileList.Count; i++)
        {
            libList.Add(new CreateLibrary(tempFileList[i].FullName));
        }
    }
コード例 #10
0
        /// <summary>
        /// https://projecteuler.net/problem=54
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        public static Result PokerHands(Problem arguments)
        {
            //var a = EvaluatePokerHand(new string[] { "5H", "5C", "6S", "7S", "KD" });
            //var b = EvaluatePokerHand(new string[] { "2C", "3S", "8S", "8D", "TD" });
            //Console.WriteLine("Winner {0}.", (a > b) ? "1" : "2");
            //a = EvaluatePokerHand(new string[] { "5D", "8C", "9S", "JS", "AC" });
            //b = EvaluatePokerHand(new string[] { "2C", "5C", "7D", "8S", "QH" });
            //Console.WriteLine("Winner {0}.", (a > b) ? "1" : "2");
            //a = EvaluatePokerHand(new string[] { "2D", "9C", "AS", "AH", "AC" });
            //b = EvaluatePokerHand(new string[] { "3D", "6D", "7D", "TD", "QD" });
            //Console.WriteLine("Winner {0}.", (a > b) ? "1" : "2");
            //a = EvaluatePokerHand(new string[] { "4D", "6S", "9H", "QH", "QC" });
            //b = EvaluatePokerHand(new string[] { "3D", "6D", "7H", "QD", "QS" });
            //Console.WriteLine("Winner {0}.", (a > b) ? "1" : "2");
            //a = EvaluatePokerHand(new string[] { "2H", "2D", "4C", "4D", "4S" });
            //b = EvaluatePokerHand(new string[] { "3C", "3D", "3S", "9S", "9D" });
            //Console.WriteLine("Winner {0}.", (a > b) ? "1" : "2");

            var count     = 0;
            var cvsinfo   = arguments.Sequence.Split('|');
            var fileName  = cvsinfo[0];
            var delimiter = Convert.ToChar(cvsinfo[1]);
            var cards     = UtilityFile.ReadTextToTwoDimensionalArray(fileName, delimiter);

            for (int i = 0; i < cards.Length; i++)
            {
                var player1 = cards[i].Take(cards[i].Length / 2).ToArray();
                var player2 = cards[i].Skip(cards[i].Length / 2).ToArray();
                cards[i] = null;

                var p1 = EvaluatePokerHand(player1);
                var p2 = EvaluatePokerHand(player2);

                if (p1 > p2)
                {
                    count++;
                }
            }

            var answer  = count.ToString();
            var message = string.Format("Player 1 wins {0} hands.", answer);

            if (Answers[arguments.Id] != answer)
            {
                message += string.Format(" => INCORRECT ({0})", Answers[arguments.Id]);
            }
            var result = new Result(arguments.Id, message)
            {
                Answer = answer
            };

            return(result);
        }
コード例 #11
0
        /// <summary>
        /// 默认获取应用程序所在的目录及子目录下的所有选项数据文件的文件路径
        /// </summary>
        /// <returns></returns>
        public static OptionXmlFile[] GetOptionFiles()
        {
            StringCollection     sc       = UtilityFile.SearchDirectory(OptionService.ApplicationStartPath, "*.option");
            List <OptionXmlFile> fileList = new List <OptionXmlFile>();

            foreach (var filePath in sc)
            {
                OptionXmlFile doc = new OptionXmlFile(filePath);
                fileList.Add(doc);
            }
            return(fileList.ToArray());
        }
コード例 #12
0
    /// <summary>
    /// 复制一份资源到指定目录下进行压缩
    /// </summary>
    void CopyModifyFileArray()
    {
        for (int i = 0; i < modifyFileArray.Length; i++)
        {
            string tempPath    = modifyFileArray[i].AssetsFilePath;
            string tempOldPath = tempPath;
            string tempNewPath = tempPath.Replace(BuildConst.PackerPath, BuildConst.BuildPackerPath);
            UtilityFile.CopyFile(tempOldPath, tempNewPath);
        }

        AssetDatabase.Refresh();
    }
コード例 #13
0
    public void GeneratePbFiles(string _protoPath)
    {
        List <FileInfo> tempProtoFileList = UtilityFile.GetDirectoryAllFile(_protoPath, "proto");

        UtilityFile.DeleteFileOrDirectory(BuildConst.BuildPbPath);
        UtilityFile.CreateDirectory(BuildConst.BuildPbPath);
        for (int i = 0; i < tempProtoFileList.Count; ++i)
        {
            FileInfo tempFile = tempProtoFileList[i];
            GeneratePbFile(tempFile.FullName, _protoPath);
        }
    }
コード例 #14
0
            /// <summary>
            /// 启动生成
            /// </summary>
            public void StartGenerate()
            {
                ConfigClassContent.Append(string.Format("public class {0} \r{1} ", ClassName, "{"));
                ConfigClassContent.Append(CreatePublicParameter(dtProperty));

                ConfigClassContent.Append(CreatePublicInnertClass(dsInnerClass));
                ConfigClassContent.Append("\r");
                ConfigClassContent.Append(GetCommonMethod());
                ConfigClassContent.Append("\r");
                ConfigClassContent.Append("}");

                UtilityFile.SaveOneFile(ConfigClassContent.ToString());
            }
コード例 #15
0
ファイル: VcBLL.cs プロジェクト: 946061526/MyTest
        public bool ConfirmVcCodeAuth(Position vcCode, int fontSize)
        {
            bool _Result = false;

            try
            {
                string _Key = UtilityFun.GetCookie("_vcWxCode", true);
                if (_Key != "" && fontSize > 0)
                {
                    string _OldCodeStr = HttpContext.Current.Session[_Key].ToString();
                    if (string.IsNullOrEmpty(_OldCodeStr))
                    {
                        UtilityFile.AddLogErrMsg("_vcWxCode", "_OldCodeStr is null, CouchbaseKey code is " + _Key + ", ip is " + UtilityFun.GetUserIP());
                    }
                    else
                    {
                        Position _OldCode = new Position();
                        string[] _Temp    = _OldCodeStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        //_Temp肯定Length为3
                        _OldCode.XDis        = int.Parse(_Temp[1]);
                        _OldCode.YDis        = int.Parse(_Temp[2]);
                        _OldCode.ChineseChar = _Temp[0];// 汉字也需要比较

                        double dis = Position.GetDistanceBetweenPositions(vcCode, _OldCode);
                        if (dis <= (double)fontSize / 2)
                        {
                            _Result = true;
                            //这两个不要清空,因为在登录等业务里,残留的cookie的value值 和 _CouchBase中的value值还会被当成验证信息。 这两个等其自然失效
                            //_Couch.RemoveObject(_Key);
                            //UtilityFun.DelCookie("_vcWxCode", "");
                        }
                        else
                        {
                            UtilityFile.AddLogErrMsg("_vcWxCode", "key is " + _Key + ", CouchbaseKey code is " + _Key + ", ip is " + UtilityFun.GetUserIP());
                        }
                    }
                }
                else
                {
                    //考虑到部分用户可能不支持Cookies,在没有检测功能情况下,先让用户通过。
                    _Result = true;
                    UtilityFile.AddLogErrMsg("_vcWxCode", "key is null, submit code is " + vcCode.ToString() + ", ip is " + UtilityFun.GetUserIP());
                }
            }
            catch (Exception ex)
            {
                _Result = false;
                UtilityFile.AddLogMsg("BLLUser.ConfirmVcCodeAuth抛出异常:" + ex.Message);
            }
            return(_Result);
        }
コード例 #16
0
        /// <summary>
        /// https://projecteuler.net/problem=59
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        public static Result XorDecryption(Problem arguments)
        {
            const char FirstChar = 'a';
            const char LastChar  = 'z';

            var sum  = 0;
            var key  = string.Empty;
            var text = string.Empty;

            var cvsinfo   = arguments.Sequence.Split('|');
            var fileName  = cvsinfo[0];
            var delimiter = Convert.ToChar(cvsinfo[1]);
            var qualifier = Convert.ToChar(cvsinfo[2]);
            var cyphers   = UtilityFile.ReadCsvToArray(fileName, delimiter, qualifier);
            var ascii     = cyphers.Select(X => Convert.ToInt32(X)).ToArray();

            var allPossiblePasswords = (from a in FirstChar.To(LastChar)
                                        from b in FirstChar.To(LastChar)
                                        from c in FirstChar.To(LastChar)
                                        select new[] { Convert.ToInt32(a), Convert.ToInt32(b), Convert.ToInt32(c) }).ToArray();

            foreach (var password in allPossiblePasswords)
            {
                var decrypted = UtilityMath.Encrypt(ascii, password);
                text = new string(decrypted.Select(x => Convert.ToChar(x)).ToArray());

                if (text.Contains(" the ")) //perform simple check: if Text contains single word 'the' it is in english
                {
                    key = new string(password.Select(x => Convert.ToChar(x)).ToArray());
                    break;
                }
            }
            sum = text.Aggregate(0, (runningTotal, next) => runningTotal += next);

            var answer  = sum.ToString();
            var message = string.Format("The sum of the ASCII values in the original English text is {0}.", answer);

            if (Answers[arguments.Id] != answer)
            {
                message += string.Format(" => INCORRECT ({0})", Answers[arguments.Id]);
            }
            var r = new Result(arguments.Id, message)
            {
                Answer = answer
            };

            return(r);
        }
コード例 #17
0
    void BuildAssetBundle(BuildTarget _target, string _versionType = "")
    {
        if (_target == BuildTarget.iOS)
        {
            File.WriteAllText(PlatformNumberFilePath, "2000");
            File.WriteAllText(VersionNumberFilePath, EditorTool.Utility.GetVersionNumber(BuildConst.IosServer).ToString());
        }
        else if (_target == BuildTarget.Android)
        {
            File.WriteAllText(PlatformNumberFilePath, "3000");
            File.WriteAllText(VersionNumberFilePath, EditorTool.Utility.GetVersionNumber(BuildConst.AndroidServer).ToString());
        }

        UtilityFile.CreateDirectory(BuildConst.BuildAssetPath);
        BuildPipeline.BuildAssetBundles(BuildConst.BuildAssetPath, BuildAssetBundleOptions.ChunkBasedCompression, _target);
    }
コード例 #18
0
ファイル: OptionManager.cs プロジェクト: testdoron/pansoft
        public void Initializes(string optionFile)
        {
            string optionFilePath = string.Empty;

            if (File.Exists(optionFile))
            {
                optionFilePath = optionFile;
            }
            else
            {
                optionFilePath = Path.Combine(ApplicationStartPath, optionFile);
            }

            this.OptionFile = OptionFile.Load(optionFilePath);

            this.OptionDocument = new XmlDocument();
            this.OptionDocument.Load(optionFilePath);

            StringCollection files = UtilityFile.SearchDirectory(ApplicationStartPath, "*.dll", true, true);

            foreach (string file in files)
            {
                Assembly ass   = Assembly.LoadFile(file);
                Type[]   types = ass.GetTypes();
                foreach (Type type in types)
                {
                    if (type.IsDefined(typeof(OptionAttribute), false))//如果Class被定制特性标记
                    {
                        object[] objs = type.GetCustomAttributes(false);
                        foreach (var obj in objs)
                        {
                            if (!(obj is OptionAttribute))
                            {
                                continue;
                            }
                            Option[] options = Option.Load(ass, type, (OptionAttribute)obj);
                            foreach (Option o in options)
                            {
                                o.OptionChangingEvent += new Option.OptionChangingEventHandler(OptionChangingEvent);
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
    void CopyLuaFile(string _filePath, bool _isToLower)
    {
        List <FileInfo> tempFileList = UtilityFile.GetDirectoryAllFile(_filePath);

        for (int i = 0; i < tempFileList.Count; i++)
        {
            if (tempFileList[i].Name.Contains(".meta"))
            {
                continue;
            }

            string tempFullFilePath  = tempFileList[i].FullName.Replace(@"\", "/");
            string tempLuaFilePath   = tempFullFilePath.Replace(_filePath, BuildConst.BuildLuaTempPath);
            string tempLuaFolderPath = Path.GetDirectoryName(tempLuaFilePath);
            string tempFilePath      = tempFullFilePath.Replace(_filePath, BuildConst.BuildLuaPath);
            string tempFolderPath    = Path.GetDirectoryName(tempFilePath);

            if (_isToLower)
            {
                tempFilePath      = tempFilePath.ToLower();
                tempFolderPath    = tempFolderPath.ToLower();
                tempLuaFilePath   = tempLuaFilePath.ToLower();
                tempLuaFolderPath = tempLuaFolderPath.ToLower();
            }

            if (!Directory.Exists(tempLuaFolderPath))
            {
                Directory.CreateDirectory(tempLuaFolderPath);
            }

            if (!tempFullFilePath.Contains(".lua"))
            {
                if (!Directory.Exists(tempFolderPath))
                {
                    Directory.CreateDirectory(tempFolderPath);
                }

                File.Copy(tempFullFilePath, tempFilePath);
                continue;
            }

            string tempNewFile = tempLuaFilePath + BuildConst.BytesName;
            File.Copy(tempFullFilePath, tempNewFile);
        }
    }
コード例 #20
0
    void DoSetFolderAssetBundleName(string _name, string _folderName, string[] _searchPatternArray)
    {
        string tempPath = BuildConst.AssetPath + _folderName;

        UtilityFile.CreateDirectory(tempPath);

        List <FileParamInfo> tempInfoList = UtilityFile.GetDirectoryAllAssetsFile(tempPath, _searchPatternArray);

        if (tempInfoList == null)
        {
            return;
        }

        for (int i = 0; i < tempInfoList.Count; i++)
        {
            DoSetAssetBundleName(_name + tempInfoList[i].FileName, tempInfoList[i].FilePath);
        }
    }
コード例 #21
0
        /// <summary>
        /// 从目录中找到所有的.Net程序集,并遍历所有程序集找到所有实现了IOption接口的类型
        /// </summary>
        /// <param name="appStartPath">The app start path.</param>
        /// <returns></returns>
        private static Type[] GetOptionClassByDirectory(string appStartPath)
        {
            List <Type> typeList = new List <Type>();

            Assembly[] assArray = UtilityFile.SearchAssemblyByDirectory(appStartPath);
            foreach (Assembly ass in assArray)
            {
                Type[] types = ass.GetTypes();
                foreach (Type type in types)
                {
                    if (UtilityType.ContainsInterface(type, typeof(IOption)))
                    {
                        typeList.Add(type);
                    }
                }
            }
            return(typeList.ToArray());
        }
コード例 #22
0
ファイル: VcBLL.cs プロジェクト: 946061526/MyTest
        /// <summary>
        /// 比对验证码
        /// 正确之后失效
        /// </summary>
        /// <param name="authCode">提交的验证码</param>
        /// <returns></returns>
        public bool ConfirmAuth(string authCode)
        {
            bool _Result = false;

            try
            {
                string _Key = UtilityFun.GetCookie("_login", false);
                if (_Key != "")
                {
                    //CouchBaseClient _Couch = new CouchBaseClient();
                    //string _OldCode = _Couch.GetObject<string>( _Key );
                    //if ( _OldCode != null && _OldCode.ToLower() == authCode.ToLower() )
                    //{
                    //    _Result = true;
                    //    _Couch.RemoveObject( _Key );
                    //    UtilityFun.DelCookie( "_login", "" );
                    //}
                    //else
                    //{
                    //    UtilityFile.AddLogErrMsg( "login", "key is " + _Key + ", submit code is " + authCode + ", org code is " + _OldCode + ", ip is " + UtilityFun.GetUserIP() );
                    //}
                    //_Couch = null;

                    string _OldCode = HttpContext.Current.Session[_Key].ToString();
                    if (_OldCode != null && _OldCode.ToLower() == authCode.ToLower())
                    {
                        _Result = true;
                        HttpContext.Current.Session[_Key] = null;
                        UtilityFun.DelCookie("_login", "");
                    }
                }
                else
                {
                    //考虑到部分用户可能不支持Cookies,在没有检测功能情况下,先让用户通过。
                    _Result = true;
                }
            }
            catch (Exception ex)
            {
                _Result = false;
                UtilityFile.AddLogMsg("BLLUser.ConfirmAuth抛出异常:" + ex.Message);
            }
            return(_Result);
        }
コード例 #23
0
    public void WriteFileArray(string _packerPath, string _filePath)
    {
        string          tempTxt  = "";
        List <FileInfo> tempList = UtilityFile.GetDirectoryAllFile(_packerPath);

        for (int i = 0; i < tempList.Count; i++)
        {
            FileInfo tempFileInfo = tempList[i];
            string   tempFullName = tempFileInfo.FullName;
            if (tempFullName.Contains(".meta") || tempFullName.Contains(".manifest"))
            {
                continue;
            }

            tempTxt = tempTxt + (tempFullName + "#" + CalculateFileMd5(tempFullName)) + "\n";
        }

        File.WriteAllText(_filePath, tempTxt);
    }
コード例 #24
0
ファイル: VcBLL.cs プロジェクト: 946061526/MyTest
        /// <summary>
        /// 更新图形验证码
        /// </summary>
        /// <returns></returns>
        public bool SetVcCodeAuth(Position vcCode)
        {
            bool _Result = true;

            try
            {
                string _Key   = "vcWxCode" + DateTime.Now.ToString("ssffffff");
                string _Value = vcCode.ChineseChar + "," + vcCode.XDis + "," + vcCode.YDis;
                //CouchBaseClient _Couch = new CouchBaseClient();
                //_Result = _Couch.SetObject( _Key, _Value, 10 * 60 * 1000d );
                HttpContext.Current.Session[_Key] = _Value;
                UtilityFun.SetCookie("_vcWxCode", _Key, "", 10, true);
            }
            catch (Exception ex)
            {
                _Result = false;
                UtilityFile.AddLogMsg("BLLUser.SetVcCodeAuth抛出异常:" + ex.Message);
            }
            return(_Result);
        }
コード例 #25
0
    void BuildAssetBundleLua(BuildTarget _target)
    {
        if (Directory.Exists(BuildConst.BuildLuaPath))
        {
            Directory.Delete(BuildConst.BuildLuaPath, true);
        }

        CopyLuaFile(Application.dataPath + "/LuaFramework/lua/", true);
        CopyLuaFile(Application.dataPath + "/LuaFramework/Tolua/Lua/", false);
        AssetDatabase.Refresh();

        List <FileParamInfo> tempInfoList = UtilityFile.GetDirectoryAllAssetsFile(BuildConst.BuildLuaTempPath, "bytes");

        for (int i = 0; i < tempInfoList.Count; i++)
        {
            BuildSingleAssetBundle(_target, tempInfoList[i].FilePath);
        }

        Directory.Delete(BuildConst.BuildLuaTempPath, true);
        AssetDatabase.Refresh();
    }
コード例 #26
0
        public void Update(Dictionary <string, string> changes)
        {
            if (_use_template)
            {
                PreFileTemplateProcesing();
            }

            var text = UtilityFile.GetTextContentOfFileInZip(Name, CONTENT_FILENAME);

            foreach (var update in changes)
            {
                text = text.Replace(update.Key, update.Value);
            }

            UtilityFile.UpddateTextContentOfFileInZip(Name, CONTENT_FILENAME, text);

            if (_use_template)
            {
                PostFileTemplateProcesing();
            }
        }
コード例 #27
0
    void BuildAssetBundleFolder(string _folderPath, BuildTarget _target)
    {
        List <BuildBundleInfo> tempList = buildBundleFolderLib.GetBundleInfoList();

        AssetBundleBuild[] tempAssetBundleArray = new AssetBundleBuild[tempList.Count];
        for (int i = 0; i < tempAssetBundleArray.Length; i++)
        {
            BuildBundleInfo tempInfo = tempList[i];
            tempAssetBundleArray[i].assetBundleName = tempInfo.Prefix + tempInfo.Path + BuildConst.ExtName;
            List <FileParamInfo> tempInfoList   = UtilityFile.GetDirectoryAllAssetsFile(_folderPath + tempInfo.Path, tempInfo.SuffixArray);
            string[]             tempAssetNames = new string[tempInfoList.Count];
            for (int j = 0; j < tempAssetNames.Length; j++)
            {
                tempAssetNames[j] = tempInfoList[j].FilePath;
            }

            tempAssetBundleArray[i].assetNames = tempAssetNames;
        }

        UtilityFile.CreateDirectory(BuildConst.BuildFolderAssetPath);
        BuildPipeline.BuildAssetBundles(BuildConst.BuildFolderAssetPath, tempAssetBundleArray, BuildAssetBundleOptions.ChunkBasedCompression, _target);
    }
コード例 #28
0
ファイル: VcBLL.cs プロジェクト: 946061526/MyTest
        /// <summary>
        /// 生成验证码
        /// </summary>
        /// <param name="authCode">验证码</param>
        /// <returns></returns>
        public bool SetAuth(string authCode)
        {
            bool _Result = true;

            try
            {
                string _Key = "login" + DateTime.Now.ToString("ssffffff");
                //CouchBaseClient _Couch = new CouchBaseClient();
                //_Result = _Couch.SetObject( _Key, authCode, 600 * 1000d );

                UtilityFun.SetCookie(_Key, authCode, "", 10, false);

                UtilityFun.SetCookie("_login", _Key, "", 10, false);
                //_Couch = null;
            }
            catch (Exception ex)
            {
                _Result = false;
                UtilityFile.AddLogMsg("BLLUser.SetAuth抛出异常:" + ex.Message);
            }
            return(_Result);
        }