Exemple #1
0
        static void Main(string[] args)
        {
            var env = args.Length == 0 ? EnvironmentManager.GetDefault() : EnvironmentManager.Get(args[0]);

            CoreserviceClientFactory.SetEnvironment(env);
            var client     = CoreserviceClientFactory.GetClient();
            var references = new List <Reference>();

            var sourceIds = StorageFactory.GetItemsToExport();

            foreach (var sourceId in sourceIds)
            {
                var item       = client.Read(sourceId, new ReadOptions());
                var importItem = ModelFactory.CreateImportItem(item);
                StorageFactory.StoreImportItem(importItem);
                foreach (var childId in sourceIds.Where(s => s != sourceId))
                {
                    if (importItem.Content.Contains(childId))
                    {
                        references.Add(new Reference(sourceId, childId));
                    }
                }
            }
            StorageFactory.StoreReferences(references);
        }
Exemple #2
0
        public InstallPackageCreator(IInstallerConfiguration configuration)
        {
            Configuration = configuration;
            var env = EnvironmentManager.Get(Configuration.Environment);

            CoreserviceClientFactory.SetEnvironment(env);
            Client = CoreserviceClientFactory.GetClient();
            DefaultConfigurationSetter.ApplyDefaults(configuration);
            StorageFactory.SetLocation(Configuration.InstallPackagePath);
        }
Exemple #3
0
        private static void ExportModels(ModelOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment before you can generate models or views - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);
            var module = new ModelGenerator(opts);

            var packagePath = module.Run();

            Console.WriteLine("output created at " + packagePath);
        }
Exemple #4
0
        private static void Install(InstallerOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment first - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);

            var module = new Installer.Installer(opts);

            var output = module.Run();

            Console.WriteLine(output);
        }
 public static bool TestFlying(BasePlayer ply, Vector3 oldPos, Vector3 newPos, bool verifyGrounded)
 {
     ply.isInAir    = false;
     ply.isOnPlayer = false;
     if (!verifyGrounded)
     {
         ply.isInAir = (ply.OnLadder() || ply.IsSwimming() ? false : !ply.IsOnGround());
     }
     else
     {
         float   flyhackExtrusion = ConVar.AntiHack.flyhack_extrusion;
         Vector3 vector3          = (oldPos + newPos) * 0.5f;
         if (!ply.OnLadder() && !WaterLevel.Test(vector3 - new Vector3(0f, flyhackExtrusion, 0f)) && (int)(EnvironmentManager.Get(vector3) & EnvironmentType.Elevator) == 0)
         {
             float   flyhackMargin = ConVar.AntiHack.flyhack_margin;
             float   radius        = ply.GetRadius();
             float   height        = ply.GetHeight(false);
             Vector3 vector31      = vector3 + new Vector3(0f, radius - flyhackExtrusion, 0f);
             Vector3 vector32      = vector3 + new Vector3(0f, height - radius, 0f);
             float   single        = radius - flyhackMargin;
             ply.isInAir = !UnityEngine.Physics.CheckCapsule(vector31, vector32, single, 1503731969, QueryTriggerInteraction.Ignore);
             if (ply.isInAir)
             {
                 int num  = UnityEngine.Physics.OverlapCapsuleNonAlloc(vector31, vector32, single, AntiHack.buffer, 131072, QueryTriggerInteraction.Ignore);
                 int num1 = 0;
                 while (num1 < num)
                 {
                     BasePlayer baseEntity = AntiHack.buffer[num1].gameObject.ToBaseEntity() as BasePlayer;
                     if (baseEntity == null || baseEntity == ply || baseEntity.isInAir || baseEntity.isOnPlayer || baseEntity.TriggeredAntiHack(1f, Single.PositiveInfinity) || baseEntity.IsSleeping())
                     {
                         num1++;
                     }
                     else
                     {
                         ply.isOnPlayer = true;
                         ply.isInAir    = false;
                         break;
                     }
                 }
                 for (int i = 0; i < (int)AntiHack.buffer.Length; i++)
                 {
                     AntiHack.buffer[i] = null;
                 }
             }
         }
     }
     if (!ply.isInAir)
     {
         ply.flyhackDistanceVertical   = 0f;
         ply.flyhackDistanceHorizontal = 0f;
     }
     else
     {
         bool    flag     = false;
         Vector3 vector33 = newPos - oldPos;
         float   single1  = Mathf.Abs(vector33.y);
         float   single2  = vector33.Magnitude2D();
         if (vector33.y >= 0f)
         {
             ply.flyhackDistanceVertical += vector33.y;
             flag = true;
         }
         if (single1 < single2)
         {
             ply.flyhackDistanceHorizontal += single2;
             flag = true;
         }
         if (flag)
         {
             float jumpHeight = ply.GetJumpHeight() + ConVar.AntiHack.flyhack_forgiveness_vertical;
             if (ply.flyhackDistanceVertical > jumpHeight)
             {
                 return(true);
             }
             float flyhackForgivenessHorizontal = 5f + ConVar.AntiHack.flyhack_forgiveness_horizontal;
             if (ply.flyhackDistanceHorizontal > flyhackForgivenessHorizontal)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #6
0
        public string Run()
        {
            var env = EnvironmentManager.Get(Configuration.Environment);

            if (env == null)
            {
                return("you must create an environment before you can generate models or views - try dyndle help add-environment");
            }

            if (string.IsNullOrEmpty(Configuration.InstallPackagePath))
            {
                // no install package path configured, we will get the embedded package from the assembly

                ResourceUtils.StoreResourceOnDisk(ResourceRootPath + "." + InstallPackageResourceName, Configuration.WorkFolder, InstallPackageResourceName);
                var packageDir = Path.Combine(Configuration.WorkFolder.FullName, "package");
                Directory.CreateDirectory(packageDir);
                ZipFile.ExtractToDirectory(Path.Combine(Configuration.WorkFolder.FullName, InstallPackageResourceName), packageDir);
                StorageFactory.SetLocation(packageDir);
            }
            else
            {
                StorageFactory.SetLocation(Configuration.InstallPackagePath);
            }


            // todo: read zipped import package from embedded resource and unzip
            var importItems = StorageFactory.GetImportItems();
            var references  = StorageFactory.GetReferences();

            mappings = new List <Reference>();

            int stopper = 10;

            while (mappings.Count() < importItems.Count() && stopper > 0)
            {
                var itemsWithoutDependencies = importItems.Where(i =>
                                                                 (mappings.All(m => m.From != i.SourceId)) && references.All(r => r.From != i.SourceId));
                foreach (var importItem in itemsWithoutDependencies)
                {
                    var id = Import(importItem);
                    importItem.TargetId = id;
                    mappings.Add(new Reference(importItem.SourceId, importItem.TargetId));
                }
                var referencesToRemove = new List <Reference>();
                foreach (var reference in references.Where(r => mappings.Any(m => m.From == r.To)))
                {
                    // get 'from item'
                    var fromItem = importItems.FirstOrDefault(i => i.SourceId == reference.From && i.TargetId == null);
                    // get mapping of the 'to item'
                    var referencedMapping = mappings.FirstOrDefault(m => m.From == reference.To);
                    if (fromItem != null)
                    {
                        fromItem.Content = fromItem.Content.Replace(referencedMapping.From.ToPublicationId(fromItem.SourceId), referencedMapping.To.ToPublicationId(fromItem.SourceId));
                        if (!string.IsNullOrEmpty(fromItem.PageTemplateId) && fromItem.PageTemplateId.ToItemId() == referencedMapping.From.ToItemId())
                        {
                            fromItem.PageTemplateId = referencedMapping.To.ToPublicationId(referencedMapping.To);
                        }
                        if (!string.IsNullOrEmpty(fromItem.ParameterSchemaId) && fromItem.ParameterSchemaId.ToItemId() == referencedMapping.From.ToItemId())
                        {
                            fromItem.ParameterSchemaId = referencedMapping.To.ToPublicationId(referencedMapping.To);
                        }
                        referencesToRemove.Add(reference);
                    }
                }

                foreach (var reference in referencesToRemove)
                {
                    references.Remove(reference);
                }

                stopper--;
            }
            return($"Dyndle imported {mappings.Count()} items into Tridion. Please publish the pages in structure group {Configuration.DyndleStructureGroup}.");
        }
Exemple #7
0
 public static bool TestFlying(BasePlayer ply, Vector3 oldPos, Vector3 newPos, bool verifyGrounded)
 {
     ply.isInAir    = false;
     ply.isOnPlayer = false;
     if (verifyGrounded)
     {
         float   flyhack_extrusion = ConVar.AntiHack.flyhack_extrusion;
         Vector3 vector            = (oldPos + newPos) * 0.5f;
         if (!ply.OnLadder() && !WaterLevel.Test(vector - new Vector3(0f, flyhack_extrusion, 0f), true, ply) && (EnvironmentManager.Get(vector) & EnvironmentType.Elevator) == 0)
         {
             float   flyhack_margin = ConVar.AntiHack.flyhack_margin;
             float   radius         = ply.GetRadius();
             float   height         = ply.GetHeight(false);
             Vector3 vector2        = vector + new Vector3(0f, radius - flyhack_extrusion, 0f);
             Vector3 vector3        = vector + new Vector3(0f, height - radius, 0f);
             float   radius2        = radius - flyhack_margin;
             ply.isInAir = !UnityEngine.Physics.CheckCapsule(vector2, vector3, radius2, 1503731969, QueryTriggerInteraction.Ignore);
             if (ply.isInAir)
             {
                 int num = UnityEngine.Physics.OverlapCapsuleNonAlloc(vector2, vector3, radius2, buffer, 131072, QueryTriggerInteraction.Ignore);
                 for (int i = 0; i < num; i++)
                 {
                     BasePlayer basePlayer = GameObjectEx.ToBaseEntity(buffer[i].gameObject) as BasePlayer;
                     if (!(basePlayer == null) && !(basePlayer == ply) && !basePlayer.isInAir && !basePlayer.isOnPlayer && !basePlayer.TriggeredAntiHack() && !basePlayer.IsSleeping())
                     {
                         ply.isOnPlayer = true;
                         ply.isInAir    = false;
                         break;
                     }
                 }
                 for (int j = 0; j < buffer.Length; j++)
                 {
                     buffer[j] = null;
                 }
             }
         }
     }
     else
     {
         ply.isInAir = !ply.OnLadder() && !ply.IsSwimming() && !ply.IsOnGround();
     }
     if (ply.isInAir)
     {
         bool    flag = false;
         Vector3 v    = newPos - oldPos;
         float   num2 = Mathf.Abs(v.y);
         float   num3 = v.Magnitude2D();
         if (v.y >= 0f)
         {
             ply.flyhackDistanceVertical += v.y;
             flag = true;
         }
         if (num2 < num3)
         {
             ply.flyhackDistanceHorizontal += num3;
             flag = true;
         }
         if (flag)
         {
             float num4 = Mathf.Max((ply.flyhackPauseTime > 0f) ? ConVar.AntiHack.flyhack_forgiveness_vertical_inertia : ConVar.AntiHack.flyhack_forgiveness_vertical, 0f);
             float num5 = ply.GetJumpHeight() + num4;
             if (ply.flyhackDistanceVertical > num5)
             {
                 return(true);
             }
             float num6 = Mathf.Max((ply.flyhackPauseTime > 0f) ? ConVar.AntiHack.flyhack_forgiveness_horizontal_inertia : ConVar.AntiHack.flyhack_forgiveness_horizontal, 0f);
             float num7 = 5f + num6;
             if (ply.flyhackDistanceHorizontal > num7)
             {
                 return(true);
             }
         }
     }
     else
     {
         ply.flyhackDistanceVertical   = 0f;
         ply.flyhackDistanceHorizontal = 0f;
     }
     return(false);
 }
Exemple #8
0
 public static bool TestFlying(
     BasePlayer ply,
     Vector3 oldPos,
     Vector3 newPos,
     bool verifyGrounded)
 {
     ply.isInAir    = false;
     ply.isOnPlayer = false;
     if (verifyGrounded)
     {
         float   flyhackExtrusion = ConVar.AntiHack.flyhack_extrusion;
         Vector3 pos = Vector3.op_Multiply(Vector3.op_Addition(oldPos, newPos), 0.5f);
         if (!ply.OnLadder() && !WaterLevel.Test(Vector3.op_Subtraction(pos, new Vector3(0.0f, flyhackExtrusion, 0.0f))) && (EnvironmentManager.Get(pos) & EnvironmentType.Elevator) == (EnvironmentType)0)
         {
             float   flyhackMargin = ConVar.AntiHack.flyhack_margin;
             float   radius        = ply.GetRadius();
             float   height        = ply.GetHeight(false);
             Vector3 vector3_1     = Vector3.op_Addition(pos, new Vector3(0.0f, radius - flyhackExtrusion, 0.0f));
             Vector3 vector3_2     = Vector3.op_Addition(pos, new Vector3(0.0f, height - radius, 0.0f));
             float   num1          = radius - flyhackMargin;
             ply.isInAir = !Physics.CheckCapsule(vector3_1, vector3_2, num1, 1503731969, (QueryTriggerInteraction)1);
             if (ply.isInAir)
             {
                 int num2 = Physics.OverlapCapsuleNonAlloc(vector3_1, vector3_2, num1, AntiHack.buffer, 131072, (QueryTriggerInteraction)1);
                 for (int index = 0; index < num2; ++index)
                 {
                     BasePlayer baseEntity = ((Component)AntiHack.buffer[index]).get_gameObject().ToBaseEntity() as BasePlayer;
                     if (!Object.op_Equality((Object)baseEntity, (Object)null) && !Object.op_Equality((Object)baseEntity, (Object)ply) && (!baseEntity.isInAir && !baseEntity.isOnPlayer) && (!baseEntity.TriggeredAntiHack(1f, float.PositiveInfinity) && !baseEntity.IsSleeping()))
                     {
                         ply.isOnPlayer = true;
                         ply.isInAir    = false;
                         break;
                     }
                 }
                 for (int index = 0; index < AntiHack.buffer.Length; ++index)
                 {
                     AntiHack.buffer[index] = (Collider)null;
                 }
             }
         }
     }
     else
     {
         ply.isInAir = !ply.OnLadder() && !ply.IsSwimming() && !ply.IsOnGround();
     }
     if (ply.isInAir)
     {
         bool    flag    = false;
         Vector3 vector3 = Vector3.op_Subtraction(newPos, oldPos);
         double  num1    = (double)Mathf.Abs((float)vector3.y);
         float   num2    = Vector3Ex.Magnitude2D(vector3);
         if (vector3.y >= 0.0)
         {
             ply.flyhackDistanceVertical += (float)vector3.y;
             flag = true;
         }
         double num3 = (double)num2;
         if (num1 < num3)
         {
             ply.flyhackDistanceHorizontal += num2;
             flag = true;
         }
         if (flag)
         {
             float num4 = ply.GetJumpHeight() + ConVar.AntiHack.flyhack_forgiveness_vertical;
             if ((double)ply.flyhackDistanceVertical > (double)num4)
             {
                 return(true);
             }
             float num5 = 5f + ConVar.AntiHack.flyhack_forgiveness_horizontal;
             if ((double)ply.flyhackDistanceHorizontal > (double)num5)
             {
                 return(true);
             }
         }
     }
     else
     {
         ply.flyhackDistanceVertical   = 0.0f;
         ply.flyhackDistanceHorizontal = 0.0f;
     }
     return(false);
 }