예제 #1
0
        static void FoundNewGroup(List<KeyValuePair<string, string>> group)
        {
            SourceInfo info = new SourceInfo();
            info.src_file = GetVal("src_file", group);
            info.src_func = GetVal("src_func", group);
            info.dur = GetVal("dur", group);
            info.tdur = GetVal("tdur", group);
            info.tts = GetVal("tts", group);

            if (!string.IsNullOrWhiteSpace(info.src_file))
            {
                if (!m_srcFiles.ContainsKey(info.src_file))
                {
                    m_srcFiles[info.src_file] = new List<SourceInfo>();
                }
                if (!string.IsNullOrEmpty(info.src_func))
                {
                    if (ContainsFunc(m_srcFiles[info.src_file], info.src_func))
                    {
                        RemoveFunc(m_srcFiles[info.src_file], info.src_func);
                    }
                    else
                    {
                        Console.WriteLine("src_file={0} src_func={1}", info.src_file, info.src_func);
                    }
                    if (!ContainsFunc(m_srcFiles[info.src_file], info.src_func))
                    {
                        m_srcFiles[info.src_file].Add(info);
                    }
                }
            }
        }
예제 #2
0
파일: Int.cs 프로젝트: takuto-h/rhea
 public static void Eq(Arguments args, VM vm, SourceInfo info)
 {
     Check(args, 2, info);
     ValueInt integer1 = (ValueInt)args[0];
     ValueInt integer2 = (ValueInt)args[1];
     vm.Push((integer1.Value == integer2.Value).ToValueBool());
 }
예제 #3
0
파일: Instance.cs 프로젝트: takuto-h/rhea
 public static void MakeInstance(Arguments args, VM vm, SourceInfo info)
 {
     ValueArray array = args[0] as ValueArray;
     ValueHash hash = args[1] as ValueHash;
     if (array == null ||
         array.Value.Any((elem) => !(elem is ValueSymbol)))
     {
         throw new RheaException(
             string.Format("array(symbol) required, but got {0}", args[0]), info
         );
     }
     if (hash == null ||
         hash.Value.Any((kvp) => !(kvp.Key is ValueSymbol) || !(kvp.Value is IValueFunc)))
     {
         throw new RheaException(
             string.Format("hash(symbol, function) required, but got {0}", args[1]), info
         );
     }
     IList<ValueSymbol> klasses = array.Value.Select(
         (elem) => (ValueSymbol)elem
     ).ToList();
     IDictionary<ValueSymbol, IValueFunc> slots = hash.Value.ToDictionary(
         (kvp) => (ValueSymbol)kvp.Key,
         (kvp) => (IValueFunc)kvp.Value
     );
     vm.Push(new ValueInstance(klasses, slots));
 }
예제 #4
0
파일: Object.cs 프로젝트: takuto-h/rhea
 public static void Klasses(Arguments args, VM vm, SourceInfo info)
 {
     IList<IValue> list = args[0].KlassList.Select(
         (elem) => (IValue)elem
     ).ToList();
     vm.Push(new ValueArray(list));
 }
예제 #5
0
 public MarkdownTextToken(IMarkdownRule rule, IMarkdownContext context, string content, SourceInfo sourceInfo)
 {
     Rule = rule;
     Context = context;
     Content = content;
     SourceInfo = sourceInfo;
 }
예제 #6
0
 public AzureNoteBlockToken(IMarkdownRule rule, IMarkdownContext context, string noteType, string content, SourceInfo sourceInfo)
 {
     Rule = rule;
     Context = context;
     Content = content;
     NoteType = noteType;
     SourceInfo = sourceInfo;
 }
예제 #7
0
파일: Hash.cs 프로젝트: takuto-h/rhea
 public static void SetItem(Arguments args, VM vm, SourceInfo info)
 {
     Check(args, 1, info);
     ValueHash hash = (ValueHash)args[0];
     IValue key = args[1];
     IValue value = args[2];
     vm.Push(hash.Value[key] = value);
 }
예제 #8
0
 public AzureSelectorBlockToken(IMarkdownRule rule, IMarkdownContext context, string selectorType, string selectorConditions, SourceInfo sourceInfo)
 {
     Rule = rule;
     Context = context;
     SelectorType = selectorType;
     SelectorConditions = selectorConditions;
     SourceInfo = sourceInfo;
 }
예제 #9
0
 public GfmEmojiInlineToken(IMarkdownRule rule, IMarkdownContext context, string shortCode, string emoji, SourceInfo sourceInfo)
 {
     Rule = rule;
     Context = context;
     ShortCode = shortCode;
     Emoji = emoji;
     SourceInfo = sourceInfo;
 }
예제 #10
0
 public MarkdownCodeBlockToken(IMarkdownRule rule, IMarkdownContext context, string code, string lang, SourceInfo sourceInfo)
 {
     Rule = rule;
     Context = context;
     Code = code;
     Lang = lang;
     SourceInfo = sourceInfo;
 }
예제 #11
0
        public override SourceModel Transform(SourceInfo source)
        {
            IMarkdownTransformer markdown = new MarkdownDeepTransformer();

            var text = File.ReadAllText(source.InputPath);

            var html = markdown.Transform(text);

            return new SourceModel { RawHtml = html };
        }
예제 #12
0
 public ExprGetMethod(
     IExpr klassExpr,
     ValueSymbol selector,
     SourceInfo info
 )
 {
     KlassExpr = klassExpr;
     Selector = selector;
     mInfo = info;
 }
예제 #13
0
파일: Int.cs 프로젝트: takuto-h/rhea
 public static void Add(Arguments args, VM vm, SourceInfo info)
 {
     Check(args, 2, info);
     ValueInt integer1 = (ValueInt)args[0];
     ValueInt integer2 = (ValueInt)args[1];
     ValueInt newInteger = new ValueInt(
         integer1.Value + integer2.Value
     );
     vm.Push(newInteger);
 }
예제 #14
0
        public TableReportInfo()
        {
            //-- Object of area selection
            this._AreaSelection = new AreaInfo();

            //-- Object of TP selection
            this._TimePeriodSelection = new TimePeriodInfo();

            //-- Object of source selection
            this._SourceSelection = new SourceInfo();
        }
예제 #15
0
 public MarkdownImageInlineToken(IMarkdownRule rule, IMarkdownContext context, string href, string title, string text, SourceInfo sourceInfo, MarkdownLinkType linkType, string refId)
 {
     Rule = rule;
     Context = context;
     Href = href;
     Title = title;
     Text = text;
     SourceInfo = sourceInfo;
     LinkType = linkType;
     RefId = refId;
 }
예제 #16
0
파일: Symbol.cs 프로젝트: takuto-h/rhea
 public static void MakeSymbol(Arguments args, VM vm, SourceInfo info)
 {
     ValueString str = args[0] as ValueString;
     if (str == null)
     {
         throw new RheaException(
             string.Format("string required, but got {0}", args[0]),
             info
         );
     }
     vm.Push(ValueSymbol.Generate(str.Value));
 }
예제 #17
0
 public ExprSetMethod(
     IExpr klassExpr,
     ValueSymbol selector,
     IExpr valueExpr,
     SourceInfo info
 )
 {
     mKlassExpr = klassExpr;
     mSelector = selector;
     mValueExpr = valueExpr;
     mInfo = info;
 }
예제 #18
0
 protected virtual IMarkdownToken GenerateToken(IMarkdownParser parser, string href, string title, string text, bool isImage, SourceInfo sourceInfo, MarkdownLinkType linkType, string refId)
 {
     var escapedHref = Regexes.Helper.MarkdownEscape.Replace(href, m => m.Groups[1].Value);
     if (isImage)
     {
         return new MarkdownImageInlineToken(this, parser.Context, escapedHref, title, text, sourceInfo, linkType, refId);
     }
     else
     {
         return new MarkdownLinkInlineToken(this, parser.Context, escapedHref, title, parser.Tokenize(sourceInfo.Copy(text)), sourceInfo, linkType, refId);
     }
 }
예제 #19
0
        /// <summary>
        /// Writes a source information to the pipeline.
        /// </summary>
        /// <param name="installation">The <see cref="Installation"/> to which the source is registered.</param>
        protected void WriteSourceList(Installation installation)
        {
            ProductInstallation product = null;
            PatchInstallation   patch   = null;
            var order = 0;

            if (installation is ProductInstallation)
            {
                product = (ProductInstallation)installation;
            }
            else if (installation is PatchInstallation)
            {
                patch = (PatchInstallation)installation;
            }

            try
            {
                foreach (var source in installation.SourceList)
                {
                    SourceInfo info = null;
                    if (null != product)
                    {
                        info = new SourceInfo(product.ProductCode, product.UserSid, product.Context, source, order++);
                    }
                    else if (null != patch)
                    {
                        info = new PatchSourceInfo(patch.ProductCode, patch.PatchCode, patch.UserSid, patch.Context, source, order++);
                    }

                    if (null != info)
                    {
                        this.WriteObject(info);
                    }
                }
            }
            catch (InstallerException ex)
            {
                if (NativeMethods.ERROR_BAD_CONFIGURATION == ex.ErrorCode)
                {
                    var code      = null != product ? product.ProductCode : null != patch ? patch.PatchCode : string.Empty;
                    var message   = string.Format(Properties.Resources.Error_Corrupt, code);
                    var exception = new Exception(message, ex);

                    var error = new ErrorRecord(exception, "Error_Corrupt", ErrorCategory.NotInstalled, installation);
                    base.WriteError(error);
                }
                else
                {
                    throw;
                }
            }
        }
예제 #20
0
        private void ShowErrors(CompilerResults compilerResult, SourceInfo sourceInfo)
        {
            var compilerErrors = compilerResult.Errors.OfType <CompilerError>()
                                 .Select(compilerError => new ScriptError()
            {
                ErrorNumber = compilerError.ErrorNumber,
                Line        = sourceInfo.CalculateVisibleLineNumber(compilerError.Line),
                Message     = compilerError.ErrorText
            })
                                 .ToArray();

            Logger.ShowErrors(compilerErrors);
        }
예제 #21
0
파일: Int.cs 프로젝트: takuto-h/rhea
 private static void Check(Arguments args, int count, SourceInfo info)
 {
     for (int i = 0; i < count; i++)
     {
         if (!(args[i] is ValueInt))
         {
             throw new RheaException(
                 string.Format("int required, but got {0}", args[i]),
                 info
             );
         }
     }
 }
예제 #22
0
        private SourceInfo[] getSourceInfo(FileInfo fileInfo, bool getDetails)
        {
            var sourceInfoList = new List <SourceInfo>();

            sourceInfoList.Add(new SourceInfo());
            sourceInfoList[0].type         = getSourceType(fileInfo);
            sourceInfoList[0].name         = fileInfo.Name;
            sourceInfoList[0].hasDetails   = getDetails;
            sourceInfoList[0].size         = (UInt64)fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if (sourceInfoList[0].type != String.Empty)
            {
                if (!getDetails)
                {
                    return(sourceInfoList.ToArray());
                }

                try
                {
                    ReaderList readerList = ReaderList.FullReaderList;

                    MSDataList msInfo = new MSDataList();
                    readerList.read(fileInfo.FullName, msInfo);

                    foreach (MSData msData in msInfo)
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if (msInfo.Count > 1)
                        {
                            sourceInfo.name += " (" + msData.run.id + ")";
                        }
                        sourceInfo.populateFromMSData(msData);
                        sourceInfoList.Add(sourceInfo);
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type    = "Invalid " + sourceInfoList[0].type;
                }

                foreach (SourceInfo sourceInfo in sourceInfoList)
                {
                    sourceInfo.size         = (UInt64)fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return(sourceInfoList.ToArray());
            }
            return(null);
        }
        public void SourceInfoAttribute_Valid_Usage()
        {
            // Ask for the base type's attributes
            object[]   attributes = typeof(SourceInfoTestClass).GetCustomAttributes(false);
            SourceInfo sourceInfo = SourceInfo.GetSourceInfoFromAttributes(attributes);

            Assert.IsNotNull(sourceInfo, "Failed to get SourceInfo from type level attributes");
            Assert.AreEqual("typeLevelFile", sourceInfo.FileName, "Wrong FileName for type level sourceInfo");
            Assert.AreEqual(1, sourceInfo.Line, "Wrong Line for type level sourceInfo");
            Assert.AreEqual(2, sourceInfo.Column, "Wrong Column for type level sourceInfo");

            // And the derived type's attributes -- should *not* inherit
            attributes = typeof(SourceInfoDerivedTestClass).GetCustomAttributes(false);
            sourceInfo = SourceInfo.GetSourceInfoFromAttributes(attributes);
            Assert.IsNotNull(sourceInfo, "Failed to get SourceInfo from type level attributes");
            Assert.AreEqual("typeLevelFileDerived", sourceInfo.FileName, "Wrong FileName for type level sourceInfo");
            Assert.AreEqual(1, sourceInfo.Line, "Wrong Line for type level sourceInfo");
            Assert.AreEqual(2, sourceInfo.Column, "Wrong Column for type level sourceInfo");

            // Validate base ctor
            MethodBase methodBase = typeof(SourceInfoTestClass).GetConstructor(new Type[0]);

            Assert.IsNotNull(methodBase, "Could not find base ctor");
            attributes = methodBase.GetCustomAttributes(false);
            sourceInfo = SourceInfo.GetSourceInfoFromAttributes(attributes);
            Assert.IsNotNull(sourceInfo, "Failed to get SourceInfo from ctor level attributes");
            Assert.AreEqual("ctorLevelFile", sourceInfo.FileName, "Wrong FileName for type level sourceInfo");
            Assert.AreEqual(3, sourceInfo.Line, "Wrong Line for ctor level sourceInfo");
            Assert.AreEqual(4, sourceInfo.Column, "Wrong Column for ctor level sourceInfo");

            // Validate derived ctor
            methodBase = typeof(SourceInfoDerivedTestClass).GetConstructor(new Type[0]);
            Assert.IsNotNull(methodBase, "Could not find derived ctor");
            attributes = methodBase.GetCustomAttributes(false);
            sourceInfo = SourceInfo.GetSourceInfoFromAttributes(attributes);
            Assert.IsNotNull(sourceInfo, "Failed to get SourceInfo from ctor level attributes");
            Assert.AreEqual("ctorLevelFileDerived", sourceInfo.FileName, "Wrong FileName for ctor level sourceInfo");
            Assert.AreEqual(3, sourceInfo.Line, "Wrong Line for ctor level sourceInfo");
            Assert.AreEqual(4, sourceInfo.Column, "Wrong Column for ctor level sourceInfo");

            // Validate base property via derived type
            PropertyInfo propertyInfo = typeof(SourceInfoDerivedTestClass).GetProperty("TheValue");

            Assert.IsNotNull(propertyInfo, "Could not locate TheValue property");
            attributes = propertyInfo.GetCustomAttributes(false);
            sourceInfo = SourceInfo.GetSourceInfoFromAttributes(attributes);
            Assert.IsNotNull(sourceInfo, "Failed to get SourceInfo from ctor level attributes");
            Assert.AreEqual("propertyLevelFile", sourceInfo.FileName, "Wrong FileName for property level level sourceInfo");
            Assert.AreEqual(5, sourceInfo.Line, "Wrong Line for ctor level sourceInfo");
            Assert.AreEqual(6, sourceInfo.Column, "Wrong Column for ctor level sourceInfo");
        }
예제 #24
0
        public static void AddFiles(IPackage package, List <string> sourceFilePaths)
        {
            List <TGIN> addedResourceKeys = new List <TGIN>();

            for (int sourceFilePathIndex = 0; sourceFilePathIndex < sourceFilePaths.Count; sourceFilePathIndex++)
            {
                string sourceInfoFilePath = sourceFilePaths[sourceFilePathIndex] + "." + SourceInfoFileExtension;

                TGIN targetResourceKeyTGIN = Path.GetFileName(sourceFilePaths[sourceFilePathIndex]);

                if (File.Exists(sourceInfoFilePath))
                {
                    try {
                        SourceInfo sourceInfo = (SourceInfo)Tools.ReadXML <SourceInfo>(sourceInfoFilePath);
                        targetResourceKeyTGIN = sourceInfo.ToTGIN();
                    } catch (Exception e) {
                        Console.Error.Write("Failed to read source info file.\n" + sourceInfoFilePath + "\n" + e.ToString());
                    }
                }

                AResourceKey targetResourceKey = targetResourceKeyTGIN;

                MemoryStream sourceStream       = new MemoryStream();
                BinaryWriter sourceStreamWriter = new BinaryWriter(sourceStream);

                using (BinaryReader sourceFileReader = new BinaryReader(new FileStream(sourceFilePaths[sourceFilePathIndex], FileMode.Open, FileAccess.Read))) {
                    sourceStreamWriter.Write(sourceFileReader.ReadBytes((int)sourceFileReader.BaseStream.Length));
                    sourceStreamWriter.Flush();
                }

                IResourceIndexEntry targetPreviousEntry = package.Find(targetResourceKey.Equals);

                while (targetPreviousEntry != null)
                {
                    package.DeleteResource(targetPreviousEntry);
                    targetPreviousEntry = package.Find(targetResourceKey.Equals);
                }

                IResourceIndexEntry targetEntry = package.AddResource(targetResourceKey, sourceStream, false);

                if (targetEntry == null)
                {
                    continue;
                }

                targetEntry.Compressed = 23106;
                addedResourceKeys.Add(targetResourceKeyTGIN);
            }

            GenerateNameMap(package, addedResourceKeys, null);
        }
예제 #25
0
        public string Edit(FormDataCollection form)
        {
            string     retVal    = string.Empty;
            string     operation = form.Get("oper");
            int        id        = ConvertHelper.ToInt32(form.Get("SourceId"));
            SourceInfo info      = null;

            if (!string.IsNullOrEmpty(operation))
            {
                switch (operation)
                {
                case "edit":
                    info = SourceRepository.GetInfo(id);
                    if (info != null)
                    {
                        info.Name = form.Get("Name");

                        info.Code = form.Get("Code");

                        info.Description = form.Get("Description");


                        info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID;

                        SourceRepository.Update(info);
                    }
                    break;

                case "add":
                    info = new SourceInfo
                    {
                        Name        = form.Get("Name"),
                        Code        = form.Get("Code"),
                        Description = form.Get("Description"),
                        CreatedBy   = UserRepository.GetCurrentUserInfo().UserID
                    };


                    SourceRepository.Create(info);
                    break;

                case "del":
                    SourceRepository.Delete(id, UserRepository.GetCurrentUserInfo().UserID);
                    break;

                default:
                    break;
                }
            }
            return(retVal);
        }
예제 #26
0
파일: SourceInfo.cs 프로젝트: jnm2/corefx
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(Source == null);
            }
            SourceInfo info = obj as SourceInfo;

            if (info != null)
            {
                return(Source == info.Source);
            }
            return(false);
        }
예제 #27
0
        /// <summary>Construct a new cohort and add it to Cohorts</summary>
        public void NewCohort(SourceInfo sourceInfo)
        {
            if (Cohorts == null)
            {
                Cohorts = new List <Cohort>();
            }
            Cohort a = new Cohort(this);

            a.Population       = sourceInfo.Population;
            a.ChronologicalAge = sourceInfo.ChronologicalAge;
            a.PhysiologicalAge = sourceInfo.PhysiologicalAge;
            a.sourceInfo       = sourceInfo;
            this.Cohorts.Add(a);
        }
예제 #28
0
        private void generate(GenerationMode mode)
        {
            var logger = createLogger();

            string[] lines = txtScript.Lines;

            if (mode == GenerationMode.Selection)
            {
                lines = txtScript.SelectedText.Split(new string[] { "\n" }, StringSplitOptions.None);
            }

            SourceInfo info = ScriptGenerator.GetSource(lines);

            txtCode.Text = info.SourceCode;

            var res = CSharpScriptCompiler.Compile(info);

            if (res.Errors.HasErrors)
            {
                var errors = new List <ScriptError>();

                foreach (var item in res.Errors)
                {
                    var compilerError = item as CompilerError;

                    if (compilerError != null)
                    {
                        var error = new ScriptError()
                        {
                            ErrorNumber = compilerError.ErrorNumber, Line = compilerError.Line, Message = compilerError.ErrorText
                        };
                        ScriptErrorExtender.TryExtend(error);
                        errors.Add(error);
                    }
                }

                logger.ShowErrors(errors.ToArray());
            }
            else
            {
                try
                {
                    testCode(res.CompiledAssembly, logger);
                }
                catch (Exception ex)
                {
                    logger.ShowErrors(ex);
                }
            }
        }
예제 #29
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (listSources.SelectedIndex < 0)
            {
                return;
            }

            SourceInfo info = (SourceInfo)listSources.Items[listSources.SelectedIndex];

            if (info != null)
            {
                OnLogRemoveRequest?.Invoke(info);
            }
        }
예제 #30
0
    public static string maxplayer = string.Empty; //최대 입찰자
    #endregion

    // Use this for initialization
    void Start()
    {
        lconstructor = GameObject.Find("LandConstructor").GetComponent <LandConstructor>();
        cmanager     = GameObject.Find("CardManager").GetComponent <CardManager>();
        startbutton  = GameObject.Find("StartButton");
        endbutton    = GameObject.Find("TurnEnd");
        endbutton.SetActive(false);
        oplayerbutton = GameObject.Find("OtherPlayersButton");
        oplayerbutton.SetActive(false);
        ainfobutton = GameObject.Find("AuctionInfoButton");
        ainfobutton.SetActive(false);
        playerfield = GameObject.Find("PField");
        help        = GameObject.Find("Help");
        help.transform.Find("Scrollbar Vertical").GetComponent <Scrollbar>().value = 1;
        help.SetActive(false);
        chatfield  = GameObject.Find("ChatField");
        turnpname  = "";
        systemtext = GameObject.Find("SystemText").GetComponent <Text>();
        turntext   = GameObject.Find("TurnText").GetComponent <Text>();
        roundtext  = GameObject.Find("RoundText").GetComponent <Text>();
        IsGame     = false;
        //IsAuction = true;
        //IsSelect = false;
        pinfo = new PlayerInfo[PhotonNetwork.playerList.Length];
        price = 0;
        lnum  = -1;

        //처음 위치 저장
        AInfopos = auctiontext.transform.parent.position;

        InitPlayer();

        if (players.Length == 1 || !PhotonNetwork.isMasterClient)
        {
            startbutton.SetActive(false);
        }

        IsPlayersPlayingCard = new bool[players.Length];
        for (int i = 0; i < pinfo.Length; i++)
        {
            IsPlayersPlayingCard[i] = true;
        }
        if (PhotonNetwork.isMasterClient)
        {
            lconstructor.ChangeSource();
            playersprice = new int[players.Length];
            source       = lconstructor.GetSource();//현재 경매에 나온 자원을 받아옴.
            SendSAuction(PhotonTargets.All, source.SourceName, source.SourceMoney);
        }
    }
예제 #31
0
 internal BindingErrorEventArgs(
     SourceInfo xamlSourceInfo,
     BindingBase binding,
     object bindingsource,
     BindableObject target,
     BindableProperty property,
     string errorCode,
     string message,
     object[] messageArgs) : base(xamlSourceInfo, binding, errorCode, message, messageArgs)
 {
     Source         = bindingsource;
     Target         = target;
     TargetProperty = property;
 }
예제 #32
0
파일: Hash.cs 프로젝트: takuto-h/rhea
 public static void GetItem(Arguments args, VM vm, SourceInfo info)
 {
     Check(args, 1, info);
     ValueHash hash = (ValueHash)args[0];
     IValue key = args[1];
     if (!hash.Value.ContainsKey(key))
     {
         throw new RheaException(
             string.Format("key not found for {0}: {1}", hash, key),
             info
         );
     }
     vm.Push(hash.Value[key]);
 }
예제 #33
0
        protected override ISourceInfo ResolveSourceValue(MappingMemberInfo memberInfo)
        {
            IDictionary <string, TProp> sourceValues = memberInfo.SourceInstance as IDictionary <string, TProp>;

            if (sourceValues == null)
            {
                return(null);
            }

            TProp sourceProp;
            var   sourceFound = sourceValues.TryGetValue(memberInfo.Name, out sourceProp);

            return(!sourceFound ? null : SourceInfo.Create(sourceProp));;
        }
예제 #34
0
        private DownloadManager()
        {
            DownloadsViewModel = new DownloadsViewModel();
            DownloadsViewModel.DownloadControlEvent += onDownloadControl;
            SourceInfo source = new SourceInfo(ConfigReader.Instance.DownloadHost, ConfigReader.Instance.DownloadPort);

            _downloader                = new DownloadCmd(source);
            _downloader.ErrorEvent    += onError;
            _downloader.ErrorReceived += onErrorReceived;
            _downloader.DownloadInfoExpandAllReceived += onDownloadInfoExpandAll;
            _downloader.DownloadInfoExpandAnyReceived += onDownloadInfoExpandAny;
            _downloader.DownloadExpandPartReceived    += onDownloadInfoExpandPart;
            _downloader.GetAllDownloadInfos();
        }
예제 #35
0
        protected override ISourceInfo ResolveSourceValue(MappingMemberInfo memberInfo)
        {
            var injectInstanceAttribute = memberInfo.Attributes.FirstOrDefault(x => x is InjectInstanceAttribute) as InjectInstanceAttribute;

            if (!IsMemberSuitable(memberInfo))
            {
                return(null);
            }

            object value;
            var    result = locator.TryResolve(memberInfo.Type, injectInstanceAttribute != null ? injectInstanceAttribute.Name : String.Empty, out value);

            return(result ? SourceInfo.Create(value) : null);
        }
예제 #36
0
파일: Primitive.cs 프로젝트: takuto-h/rhea
 public static void Callcc(Arguments args, VM vm, SourceInfo info)
 {
     IValueFunc func = args[0] as IValueFunc;
     if (func == null)
     {
         throw new RheaException(
             string.Format("function required, but got {0}", args[0]),
             info
         );
     }
     ValueCont cont = vm.GetCont();
     IList<IValue> newArgs = new List<IValue> { cont };
     func.Call(newArgs, vm, info);
 }
예제 #37
0
        public static string CreateHtml(Monster monster = null, Character ch = null, bool addDescription = true, bool completePage = true, string css = null)
        {
            Monster useMonster;

            if (ch != null)
            {
                useMonster = ch.Monster;
            }
            else
            {
                useMonster = monster;
            }

            StringBuilder blocks = new StringBuilder();

            if (completePage)
            {
                blocks.CreateHtmlHeader(css);
            }

            CreateTopSection(useMonster, ch, blocks);

            CreateDefenseSection(useMonster, blocks);

            CreateOffenseSection(useMonster, blocks);
            CreateTacticsSection(useMonster, blocks);
            CreateStatisticsSection(useMonster, blocks);
            CreateEcologySection(useMonster, blocks);
            CreateSpecialAbilitiesSection(useMonster, blocks);
            if (addDescription)
            {
                CreateDescriptionSection(useMonster, blocks);
            }



            if (SourceInfo.GetSourceType(useMonster.Source) != SourceType.Core)
            {
                blocks.CreateItemIfNotNull("Source ", SourceInfo.GetSource(useMonster.Source));
            }


            if (completePage)
            {
                blocks.CreateHtmlFooter();
            }

            return(blocks.ToString());
        }
        /// <summary>
        /// Creates an instance of the given <paramref name="type"/> using the public properties of the
        /// supplied <paramref name="sample"/> object as input.
        /// This method will try to determine the least-cost route to constructing the instance, which
        /// implies mapping as many properties as possible to constructor parameters. Remaining properties
        /// on the source are mapped to properties on the created instance or ignored if none matches.
        /// TryCreateInstance is very liberal and attempts to convert values that are not otherwise
        /// considered compatible, such as between strings and enums or numbers, Guids and byte[], etc.
        /// </summary>
        /// <returns>An instance of <paramref name="type"/>.</returns>
        public static object TryCreateInstance(this Type type, object sample)
        {
            Type       sourceType = sample.GetType();
            SourceInfo sourceInfo = sourceInfoCache.Get(sourceType);

            if (sourceInfo == null)
            {
                sourceInfo = SourceInfo.CreateFromType(sourceType);
                sourceInfoCache.Insert(sourceType, sourceInfo);
            }
            object[]  paramValues = sourceInfo.GetParameterValues(sample);
            MethodMap map         = MapFactory.PrepareInvoke(type, sourceInfo.ParamNames, sourceInfo.ParamTypes, paramValues);

            return(map.Invoke(paramValues));
        }
예제 #39
0
        public JsonResult(int index, JsonElement data, SourceInfo sourceInfo) : base(index)
        {
            SourceInfo = sourceInfo;
            if (data.ValueKind != JsonValueKind.Object)
            {
                throw new ArgumentException("must be a JSON Object", nameof(data));
            }

            // break the reference to the underlying file stream,
            // which on close would dispose the memory backing the JsonElement
            this.data = data.Clone();
            // this is not a great solution, but none of the inbuilt mechanism for creating lookups for string keys
            // support a StringComparison argument when checking if a key exists!
            names = data.EnumerateObject().Select(property => property.Name).ToArray();
        }
예제 #40
0
 public void ESBEditSource(IDbConnection cn, SourceInfo entity)
 {
     using (SqlCommand cmd = new SqlCommand())
     {
         cmd.Connection  = cn as SqlConnection;
         cmd.CommandText = @"UPDATE ESB_SourceInfo SET sourceName=@sourceName,connectId=@connectId,caption=@caption,sourceStr=@sourceStr,updateTime=@updateTime WHERE sourceId=@sourceId";
         cmd.Parameters.Add("@sourceId", SqlDbType.Int).Value        = entity.sourceId;
         cmd.Parameters.Add("@sourceName", SqlDbType.NVarChar).Value = entity.sourceName;
         cmd.Parameters.Add("@connectId", SqlDbType.Int).Value       = entity.connectInfo.connectId;
         cmd.Parameters.Add("@caption", SqlDbType.NVarChar).Value    = entity.caption;
         cmd.Parameters.Add("@sourceStr", SqlDbType.NVarChar).Value  = entity.sourceStr;
         cmd.Parameters.Add("@updateTime", SqlDbType.DateTime).Value = entity.updateTime;
         cmd.ExecuteNonQuery();
     }
 }
예제 #41
0
    public override void TakeEffect(AbilityInfo[] info)
    {
        base.TakeEffect(info);

        //Get Info
        SourceInfo sourceInfo = GetAbilityInfo <SourceInfo>();
        TargetInfo targetInfo = GetAbilityInfo <TargetInfo>();

        FieldBlock block = targetInfo.m_Blocks[0];

        if (block.m_Unit == null)
        {
            sourceInfo.m_Source.m_Position.MoveTo(block);
        }
    }
예제 #42
0
        private bool TryLaunchExternalEditor(SourceInfo r)
        {
            if (File.Exists(_externalEditorPath))
            {
                var cmdline = _externalEditorCommandLinePattern
                              .Replace("$file$", r.File.FullName)
                              .Replace("$line$", r.Line.ToString());
                var p = new Process {
                    StartInfo = new ProcessStartInfo(_externalEditorPath, cmdline)
                };
                return(p.Start());
            }

            return(false);
        }
예제 #43
0
파일: Primitive.cs 프로젝트: takuto-h/rhea
 public static void DynamicWind(Arguments args, VM vm, SourceInfo info)
 {
     ValueCont cont = vm.GetCont();
     var winder = new KeyValuePair<IValue, IValue>(args[0], args[2]);
     var winders = SList.Cons(winder, vm.Winders);
     Stack<IInsn> insnStack = new Stack<IInsn>();
     insnStack.Push(new InsnCall(0, info));
     insnStack.Push(InsnPop.Instance);
     insnStack.Push(new InsnSetWinders(winders));
     insnStack.Push(new InsnPush(args[1]));
     insnStack.Push(new InsnCall(0, info));
     insnStack.Push(new InsnCall(1, info));
     vm.Insns = insnStack.ToSList();
     vm.Stack = SList.List<IValue>(args[0], cont);
 }
예제 #44
0
파일: Primitive.cs 프로젝트: takuto-h/rhea
 public static void Load(Arguments args, VM vm, SourceInfo info)
 {
     ValueString str = args[0] as ValueString;
     if (str == null)
     {
         throw new RheaException(
             string.Format("string required, but got {0}", args[0]),
             info
         );
     }
     string fileName = str.Value;
     Interpreter interp = new Interpreter(vm.Env);
     bool result = interp.InterpretFile(fileName);
     vm.Push(result.ToValueBool());
 }
        public override Expression Assign(Expression target, Expression value, SourceInfo sourceInfo)
        {
            if (target is GlobalVariableExpression)
            {
                throw new InvalidOperationException("Cannot assign to a global variable");
            }

            //TODO: Are there any static typing optimisations that can be done?
            if (IsConstantType(target) && IsConstantType(value))
            {
            }


            return(base.Assign(target, value, sourceInfo));
        }
예제 #46
0
        public AstFunc(SourceInfo si, string name, List <AstDeclaration> @params, AstType returnType, List <AstNode> body)
            : base(si)
        {
            Name        = name;
            MangledName = GetMangledName(name, @params);
            Params      = @params;
            Body        = body;
            ReturnType  = returnType;

            IsGeneric = @params.Any(p => p.IsGeneric);
            if (!IsGeneric && returnType.IsGeneric)
            {
                throw new NotImplementedException("Function cannot return generic type not defined in param list.");
            }
        }
        public ISourceInfo ResolveSourceValue(IPropertyMappingInfo propInfo, object source)
        {
            var propInfoKey = BuilderUtils.GetKey(propInfo);
            KeyValuePair <string, Type> valueType;

            if (PropertyInjectionResolvers.TryGetValue(propInfoKey, out valueType))
            {
                object value;
                if (locator.TryResolve(valueType.Value, valueType.Key, out value))
                {
                    return(SourceInfo.Create(value));
                }
            }
            return(null);
        }
예제 #48
0
    public void OnPointerClick(PointerEventData eventData)
    {
        Unit u = GetComponent <Unit>();

        if (u.m_Position.m_Block == null)
        {
            return;
        }
        source           = Instantiate(source);
        target           = Instantiate(target);
        source.m_Source  = u;
        target.m_Targets = new List <Unit>();
        target.m_Targets.Add(u);
        AbilityInfo[] abilityInfos = new AbilityInfo[] { source, target };
        effect.TakeEffect(abilityInfos);
    }
예제 #49
0
    private int GetValue()
    {
        int value;

        SourceInfo sourceInfo = GetAbilityInfo <SourceInfo>();
        Unit       source     = sourceInfo.m_Source;

        value = source.m_Data.GetStat(sourceProperty);

        if (negative)
        {
            value = -value;
        }

        return(value);
    }
예제 #50
0
 protected override Expression VisitVelocityExpression(VelocityExpression node)
 {
     if (_symbolDocument != null)
     {
         var extension = node as VelocityExpression;
         if (extension != null && extension.SourceInfo != null && extension.SourceInfo != _currentSourceInfo)
         {
             _currentSourceInfo = extension.SourceInfo;
             return(Expression.Block(
                        Expression.DebugInfo(_symbolDocument, _currentSourceInfo.StartLine, _currentSourceInfo.StartColumn, _currentSourceInfo.EndLine, _currentSourceInfo.EndColumn),
                        Visit(node)
                        ));
         }
     }
     return(base.VisitVelocityExpression(node));
 }
예제 #51
0
파일: Ensure.cs 프로젝트: adamralph/Radical
            public static SourceInfo FromStack(StackTrace st, bool lazy)
            {
                SourceInfo si = SourceInfo.Empty;

                if (st.FrameCount > 0)
                {
#if DEBUG
                    var frame = st.GetFrame(1);
#else
                    var frame = st.GetFrame(0);
#endif
                    si = new SourceInfo(frame, lazy);
                }

                return(si);
            }
예제 #52
0
        private static AstExtend CreateDefaultCtorOrDtor(string type, string ctorOrDtor)
        {
            var si = new SourceInfo(string.Format("<default_{0}_{1}>", type, ctorOrDtor), -1, -1);

            return(new AstExtend(
                       si,
                       type,
                       ctorOrDtor,
                       true,
                       new List <AstDeclaration>()
            {
                new AstDeclaration(si, "this", new AstType(si, type, 1, 0, false, false), null)
            },
                       new AstType(si, "void", 0, 0, false, false),
                       new List <AstNode>()));
        }
예제 #53
0
        protected override ISourceInfo ResolveSourceValue(MappingMemberInfo memberInfo)
        {
            var sourceValue = memberInfo.SourceInstance;

            if (sourceValue == null)
            {
                return(null);
            }
            if (memberInfo.Type == memberInfo.SourceType)
            {
                return(SourceInfo.Create(sourceValue));
            }
            ;

            return(null);
        }
예제 #54
0
        // Generate the documentation for a source file by reading it in, splitting it
        // up into comment/code sections, highlighting them for the appropriate language,
        // and merging them into an HTML template.
        public override SourceModel Transform(SourceInfo source)
        {
            IMarkdownTransformer markdown = new MarkdownDeepTransformer();

            var sections = Parse(source);

            // Prepares a single chunk of code for HTML output and runs the text of its
            // corresponding comment through **Markdown**, using a C# implementation
            // called [MarkdownSharp](http://code.google.com/p/markdownsharp/).
            foreach (var section in sections)
            {
                section.DocsHtml = markdown.Transform(section.DocsHtml);
                section.CodeHtml = HttpUtility.HtmlEncode(section.CodeHtml);
            }

            return new SourceModel { Sections = sections };
        }
예제 #55
0
        // Given a string of source code, parse out each comment and the code that
        // follows it, and create an individual `Section` for it.
        private IList<Section> Parse(SourceInfo source)
        {
            var lines = File.ReadAllLines(source.InputPath);

            var sections = new List<Section>();
            var docsText = new StringBuilder();
            var codeText = new StringBuilder();

            Action<string, string> addSection = (docs, code) =>
            {
                if (MarkdownMaps != null)
                {
                    docs = MarkdownMaps.Aggregate(docs,
                        (currentDocs, map) => Regex.Replace(currentDocs, map.Key, map.Value, RegexOptions.Multiline));
                }

                sections.Add(new Section
                {
                    DocsHtml = docs,
                    CodeHtml = code
                });
            };

            foreach (var line in lines)
            {
                if (CommentMatcher.IsMatch(line) && !CommentFilter.IsMatch(line))
                {
                    if (codeText.Length > 0)
                    {
                        addSection(docsText.ToString(), codeText.ToString());
                        docsText.Length = 0;
                        codeText.Length = 0;
                    }

                    docsText.AppendLine(CommentMatcher.Replace(line, string.Empty));
                }
                else
                {
                    codeText.AppendLine(line);
                }
            }

            addSection(docsText.ToString(), codeText.ToString());

            return sections;
        }
예제 #56
0
    private static GameObject CreateObjectFromSourceInfo(SourceInfo source)
    {
        GameObject obj = new GameObject(" Source #" + (sourceID++) + " ("+source.type.ToString()+")");

        //Need a mesh filter and a mesh renderer for the source's mesh rendering
        MeshFilter filter = obj.AddComponent("MeshFilter") as MeshFilter;
        filter.mesh = Object.Instantiate(source.mesh) as Mesh;

        MeshRenderer renderer = obj.AddComponent("MeshRenderer") as MeshRenderer;
        renderer.material = Object.Instantiate(source.material) as Material;

        //Add a box collider
        MeshCollider hitBox = obj.AddComponent("MeshCollider") as MeshCollider;
        hitBox.transform.parent = obj.transform;

        //Add proper source script
        Source script = obj.AddComponent(scriptTypenameByElementType[source.type]) as Source;
        script.Initialize(source);

        return obj;
    }
예제 #57
0
파일: Env.cs 프로젝트: takuto-h/rhea
 public static void DefineMethod(
     this IEnv env,
     ValueSymbol klass,
     ValueSymbol selector,
     IValueFunc func,
     SourceInfo info
 )
 {
     /*if (env.ContainsMethod(klass, selector))
     {
         throw new RheaException(
             string.Format(
                 "method is already defined: {0}:{1}",
                 klass.Name.ToIdentifier(),
                 selector.Name.ToIdentifier()
             ),
             info
         );
     }
     env.AddMethod(klass, selector, func);*/
     env[klass, selector] = func;
 }
예제 #58
0
파일: InsnDefVar.cs 프로젝트: takuto-h/rhea
 public InsnDefVar(ValueSymbol symbol, SourceInfo info)
 {
     mSymbol = symbol;
     mInfo = info;
 }
예제 #59
0
    private SourceData GetSourceInfo(DI_MapDataColumns mapDataColumns, DataTable sessionData, bool isMyData, string dbNid, string LanguageCode)
    {
        SourceData RetVal = null;
        DataTable SourceTable = null;
        SourceInfo sourceInfo;
        try
        {
            if (sessionData.Rows.Count > 0)
            {
                sourceInfo = new SourceInfo();
                RetVal = new SourceData();

                //get theme name IndicatorUnitSubgroup from Database
                _DBCon = Global.GetDbConnection(int.Parse(dbNid));
                //Step 2 Get IUS and Source information
                //Step 2.1. Get Source Information from Database
                List<DbParameter> DbParams = null;
                DbParameter sourceParam1 = _DBCon.CreateDBParameter();
                sourceParam1.ParameterName = "SourceNIds";
                sourceParam1.DbType = DbType.String;
                sourceParam1.Value = this.AddQuotesInCommaSeperated(this.GetCSV(sessionData, mapDataColumns.SourceNid), false);

                DbParams = new List<DbParameter>();
                DbParams.Add(sourceParam1);
                SourceTable = _DBCon.ExecuteDataTable("sp_get_sources_from_nids_" + LanguageCode, CommandType.StoredProcedure, DbParams).DefaultView.ToTable(true, mapDataColumns.SourceNid, mapDataColumns.SourceName);

                foreach (DataRow row in SourceTable.Rows)
                {
                    sourceInfo = new SourceInfo();
                    sourceInfo.SourceNId = row[mapDataColumns.SourceNid].ToString();
                    sourceInfo.SourceName = row[mapDataColumns.SourceName].ToString();
                    RetVal.Add(sourceInfo);
                }

            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw;
        }

        return RetVal;
    }
예제 #60
0
 protected override void InitSourceData()
 {
     SourceInfo si = new SourceInfo(null);
     hostIds[si.Server] = GetServerId(si.Server);
     appIds[si.AppPath] = GetAppPathId(si.AppPath);            
 }