コード例 #1
0
 /// <summary>
 ///     Tworzy instancję obiektu
 ///     <param name="fieldName"></param>
 ///     <param name="targetObject"></param>
 ///     <param name="includeModule"></param>
 /// </summary>
 public PhpInstanceFieldAccessExpression(string fieldName, IPhpValue targetObject,
                                         PhpCodeModuleName includeModule)
 {
     FieldName     = fieldName;
     TargetObject  = targetObject;
     IncludeModule = includeModule;
 }
コード例 #2
0
 /*
  * /// <summary>
  * /// Tworzy instancję obiektu
  * /// </summary>
  * public PhpDefinedConstExpression()
  * {
  * }
  *
  * Przykłady użycia
  *
  * implement INotifyPropertyChanged
  * implement INotifyPropertyChanged_Passive
  * implement ToString ##DefinedConstName## ##ModuleName##
  * implement ToString DefinedConstName=##DefinedConstName##, ModuleName=##ModuleName##
  * implement equals DefinedConstName, ModuleName
  * implement equals *
  * implement equals *, ~exclude1, ~exclude2
  */
 #region Constructors
 /// <summary>
 /// Tworzy instancję obiektu
 /// <param name="definedConstName"></param>
 /// <param name="moduleName"></param>
 /// </summary>
 public PhpDefinedConstExpression(string definedConstName, PhpCodeModuleName moduleName)
 {
     if (definedConstName == "PHP_EOL" && moduleName != null)
     {
         throw new Exception("PHP_EOL is built in");
     }
     _definedConstName = definedConstName;
     _moduleName       = moduleName;
 }
コード例 #3
0
 public IPhpValue MakeIncludePath(PhpCodeModuleName relatedTo)
 {
     if (relatedTo.Library == Library)
     {
         var knownPath = ProcessPath(_name + _extension, relatedTo._name + _extension);
         //dirname(__FILE__)
         var __FILE__ = new PhpDefinedConstExpression("__FILE__", null);
         var dirname  = new PhpMethodCallExpression("dirname", __FILE__);
         var path     = new PhpConstValue(PathUtil.MakeUnixPath(PathUtil.UNIX_SEP + knownPath));
         var result   = PhpBinaryOperatorExpression.ConcatStrings(dirname, path);
         return(result);
     }
     else
     {
         string path      = null;
         string pathRelTo = null;
         if (_phpIncludePathExpression is PhpConstValue)
         {
             path = (_phpIncludePathExpression as PhpConstValue).Value as string;
             if (path == null)
             {
                 throw new NotSupportedException();
             }
         }
         else
         {
             return(_phpIncludePathExpression); // assume expression like MPDF_LIB_PATH . 'lib/mpdf/mpdf.php'
         }
         if (relatedTo._phpIncludePathExpression is PhpConstValue)
         {
             pathRelTo = (relatedTo._phpIncludePathExpression as PhpConstValue).Value as string;
             if (pathRelTo == null)
             {
                 throw new NotSupportedException();
             }
         }
         if (!string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(path))
         {
             var knownPath = ProcessPath(path, pathRelTo);
             return(new PhpConstValue(knownPath));
         }
         throw new NotSupportedException();
         //var aaaa = "/" + name + extension;
         //if (phpIncludePathExpression == null)
         //    return null;
         //if (phpIncludePathExpression is PhpConstValue)
         //{
         //    aaaa = ((phpIncludePathExpression as PhpConstValue).Value ?? "").ToString() + aaaa;
         //    return ProcessPath(aaaa, relatedTo.emitPath);
         //    // return new PhpConstValue(aaaa, true);
         //}
         //var a = new PhpConstValue(aaaa, true);
         //var g = new PhpBinaryOperatorExpression(".", phpIncludePathExpression, a);
         //return g;
     }
     throw new NotSupportedException();
 }
コード例 #4
0
ファイル: PhpCodeModule.cs プロジェクト: yekainew/cs2php
 /// <summary>
 ///     Tworzy instancję obiektu
 ///     <param name="name">nazwa pliku</param>
 /// </summary>
 public PhpCodeModule(PhpCodeModuleName name)
 {
     Name = name;
 }
コード例 #5
0
 /*
  * /// <summary>
  * /// Tworzy instancję obiektu
  * /// </summary>
  * public PhpInstanceFieldAccessExpression()
  * {
  * }
  *
  * Przykłady użycia
  *
  * implement INotifyPropertyChanged
  * implement INotifyPropertyChanged_Passive
  * implement ToString ##FieldName## ##TargetObject## ##IncludeModule##
  * implement ToString FieldName=##FieldName##, TargetObject=##TargetObject##, IncludeModule=##IncludeModule##
  * implement equals FieldName, TargetObject, IncludeModule
  * implement equals *
  * implement equals *, ~exclude1, ~exclude2
  */
 #region Constructors
 /// <summary>
 /// Tworzy instancję obiektu
 /// <param name="FieldName"></param>
 /// <param name="TargetObject"></param>
 /// <param name="IncludeModule"></param>
 /// </summary>
 public PhpInstanceFieldAccessExpression(string FieldName, IPhpValue TargetObject, PhpCodeModuleName IncludeModule)
 {
     fieldName          = FieldName;
     targetObject       = TargetObject;
     this.IncludeModule = IncludeModule;
 }
コード例 #6
0
        /// <summary>
        /// Used for patch only
        /// </summary>
        public static bool IsFrameworkName(PhpCodeModuleName name)
        {
            var List = "commonlanguageruntimelibrary".Split(' ');

            return(List.Contains(name.Library));
        }