示例#1
0
        public static PhpEmitStyle xClone(PhpEmitStyle x, ShowBracketsEnum e)
        {
            var tmp = xClone(x);

            tmp.Brackets = e;
            return(tmp);
        }
示例#2
0
 public static PhpEmitStyle xClone(PhpEmitStyle x)
 {
     if (x == null)
     {
         return(new PhpEmitStyle());
     }
     return((PhpEmitStyle)(x as ICloneable).Clone());
 }
示例#3
0
        /*
        /// <summary>
        /// Tworzy instancję obiektu
        /// </summary>
        public PhpEmitStyle()
        {
        }

        Przykłady użycia

        implement INotifyPropertyChanged
        implement INotifyPropertyChanged_Passive
        implement ToString ##AsIncrementor## ##Brackets## ##Compression## ##UseBracketsEvenIfNotNecessary## ##CurrentNamespace## ##CurrentClass##
        implement ToString AsIncrementor=##AsIncrementor##, Brackets=##Brackets##, Compression=##Compression##, UseBracketsEvenIfNotNecessary=##UseBracketsEvenIfNotNecessary##, CurrentNamespace=##CurrentNamespace##, CurrentClass=##CurrentClass##
        implement equals AsIncrementor, Brackets, Compression, UseBracketsEvenIfNotNecessary, CurrentNamespace, CurrentClass
        implement equals *
        implement equals *, ~exclude1, ~exclude2
        */
        #region ICloneable
        /// <summary>
        /// Creates copy of object
        /// </summary>
        object ICloneable.Clone()
        {
            var myClone = new PhpEmitStyle();
            myClone.AsIncrementor = AsIncrementor;
            myClone.Brackets = Brackets;
            myClone.Compression = Compression;
            myClone.UseBracketsEvenIfNotNecessary = UseBracketsEvenIfNotNecessary;
            myClone.CurrentNamespace = CurrentNamespace;
            myClone.CurrentClass = CurrentClass;
            return myClone;
        }
示例#4
0
        /*
         * /// <summary>
         * /// Tworzy instancję obiektu
         * /// </summary>
         * public PhpEmitStyle()
         * {
         * }
         *
         * Przykłady użycia
         *
         * implement INotifyPropertyChanged
         * implement INotifyPropertyChanged_Passive
         * implement ToString ##AsIncrementor## ##Brackets## ##Compression## ##UseBracketsEvenIfNotNecessary## ##CurrentNamespace## ##CurrentClass##
         * implement ToString AsIncrementor=##AsIncrementor##, Brackets=##Brackets##, Compression=##Compression##, UseBracketsEvenIfNotNecessary=##UseBracketsEvenIfNotNecessary##, CurrentNamespace=##CurrentNamespace##, CurrentClass=##CurrentClass##
         * implement equals AsIncrementor, Brackets, Compression, UseBracketsEvenIfNotNecessary, CurrentNamespace, CurrentClass
         * implement equals *
         * implement equals *, ~exclude1, ~exclude2
         */
        #region ICloneable
        /// <summary>
        /// Creates copy of object
        /// </summary>
        object ICloneable.Clone()
        {
            var myClone = new PhpEmitStyle();

            myClone.AsIncrementor = AsIncrementor;
            myClone.Brackets      = Brackets;
            myClone.Compression   = Compression;
            myClone.UseBracketsEvenIfNotNecessary = UseBracketsEvenIfNotNecessary;
            myClone.CurrentNamespace = CurrentNamespace;
            myClone.CurrentClass     = CurrentClass;
            return(myClone);
        }
示例#5
0
        private void TranslateAndCreatePhpFiles(TranslationInfo translationInfo, string outDir)
        {
            if (_verboseToConsole)
            {
                Console.WriteLine("Translate C# -> Php");
            }

            translationInfo.CurrentAssembly = CompiledAssembly;
            var assemblyTi = translationInfo.GetOrMakeTranslationInfo(CompiledAssembly);
            var ecBaseDir  = Path.Combine(outDir, assemblyTi.RootPath.Replace("/", "\\"));

            Console.WriteLine("Output root {0}", ecBaseDir);

            if (!string.IsNullOrEmpty(assemblyTi.PhpPackageSourceUri))
            {
                DownloadAndUnzip(assemblyTi.PhpPackageSourceUri, ecBaseDir, assemblyTi.PhpPackagePathStrip);
                return; //??? czy return?
            }

            var translationState = new TranslationState(translationInfo);
            var translator       = new Translator.Translator(translationState);

            translator.Translate(Sandbox);

            var libName = assemblyTi.LibraryName;

            if (_verboseToConsole)
            {
                Console.WriteLine("Create Php output files");
            }

            #region Tworzenie plików php

            {
                // var emitContext = new EmitContext();
                var emitStyle = new PhpEmitStyle();

                translationInfo.CurrentAssembly = CompiledAssembly; // dla pewności
                foreach (var module in translator.Modules.Where(i => i.Name.Library == libName && !i.IsEmpty))
                {
                    var fileName = module.Name.MakeEmitPath(ecBaseDir, 1);
                    foreach (var modProcessor in translationInfo.ModuleProcessors)
                    {
                        modProcessor.BeforeEmit(module, translationInfo);
                    }
                    var emiter = new PhpSourceCodeEmiter();
                    module.Emit(emiter, emitStyle, fileName);
                }
            }

            #endregion
        }
示例#6
0
        /// <summary>
        ///     Creates copy of object
        /// </summary>
        object ICloneable.Clone()
        {
            var myClone = new PhpEmitStyle
            {
                AsIncrementor = AsIncrementor,
                Brackets      = Brackets,
                Compression   = Compression,
                UseBracketsEvenIfNotNecessary = UseBracketsEvenIfNotNecessary,
                CurrentNamespace = CurrentNamespace,
                CurrentClass     = CurrentClass
            };

            return(myClone);
        }
示例#7
0
 public static PhpEmitStyle xClone(PhpEmitStyle x, ShowBracketsEnum e)
 {
     var tmp = xClone(x);
     tmp.Brackets = e;
     return tmp;
 }
示例#8
0
 public static PhpEmitStyle xClone(PhpEmitStyle x)
 {
     if (x == null)
         return new PhpEmitStyle();
     return (PhpEmitStyle)(x as ICloneable).Clone();
 }
示例#9
0
 public StatementEmitInfo GetStatementEmitInfo(PhpEmitStyle style)
 {
     throw new NotImplementedException();
 }
示例#10
0
 public void Emit(PhpSourceCodeEmiter emiter, PhpSourceCodeWriter writer, PhpEmitStyle style)
 {
     throw new NotImplementedException();
 }
示例#11
0
        private void TranslateAndCreatePhpFiles(TranslationInfo translationInfo, string outDir)
        {
            if (_verboseToConsole)
                Console.WriteLine("Translate C# -> Php");

            translationInfo.CurrentAssembly = _compiledAssembly;
            var assemblyTi = translationInfo.GetOrMakeTranslationInfo(_compiledAssembly);
            var ecBaseDir = Path.Combine(outDir, assemblyTi.RootPath.Replace("/", "\\"));
            Console.WriteLine("Output root {0}", ecBaseDir);

            if (!string.IsNullOrEmpty(assemblyTi.PhpPackageSourceUri))
            {
                DownloadAndUnzip(assemblyTi.PhpPackageSourceUri, ecBaseDir, assemblyTi.PhpPackagePathStrip);
                return; //??? czy return?
            }
            var translationState = new TranslationState(translationInfo);
            var translator = new Translator.Translator(translationState);

            translator.Translate(_sandbox);

            var libName = assemblyTi.LibraryName;


            if (_verboseToConsole)
                Console.WriteLine("Create Php output files");
            #region Tworzenie plików php
            {
                // var emitContext = new EmitContext();
                var emitStyle = new PhpEmitStyle();

                translationInfo.CurrentAssembly = _compiledAssembly;// dla pewności
                foreach (var module in translator.Modules.Where(i => i.Name.Library == libName && !i.IsEmpty))
                {
                    var fileName = module.Name.MakeEmitPath(ecBaseDir, 1);
                    foreach (var modProcessor in translationInfo.ModuleProcessors)
                    {
                        modProcessor.BeforeEmit(module, translationInfo);
                    }
                    var emiter = new PhpSourceCodeEmiter();
                    module.Emit(emiter, emitStyle, fileName);

                }
            }

            #endregion
        }