Exemplo n.º 1
0
        void PerformMethod(MethodDefinition mtd, NameMode mode)
        {
            if (GetRenOk(mtd))
            {
                mtd.Name = ObfuscationHelper.GetNewName(mtd.Name, mode);
                Identifier id = (Identifier)(mtd as IAnnotationProvider).Annotations[NameAnalyzer.RenId];
                Identifier n  = id;
                n.scope = mtd.DeclaringType.FullName;
                n.name  = mtd.Name;
                foreach (IReference refer in (mtd as IAnnotationProvider).Annotations[NameAnalyzer.RenRef] as List <IReference> )
                {
                    refer.UpdateReference(id, n);
                }

                foreach (ParameterDefinition para in mtd.Parameters)
                {
                    para.Name = ObfuscationHelper.GetNewName(para.Name, mode);
                }
            }

            //Variable names are stored in pdb, so no need to rename
            //if (mtd.HasBody)
            //{
            //    foreach (VariableDefinition var in mtd.Body.Variables)
            //    {
            //        var.Name = ObfuscationHelper.GetNewName(var.Name, mode);
            //    }
            //}
        }
Exemplo n.º 2
0
 public EntityList(Game game)
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     NamesMode  = Options.GetEnum(OptionsKey.NamesMode, NameMode.AllNamesAndHovered);
     ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
 }
Exemplo n.º 3
0
        void LoadCachedNames()
        {
            WorkPool.QueueUserWorkItem(syncx =>
            {
                try
                {
                    byte[] data       = File.ReadAllBytes(cacheFileName);
                    OSDMap cache      = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
                    OSDArray namesOSD = (OSDArray)cache["names"];
                    DateTime now      = DateTime.Now;
                    TimeSpan maxAge   = new TimeSpan(48, 0, 0);
                    NameMode mode     = (NameMode)(int)instance.GlobalSettings["display_name_mode"];

                    lock (names)
                    {
                        for (int i = 0; i < namesOSD.Count; i++)
                        {
                            AgentDisplayName name = AgentDisplayName.FromOSD(namesOSD[i]);
                            if (mode == NameMode.Standard || ((now - name.Updated) < maxAge))
                            {
                                names[name.ID] = name;
                            }
                        }
                    }

                    Logger.DebugLog(string.Format("Restored {0} names from the avatar name cache", names.Count));
                }
                catch (Exception ex)
                {
                    Logger.Log("Failed loading cached avatar names: ", Helpers.LogLevel.Warning, client, ex);
                }
            });
        }
Exemplo n.º 4
0
        private void treeList_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
        {
            NameMode m_NameMode = this.treeList.SelectedItem as NameMode;

            if (m_NameMode != null)
            {
                switch (m_NameMode.TYPE)
                {
                case 1:
                    getFactory(m_NameMode);
                    break;

                case 2:
                    getWorkShop(m_NameMode);
                    break;

                case 3:
                    getLine(m_NameMode);
                    break;

                default:
                    gbLineContent.Visibility     = Visibility.Hidden;
                    gbWorkShopContent.Visibility = Visibility.Hidden;
                    break;
                }
            }
        }
Exemplo n.º 5
0
        public NameRobotForm(NameMode mode)
        {
            InitializeComponent();

            nameMode = mode;

            PathTextBox.Text = SynthesisGUI.PluginSettings.GeneralSaveLocation;
        }
Exemplo n.º 6
0
 public EntityList( Game game )
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     game.Events.TextureChanged += TextureChanged;
     NamesMode = Options.GetEnum( OptionsKey.NamesMode, NameMode.AllAndHovered );
     if( game.ClassicMode ) NamesMode = NameMode.HoveredOnly;
     ShadowMode = Options.GetEnum( OptionsKey.EntityShadow, EntityShadow.None );
     if( game.ClassicMode ) ShadowMode = EntityShadow.None;
 }
Exemplo n.º 7
0
        private void getFactory(NameMode m_NameMode)
        {
            gbWorkShopContent.Visibility = Visibility.Hidden;
            gbLineContent.Visibility     = Visibility.Hidden;
            gbFactoryContent.Visibility  = Visibility.Visible;
            RsFactory m_RsFactory = ws.UseService(s => s.GetRsFactoryById(m_NameMode.PKNO));

            gbFactoryContent.DataContext = m_RsFactory;
            //RsWorkShop m_RsWorkShop = ws.UseService(s => s.GetRsWorkShopById(m_RsLine.WORKSHOP_PKNO));
            //this.txt_ParentWorkShop.Text = m_RsWorkShop.WORKSHOP_NAME;
        }
Exemplo n.º 8
0
        private void getWorkShop(NameMode m_NameMode)
        {
            gbFactoryContent.Visibility  = Visibility.Hidden;
            gbWorkShopContent.Visibility = Visibility.Visible;
            gbLineContent.Visibility     = Visibility.Hidden;
            RsWorkShop m_RsWorkShop = ws.UseService(s => s.GetRsWorkShopById(m_NameMode.PKNO));

            gbWorkShopContent.DataContext = m_RsWorkShop;
            RsFactory m_RsFactory = ws.UseService(s => s.GetRsFactoryById(m_RsWorkShop.FACTORY_PKNO));

            this.txt_ParentFactory.Text = m_RsFactory.FACTORY_NAME;
        }
Exemplo n.º 9
0
 public string GetNewName(string originalName, NameMode mode)
 {
     string ret;
     switch (mode)
     {
         case NameMode.Unreadable: ret = RenameUnreadable(originalName); break;
         case NameMode.ASCII: ret = RenameASCII(originalName); break;
         case NameMode.Letters: ret = RenameLetters(originalName); break;
         default: throw new InvalidOperationException();
     }
     if (cr != null)
         cr.Database.AddEntry("Rename", originalName, ret);
     return ret;
 }
Exemplo n.º 10
0
 public string GetNewName(string originalName, NameMode mode)
 {
     string ret;
     switch (mode)
     {
         case NameMode.Unreadable: ret = RenameUnreadable(originalName); break;
         case NameMode.ASCII: ret = RenameASCII(originalName); break;
         case NameMode.Letters: ret = RenameLetters(originalName); break;
         default: throw new InvalidOperationException();
     }
     if (cr != null)
         cr.Database.AddEntry("Rename", originalName, ret);
     return ret;
 }
Exemplo n.º 11
0
 public static DialogResult NameRobot(out string RobotName, NameMode mode = NameMode.SaveAs)
 {
     try
     {
         NameRobotForm form = new NameRobotForm(mode);
         form.ShowDialog();
         RobotName = form.RobotNameTextBox.Text;
         return(form.DialogResult);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
         throw;
     }
 }
Exemplo n.º 12
0
 public EntityList(Game game)
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     game.Events.TextureChanged  += TextureChanged;
     NamesMode = Options.GetEnum(OptionsKey.NamesMode, NameMode.AllAndHovered);
     if (game.ClassicMode)
     {
         NamesMode = NameMode.HoveredOnly;
     }
     ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
     if (game.ClassicMode)
     {
         ShadowMode = EntityShadow.None;
     }
 }
Exemplo n.º 13
0
        private void BarItemShop_OnItemClick(object sender, RoutedEventArgs e)
        {
            //添加工序
            NameMode m_namemode = this.treeList.SelectedItem as NameMode;

            gbItemContent.Visibility = Visibility.Visible;
            if (m_namemode.TYPE == 1)
            {
                RsRoutingDetail m_RsRoutingDetail = new RsRoutingDetail();
                m_RsRoutingDetail.PKNO         = Guid.NewGuid().ToString("N");
                m_RsRoutingDetail.ROUTING_PKNO = m_namemode.PKNO;
                m_RsRoutingDetail.OP_INDEX     =
                    ws.UseService(s => s.GetRsRoutingDetailCount($"ROUTING_PKNO = '{m_namemode.PKNO}'")) + 1;
                bool isSuccss = ws.UseService(s => s.AddRsRoutingDetail(m_RsRoutingDetail));

                gbItemContent.DataContext = m_RsRoutingDetail;
            }
        }
Exemplo n.º 14
0
        public EntityList(Game game)
        {
            this.game = game;
            game.Graphics.ContextLost      += ContextLost;
            game.Graphics.ContextRecreated += ContextRecreated;
            game.Events.ChatFontChanged    += ChatFontChanged;

            NamesMode = Options.GetEnum(OptionsKey.NamesMode, NameMode.Hovered);
            if (game.ClassicMode)
            {
                NamesMode = NameMode.Hovered;
            }
            ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
            if (game.ClassicMode)
            {
                ShadowMode = EntityShadow.None;
            }
        }
Exemplo n.º 15
0
        private void treeList_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
        {
            NameMode m_NameMode = this.treeList.SelectedItem as NameMode;

            gbItemContent.Visibility = Visibility.Visible;
            RsRoutingDetail m_RsRoutingDetail = ws.UseService(s => s.GetRsRoutingDetailById(m_NameMode.PKNO));

            gbItemContent.DataContext = m_RsRoutingDetail;

            gridTools.ItemsSource = null;

            if (m_RsRoutingDetail == null)
            {
                return;
            }

            gridTools.ItemsSource =
                ws.UseService(s => s.GetRsRoutingToolss($"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}"));
        }
Exemplo n.º 16
0
        private void BarItemLine_OnItemClick(object sender, RoutedEventArgs e)
        {
            NameMode m_namemode = this.treeList.SelectedItem as NameMode;

            gbLineContent.Visibility = Visibility.Visible;
            if (m_namemode.TYPE == 2)
            {
                RsLine m_RsLine = new RsLine();
                m_RsLine.PKNO          = Guid.NewGuid().ToString("N");
                m_RsLine.WORKSHOP_PKNO = (treeList.SelectedItem as NameMode).PKNO;
                bool isSuccss = ws.UseService(s => s.AddRsLine(m_RsLine));
                gbLineContent.DataContext = m_RsLine;
                RsWorkShop m_RsWorkShop = ws.UseService(s => s.GetRsWorkShopById(m_RsLine.WORKSHOP_PKNO));
                this.txt_ParentWorkShop.Text = m_RsWorkShop.WORKSHOP_NAME;
            }
            else
            {
            }
            Initialize();
        }
Exemplo n.º 17
0
        public static string PrettyName(this Type type, NameMode mode = NameMode.Short)
        {
            string name;

            if (_specialNames.TryGetValue(type, out name))
            {
                return(name);
            }
            if (mode == NameMode.Full)
            {
                return(type.FullName);
            }
            else if (mode == NameMode.WithNamespace)
            {
                if (string.IsNullOrEmpty(type.Namespace))
                {
                    return(type.Name);
                }
                return(type.Namespace + "." + type.Name);
            }
            return(type.Name);
        }
Exemplo n.º 18
0
    public void setMode(NameMode mode)
    {
        this.mode = mode;
        if (mode == NameMode.FADE)
        {
            string nameToUse;
            this.currentColorIndex = 0;
            this.currentColorStep  = 0;

            if (this.target > 0)
            {
                PhotonPlayer player = PhotonPlayer.Find(this.target);

                if (player != null && player.customProperties[PhotonPlayerProperty.name] != null)
                {
                    nameToUse = ModMain.stripColorCodes((string)player.customProperties[PhotonPlayerProperty.name]);
                }
                else
                {
                    nameToUse = ModMain.stripColorCodes((string)PhotonNetwork.player.customProperties[PhotonPlayerProperty.name]);
                }
            }
            else
            {
                nameToUse = ModMain.stripColorCodes((string)PhotonNetwork.player.customProperties[PhotonPlayerProperty.name]);
            }

            char[]   temp  = nameToUse.ToCharArray();
            string[] temp2 = new string[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                temp2[i] = "" + temp[i];
            }

            this.fadeNameParts = temp2;
        }
    }
Exemplo n.º 19
0
        //  命名事件处理函数
        public void nameEventHandler(String newName, FileMode fileMode, NameMode nameMode)
        {
            foreach (var nodeIndex in blockGroup.inodeList[blockGroup.currentInodeIndex].childInodeIndex)
            {
                if (blockGroup.inodeList[nodeIndex].fileName == newName)
                {
                    MessageBox.Show("存在重名文件!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (nameMode == NameMode.rename)  // 重命名
            {
                var    selectedItem = listBoxFile.SelectedItem;
                String selectedName = selectedItem.ToString().Split(new char[] { ' ' })[0];
                int    fileIndex    = blockGroup.getIndexFromeName(selectedName, blockGroup.currentInodeIndex);
                if (fileIndex == -1)
                {
                    return;
                }
                else
                {
                    Inode inode = blockGroup.inodeList[fileIndex];
                    inode.fileName = newName;
                    blockGroup.inodeList[fileIndex] = inode;
                }
                blockGroup.showFile(ref listBoxFile);
                this.Enabled = true;
                return;
            }
            if (!blockGroup.createFile(fileMode, newName))
            {
                MessageBox.Show("磁盘空间不足!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            blockGroup.showFile(ref this.listBoxFile);
            this.Enabled = true;
        }
Exemplo n.º 20
0
        private void BarItemShop_OnItemClick(object sender, RoutedEventArgs e)
        {
            NameMode m_namemode = this.treeList.SelectedItem as NameMode;

            if (m_namemode == null)
            {
                return;
            }
            gbWorkShopContent.Visibility = Visibility.Visible;
            if (m_namemode.TYPE == 1)
            {
                RsWorkShop m_RsWorkShop = new RsWorkShop();
                m_RsWorkShop.PKNO         = Guid.NewGuid().ToString("N");
                m_RsWorkShop.FACTORY_PKNO = m_namemode.PKNO;
                bool isSuccss = ws.UseService(s => s.AddRsWorkShop(m_RsWorkShop));
                gbWorkShopContent.DataContext = m_RsWorkShop;
                RsFactory m_RsFactory = ws.UseService(s => s.GetRsFactoryById(m_RsWorkShop.FACTORY_PKNO));
                this.txt_ParentFactory.Text = m_RsFactory.FACTORY_NAME;
            }
            else
            {
            }
            Initialize();
        }
Exemplo n.º 21
0
 public string GetRandomName(NameMode mode)
 {
     return GetNewName(GetRandomString(), mode);
 }
Exemplo n.º 22
0
    void OnGUI()
    {
        bakeMode = (BakeMode)EditorGUILayout.EnumPopup("Bake Mode", bakeMode);
        if (bakeMode != BakeMode.BentNormal)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        bentNormalsSpace = (NormalsSpace)EditorGUILayout.EnumPopup("Normals Space", bentNormalsSpace);
        if (bakeMode != BakeMode.BentNormal)
        {
            EditorGUI.EndDisabledGroup();
        }
        if (bakeMode != BakeMode.NormalsConversion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        normalsConversionMode = (NormalsConversionMode)EditorGUILayout.EnumPopup("Conversion Mode", normalsConversionMode);
        if (bakeMode != BakeMode.NormalsConversion)
        {
            EditorGUI.EndDisabledGroup();
        }
        uvChannel = (UVChannel)EditorGUILayout.EnumPopup(new GUIContent("Texture Channel", "The UV channel to use when generating the output texture(s)."), uvChannel);
        bakeRes   = (Resolution)EditorGUILayout.EnumPopup(new GUIContent("Output resolution", "The resolution of the output texture(s)."), bakeRes);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        samples      = EditorGUILayout.IntSlider(new GUIContent("Sample Count", "The number of depth map samples used for each pixel."), samples, 64, 8192);
        shadowMapRes = (Resolution)EditorGUILayout.EnumPopup(new GUIContent("Depth Map Resolution", "The resolution of the depth map. Probably only have to increase this if baking high-resolution maps for multiple, large objects."), shadowMapRes);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.EndDisabledGroup();
        }
        dilation = Mathf.Max(EditorGUILayout.IntField(new GUIContent("Dilation", "Adds edge padding to the output."), dilation), 0);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        shadowBias = EditorGUILayout.Slider(new GUIContent("Depth Bias", "Depth map sampling bias. A larger value will generally give you less artifacts at the cost of loss of accuracy."), shadowBias, 0f, 1f);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.EndDisabledGroup();
        }
        if (bakeMode != BakeMode.AmbientOcclusion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        aoBias = EditorGUILayout.Slider(new GUIContent("AO Bias", "Ambient Occlusion output bias. A value of 0.5 is considered neutral."), aoBias, 0f, 1f);
        if (bakeMode != BakeMode.AmbientOcclusion)
        {
            EditorGUI.EndDisabledGroup();
        }
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        clampToHemisphere = EditorGUILayout.Toggle(new GUIContent("Clamp To Hemisphere", "Discard samples that would intersect the pixel's own surface."), clampToHemisphere);
        includeScene      = EditorGUILayout.Toggle(new GUIContent("Include Scene", "If checked, will include other non-selected objects in the scene when rendering the depth map."), includeScene);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.EndDisabledGroup();
        }
        forceSharedTexture = EditorGUILayout.Toggle(new GUIContent("Force Shared Texture", "If checked, will render all selected objects into the same output texture. Useful if you are baking multiple objects which share a texture, but don't share materials. Objects with the same material will still be grouped even if this is not checked."), forceSharedTexture);
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        if (forceSharedTexture)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        useNormalMaps = EditorGUILayout.Toggle(new GUIContent("Use Normal Maps", "If checked, the baker will include any normal maps present on the original materials when baking. This can give a higher quality result if the bake resolution is high enough."), useNormalMaps);
        if (forceSharedTexture)
        {
            EditorGUI.EndDisabledGroup();
        }
        useOriginalShaders = EditorGUILayout.Toggle(new GUIContent("Use Original Shaders", "Bake the depth maps using the objects' original shaders. This is useful if you are using vertex-modifying shaders, but also prevents overriding the face cull mode."), useOriginalShaders);
        if (useOriginalShaders)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        cullOverrideMode = (CullOverrideMode)EditorGUILayout.EnumPopup(new GUIContent("Face Cull Override", "Force double or single-sided rendering. In most cases you probably want to force double-sided."), cullOverrideMode);
        if (useOriginalShaders)
        {
            EditorGUI.EndDisabledGroup();
        }
        if (bakeMode == BakeMode.NormalsConversion)
        {
            EditorGUI.EndDisabledGroup();
        }

        transparentPixels = EditorGUILayout.Toggle(new GUIContent("Transparent Background", "Whether to fill background pixels in the output texture with neutral values or leave them blank."), transparentPixels);
        GUILayout.Space(4);
        outputPath = EditorGUILayout.TextField("Output Folder", outputPath);
        nameMode   = (NameMode)EditorGUILayout.EnumPopup(new GUIContent("Output Names", "How to determine the output file name. Only used if multiple objects which share materials are selected."), nameMode);
        var rect = GUILayoutUtility.GetLastRect();

        if (Selection.gameObjects.Length < 1)
        {
            EditorGUI.BeginDisabledGroup(true);
        }
        if (GUILayout.Button(Selection.gameObjects.Length < 1 ? "Select some objects to bake!" : (Selection.gameObjects.Length == 1 ? "Bake Selected Object" : "Bake Selected Objects")))
        {
            Bake(Selection.gameObjects);
        }
        if (Selection.gameObjects.Length < 1)
        {
            EditorGUI.EndDisabledGroup();
        }
    }
Exemplo n.º 23
0
 public string GetRandomName(NameMode mode)
 {
     return(GetNewName(GetRandomString(), mode));
 }