public static PhpEmitStyle xClone(PhpEmitStyle x, ShowBracketsEnum e) { var tmp = xClone(x); tmp.Brackets = e; return(tmp); }
public static PhpEmitStyle xClone(PhpEmitStyle x) { if (x == null) { return(new PhpEmitStyle()); } return((PhpEmitStyle)(x as ICloneable).Clone()); }
/* /// <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; }
/* * /// <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); }
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 }
/// <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); }
public static PhpEmitStyle xClone(PhpEmitStyle x, ShowBracketsEnum e) { var tmp = xClone(x); tmp.Brackets = e; return tmp; }
public static PhpEmitStyle xClone(PhpEmitStyle x) { if (x == null) return new PhpEmitStyle(); return (PhpEmitStyle)(x as ICloneable).Clone(); }
public StatementEmitInfo GetStatementEmitInfo(PhpEmitStyle style) { throw new NotImplementedException(); }
public void Emit(PhpSourceCodeEmiter emiter, PhpSourceCodeWriter writer, PhpEmitStyle style) { throw new NotImplementedException(); }
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 }