Example #1
0
 private void RemoveMissingModuleObject(MissingModule deletableModule)
 {
     for (var i = 0; i < AllDifferencesJson.AllMissingModules.Count; i++)
     {
         if (AllDifferencesJson.AllMissingModules[i].Name.Equals(deletableModule.Name))
         {
             AllDifferencesJson.AllMissingModules.RemoveAt(i);
         }
     }
 }
Example #2
0
 void DrawMissingModule(MissingModule m)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.PrefixLabel(m.name);
     if (GUILayout.Button("Link"))
     {
         Application.OpenURL(m.link);
     }
     EditorGUILayout.EndHorizontal();
 }
Example #3
0
        private bool FindDuplucateMissingModule(MissingModule newMissingModule)
        {
            foreach (var missingModule in this.allMissingModules)
            {
                if (missingModule.Name.Equals(newMissingModule.Name) && missingModule.Language.Equals(newMissingModule.Language))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #4
0
        private void AddMissingModule(AllJsonInOneLanguage jsonLanguage, string module)
        {
            MissingModule newMissingModule = new MissingModule
            {
                Language  = jsonLanguage.Language,
                Name      = module,
                ErrorType = "Missing Subject",
                Action    = "Add missing subject"
            };

            if (FindDuplucateMissingModule(newMissingModule))
            {
                this.allMissingModules.Add(newMissingModule);
            }
        }
Example #5
0
        private Module LoadModule(int index, byte[] rawModule, string name)
        {
            string location = name == null ? null : Path.Combine(Path.GetDirectoryName(this.location), name);

            if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0)
            {
                return(externalModules[index] = new ResourceModule(manifestModule, index, location));
            }
            else
            {
                if (rawModule == null)
                {
                    try
                    {
                        rawModule = File.ReadAllBytes(location);
                    }
                    catch (FileNotFoundException)
                    {
                        if (resolvers != null)
                        {
                            ResolveEventArgs arg = new ResolveEventArgs(name, this);
                            foreach (ModuleResolveEventHandler resolver in resolvers)
                            {
                                Module module = resolver(this, arg);
                                if (module != null)
                                {
                                    return(module);
                                }
                            }
                        }
                        if (universe.MissingMemberResolution)
                        {
                            return(externalModules[index] = new MissingModule(this, index));
                        }
                        throw;
                    }
                }
                return(externalModules[index] = new ModuleReader(this, manifestModule.universe, new MemoryStream(rawModule), location, false));
            }
        }
Example #6
0
        public bool CheckModuleHumanErrors()
        {
            var hasErrors     = false;
            var jsonValidator = new JsonValidator();

            this.findLabel.SetMetaInAllLanguage();
            foreach (var language in CurrentProject.AllLanguage)
            {
                var newJsonLanguage = this.findLabel.GetAllFilesOneLanguage(language);

                foreach (var module in newJsonLanguage.AllJsonFileNames)
                {
                    var viLabels   = new VILabelsJObject(module, language, this.fileSystem);
                    var resultJson = jsonValidator.Validate(viLabels);
                    if (!resultJson.IsValid)
                    {
                        hasErrors = true;
                        var path             = Path.Combine(CurrentProject.Path, language, module);
                        var newMissingModule = new MissingModule
                        {
                            Language     = language,
                            Name         = module,
                            ErrorType    = "HumanError",
                            Action       = "Click here to go to the File",
                            Path         = path,
                            ErrorMessage = resultJson.BrokenRules[0].Message
                        };
                        AllDifferencesJson.AllMissingModules.Add(newMissingModule);
                    }
                }
            }

            this.findLabel.RemoveMetaInAllLanguage();

            return(hasErrors);
        }
Example #7
0
 private Module LoadModule(int index, byte[] rawModule, string name)
 {
     string location = name == null ? null : Path.Combine(Path.GetDirectoryName(this.location), name);
     if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0)
     {
         return externalModules[index] = new ResourceModule(manifestModule, index, location);
     }
     else
     {
         if (rawModule == null)
         {
             try
             {
                 rawModule = File.ReadAllBytes(location);
             }
             catch (FileNotFoundException)
             {
                 if (resolvers != null)
                 {
                     ResolveEventArgs arg = new ResolveEventArgs(name, this);
                     foreach (ModuleResolveEventHandler resolver in resolvers)
                     {
                         Module module = resolver(this, arg);
                         if (module != null)
                         {
                             return module;
                         }
                     }
                 }
                 if (universe.MissingMemberResolution)
                 {
                     return externalModules[index] = new MissingModule(this, index);
                 }
                 throw;
             }
         }
         return externalModules[index] = new ModuleReader(this, manifestModule.universe, new MemoryStream(rawModule), location);
     }
 }