Пример #1
0
        private void MainInternal(string[] args)
        {
            try {
                UrlZone zone = UrlZones.GetUrlZone(Assembly.GetExecutingAssembly().Location);
                if (zone != UrlZone.LocalMachine)
                {
                    Console.WriteLine("Warning: running from untrusted location ({0}). Loading plugins may fail.".Fmt(zone));
                }
            }
            catch {
                Console.WriteLine("Warning: zone check failed.");
            }

            Options options = Options.ParseCommandLine(args);

            if (options == null)
            {
                Exit(1);
                return;
            }

            ComposeContentServices();
            if (options.ConvertVerb != null)
            {
                RunConvertVerb(options.ConvertVerb);
            }
            else if (options.ListLibsVerb != null)
            {
                RunListLibsVerb(options.ListLibsVerb);
            }
        }
Пример #2
0
    public byte[] GetZoneActionPolicy(UrlZone zone, UrlAction action, UrlZoneReg zoneReg)
    {
        IntPtr pPolicy = Marshal.AllocHGlobal(8196);

        try
        {
            if (this.izm.GetZoneActionPolicy((uint)zone, (uint)action, pPolicy, 8196, (uint)zoneReg) == 0)
            {
                byte[] buff = new byte[8196];

                for (int i = 0; i < buff.Length; i++)
                {
                    buff[i] = Marshal.ReadByte(pPolicy, i);
                }

                return(buff);
            }

            throw new Exception();
        }
        finally
        {
            Marshal.FreeHGlobal(pPolicy);
        }
    }
Пример #3
0
    public void SetZoneAttributes(UrlZone zone, ZoneAttributes attributes)
    {
        attributes.Size = (uint)Marshal.SizeOf(attributes);

        if (this.izm.SetZoneAttributes((uint)zone, ref attributes) != 0)
        {
            throw new Exception();
        }
    }
Пример #4
0
    public ZoneAttributes GetZoneAttributes(UrlZone zone)
    {
        ZoneAttributes za = new ZoneAttributes();

        if (this.izm.GetZoneAttributes((uint)zone, ref za) == 0)
        {
            return(za);
        }

        throw new Exception();
    }
Пример #5
0
 public int CopyTemplatePoliciesToZone(URLTEMPLATE template, UrlZone zone)
 {
     try
     {
         if (this.izm.CopyTemplatePoliciesToZone((uint)template, (uint)zone, 0) == 0)
         {
             return(0);
         }
         throw new Exception();
     }
     finally { }
 }
Пример #6
0
 public static void SetUrlZone (string fileName, UrlZone urlZone)
 {
     var persistentZoneId = new PersistentZoneIdentifier();
     try {
         var zoneId = (IZoneIdentifier)persistentZoneId;
         var persistFile = (IPersistFile)persistentZoneId;
         zoneId.SetId(urlZone);
         persistFile.Save(fileName, false);
     }
     finally {
         Marshal.ReleaseComObject(persistentZoneId);
     }
 }
Пример #7
0
        public static void SetUrlZone(string fileName, UrlZone urlZone)
        {
            var persistentZoneId = new PersistentZoneIdentifier();

            try {
                var zoneId      = (IZoneIdentifier)persistentZoneId;
                var persistFile = (IPersistFile)persistentZoneId;
                zoneId.SetId(urlZone);
                persistFile.Save(fileName, false);
            }
            finally {
                Marshal.ReleaseComObject(persistentZoneId);
            }
        }
Пример #8
0
 public virtual extern void SetId(UrlZone id);