Example #1
0
        private EResourceInfo GenerateResource(UploadRes uploadRes)
        {
            uploadRes.owner = this.getUserId();
            EResourceInfo resourceInfo = new EResourceInfo
            {
                Owner    = uploadRes.owner,
                RefCode  = uploadRes.refCode,
                Remark   = uploadRes.remark,
                ResType  = uploadRes.resType,
                Url      = uploadRes.outerUrl,
                FileType = uploadRes.fileType,
            };

            if (uploadRes.isReset)
            {
                resourceInfo.Code = uploadRes.resCode;
            }
            else
            {
                resourceInfo.Code = CodeManager.ResCode(
                    resourceInfo.FileType,
                    (int)resourceInfo.ResType,
                    resourceInfo.RefCode,
                    resourceInfo.Owner);
            }
            return(resourceInfo);
        }
Example #2
0
        // This method 'builds' the form
        // This method will be called by code we will place
        // in the MakeRootDialog method of the MessagesControlller.cs file
        public static IForm <AddCsharpFunctionForm> BuildForm()
        {
            OnCompletionAsyncDelegate <AddCsharpFunctionForm> Save = async(context, state) =>
            {
                CodeManager  _manager = new CodeManager();
                CodeFunction _user    = new CodeFunction();

                _user.Name        = context.PrivateConversationData.GetValue <string>("Name");
                _user.Description = context.PrivateConversationData.GetValue <string>("Description");
                _user.FullBody    = context.PrivateConversationData.GetValue <string>("FullBody");

                await _manager.AddFunctionAsync(_user);

                await context.PostAsync("Đã thêm được rồi bạn nhé.");
            };

            return(new FormBuilder <AddCsharpFunctionForm>()
                   .Message("Bạn đang thêm Contact mới. Hãy điền các thông tin sau: ")
                   .Field(nameof(None), "")
                   .Field(nameof(Name), "Tên của hàm ?")
                   .Field(nameof(Description), "Hàm này làm gì ?")
                   .Field(nameof(FullBody), "Nội dung đầy đủ (bao gồm cả namespace) ?")
                   .OnCompletion(async(context, form) =>
            {
                await Save(context, form);
            })
                   .Build());
        }
Example #3
0
        public static void Run()
        {
            var codes = "";
            //for each code, take out each of the letters and save them into their respective arrays
            var codeManager        = new CodeManager();
            var managerInitialised = false;
            var total = 0;

            foreach (string code in codes.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
            {
                var positions = code.Length;
                if (!managerInitialised)
                {
                    codeManager.InitialisePositions(positions);
                    managerInitialised = true;
                }
                for (int index = 0; index <= code.Length - 1; index++)
                {
                    var letter = code[index];
                    codeManager.AddLetter(index, letter);
                }
                total++;
            }
            //once we have all the codes split out, we want to get the most common in each position
            Console.WriteLine(String.Format("The most common letters are {0}", codeManager.GetOrderOfLetters(false)));
            Console.WriteLine(String.Format("The least common letters are {0}", codeManager.GetOrderOfLetters(true)));
        }
Example #4
0
        protected override iTextSharp.text.pdf.PdfPCell AddFrontRowRightItem <T>(T item)
        {
            NewSostanze sostanza = item as NewSostanze;
            PdfPCell    cella    = NewBorderedCell();

            cella.HorizontalAlignment = Element.ALIGN_CENTER;

            //----INDICAZIONE CHE E' UN CARTELLINO SOSTANZA
            Paragraph par = new Paragraph("CARTELLINO SOSTANZA", boldfontlarge);

            par.Alignment           = Element.ALIGN_CENTER;
            par.ExtraParagraphSpace = 5;
            cella.AddElement(par);

            //----CODICE QR
            int      codesAvailable = sostanza.CodiciQrs.Count;
            int      codeSelected   = rand.Next(codesAvailable);
            CodiciQr codice         = sostanza.CodiciQrs.Skip(codeSelected).FirstOrDefault();

            Guid  codiceUnico = codice.Codice;
            Image qrCode      = Image.GetInstance(CodeManager.GetPictureFromGuid(codiceUnico), BaseColor.WHITE);

            qrCode.Alignment = Image.ALIGN_CENTER;
            qrCode.ScalePercent(60, 60);
            cella.AddElement(qrCode);

            //----MODO USO
            par           = new Paragraph(sostanza.ModoUso, boldfontlarge);
            par.Alignment = Element.ALIGN_CENTER;
            cella.AddElement(par);

            return(cella);
        }
Example #5
0
        protected override iTextSharp.text.pdf.PdfPCell AddRowLeftItem <T>(T item)
        {
            HoloDisk oggetto = item as HoloDisk;
            PdfPCell cella   = NewBorderedCell();

            cella.HorizontalAlignment = Element.ALIGN_CENTER;

            Paragraph par = new Paragraph("DATAPAD", font);

            par.Alignment = Element.ALIGN_CENTER;
            cella.AddElement(par);

            par                     = new Paragraph(oggetto.Codice, boldFont);
            par.Alignment           = Element.ALIGN_CENTER;
            par.ExtraParagraphSpace = 5;
            cella.AddElement(par);

            Image qrCode = Image.GetInstance(CodeManager.GetPictureFromGuid(oggetto.CodiceQr), BaseColor.WHITE);

            qrCode.Alignment = Image.ALIGN_CENTER;
            qrCode.ScalePercent(60, 60);
            cella.AddElement(qrCode);

            //----LOGO
            logo.ScalePercent(4, 4);
            cella.AddElement(logo);
            return(cella);
        }
Example #6
0
    void Awake()
    {
        if (_ins == null)
        {
            // Populate with first instance
            _ins = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            // Another instance exists, destroy
            if (this != _ins)
            {
                Destroy(this.gameObject);
            }
        }

        if (setupSyntaxHighlighter)
        {
            SetupSyntaxHighlighter(keywordTxtFiles);
        }

        if (setupUCCE)
        {
            SetupUCCE();
        }
    }
Example #7
0
        public static void DropItem(Client client, PacketIn packet)
        {
            int        IID   = (int)packet.ReadUInt32();
            PlayerItem pItem = PlayerItem.GetItem(IID);

            int quantity = (int)packet.ReadUInt32();

            //check if the item exists
            if (pItem == null)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            //check if player owns the item
            if (pItem.PID != client.Character.Player.PID)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code);

            handler.Drop(pItem, quantity, client.Character, client);
        }
Example #8
0
        private void LoadBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                //openFileDialog.InitialDirectory = "c:\\";
                Filter           = "ls files (*.ls)|*.ls|bin files (*.bin)|*.bin|All files (*.*)|*.*",
                FilterIndex      = 1,
                RestoreDirectory = true
            };

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                SetRecv(false);
                string filePath = openFileDialog.FileName;
                try
                {
                    byte[] buffer = File.ReadAllBytes(filePath);
                    buffer = CodeManager.MirrorByteArray(buffer);
                    _tapePunch.SetBuffer(buffer);
                    PunchedTapePb.Refresh();
                    UpdateScrollbar();
                    SetAndShowFilename(Path.GetFileName(filePath));
                }
                catch (Exception)
                {
                }
            }
        }
Example #9
0
        private string PunchDataToText(byte[] punchData)
        {
            string      text       = "";
            ShiftStates shiftState = ShiftStates.Ltr;

            foreach (byte code in punchData)
            {
                if (code == CodeManager.BAU_LTRS)
                {
                    shiftState = ShiftStates.Ltr;
                }
                else if (code == CodeManager.BAU_FIGS)
                {
                    shiftState = ShiftStates.Figs;
                }
                else
                {
                    char ascii = CodeManager.BaudotCharToAscii(code, shiftState, ConfigManager.Instance.Config.CodeSet, CodeManager.SendRecv.Send);
                    if (ascii != '\r')
                    {
                        text += ascii;
                    }
                }
            }
            return(text);
        }
Example #10
0
 public async Task InstanceAndInitApplicationWithNullShouldThrowArgumentNullException()
 {
     // ARRANGE
     var codeManager = new CodeManager(ConfigFixturePath);
     // ACT/ASSERT
     await Assert.ThrowsAsync <ArgumentNullException>(() => codeManager.InstanceAndInitApplications(null));
 }
Example #11
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                Filter           = "ls files (*.ls)|*.ls|bin files (*.bin)|*.bin|All files (*.*)|*.*",
                FilterIndex      = 1,
                RestoreDirectory = true,
                FileName         = _fileName,
            };

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                byte[] buffer = _tapePunch.GetBuffer();
                buffer = CodeManager.MirrorByteArray(buffer);
                string filePath = saveFileDialog.FileName;
                try
                {
                    File.WriteAllBytes(filePath, buffer);
                    SetAndShowFilename(Path.GetFileName(filePath));
                }
                catch (Exception)
                {
                }
            }
        }
Example #12
0
 public CodeController(CodeManager codeManager, IExerciseManager exerciseManager, UserManager <User> userManager, IConfiguration configuration)
 {
     this.codeManager     = codeManager;
     this.exerciseManager = exerciseManager;
     this.userManager     = userManager;
     this.configuration   = configuration;
 }
Example #13
0
    /// <summary>
    /// 경험치를 얻고 레벨업을 합니다. 레벨은 <see cref="NetworkPacket.maxLevel"/> 까지 올라갑니다.
    /// </summary>
    /// <param name="AUID"></param>
    /// <param name="userLevel"></param>
    /// <param name="userExp"></param>
    /// <param name="getExp"></param>
    /// <returns></returns>
    static public bool GetExpAndLevelUp(int AUID, ref int userLevel, ref int userExp, int getExp)
    {
        if (userLevel == NetworkPacket.maxLevel)
        {
            return(false);
        }

        // 경험치를 얻고.
        //int newLevel = userLevel;
        int newExp = userExp + getExp;

        Debug.Log(CodeManager.GetMethodName() + "AUID : " + AUID + " / Level : " + userLevel + " / Exp : " + userExp + " + " + getExp);

        CSVReader tbuser = new CSVReader("TbUser.txt");

        string[] arr2 = tbuser.FindJSONDataArray(null, null, true);

        bool levelup = false;

        // 레벨업을 하고.
        while (newExp >= int.Parse(ReadJSONData.ReadLine(arr2[userLevel - 1])[5]))
        {
            //Level UP
            newExp -= int.Parse(ReadJSONData.ReadLine(arr2[userLevel - 1])[5]);

            if (userLevel < NetworkPacket.maxLevel)
            {
                userLevel++;
            }

            levelup = true;

            Debug.Log(CodeManager.GetMethodName() + "AUID : " + AUID + " / Level : " + userLevel + " / Exp : " + newExp + " / Level UP !!");

            if (userLevel == NetworkPacket.maxLevel)
            {
                break;
            }
        }

        if (userLevel == NetworkPacket.maxLevel)
        {
            Debug.Log(CodeManager.GetMethodName() + "AUID : " + AUID + " / 만렙을 달성했다!!");
            userExp = 0;
        }
        else
        {
            userExp = newExp;
        }

        if (levelup)
        {
            //////////////////////////////////////////////////////////////
            // 업적을 갱신한다.
            UpdateAchievementWithNewValue(AUID, userLevel, "Achievement_00015", "Achievement_00016", "Achievement_00017", "Achievement_00018", "Achievement_00019");
        }

        return(levelup);
    }
    void GetEnergyTime(string[] data, string GUID, uLink.NetworkMessageInfo info)
    {
        if (GetComponent <Receiver_Account>().DuplicateLogin(data[0], GUID, info))
        {
            return;
        }

        int AUID = int.Parse(data[0]);

        //타입을 설정합니다.
        GetEnergyTimeRes res  = new GetEnergyTimeRes();
        ProtocolType     type = ProtocolType.GetEnergyTime;

        if (int.Parse(data[0]) <= 0)
        {
            res.ret = GetEnergyTimeStatus.NO_AUID;
            uLink.BitStream bitstream_noauid = new uLink.BitStream(false);
            bitstream_noauid.Write(res);
            if (info.sender.isConnected)
            {
                view.RPC("ReceiveResponse", info.sender, type, bitstream_noauid);
            }

            return;
        }



        SQLManager.DBOpen();

        RefreshEnergy(AUID);

        res.isEnergyUp = isEnergyUp;
        res.userEnergy = finalEnergy;
        res.MaxEnergy  = MaxEnergy;
        res.EnergyTime = EnergyTime;
        res.cutLine    = cutLine;
        res.lastTime   = (int)lastTime;

        res.ret = GetEnergyTimeStatus.SUCCESS;


        /////////////////////////////////////////////////////////////////////////////

        // 이하는 동일합니다.
        if (showJsonLog)
        {
            Debug.Log(CodeManager.GetFunctionName() + "AUID: " + AUID + " (" + res.ret + ")");
        }

        uLink.BitStream bitstream = new uLink.BitStream(false);
        bitstream.Write(res);
        if (info.sender.isConnected)
        {
            view.RPC("ReceiveResponse", info.sender, type, bitstream);
        }

        SQLManager.DBClose();
    }
Example #15
0
        public void SetUp()
        {
            _typeCacheMock       = new Mock <ITypeCache> (MockBehavior.Strict);
            _typeAssemblerMock   = new Mock <ITypeAssembler> (MockBehavior.Strict);
            _assemblyContextPool = new Mock <IAssemblyContextPool> (MockBehavior.Strict);

            _manager = new CodeManager(_typeCacheMock.Object, _typeAssemblerMock.Object, _assemblyContextPool.Object);
        }
Example #16
0
 public void SendBufferEnqueueString(string asciiStr)
 {
     asciiStr = CodeManager.AsciiStringToTelex(asciiStr, _configManager.CodeSet);
     foreach (char chr in asciiStr)
     {
         _sendBuffer.Enqueue(chr);
     }
 }
Example #17
0
        public ActionResult FilterTable(string table, string top, string from, string to, string level, string keyword)
        {
            FilterModel model = new FilterModel(table, top, from, to, level, keyword);

            CodeManager sqlModel = new CodeManager(model);

            return(PartialView("~/Views/Home/_Partial/_Logs.cshtml", sqlModel.HomeModels));
        }
Example #18
0
        public void SetUp()
        {
            _typeCacheMock       = MockRepository.GenerateStrictMock <ITypeCache>();
            _typeAssemblerMock   = MockRepository.GenerateStrictMock <ITypeAssembler>();
            _assemblyContextPool = MockRepository.GenerateStrictMock <IAssemblyContextPool>();

            _manager = new CodeManager(_typeCacheMock, _typeAssemblerMock, _assemblyContextPool);
        }
Example #19
0
 protected override void Awake()
 {
     base.Awake();
     healthMgr        = GetComponent <EnemyHealthManager>();
     codeMgr          = msCode.GetComponent <CodeManager>();
     myValue          = Random.Range(2, 9);
     numberLabel.text = myValue.ToString();
 }
Example #20
0
    void Awake()
    {
        mainCam = Camera.main;

        dialogManager = FindObjectOfType <DialogManager>();
        codeManager   = FindObjectOfType <CodeManager>();
        toolbar       = FindObjectOfType <ToolbarManager>();
    }
Example #21
0
        public void ApplicationAllShouldBePresentInCsFile()
        {
            // ARRANGE
            var codeManager = new CodeManager(ConfigFixturePath);

            // ACT
            // ASSERT
            Assert.Equal(7, codeManager.DaemonAppTypes.Count());
        }
Example #22
0
        public void ApplicationShouldBePresentInCsFile()
        {
            // ARRANGE
            var codeManager = new CodeManager(Path.Combine(ConfigFixturePath, "level2", "level3"));

            // ACT
            // ASSERT
            Assert.Single(codeManager.DaemonAppTypes.Select(n => n.Name == "LevOneApp"));
        }
        public static MvcHtmlString RadioButtonListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            var codes             = CodeManager.GetCodes(codeCategory);
            var metadata          = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
            var name              = ExpressionHelper.GetExpressionText(expression);
            var fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name);

            return(ListControlUtil.GenerateHtml(fullHtmlFieldName, codes, repeatDirection, "radio", metadata.Model));
        }
Example #24
0
 public void MirrorBuffer()
 {
     byte[] newBuffer = new byte[_buffer.Count];
     for (int i = 0; i < _buffer.Count; i++)
     {
         newBuffer[i] = CodeManager.MirrorCode(_buffer[i].Code);
     }
     SetBuffer(newBuffer);
 }
Example #25
0
 // Use this for initialization
 void Start()
 {
     codeScript     = GameObject.Find("CodeManager").GetComponent <CodeManager>();
     botNames       = new List <string>();
     width          = 700;
     height         = 400;
     loadBotWindow  = new Rect(Screen.width / 2 - (width / 2), Screen.height / 2 - (height / 2), width, height);
     loadDoneWindow = new Rect(Screen.width / 2 - (300 / 2), Screen.height / 2 - (150 / 2), 300, 150);
 }
Example #26
0
        public static MvcHtmlString CheckBoxListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string nameSuffix, string codeCategory, string vTenantID, string vTenantFlag, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            var           codes             = CodeManager.GetCodes(codeCategory, vTenantID, vTenantFlag);
            ModelMetadata metadata          = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData);
            string        name              = ExpressionHelper.GetExpressionText(expression);
            string        fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name) + "_" + nameSuffix;

            return(ListControlUtil.GenerateHtml(fullHtmlFieldName, codes, repeatDirection, "checkbox", metadata.Model));
        }
Example #27
0
 public ReckoningManager(Environment.GlobalConfig.DB.FromType fromType)
 {
     _companyCussent    = new CompanyCussent(fromType);
     _reckoningDao      = InventoryInstance.GetReckoningDao(fromType);
     _goodsOrderDeliver = new GoodsOrderDeliver(fromType);
     _goodsOrder        = new DAL.Implement.Order.GoodsOrder(fromType);
     _goodsOrderDetail  = new GoodsOrderDetail(fromType);
     _codeManager       = new CodeManager();
     _storageRecordDao  = new StorageRecordDao(fromType);
 }
Example #28
0
    public static object GetPCodeValue(BPMConnection cn, object value, Type returnType, bool allowEmptyCode, object defaultValue)
    {
        CodeBlock codeBlock = value as CodeBlock;

        if (codeBlock == null || String.IsNullOrEmpty(codeBlock.CodeText))
        {
            return(value);
        }

        return(CodeManager.GetCodeResult(cn, codeBlock.CodeText, returnType, allowEmptyCode, defaultValue));
    }
Example #29
0
    void Start()
    {
        customValue = "";

        originalWidth  = 1280;
        originalHeight = 720;
        scale.x        = Screen.width / originalWidth;
        scale.y        = Screen.height / originalHeight;
        scale.z        = 1;
        codeScript     = GameObject.Find("CodeManager").GetComponent <CodeManager>();
    }
Example #30
0
        private void SaveMenuData()
        {
            List <string> content = new List <string>();

            for (int i = 0; i < _current.Count; i++)
            {
                content.Add(_current[i].name);
            }

            CodeManager.AddItemsToBlock(BaseEngineConstants.MenuDataFileName, "", BaseEngineConstants.MenuDataEnumForMenu, content.ToArray(), BaseEngineConstants.MenuDataEnumsOffset);
        }
Example #31
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BaseCore.CodeManager cm = new CodeManager(1);
         Dictionary<int, string> questions = new Dictionary<int, string>();
         questions = cm.GetSysCodeValues((int)BaseCore.Enumerations.SysCodeTypes.SECRET_QUESTIONS);
         ddlQuestion.DataSource = questions;
         ddlQuestion.DataValueField = "Key";
         ddlQuestion.DataTextField = "Value";
         ddlQuestion.DataBind();
     }
 }
Example #32
0
    protected void LoadDropDowns()
    {
        BaseCore.CodeManager cm = new CodeManager(1);
        Dictionary<int, string> questions = new Dictionary<int, string>();
        questions = cm.GetSysCodeValues((int)BaseCore.Enumerations.SysCodeTypes.SECRET_QUESTIONS);
        ddlQuestion.DataSource = questions;
        ddlQuestion.DataValueField = "Key";
        ddlQuestion.DataTextField = "Value";
        ddlQuestion.DataBind();
        ddlQuestion.Items.Insert(0, new ListItem("-- Select One --", ""));

        BaseCore.RoleList obj = new BaseCore.RoleList();
        ddlRole.DataSource = obj.GetRoles(-1, 1);
        ddlRole.DataTextField = "Name";
        ddlRole.DataValueField = "ID";
        ddlRole.DataBind();
        ddlRole.Items.Insert(0, new ListItem("-- Select One --", ""));
    }
Example #33
0
    void Awake()
    {
        if (_ins == null)
        {
            // Populate with first instance
            _ins = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            // Another instance exists, destroy
            if (this != _ins)
                Destroy(this.gameObject);
        }

        if (setupSyntaxHighlighter)
            SetupSyntaxHighlighter(keywordTxtFiles);

        if (setupUCCE)
            SetupUCCE();
    }